1
0
Fork 0
Commit Graph

476 Commits (redonkable)

Author SHA1 Message Date
Peter Chen d43f529edd MLK-16065-5 extcon: ptn5150: add PTN5150 Type-C CC logic chip
Add NXP PTN5150 Type-C CC logic chip, this chip supplies CC flip
function automatically, and the driver will notify extcon
consumer (USB controller driver) attach and detach events.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
Chanwoo Choi c0a8e04773 extcon: Release locking when sending the notification of connector state
commit 8a9dbb779f upstream.

Previously, extcon used the spinlock before calling the notifier_call_chain
to prevent the scheduled out of task and to prevent the notification delay.
When spinlock is locked for sending the notification, deadlock issue
occured on the side of extcon consumer device. To fix this issue,
extcon consumer device should always use the work. it is always not
reasonable to use work.

To fix this issue on extcon consumer device, release locking when sending
the notification of connector state.

Fixes: ab11af049f ("extcon: Add the synchronization extcon APIs to support the notification")
Cc: stable@vger.kernel.org
Cc: Roger Quadros <rogerq@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-09 19:55:56 +02:00
Hans de Goede 7044bf9ef6 extcon: intel-cht-wc: Set direction and drv flags for V5 boost GPIO
commit ad49aee401 upstream.

Sometimes (firmware bug?) the V5 boost GPIO is not configured as output
by the BIOS, leading to the 5V boost convertor being permanently on,

Explicitly set the direction and drv flags rather then inheriting them
from the firmware to fix this.

Fixes: 585cb239f4 ("extcon: intel-cht-wc: Disable external 5v boost ...")
Cc: stable@vger.kernel.org
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-24 09:36:29 +02:00
Hans de Goede 606f74e3d0 extcon: int3496: process id-pin first so that we start with the right status
commit 0434352d3d upstream.

Some other drivers may be waiting for our extcon to show-up, exiting their
probe methods with -EPROBE_DEFER until we show up.

These drivers will typically get the cable state directly after getting
the extcon, this commit changes the int3496 code to wait for the initial
processing of the id-pin to complete before exiting probe() with 0, which
will cause devices waiting on the defered probe to get reprobed.

This fixes a race where the initial work might still be running while other
drivers were already calling extcon_get_state().

Fixes: 2f556bdb9f ("extcon: int3496: Add Intel INT3496 ACPI ... driver")
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28 10:19:39 +01:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.

By default all files without license information are under the default
license of the kernel, which is GPL version 2.

Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier.  The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.

This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.

