History log of /linux-master/drivers/extcon/extcon-gpio.c
Revision Date Author Comments
# 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>


# 8bc4810b 30-May-2019 Linus Walleij <linus.walleij@linaro.org>

extcon: gpio: Request reasonable interrupts

The only thing that makes sense is to request a falling edge interrupt
if the line is active low and a rising edge interrupt if the line is
active high, so just do that and get rid of the assignment from
platform data. The GPIO descriptor knows if the line is active high
or low.

Also make irq a local variable in probe(), it's not used anywhere else.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[cw00.choi: Fix build error of data->irq_flags]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 9c92ab61 29-May-2019 Thomas Gleixner <tglx@linutronix.de>

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

Based on 1 normalized pattern(s):

this software is licensed under the terms of the gnu general public
license version 2 as published by the free software foundation and
may be copied distributed and modified under those terms 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-only

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

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d368e7de 12-Feb-2018 Linus Walleij <linus.walleij@linaro.org>

extcon: gpio: Convert to fully use GPIO descriptor

Since we are not getting the GPIO from any platform data and global
GPIO numberspace, we simply get the named "extcon" GPIO directly from
the device. Cut away "active low" since GPIO descriptors already know
if the line is active high or low. Simplify a bit with a
struct device *dev helper variable in probe() and cut the complex
init() function.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# a62300d9 12-Feb-2018 Linus Walleij <linus.walleij@linaro.org>

extcon: gpio: Move platform data into state container

This moves the platform data settings from the platform data
struct and into the state container, saving some unnecessary
references and simplifying things a bit.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
[cw00.choi: Add FIXME comment of extcon_id]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 66afdedf 12-Feb-2018 Linus Walleij <linus.walleij@linaro.org>

extcon: gpio: Localize platform data

Nothing in the entire kernel #includes <linux/extcon/extcon-gpio.h>
so move the platform data declaration inside of the driver.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 176aa360 20-Sep-2017 Chanwoo Choi <cw00.choi@samsung.com>

extcon: Split out extcon header file for consumer and provider device

The extcon has two type of extcon devices as following.
- 'extcon provider deivce' adds new extcon device and detect the
state/properties of external connector. Also, it notifies the
state/properties to the extcon consumer device.
- 'extcon consumer device' gets the change state/properties
from extcon provider device.
Prior to that, include/linux/extcon.h contains all exported API for
both provider and consumer device driver. To clarify the meaning of
header file and to remove the wrong use-case on consumer device,
this patch separates into extcon.h and extcon-provider.h.

[Description for include/linux/{extcon.h|extcon-provider.h}]
- extcon.h includes the extcon API and data structure for extcon consumer
device driver. This header file contains the following APIs:
: Register/unregister the notifier to catch the change of extcon device
: Get the extcon device instance
: Get the extcon device name
: Get the state of each external connector
: Get the property value of each external connector
: Get the property capability of each external connector

- extcon-provider.h includes the extcon API and data structure for extcon
provider device driver. This header file contains the following APIs:
: Include 'include/linux/extcon.h'
: Allocate the memory for extcon device instance
: Register/unregister extcon device
: Set the state of each external connector
: Set the property value of each external connector
: Set the property capability of each external connector

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kishon Vijay Abraham I <kishon@ti.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>


# 1662622f 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Remove the usage of extcon_set_state()

This patch removes the usage of extcon_set_state() because it uses
the bit masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set_cable_state_() with extcon id.

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


# 7575591c 21-Jul-2016 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Remove the usage of extcon_set_state()

This patch removes the usage of extcon_set_state() because it uses
the bit masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set_cable_state_() with extcon id.

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


# b51b3870 23-Dec-2015 Moritz Fischer <moritz.fischer@ettus.com>

extcon: gpio: Fix typo in comment

This patch fixes the typo in comment of extcon-gpio.c driver.
- 'interrput' -> 'interrupt'

Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# de992acb 29-Sep-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Use descriptor-based GPIO interface instead of legacy gpio_* API

This patch uses the descriptor-based GPIO interface (gpiod_* API) instead of
legacy gpio_* API and add the internal gpio_extcon_init() to handle
all gpio-related tasks.

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


# 6ba12997 29-Sep-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Fix minor coding style and remove the unused fields.

This patch fixes the minor coding style about indentation and removes the
unused fields from struct gpio_extcon_platform_data.

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


# ce6f7496 29-Sep-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Add the missing supported_cable parameter to devm_extcon_dev_allocate()

