Commit graph

1215167 commits

Author SHA1 Message Date
Uwe Kleine-König
0667faab96 gpio: brcmstb: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-02 08:54:20 +02:00
Uwe Kleine-König
484b322676 gpio: amdpt: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-02 08:54:09 +02:00
Uwe Kleine-König
2ae6a45f81 gpio: altera: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-10-02 08:53:57 +02:00
Bartosz Golaszewski
3a7fd473bd mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c
We have a special place for OF polarity quirks in gpiolib-of.c. Let's
move this over there so that it doesn't pollute the driver.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
2023-09-27 13:13:54 +02:00
Fabio Estevam
16fdcec808 dt-bindings: gpio: fsl-imx-gpio: Document imx25 and imx27
fsl,imx25-gpio and fsl,imx27-gpio are not documented, causing schema
warnings.

fsl,imx25-gpio is compatible with fsl,imx35-gpio and fsl,imx27-gpio
is compatible with fsl,imx21-gpio.

Document them accordingly.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 09:23:51 +02:00
Yinbo Zhu
3feb70a617 gpio: loongson: add more gpio chip support
This patch was to add loongson 2k0500, 2k2000 and 3a5000 gpio chip
driver support and define inten_offset attibute to enable gpio chip
interrupt.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 09:06:50 +02:00
Yinbo Zhu
1b83a90bd1 gpio: dt-bindings: add more loongson gpio chip support
This patch was to add loongson 2k0500, 2k2000 and 3a5000 gpio chip
dt-bindings support in yaml file.

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 09:06:27 +02:00
Linus Walleij
ff2cbd758d gpio: Rewrite IXP4xx GPIO bindings in schema
This rewrites the IXP4xx GPIO bindings to use YAML schema,
and adds two new properties to enable fixed clock output on
pins 14 and 15.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 08:55:55 +02:00
Kees Cook
a512635da9 gpiolib: cdev: annotate struct linereq with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct linereq.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-25 09:42:23 +02:00
Bartosz Golaszewski
9f93f18305 gpio: sim: initialize a managed pointer when declaring it
Variables managed with __free() should typically be initialized where
they are declared so that the __free() callback is paired with its
counterpart resource allocator. Fix the second instance of using
__free() in gpio-sim to follow this pattern.

Fixes: 3faf89f27a ("gpio: sim: simplify code with cleanup helpers")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-25 08:41:07 +02:00
Bartosz Golaszewski
db8588f95c gpio: sim: include a missing header
We're using various ERR macros from linux/err.h but the include is
missing. Add it.

Fixes: cb8c474e79 ("gpio: sim: new testing module")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-18 16:45:10 +02:00
Bartosz Golaszewski
7777fa9247 gpio: eic-sprd: use a helper variable for &pdev->dev
Instead of dereferencing pdev everywhere, just store the address of the
underlying struct device in a local variable.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
2023-09-13 14:13:32 +02:00
Bartosz Golaszewski
dbd31c71c5 gpio: eic-sprd: unregister from the irq notifier on remove()
This is a tristate module, it can be unloaded. We need to cleanup properly
and unregister from the interrupt notifier on driver detach.

Fixes: b32415652a ("gpio: eic-sprd: use atomic notifiers to notify all chips about irqs")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
2023-09-13 14:13:06 +02:00
Bartosz Golaszewski
a5c612b9db pinctrl: da9062: don't include private GPIOLIB header
gpiochip_get_desc() now lives in linux/gpio/driver.h and there is no
longer any need to include GPIOLIB's private header.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-12 10:06:01 +02:00
Bartosz Golaszewski
fe4fa2e4f7 gpiolib: make gpiochip_get_desc() public
It makes sense for a GPIO driver to want to get its own descriptor
without requesting it. After all, the driver knows that it'll still be
valid. Let's move this helper to linux/gpio/driver.h.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-12 10:05:58 +02:00
Bartosz Golaszewski
d56c6f798a pinctrl: da9062: add missing include
gpiod_is_active_low() is defined in linux/gpio/consumer.h. It's only
because we're pulling in the gpiolib.h private header that we get this
declaration implicitly but let's fix it as that is going away soon.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-12 10:05:55 +02:00
Bartosz Golaszewski
88d31f836b gpio: sim: don't fiddle with GPIOLIB private members
We access internals of struct gpio_device and struct gpio_desc because
it's easier but it can actually be avoided and we're working towards a
better encapsulation of GPIO data structures across the kernel so let's
start at home.