How this work was done:

Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
 - file had no licensing information it it.
 - file was a */uapi/* one with no licensing information in it,
 - file was a */uapi/* one with existing licensing information,

Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.

The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne.  Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.

The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed.  Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.

Criteria used to select files for SPDX license identifier tagging was:
 - Files considered eligible had to be source code files.
 - Make and config files were included as candidates if they contained >5
   lines of source
 - File already had some variant of a license header in it (even if <5
   lines).

All documentation files were explicitly excluded.

The following heuristics were used to determine which SPDX license
identifiers to apply.

 - when both scanners couldn't find any license traces, file was
   considered to have no license information in it, and the top level
   COPYING file license applied.

   For non */uapi/* files that summary was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0                                              11139

   and resulted in the first patch in this series.

   If that file was a */uapi/* path one, it was "GPL-2.0 WITH
   Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:

   SPDX license identifier                            # files
   ---------------------------------------------------|-------
   GPL-2.0 WITH Linux-syscall-note                        930

   and resulted in the second patch in this series.

 - if a file had some form of licensing information in it, and was one
   of the */uapi/* ones, it was denoted with the Linux-syscall-note if
   any GPL family license was found in the file or had no licensing in
   it (per prior point).  Results summary:

   SPDX license identifier                            # files
   ---------------------------------------------------|------
   GPL-2.0 WITH Linux-syscall-note                       270
   GPL-2.0+ WITH Linux-syscall-note                      169
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
   ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
   LGPL-2.1+ WITH Linux-syscall-note                      15
   GPL-1.0+ WITH Linux-syscall-note                       14
   ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
   LGPL-2.0+ WITH Linux-syscall-note                       4
   LGPL-2.1 WITH Linux-syscall-note                        3
   ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
   ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1

   and that resulted in the third patch in this series.

 - when the two scanners agreed on the detected license(s), that became
   the concluded license(s).

 - when there was disagreement between the two scanners (one detected a
   license but the other didn't, or they both detected different
   licenses) a manual inspection of the file occurred.

 - In most cases a manual inspection of the information in the file
   resulted in a clear resolution of the license that should apply (and
   which scanner probably needed to revisit its heuristics).

 - When it was not immediately clear, the license identifier was
   confirmed with lawyers working with the Linux Foundation.

 - If there was any question as to the appropriate license identifier,
   the file was flagged for further research and to be revisited later
   in time.

In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.

Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights.  The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.

Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.

In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.

Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
 - a full scancode scan run, collecting the matched texts, detected
   license ids and scores
 - reviewing anything where there was a license detected (about 500+
   files) to ensure that the applied SPDX license was correct
 - reviewing anything where there was no detection but the patch license
   was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
   SPDX license was correct

This produced a worksheet with 20 files needing minor correction.  This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.

These .csv files were then reviewed by Greg.  Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected.  This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.)  Finally Greg ran the script using the .csv files to
generate the patches.

Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02 11:10:55 +01:00
Maciej Purski 4243c408f7 extcon: max77693: Allow MHL attach notifier
Without this patch extcon couldn't notify attaching MHL cable.

Signed-off-by: Maciej Purski <m.purski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-08-25 09:32:27 +09:00
Chanwoo Choi 6ab6094f37 extcon: Correct description to improve the readability
The extcon files explains the detailed operation for functions and
what is meaning of extcon structure. There are different explanation
even if the same argument.

So, it modifies the description for both functions and structures
in order to improve the readability and guide the role of functions
more well.

Also, this patch fixes the mismatching license info as a GPL v2
and removes the inactive author information.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-08-16 09:27:55 +09:00
Chanwoo Choi dd4ed69a0e extcon: Remove unused CABLE_NAME_MAX definition
This patch removes the unused CABLE_NAME_MAX definition.

Signed-off-by: Chanwoo Choi <cwchoi00@gmail.com>
2017-08-16 09:27:55 +09:00
Christophe JAILLET 1cf76c4eeb extcon: cros-ec: Fix a potential NULL pointer dereference
Return -ENOMEM in case of memory allocation failure. This avoids a NULL
pointer dereference.

Fixes: c698316661 ("extcon: cros-ec: Add extcon-cros-ec driver to support display out")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-08-07 15:34:20 +09:00
Rob Herring 5c27036d2b extcon: Convert to using %pOF instead of full_name
Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-07-19 10:37:10 +09:00
Chanwoo Choi 15dec834a0 Merge remote-tracking branch 'origin/ib-extcon-mfd-4.14' into extcon-next 2017-07-17 19:26:30 +09:00
Benson Leung c698316661 extcon: cros-ec: Add extcon-cros-ec driver to support display out
This is the driver for the USB Type C cable detection mechanism
built into the ChromeOS Embedded Controller on systems that
have USB Type-C ports.

At present, this allows for the presence of display out, but in
future, it may also be used to notify host and device type cables
and the presence of power.

Signed-off-by: Benson Leung <bleung@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Chanwoo Choi <cw00.chio@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-07-17 19:25:49 +09:00
Arvind Yadav ff890bc008 extcon: int3496: Constify acpi_device_id
acpi_device_id are not supposed to change at runtime. All functions
working with acpi_device_id provided by <acpi/acpi_bus.h> work with
const acpi_device_id. So mark the non-const structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
   1733	    352	      0	   2085	    825 drivers/extcon/extcon-intel-int3496.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
   1797	    272	      0	   2069	    815 drivers/extcon/extcon-intel-int3496.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-07-16 15:09:30 +09:00
Andy Shevchenko 1f4be24786 extcon: int3496: Switch to devm_acpi_dev_add_driver_gpios()
Switch to use managed variant of acpi_dev_add_driver_gpios() to simplify
error path and fix potentially wrong assingment if ->probe() fails.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-06-12 10:00:24 +09:00
Peter Robinson a781a7d646 extcon: qcom-spmi-misc: add dependency on ARCH_QCOM
Depend on the architecture the device actuall is in, also add
dep on the compile test to ensure continued coverage.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-05-23 18:35:42 +09:00
Markus Elfring cf5459a9e2 extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()
* A multiplication for the size determination of a memory allocation
  indicated that an array data structure should be processed.
  Thus use the corresponding function "devm_kcalloc".

* Replace the specification of a data structure by a pointer dereference
  to make the corresponding size determination a bit safer according to
  the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-05-23 18:32:03 +09:00
Markus Elfring 826a47e978 extcon: Fix a typo in three comment lines
Adjust three words in this description for a function.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-05-23 18:32:02 +09:00
Markus Elfring 3f5071a8b0 extcon: Use devm_kcalloc() in extcon_dev_register()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kcalloc".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-05-23 18:32:02 +09:00
Chanwoo Choi 70641a0a84 extcon: Use BIT() macro for the left-shift operation
This patch just uses the BIT() macro to make the code simple.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 11:12:45 +09:00
Hans de Goede c42a880c31 extcon: intel-cht-wc: Ignore failure to detect charger-type on host mode exit
When we leave host-mode because the id-pin is no longer connected to
ground, the 5v boost converter is normally still on, so we will see
Vbus, but it is not from a charger (normally) so the charger-type
detection will fail.

This commit silences the cht_wc_extcon_get_charger() false-positive
errors when we're leaving host mode.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:26 +09:00
Hans de Goede 585cb239f4 extcon: intel-cht-wc: Disable external 5v boost converter on probe
Disable the 5v boost converter on probe in case it was left on by
the BIOS, this fixes 2 problems:

1) This gets seen by the external battery charger as a valid Vbus
   supply and it then tries to feed Vsys from this creating a
   feedback loop which causes aprox. 300 mA extra battery drain
   (and unless we drive the external-charger-disable pin high it
   also tries to charge the battery causing even more feedback).
2) This gets seen by the pwrsrc block as a SDP USB Vbus supply

Since the external battery charger has its own 5v boost converter
which does not have these issues, we simply turn the separate
external 5v boost converter off and leave it off entirely.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:25 +09:00
Chanwoo Choi c9d0f1d121 extcon: Remove porting compatibility of swich class
This patch removes the porting compatibility for switch class
because there is no any usage and requirement of swich class
over a couple of years.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:24 +09:00
Hans de Goede db0f3baaa3 extcon: intel-cht-wc: Add Intel Cherry Trail Whiskey Cove PMIC extcon driver
Add a driver for charger detection / control on the Intel Cherrytrail
Whiskey Cove PMIC.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:23 +09:00
Roger Quadros 01944321de extcon: palmas: Don't miss GPIO events during suspend/resume
The USB cable state can change during suspend/resume
so be sure to check and update the extcon state.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:22 +09:00
Roger Quadros 8680b4d193 extcon: usb-gpio: Don't miss event during suspend/resume
We must check for ID/VBUS changes during resume irrespective
of whether our device wakeup is enabled or not.

Without this we seem to be missing ID/VBUS events after
system suspend/resume.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:21 +09:00
Peter Chen 98fd079297 extcon: usb-gpio: Do not enable USB as wakeup source by default
Whether the USB port as a wakeup source should be determined by user,
but not enabled by default.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:20 +09:00
Charles Keepax e57bb43c7e extcon: arizona: Wait for any running HPDETs to complete on jack removal
As the HPDET can't be aborted mid way through we should not allow any new
insertion to be processed until the previous HPDET has finished. It is very
unlikely but with low enough debounce settings you could start a new HPDET
before the old one has completed, which results in an erroneous reading.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-04-06 10:55:19 +09:00
Chanwoo Choi bc9a5c37a5 Merge branch 'ib-extcon-4.12' into HEAD 2017-04-06 10:54:36 +09:00
Chanwoo Choi 815429b39d extcon: Add new extcon_register_notifier_all() to monitor all external connectors
The extcon core already provides the extcon_register_notifier() function
in order to register the notifier block which is used to monitor
the state change for the specific external connector such as EXTCON_USB,
EXTCON_USB_HOST and so on. The extcon consumer uses the this function.

The extcon consumer might need to monitor the all supported external
connectors from the extcon device. In this case, The extcon consumer
should have each notifier_block structure for each external connector.

This patch adds the new extcon_register_notifier_all() function
that extcon consumer is able to monitor the state change of all
supported external connectors by using only one notifier_block structure.

- List of new added functions:
int extcon_register_notifier_all(struct extcon_dev *edev,
			struct notifier_block *nb);
int extcon_unregister_notifier_all(struct extcon_dev *edev,
			struct notifier_block *nb);
int devm_extcon_register_notifier_all(struct device *dev,
			struct extcon_dev *edev, struct notifier_block *nb);
void devm_extcon_unregister_notifier_all(struct device *dev,
			struct extcon_dev *edev, struct notifier_block *nb);

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
2017-04-04 11:22:42 +09:00
Andy Shevchenko 366380cd62 Revert "extcon: usb-gpio: add support for ACPI gpio interface"
The commit 942c7924a5 introduced a check for ACPI handle for the
device that never appears on any ACPI-enabled platform so far. It seems
a confusion with extcon-intel-int3496 which does support ACPI-enabled
platforms.

Revert commit 942c7924a5 to avoid any confusion in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-27 13:17:41 +09:00
Hans de Goede 70216fd937 extcon: int3496: Set the id pin to direction-input if necessary
With the new more strict ACPI gpio code the dsdt's IoRestriction
flags are honored on gpiod_get, but in some dsdt's it is wrong,
so explicitly call gpiod_direction_input on the id gpio if
necessary.

This fixes the following errors when the int3496 code is used
together with the new more strict ACPI gpio code:

[ 2382.484415] gpio gpiochip1: (INT33FF:01): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[ 2382.484425] gpio gpiochip1: (INT33FF:01): unable to lock HW IRQ 3 for IRQ
[ 2382.484429] genirq: Failed to request resources for INT3496:00 (irq 174) on irqchip chv-gpio
[ 2382.484518] intel-int3496 INT3496:00: can't request IRQ for USB ID GPIO: -22
[ 2382.500359] intel-int3496: probe of INT3496:00 failed with error -22

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-22 18:29:48 +09:00
Hans de Goede 408c5b41d2 extcon: int3496: Use gpiod_get instead of gpiod_get_index
Now that we've an acpi mapping table we should be using gpiod_get
instead of gpiod_get_index.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-22 18:29:47 +09:00
Peter Robinson 059c7874b8 extcon: int3496: Add dependency on X86 as it's Intel specific
Add dependency on X86 so it doesn't show up on other arches and
add a option for compile test so it still gets build coverage.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-22 18:29:46 +09:00
Andy Shevchenko 8cb2cbae45 extcon: int3496: Add GPIO ACPI mapping table
In order to make GPIO ACPI library stricter prepare users of
gpiod_get_index() to correctly behave when there no mapping is
provided by firmware.

Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-22 18:29:46 +09:00
Andy Shevchenko 90400c5884 extcon: int3496: Rename GPIO pins in accordance with binding
Update GPIO pin names in extcon-intel-int3496.c driver to follow
the existing extcon binding.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-22 18:29:45 +09:00
Andy Shevchenko bafa687dcc extcon: int3496: Propagate error code of gpiod_to_irq()
gpiod_to_irq() doesn't return 0. Thus, we just adjust condition and
replace -EINVAL by actual error code it returns.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-03-13 12:39:30 +09:00
Masahiro Yamada c6efb58db4 scripts/spelling.txt: add "swithc" pattern and fix typo instances
Fix typos and add the following to the scripts/spelling.txt:

  swithc||switch
  swithced||switched
  swithcing||switching

Link: http://lkml.kernel.org/r/1481573103-11329-3-git-send-email-yamada.masahiro@socionext.com
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-02-27 18:43:46 -08:00
Roger Quadros 567ab5a81b extcon: palmas: Use dev_dbg macro for the debug messages
User is not interested in USB cable events appearing on the
console. Use dev_dbg() instead of dev_info() for these events.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-25 15:03:54 +09:00
Chanwoo Choi 86d6cda68f extcon: Modify the name of EXTCON_USB_HOST connector
This patch renames the EXTCON_USB_HOST by using '-' char because
the name of all external connector use the '-' char instead of '_' char.
- "USB_HOST" -> "USB-HOST"

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:58 +09:00
Chanwoo Choi 3c5f0e0768 extcon: Add new EXTCON_CHG_USB_PD type for USB Power Delivery
This patch adds the new EXTCON_CHG_USB_PD for USB PD (Power Delivery)[1].
The USB Power Delivery specification specifies that USB cable provides
the increased power more than 7.5W to device with larger power demand.
The EXTCON_CHG_USB_PD has the EXTCON_TYPE_CHG and EXTCON_TYPE_USB type.

[1] https://en.wikipedia.org/wiki/USB#PD

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:58 +09:00
Peter Chen bcb7440e76 extcon: usb-gpio: Add pinctrl operation during system PM
At some systems, the pinctrl setting will be lost or needs to
set as "sleep" state to save power consumption. So, we need to
configure pinctrl as "sleep" state when system enters suspend,
and as "default" state after system resumes. In this way, the
pinctrl value can be recovered as "default" state after resuming.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:12 +09:00
Chanwoo Choi e6cf046543 extcon: Move defintion of struct extcon_dev to driver/extcon directory
This patch moves the 'struct extcon_dev' of extcon subsystem
to driver/extcon/extcon.h header file because the struct extcon_dev have to
be handled by extcon API to guarantee the consistency of strcut extcon_dev.
If external drivers are able to touch the struct extcon_dev directly, it might
cause the critical and unknown problem.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:11 +09:00
Chanwoo Choi 6e3a7e89ff extcon: adc-jack: Use the internal data instead of using struct extcon_dev
This patch uses the internal dev instance instead of using the field of struct
extcon_dev because the core structure (extcon_dev) of extcon have to be touched
by only extcon core driver.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:11 +09:00
David Cohen 2f556bdb9f extcon: int3496: Add Intel INT3496 ACPI device extcon driver
Add an extcon driver for USB OTG ports controlled by an Intel INT3496
ACPI device (e.g. Baytrail, Cherrytrail devices).

Signed-off-by: David Cohen <david.a.cohen@intel.com>
[hdgoede@redhat.com: Port to current kernel, cleanup, submit upstream]
[hdgoede@redhat.com: Add Documentation/extcon/intel-int3496.txt]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:11 +09:00
Baolin Wang 5298b83658 extcon: axp288: Set EXTCON_USB when EXTCON_CHG_USB_SDP was set
According to the documentation, we should set the EXTCON_USB when
one SDP charger connector was reported.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:11 +09:00
Chanwoo Choi 01b4c9a1ae extcon: Remove potential problem when calling extcon_register_notifier()
This patch removes the potential problem of extcon_register_notifier()
when edev parameter is NULL. When edev is NULL, this function returns
the first extcon device which includes the sepecific external connector
of second paramter. But, it don't guarantee the same operation in all cases.
To remove this confusion and potential problem, this patch fixes it.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:11 +09:00
Hans de Goede dd3a55fc68 extcon: axp288: Fix the module not auto-loading
Add a MODULE_DEVICE_TABLE to fix the module not auto-loading.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:10 +09:00
Hans de Goede be1749528e extcon: axp288: Remove unnecessary irq?_en register writes
Setting the irq_enable bits is taken care of by the irq chip when we
request the irqs and the driver should not be meddling with the
irq?_en registers itself.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:10 +09:00
Hans de Goede 5757aca101 extcon: axp288: Use vbus-valid instead of -present to determine cable presence
The vbus-present bit in the power status register also gets set to 1
when a usb-host cable (id-pin shorted to ground) is plugged in and a 5v
boost converter is supplying 5v to the otg usb bus.

This causes a "disconnect or unknown or ID event" warning in dmesg as
well as the extcon device to report the last detected charger cable
type as being connected even though none is connected.

This commit switches to checking the vbus-valid bit instead, which is
only 1 when both vbus is present and the vbus-path is enabled in the
vbus-path control register (the vbus-path gets disabled when a usb-host
cable is detected, to avoid the pmic drawing power from the 5v boost
converter).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:10 +09:00
Hans de Goede 5d2199ea34 extcon: axp288: Fix possibly reporting 2 cables in state true
When the charger type changes from e.g. SDP to CDP, without Vbus being
seen as low in between axp288_handle_chrg_det_event would set the state
for the new cable type to true, without clearing the state of the
previous cable type to false.

This commit fixes this and also gets rid of the function local static
cable variable, properly storing all drv state in the axp288_extcon_info
struct.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2017-01-09 10:04:10 +09:00