History log of /linux-master/drivers/extcon/extcon-ptn5150.c
Revision Date Author Comments
# bcfa8e33 29-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

extcon: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 1bfcaa57 19-Apr-2022 Li Jun <jun.li@nxp.com>

extcon: ptn5150: Add usb role class support

Some usb controller drivers may not support extcon but use
usb role class as it's the preferred approach, so to support
usb dual role switch with usb role class, add usb role class
consumer support.

Signed-off-by: Li Jun <jun.li@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 782cd939 19-Apr-2022 Li Jun <jun.li@nxp.com>

extcon: ptn5150: Add queue work sync before driver release

Add device managed action to sync pending queue work, otherwise
the queued work may run after the work is destroyed.

Fixes: 4ed754de2d66 ("extcon: Add support for ptn5150 extcon driver")
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 6be65ed4 09-Sep-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Do not print error during probe if nothing is attached

The commit 85256f611f66 ("extcon: ptn5150: Check current USB mode when
probing") reused code for checking CC status register in the probe path
to determine what is initially connected. However if nothing is
connected, the CC status register will have 0x0 value and print an error
message:

ptn5150 1-003d: Unknown Port status : 0

This is not an error. Also any other unknown port status values are not
really errors but unhandled cases.

Fixes: 85256f611f66 ("extcon: ptn5150: Check current USB mode when probing")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# b9a32f62 09-Sep-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Use defines for registers

The register addresses are not continuous, so use simple defines for
them. This also makes it easier to find the address for register.

No functional change.

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


# ea6a95d0 27-Aug-2020 Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>

extcon: ptn5150: Set the VBUS and POLARITY property capability

Set the capability value of property for VBUS and POLARITY.

Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>
[cw00.choi: Replace the space with tab for the indentation]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 7e3b1caf 26-Aug-2020 Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>

extcon: ptn5150: Switch to GENMASK() and BIT() macros

Switch to GENMASK() and BIT() macros.

Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 611e92a0 26-Aug-2020 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

extcon: ptn5150: Deduplicate parts of dev_err_probe()

dev_err_probe() is designed to be used like

return dev_err_probe(dev, ret, "Error message\n");

Hence no need to have a separate return statement. Besides that
dev_err_probe() prints already returned error code, no need to repeat
that either.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 0b0549b6 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Convert to .probe_new

The 'struct i2c_device_id' argument of probe function is not used, so
convert the driver to simpler 'probe_new' interface.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 35f1f8f2 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Convert to module_i2c_driver

Use module_i2c_driver() to simplify driver init boilerplate.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# b8787ff8 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Reduce the amount of logs on deferred probe

There is no point to print deferred probe (and its failures to get
resources) as an error. In case of multiple probe tries this would
pollute the dmesg.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# fbaf3b67 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Make 'vbus-gpios' optional

The PTN5150 chip can be used in hardware designs with only reporting of
USB Type-C connection, without the VBUS control. The driver however
unconditionally expected 'vbus-gpios'.

Since all uses of the VBUS GPIO descriptor are NULL safe, the code can
accept missing GPIO and provide only extcon status reporting.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 85256f61 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Check current USB mode when probing

When machine boots up, the USB could be already in OTG mode. In such
case there will be no interrupt coming to ptn5150 device and driver will
report default state of nothing connected. Detection of USB connection
would happen on first unplug of the cable.

Factor out code for checking current connection mode and call it right
after probe so the existing USB mode will be properly reported.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# fa31f587 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Lower the noisiness of probe

The ptn5150 driver always prints device type on probe but as raw hex,
without any translation to meaningful description. This is useful only
for board bring up time so lower the verbosity to debug.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# e095882e 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Simplify getting vbus-gpios with flags

Instead of obtaining GPIO as input and configuring it right after to
output-low, just use proper GPIOD_OUT_LOW flag. Code is smaller and
simpler.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 45ce36f5 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Use generic "interrupts" property

Interrupts do not have to be always GPIO based so instead of expecting
"int-gpios" property and converting the GPIO to an interrupt, just
accept any interrupt via generic "interrupts" property.

Keep support for old "int-gpios" for backward compatibility.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 6aaad58c 17-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

extcon: ptn5150: Fix usage of atomic GPIO with sleeping GPIO chips

The driver uses atomic version of gpiod_set_value() without any real
reason. It is called in a workqueue under mutex so it could sleep
there. Changing it to "can_sleep" flavor allows to use the driver with
all GPIO chips.

Fixes: 4ed754de2d66 ("extcon: Add support for ptn5150 extcon driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 3dfed895 24-Jan-2019 Wei Yongjun <weiyongjun1@huawei.com>

extcon: ptn5150: Fix return value check in ptn5150_i2c_probe()

In case of error, the function devm_gpiod_get() returns ERR_PTR() and
never returns NULL. The NULL test in the return value check should be
replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>


# 4ed754de 23-Jan-2019 Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>

extcon: Add support for ptn5150 extcon driver

PTN5150 is a small thin low power CC (Configurationn Channel)
Logic chip supporting the USB Type-C connector application with
CC control logic detection and indication functions.

Signed-off-by: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
[cw00.choi: Fix bulid dependency and clean-up code]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>