Instead of checking gpio_desc flags, let's just track the requests of
GPIOs in the driver. We also already store the information about
direction of simulated lines.

For kobjects needed by sysfs callbacks: we can iterate over the children
devices of the top-level platform device and compare their fwnodes
against the one passed to the init function from probe.

While at it: fix one line break and remove the untrue part about
configfs callbacks using dev_get_drvdata() from a comment.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2023-09-12 09:29:24 +02:00
Bartosz Golaszewski
9a249ec89a Immutable branch between pdx86 android tablets branch and GPIO due for the v6.7 merge window
ib-x86-android-tablets-v6.7: v6.6-rc1 + ib-pdx86-android-tablets
 for merging into the GPIO subsystem for v6.7.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEEuvA7XScYQRpenhd+kuxHeUQDJ9wFAmT++0EUHGhkZWdvZWRl
 QHJlZGhhdC5jb20ACgkQkuxHeUQDJ9wpeQgAuseg8r6ZtneCmmRuD2s6fcPaAgPX
 YoX14tWV8iHDRmNktg504kO+V6qW7XDRYAoQ2zx0yMSdi7jPZSNtHJxLLnhPL9FZ
 0sx6KwCFUyhXtF5HEr3jC21kg+94wPRe8XQCQ2zLZ+7mta+272gZZREyBi4CBfYv
 N3mSgiBYEfWgdY0Ye4HcMrg3yDKcCspcc6Wy3tErFjrw5emdMvPIl4INurECQ3lq
 f2b5iVmpWK00xG+rFUFEUt+pp5fjCawOsnvvbnrC2xG++m8/N6UmVdAO2/JnXCrL
 ZrxNM7WUKR0prCCj+s0uy9Otzz5X6DbkpZ8RY7e5s8ywN/O+yUNWlc7n5A==
 =mgID
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-ib-x86-android-tablets-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 into gpio/for-next

Immutable branch between pdx86 android tablets branch and GPIO due for the v6.7 merge window

ib-x86-android-tablets-v6.7: v6.6-rc1 + ib-pdx86-android-tablets
for merging into the GPIO subsystem for v6.7.
2023-09-12 09:15:48 +02:00
Hans de Goede
9578db7939 platform/x86: x86-android-tablets: Drop "linux,power-supply-name" from lenovo_yt3_bq25892_0_props[]
The "linux,power-supply-name" property is a left-over from an earlier
attempt to allow properties to specify the power_supply class-device name.

The patch to read this property never made it upstream (and is no longer
necessary). Drop the unused property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-9-hdegoede@redhat.com
2023-09-11 13:28:59 +02:00
Hans de Goede
61226c1cfa platform/x86: x86-android-tablets: Use platform-device as gpio-keys parent
Use the new x86-android-tablets platform-device as gpio-keys parent
to make it clear that this gpio-keys device was instantiated by
the x86-android-tablets driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-8-hdegoede@redhat.com
2023-09-11 13:28:58 +02:00
Hans de Goede
4014ae236b platform/x86: x86-android-tablets: Stop using gpiolib private APIs
Refactor x86_android_tablet_get_gpiod() to no longer use
gpiolib private functions like gpiochip_find().

As a bonus this allows specifying that the GPIO is active-low,
like the /CE (charge enable) pin on the bq25892 charger on
the Lenovo Yoga Tablet 3.

Reported-by: Bartosz Golaszewski <brgl@bgdev.pl>
Closes: https://lore.kernel.org/platform-driver-x86/20230905185309.131295-12-brgl@bgdev.pl/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-7-hdegoede@redhat.com
2023-09-11 13:28:58 +02:00
Hans de Goede
8b57d33a6f platform/x86: x86-android-tablets: Create a platform_device from module_init()
Create a platform_device from module_init() and change
x86_android_tablet_init() / cleanup() into platform_device
probe() and remove() functions.

This is a preparation patch for refactoring x86_android_tablet_get_gpiod()
to no longer use gpiolib private functions like gpiochip_find().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-6-hdegoede@redhat.com
2023-09-11 13:28:58 +02:00
Hans de Goede
56e1f53b58 platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip support
x86_dev_info.invalid_aei_gpiochip is no longer used by any boards
and the x86-android-tablets code should not use the gpiolib private
acpi_gpiochip_free_interrupts() function.