The commit 2a9de9c0 ("extcon: Use the unique id for external connector instead
of string") defines the unique id of each external connector to identify the
type of external connector instead of string name. So, devm_extcon_dev_allocate()
should include the second parameter (unsigned int *supported_cable). This patch
adds the supported_cable parameter which is passed by platform data.

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


# 60f9b9e6 29-Sep-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Remove duplicate data from struct gpio_extcon_data

There are duplicate data between struct gpio_extcon_data and struct
gpio_extcon_platform_data. This patch removes them from struct gpio_extcon_data.
Instead, this patch add pdata field to struct gpio_extcon_data.

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


# ae59f3a2 25-Sep-2015 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Use resource managed function for request_irq

This patch uses the resource managed function for registering
interrupt.

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


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

extcon: Remove optional print_state() function pointer of struct extcon_dev

This patch removes the optional print_state() function pointer which included
in 'struct extcon_dev' because the extcon must maintain the consistent name
of extcon device on sysfs instead of inconsistent state of external connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.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>


# 62364357 08-Sep-2014 George Cherian <george.cherian@ti.com>

extcon: gpio: Fix code cleanup

This patch fixes following minor cleanup:
- Order the include files in alphabetical order.
- Fix description of state_off in extcon_gpio.h
- Add a descrition for check_on_resume in extcon_gpio.h

Signed-off-by: George Cherian <george.cherian@ti.com>
[Modify the name/description of patch to keep standary codiyg style by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 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>


# 60cd62d4 21-Apr-2014 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Use devm_extcon_dev_allocate for extcon_dev

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

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>


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

extcon: gpio: 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>


# 3cc731d9 27-Feb-2014 Jingoo Han <jg1.han@samsung.com>

extcon: gpio: 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>


# 6544dfa5 08-Jan-2014 Rongjun Ying <rongjun.ying@csr.com>

extcon: gpio: Add power resume support

When system on the suspend state, Some SoC can't get gpio interrupt.
After system resume, need send extcon uevent to userspace.

Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Reviewed-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 4288d9b8 22-Nov-2013 Guenter Roeck <linux@roeck-us.net>

extcon: gpio: Request gpio pin before modifying its state

Commit 338de0ca (extcon: gpio: Use gpio driver/chip debounce if supported)
introduced a call to gpio_set_debounce() before actually requesting the
respective gpio pin from the gpio subsystem.

The gpio subsystem expects that a gpio pin was requested before modifying its
state. Not doing so results in a warning from gpiolib, and the gpio pin is
auto-requested. This in turn causes the subsequent devm_gpio_request_one()
to fail. So devm_gpio_request_one() must be called prior to calling
gpio_set_debounce().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.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>


# 5bfbdc9c 11-Sep-2013 Guenter Roeck <linux@roeck-us.net>

extcon: gpio: Add support for active-low presence to detect pins

This patch add 'gpio_active_low' field to 'struct gpio_extcon_data'
to check whether gpio active state is 1(high) or 0(low).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@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>


# 338de0ca 10-Sep-2013 Guenter Roeck <linux@roeck-us.net>

extcon: gpio: Use gpio driver/chip debounce if supported

This patch use gpio_set_debounce() API provided from gpiolib if SoC or device
driver with gpio support gpio_set_debounce() function.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 1073514b 29-Aug-2013 Guenter Roeck <linux@roeck-us.net>

extcon: gpio: Do not unnecessarily initialize variables

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# d0db2e7a 19-Jul-2013 Mark Brown <broonie@linaro.org>

extcon: gpio: Use power efficient workqueue for debounce

The debounce timeout is generally quite long and the work not performance
critical so allow the scheduler to run the work anywhere rather than in
the normal per-CPU workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>


# fd116066 13-Feb-2013 Chanwoo Choi <cw00.choi@samsung.com>

extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style

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>


# 5f7e2228 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

extcon: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 44f34fd4 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

extcon: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 93ed0327 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

extcon: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8dee001d 07-Aug-2012 Sachin Kamat <sachin.kamat@linaro.org>

extcon: Remove duplicate inclusion of extcon.h header file

extcon.h header file was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>


# 0ea62503 09-Aug-2012 MyungJoo Ham <myungjoo.ham@samsung.com>

Extcon: renamed files to comply with the standard naming.

Replaced '_' with '-' in the extcon file names, which has been bogging
since new drivers have been using the standard naming.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>