History log of /linux-master/drivers/extcon/extcon-palmas.c
Revision Date Author Comments
# c95fb88f 13-Mar-2023 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

extcon: palmas: Remove unused of_gpio.h

of_gpio.h provides a single function, which is not used in this driver.
Remove unused header.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 2fb67280 19-Jun-2022 Colin Ian King <colin.king@intel.com>

extcon: Remove extraneous space before a debug message

There is an extreneous space before a dev_dbg message, remove it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# f94a5bec 23-Mar-2021 Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

extconn: Clean-up few drivers by using managed work init

Few drivers implement remove call-back only for ensuring a delayed
work gets cancelled prior driver removal. Clean-up these by switching
to use devm_delayed_work_autocancel() instead.

Additionally, this helps avoiding mixing devm and manual resource
management and cleans up a (theoretical?) bug from extconn-palmas.c
and extcon-qcom-spmi-misc.c where (devm managed)IRQ might schedule
new work item after wq was cleaned at remove().

This change is compile-tested only. All testing is appreciated.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/b1030eddbf0069f2d39e951be1d8e40d6413aeeb.1616506559.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d0f66810 28-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: palmas: Simplify with dev_err_probe()

Common pattern of handling deferred probe can be simplified with
dev_err_probe(). Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# f6dfb3c9 13-Jul-2020 Alexander A. Klimov <grandmaster@al2klimov.de>