Reported-by: Bartosz Golaszewski <brgl@bgdev.pl>
Closes: https://lore.kernel.org/platform-driver-x86/20230905185309.131295-12-brgl@bgdev.pl/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-5-hdegoede@redhat.com
2023-09-11 13:28:58 +02:00
Hans de Goede
1fc95b025f platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip from Peaq C1010
Remove the invalid_aei_gpiochip setting from the x86_dev_info
for the Peaq C1010.

This is no longer necessary since there now is a quirk to ignore
the "dolby" button GPIO in gpiolib_acpi_quirks[] in
drivers/gpio/gpiolib-acpi.c .

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-4-hdegoede@redhat.com
2023-09-11 13:28:58 +02:00
Hans de Goede
6cc64f6173 gpiolib: acpi: Add a ignore interrupt quirk for Peaq C1010
On the Peaq C1010 2-in-1 INT33FC:00 pin 3 is connected to
a "dolby" button. At the ACPI level an _AEI event-handler
is connected which sets an ACPI variable to 1 on both
edges. This variable can be polled + cleared to 0 using WMI.

Since the variable is set on both edges the WMI interface is pretty
useless even when polling. So instead of writing a custom WMI
driver for this the x86-android-tablets code instantiates
a gpio-keys platform device for the "dolby" button.

Add an ignore_interrupt quirk for INT33FC:00 pin 3 on the Peaq C1010,
so that it is not seen as busy when the gpio-keys driver requests it.

Note this replaces a hack in x86-android-tablets where it would
call acpi_gpiochip_free_interrupts() on the INT33FC:00 GPIO
controller. acpi_gpiochip_free_interrupts() is considered private
(internal) gpiolib API so x86-android-tablets should stop using it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-3-hdegoede@redhat.com
2023-09-11 13:28:55 +02:00
Hans de Goede
5fb36a8c87 gpiolib: acpi: Check if a GPIO is listed in ignore_interrupt earlier
In some cases where a broken AEI is present for a GPIO and the GPIO
is listed in the ignore_interrupt list to avoid the broken event
handler, the kernel may want to use the GPIO for another purpose.

Before this change trying to use such a GPIO for another purpose would
fail, because the ignore_interrupt list was only checked after
the acpi_request_own_gpiod() call, causing the GPIO to already be
claimed even though it is listed in the ignore_interrupt list.

Fix this by moving the ignore_interrupt list to above
the acpi_request_own_gpiod() call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20230909141816.58358-2-hdegoede@redhat.com
2023-09-11 13:28:25 +02:00
Bartosz Golaszewski
b32415652a gpio: eic-sprd: use atomic notifiers to notify all chips about irqs
Calling gpiochip_find() from interrupt handler in this driver is an
abuse of the GPIO API. It only happens to work because nobody added a
might_sleep() to it and the lock used by GPIOLIB is a spinlock.

Both will soon be changed as we're limiting both the number of
interfaces allowed to be called from atomic context as well as making
struct gpio_chip private to the GPIO code that owns it. We'll also
switch to protecting the global GPIO device list with a mutex as there
is no reason to allow changes to it from interrupt handlers.

Instead of iterating over all SPRD chips and looking up each
corresponding GPIO chip, let's make each SPRD GPIO controller register
with a notifier chain. The chain will be called at interrupt so that
every chip that already probed will be notified. The rest of the
interrupt handling remains the same. This should result in faster code as
we're avoiding iterating over the list of all GPIO devices.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Chunyan Zhang <zhang.lyra@gmail.com>
Tested-by: Wenhua Lin <wenhua.lin@unisoc.com>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
f4e840238c gpio: mb86s7x: don't include gpiolib.h
The gpiolib.h is unnecessarily included in the driver. None of its
symbols are used so drop it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
ee27ed13dc gpio: dwapb: don't include gpiolib.h
The gpiolib.h is unnecessarily included in the driver. None of its
symbols are used so drop it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
f8681c2367 gpio: xgene-sb: don't include gpiolib.h
The gpiolib.h is unnecessarily included in the driver. None of its
symbols are used so drop it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
37d42ab392 gpiolib: remove unnecessary extern specifiers from the driver header
'extern' doesn't do anything for function declarations. Remove it.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
8de54392b8 gpiolib: remove stray newline in gpio/driver.h
Fix a double newline in the GPIO provider header.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 11:17:06 +02:00
Bartosz Golaszewski
7e12c495a3 gpio: of: correct notifier return codes
According to the comments in linux/notifier.h, the code to return when a
notifications is "not for us" is NOTIFY_DONE, not NOTIFY_OK.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:17:05 +02:00
Bartosz Golaszewski
f42dafe3da gpiolib: unexport gpiod_set_transitory()
There are no and never have been any users of gpiod_set_transitory()
outside the core GPIOLIB code. Make it private.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:17:05 +02:00
Bartosz Golaszewski
ed9e8d136f gpio: mockup: don't access internal GPIOLIB structures
Don't include gpiolib.h. Track the request status of lines locally
instead. In order to retrieve the device name use the fact that
gpio-mockup supports only a single GPIO device per platform device and
call device_find_any_child().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:17:02 +02:00
Bartosz Golaszewski
33f909fdd1 gpio: mockup: simplify code by using cleanup helpers
Use lock from linux/cleanup.h and simplify locking paths.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:17:00 +02:00
Bartosz Golaszewski
9790222d28 gpio: mockup: deprecate the old testing module
We have a much better alternative to the clunky old gpio-mockup. Don't
remove it just yet (there are tests depending on it out there) but make
Kconfig say that it should no longer be used in new projects.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:16:56 +02:00
Bartosz Golaszewski
ce9bcbc23b gpio: mockup: remove unused field
The desc assigned to debugfs private structure is unused so remove it.

Fixes: 9202ba2397 ("gpio: mockup: implement event injecting over debugfs")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:16:53 +02:00
Bartosz Golaszewski
8d5e2db297 gpio: mockup: fix kerneldoc
The pull field of the line state struct is undocumented. Fix it.

Fixes: 2a9e27408e ("gpio: mockup: rework debugfs interface")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2023-09-11 11:16:49 +02:00
xingtong.wu
3d15d17fc3 gpio-f7188x: fix base values conflicts with other gpio pins
switch pin base from static to automatic allocation to
avoid conflicts and align with other gpio chip drivers

Signed-off-by: xingtong.wu <xingtong.wu@siemens.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:03:44 +02:00
Andy Shevchenko
adb5f1560c gpio: pca953x: Revisit header inclusions
Some of the headers are not use, some are missing. Fix that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:10 +02:00
Andy Shevchenko
40db075545 gpio: pca953x: Get rid of useless goto label
In a few functions goto label is useless as there are no locking,
no nothing that may justify its usage. Get rid of it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:09 +02:00
Andy Shevchenko
7c30130662 gpio: pca953x: Switch to DEFINE_SIMPLE_DEV_PM_OPS()
SIMPLE_DEV_PM_OPS() is deprecated, replace it with pm_sleep_ptr()
and DEFINE_SIMPLE_DEV_PM_OPS() for setting the driver's PM routines.
We can now remove the ifdeffery surrounding the suspend and resume
functions.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:07 +02:00
Andy Shevchenko
9da0a75ea7 gpio: pca953x: Utilise temporary variable for struct gpio_chip
We have a temporary variable to keep pointer to struct gpio_chip.
Utilise it where it makes sense.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:06 +02:00
Andy Shevchenko
6811886ac9 gpio: pca953x: Utilise temporary variable for struct device
We have a temporary variable to keep pointer to struct device.
Utilise it where it makes sense.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:04 +02:00
Andy Shevchenko
8e471b784a gpio: pca953x: Simplify code with cleanup helpers
Use macros defined in linux/cleanup.h to automate resource lifetime
control in gpio-pca953x.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:02 +02:00
Andy Shevchenko
ec5bde6201 gpio: pca953x: Split pca953x_restore_context() and pca953x_save_context()
Split regcache handling to the respective helpers. It will allow to
have further refactoring with ease.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:01 +02:00
Andy Shevchenko
c47f7ff0fe gpio: pca953x: Utilise dev_err_probe() where it makes sense
At least in pca953x_irq_setup() we may use dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 09:00:00 +02:00
Andy Shevchenko
53c59d66c4 gpio: pca953x: Fully convert to device managed resources
Curtrently the error path is unsynchronised with removal due to
regulator being disabled before other device managed resources
are handled. Correct that by wrapping regulator enablement in
the respective call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 08:59:59 +02:00
Andy Shevchenko
2f4d3e2933 gpio: pca953x: Drop unused fields in struct pca953x_platform_data
New code should solely use firmware nodes for the specifics and
not any callbacks.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-11 08:59:57 +02:00