extcon: Replace HTTP links with HTTPS ones

Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
If not .svg:
For each line:
If doesn't contain `\bxmlns\b`:
For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`:
If both the HTTP and HTTPS versions
return 200 OK and serve the same content:
Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 3426ad6d 17-Feb-2020 H. Nikolaus Schaller <hns@goldelico.com>

extcon: palmas: Hide error messages if gpio returns -EPROBE_DEFER

If the gpios are probed after this driver (e.g. if they
come from an i2c expander) there is no need to print an
error message.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# c942fddf 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157

Based on 3 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version this program is distributed in the
hope that it will be useful but without any warranty without even
the implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [kishon] [vijay] [abraham]
[i] [kishon]@[ti] [com] this program is distributed in the hope that
it will be useful but without any warranty without even the implied
warranty of merchantability or fitness for a particular purpose see
the gnu general public license for more details

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version [author] [graeme] [gregory]
[gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i]
[kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema]
[hk] [hemahk]@[ti] [com] this program is distributed in the hope
that it will be useful but without any warranty without even the
implied warranty of merchantability or fitness for a particular
purpose see the gnu general public license for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 1105 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 01944321 15-Feb-2017 Roger Quadros <rogerq@ti.com>

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>


# 567ab5a8 24-Jan-2017 Roger Quadros <rogerq@ti.com>

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>


# 9fe172b9 08-Dec-2016 Roger Quadros <rogerq@ti.com>

extcon: palmas: Check the parent instance to prevent the NULL

extcon-palmas must be child of palmas and expects parent's
drvdata to be valid. Check for non NULL parent drvdata and
fail if it is NULL. Not doing so will result in a NULL
pointer dereference later in the probe() parent drvdata
is NULL (e.g. misplaced extcon-palmas node in device tree).

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 8670b459 16-Aug-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Use the extcon_set_state_sync() instead of deprecated functions

This patch alters the renamed extcon API to set the state of the external
connectors instead of deprecated extcon_set_cable_state_().

Because the patch[1] modifies the function name to maintain the function
naming pattern.
- extcon_set_cable_state_() -> extcon_set_state_sync()
- extcon_get_cable_state_() -> extcon_get_state()

[1] https://lkml.org/lkml/2016/8/4/729
- extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Roger Quadros <rogerq@ti.com>


# 62e6d1e5 15-Jun-2016 Roger Quadros <rogerq@ti.com>

extcon: palmas: Fix boot up state of VBUS when using GPIO detection

If USB cable is connected prior to boot, we don't get any interrupts
so we must manually check the VBUS state and report it during probe.
If we don't do it then USB controller will never know that peripheral
cable was connected till the user unplugs and replugs the cable.

Fixes: b7aad8e2685b ("extcon: palmas: Add the support for VBUS detection by using GPIO")
Cc: stable@vger.kernel.org
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# f75587b8 01-Apr-2016 Nishanth Menon <nm@ti.com>

extcon: palmas: Drop stray IRQF_EARLY_RESUME flag

Palmas extcon IRQs are nested threaded and wired to the Palmas
interrupt controller. So, this flag is not required for nested
IRQs anymore, since commit 3c646f2c6aa9 ("genirq: Don't suspend
nested_thread irqs over system suspend") was merged. However, the
fix in commit ae64e42cc2b3 ("extcon: palmas: Drop IRQF_EARLY_RESUME
flag") missed a stray flag causing the following crash on resume on
BeagleBoard-X15 platform:

[ 53.670141] Unhandled fault: imprecise external abort (0x1406) at 0x00000000
[..]
[ 53.670141] [<c04ae734>] (omap_set_gpio_triggering) from [<c04aeb94>] (omap_gpio_unmask_irq+0xc0/0xc4)
[ 53.670141] [<c04aeb94>] (omap_gpio_unmask_irq) from [<c01a0b88>] (irq_enable+0x30/0x44)
[ 53.670141] [<c01a0b88>] (irq_enable) from [<c019ebd8>] (__enable_irq+0x54/0x78)
[ 53.670141] [<c019ebd8>] (__enable_irq) from [<c01a4e60>] (resume_irqs+0xe8/0x100)
[ 53.670141] [<c01a4e60>] (resume_irqs) from [<c0514840>] (syscore_resume+0x94/0x298)
[ 53.670141] [<c0514840>] (syscore_resume) from [<c01981cc>] (suspend_devices_and_enter+0x790/0x9e4)
[ 53.670141] [<c01981cc>] (suspend_devices_and_enter) from [<c0198a60>] (pm_suspend+0x640/0x75c)
[ 53.670141] [<c0198a60>] (pm_suspend) from [<c0196bec>] (state_store+0x64/0xb8)
[ 53.670141] [<c0196bec>] (state_store) from [<c0307944>] (kernfs_fop_write+0xc0/0x1bc)
[ 53.670141] [<c0307944>] (kernfs_fop_write) from [<c028acb0>] (__vfs_write+0x1c/0xd8)
[ 53.670141] [<c028acb0>] (__vfs_write) from [<c028bba0>] (vfs_write+0x90/0x16c)
[ 53.670141] [<c028bba0>] (vfs_write) from [<c028c8c0>] (SyS_write+0x44/0x9c)
[ 53.670141] [<c028c8c0>] (SyS_write) from [<c0107840>] (ret_fast_syscall+0x0/0x1c)
[..]

Fixes: ae64e42cc2b3 ("extcon: palmas: Drop IRQF_EARLY_RESUME flag")
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Roger Quadros <rogerq@ti.com>

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# ae64e42c 26-Feb-2016 Grygorii Strashko <grygorii.strashko@ti.com>

extcon: palmas: Drop IRQF_EARLY_RESUME flag

Palams extcon IRQs are nested threaded and wired to the Palmas
inerrupt controller. So, this flag is not required for nested irqs
anymore, since commit 3c646f2c6aa9 ("genirq: Don't suspend
nested_thread irqs over system suspend") was merged.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Roger Quadros <rogerq@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# b7aad8e2 29-Dec-2015 Felipe Balbi <balbi@ti.com>

extcon: palmas: Add the support for VBUS detection by using GPIO

This patch support for VBUS detection by using GPIO pin.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>


# ac22a1d3 12-Aug-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: palmas: Fix build break due to devm_gpiod_get_optional API change

With commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
it becomes necessary to pass the flags argument. And this patch adds the gpio
header file to fix the build breakage when build testing with random
configuration files.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>


# 92b7cb5d 03-Aug-2015 Roger Quadros <rogerq@ti.com>

extcon: palmas: Support GPIO based USB ID detection

Some palmas based chip variants do not have OTG based ID logic.
For these variants we rely on GPIO based USB ID detection.

These chips do have VBUS comparator for VBUS detection so we
continue to use the old way of detecting VBUS.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 1fe189bf 11-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: palmas: Remove the mutually_exclusive array

This patch removes the mutually_exclusive array of extcon-palmas.c.
After used the unique id of each external connector on 2a9de9c0f08d
("extcon: Use the unique id for external connector instead of string"),
extcon driver can't directly handle the bit value indicating the external
connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# e350f804 11-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: palmas: Fix NULL pointer error

This patch fixes NULL pointer error by removing the unneeded kfree() call
of edev->name because extcon-palmas no longer allocate the memory for edev->name.

Fixes: d71aadda19f8 ("extcon: Remove the optional name of extcon device")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>


# 73b6ecdb 11-Jun-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Redefine the unique id of supported external connectors without 'enum extcon' type

This patch just redefine the unique id of supported external connectors without
'enum extcon' type. Because unique id would be used on devictree file(*.dts) to
indicate the specific external connectors like key number of input framework.
So, I have the plan to move this definitions to following header file which
includes the unique id of supported external connectors.
- include/dt-bindings/extcon/extcon.h

Fixes: 2a9de9c0f08d ("extcon: Use the unique id for external connector instead of string")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2a9de9c0 24-Apr-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Use the unique id for external connector instead of string

This patch uses the unique id to identify the type of external connector instead
of string name. The string name have the many potential issues. So, this patch
defines the 'extcon' enumeration which includes all supported external connector
on EXTCON subsystem. If new external connector is necessary, the unique id of
new connector have to be added in 'extcon' enumeration. There are current
supported external connector in 'enum extcon' as following:

enum extcon {
EXTCON_NONE = 0x0,

/* USB external connector */
EXTCON_USB = 0x1,
EXTCON_USB_HOST = 0x2,

/* Charger external connector */
EXTCON_TA = 0x10,
EXTCON_FAST_CHARGER = 0x11,
EXTCON_SLOW_CHARGER = 0x12,
EXTCON_CHARGE_DOWNSTREAM = 0x13,

/* Audio and video external connector */
EXTCON_LINE_IN = 0x20,
EXTCON_LINE_OUT = 0x21,
EXTCON_MICROPHONE = 0x22,
EXTCON_HEADPHONE = 0x23,

EXTCON_HDMI = 0x30,
EXTCON_MHL = 0x31,
EXTCON_DVI = 0x32,
EXTCON_VGA = 0x33,
EXTCON_SPDIF_IN = 0x34,
EXTCON_SPDIF_OUT = 0x35,
EXTCON_VIDEO_IN = 0x36,
EXTCON_VIDEO_OUT = 0x37,

/* Miscellaneous external connector */
EXTCON_DOCK = 0x50,
EXTCON_JIG = 0x51,
EXTCON_MECHANICAL = 0x52,

EXTCON_END,
};

For example in extcon-arizona.c:
To use unique id removes the potential issue about handling
the inconsistent name of external connector with string.
- Previously, use the string to register the type of arizona jack connector
static const char *arizona_cable[] = {
"Mechanical",
"Microphone",
"Headphone",
"Line-out",
};
- Newly, use the unique id to register the type of arizona jack connector
static const enum extcon arizona_cable[] = {
EXTCON_MECHANICAL,
EXTCON_MICROPHONE,
EXTCON_HEADPHONE,
EXTCON_LINE_OUT,

EXTCON_NONE,
};

And this patch modify the prototype of extcon_{get|set}_cable_state_() which
uses the 'enum extcon id' instead of 'cable_index'. Because although one more
extcon drivers support USB cable, each extcon driver might has the differnt
'cable_index' for USB cable. All extcon drivers can use the unique id number
for same external connector with modified extcon_{get|set}_cable_state_().

- Previously, use 'cable_index' on these functions:
extcon_get_cable_state_(struct extcon_dev*, int cable_index)
extcon_set_cable_state_(struct extcon_dev*, int cable_index, bool state)

-Newly, use 'enum extcon id' on these functions:
extcon_get_cable_state_(struct extcon_dev*, enum extcon id)
extcon_set_cable_state_(struct extcon_dev*, enum extcon id, bool state)

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[arnd: Report the build break about drivers/usb/phy/phy-tahvo.c after using the
unique id for external connector insteadf of string]
Reported-by: Arnd Bergmann <arnd@arndb.de>
[dan.carpenter: Report the build warning of extcon_{set|get}_cable_state_()]
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>


# d71aadda 04-May-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Remove the optional name of extcon device

This patch removes the optional name of extcon device. Instead,
extcon_dev_register() set the device name as 'extcon[number]' naming pattern.
- /sys/class/extcon/[hardcoded device name] -> /sys/class/extcon/extcon[number]

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Jaewon Kim <jaewon02.kim@samsung.com>


# 08147bb1 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

extcon: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# ac65a625 29-May-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Set parent device of extcon device using prameter of devm_extcon_dev_allocate

This patch set the parent device of extcon device using first parameter of
devm_extco_dev_allocate() to remove duplicate code on all of extcon provider
drivers.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reported-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tested-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>


# 3bc2ac7d 23-May-2014 Krzysztof Kozlowski <krzk@kernel.org>

extcon: palmas: Make of_device_id array const

Array of struct of_device_id may be be const as expected by
of_match_table field.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 3f79a3fb 21-Apr-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: palmas: Use devm_extcon_dev_allocate for extcon_dev

This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>


# b4dad55a 21-Apr-2014 Sangjung Woo <sangjung.woo@samsung.com>

extcon: palmas: Use devm_extcon_dev_register()

Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# f63d32d4 27-Mar-2014 Kishon Vijay Abraham I <kishon@ti.com>

extcon: palmas: explicitly set edev name as node name

commit ca488 (extcon: of: Remove unnecessary function call by using the
name of device_node) started using node name instead of device name
to get the extcon device. This breaks dwc3-omap since it's not able to
get the extcon device anymore. Fixed it by setting edev name of
palmas to be the same as its node name.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reported-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 8d4288fb 27-Feb-2014 Jingoo Han <jg1.han@samsung.com>

extcon: palmas: Use SIMPLE_DEV_PM_OPS macro

Use SIMPLE_DEV_PM_OPS macro in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# b7d2d5be 10-Oct-2013 George Cherian <george.cherian@ti.com>

extcon: palmas: Handle ID interrupt properly using USB_ID_INT_SRC

Always cross check with the ID state and the source of interrupt.
Also add a case in which ID Source is ID_GND but LATCH state is set
wrongly. This uses the previous Link stat to determine the new state.

Signed-off-by: George Cherian <george.cherian@ti.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 5fbc77d6 10-Oct-2013 Kishon Vijay Abraham I <kishon@ti.com>

extcon: palmas: Added a new compatible type *ti,palmas-usb-vid*

The Palmas device contains only a USB VBUS-ID detector, so added a
compatible type *ti,palmas-usb-vid*. Didn't remove the existing compatible
types for backward compatibility.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 42d7d753 26-Sep-2013 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Simplify extcon_dev_register() prototype by removing unnecessary parameter

This patch remove extcon_dev_register()'s second parameter which means
the pointer of parent device to simplify prototype of this function.
So, if extcon device has the parent device, it should set the pointer of
parent device to edev.dev.parent in extcon device driver instead of in
extcon_dev_register().

Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# 7c0f6558 10-Sep-2013 Jingoo Han <jg1.han@samsung.com>

extcon: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 7281e05a 10-Jul-2013 Laxman Dewangan <ldewangan@nvidia.com>

extcon: palmas: Option to disable ID/VBUS detection based on platform

Based on system design, platform needs to detect the VBUS or ID or
both. Provide option to select this through platform data to
disable part of cable detection through palmas-usb.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# 024783ef 09-Jul-2013 Laxman Dewangan <ldewangan@nvidia.com>

extcon: palams: add support for suspend/resume

Add suspend/resume callbacks and support for wakeup from
suspend on USB HOST or USB Device cable insertion or removal.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# 002945f0 09-Jul-2013 Laxman Dewangan <ldewangan@nvidia.com>

extcon: palmas: enable ID_GND and ID_FLOAT detection always

When integrating driver with Tegra platform, it is found that
the ID pins get detected only once after booting system and
further removal and re-insert does not detect the ID pin.

Fixing this issue with enabling interrupt on ID_GND and ID_FLOAT
always and clearing the status on LATCH register which actually
occurred.

Also if interrupt occurs with line status as zero then based on
previous status, set the cable state.

Add debug prints to display the cable state when any cable
insertion/removal happen.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# fc57303a 14-Jun-2013 Kishon Vijay Abraham I <kishon@ti.com>

extcon: palmas: remove assigning "edev.name" to palmas

of_extcon_get_extcon_dev() uses dev_name for getting the reference
to the extcon device. If the extcon driver assigns a different
name other than dev_name, of_extcon_get_extcon_dev() wouldn't
be able to find the reference to the extcon device. Since the
client drivers of extcon-palmas would be using
of_extcon_get_extcon_dev(), removed assigning edev.name
in extcon-palmas.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# b1f254e3 27-May-2013 Graeme Gregory <gg@slimlogic.co.uk>

extcon: Palmas Extcon Driver

This is the driver for the USB comparator built into the palmas chip. It
handles the various USB OTG events that can be generated by cable
insertion/removal.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
[kishon@ti.com: adapted palmas usb driver to use the extcon framework]
Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>