Commit graph

1764 commits

Author SHA1 Message Date
Henning Schild 8aee49eb93 leds: simatic-ipc-leds-gpio: Add terminating entries to gpio tables
The entries do not seem to be stricly needed when the number of entries
is given via the number of LEDs. But adding them is a safeguard should
anyone ever iterate over the tables to their end, it also gets us in
line with other drivers that register "leds-gpio" tables.

Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230524124628.32295-2-henning.schild@siemens.com
2023-06-08 18:29:20 +01:00
Jiapeng Chong b3f4b679ff leds: flash: leds-qcom-flash: Fix an unsigned comparison which can never be negative
The variable 'count' is defined as unsigned type, so the following if
statement is invalid, we can modify the type of count to int.

if (count <= 0) {
	dev_err(dev, "No led-sources specified\n");
	return -ENODEV;
}

./drivers/leds/flash/leds-qcom-flash.c:546:5-10: WARNING: Unsigned expression compared with zero: count <= 0.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5344
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230531053559.5702-1-jiapeng.chong@linux.alibaba.com
2023-06-08 18:12:46 +01:00
Jiapeng Chong dda968475b leds: cht-wcove: Remove unneeded semicolon
No functional modification involved.

./drivers/leds/leds-cht-wcove.c:193:2-3: Unneeded semicolon.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5343
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230531024020.106641-1-jiapeng.chong@linux.alibaba.com
2023-06-08 18:11:14 +01:00
Yang Li de416a9f91 leds: cht-wcove: Fix an unsigned comparison which can never be negative
The return value from the call to cht_wc_leds_find_freq() is int.
However, the return value is being assigned to an unsigned
int variable 'ctrl', so making it an int.

Eliminate the following warning:
drivers/leds/leds-cht-wcove.c:236 cht_wc_leds_set_effect() warn: unsigned 'ctrl' is never less than zero.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5341
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230531020238.102684-1-yang.lee@linux.alibaba.com
2023-06-08 17:37:51 +01:00
Hans de Goede 3f80ba4444 leds: cht-wcove: Mark cht_wc_leds_brightness_get() static
cht_wc_leds_brightness_get() is only used internally, mark it static.

Cc: Yauhen Kharuzhy <jekhor@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202305260008.QCRrKILf-lkp@intel.com/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230525183317.129232-1-hdegoede@redhat.com
2023-06-08 15:56:11 +01:00
Martin Kurbanov 36a87f371b leds: Add AW20xx driver
This commit adds support for AWINIC AW20036/AW20054/AW20072 LED driver.
This driver supports following AW200XX features:
  - Individual 64-level DIM currents

Signed-off-by: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230519130403.212479-3-mmkurbanov@sberdevices.ru
Signed-off-by: Lee Jones <lee@kernel.org>
2023-06-01 19:46:35 +01:00
Lu Hongfei 8f38f8fa72 led: qcom-lpg: Fix resource leaks in for_each_available_child_of_node() loops
Ensure child node references are decremented properly in the error path.

Signed-off-by: Lu Hongfei <luhongfei@vivo.com>
Link: https://lore.kernel.org/r/20230525111705.3055-1-luhongfei@vivo.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 13:01:45 +01:00
Azeem Shaikh 36af333a75 leds: as3645a: Replace strlcpy with strscpy
Part of a tree-wide effort to remove deprecated strlcpy()[1] and replace
it with strscpy()[2]. No return values were used, so direct replacement
is safe.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Link: https://lore.kernel.org/r/20230524144824.2360607-1-azeemshaikh38@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:44:25 +01:00
Marek Vasut 2d6180147e leds: gpio: Configure per-LED pin control
Each gpio-leds DT node DT subnode can have a pinctrl property assigned
to it, parse the DT subnode pinctrl properties and configure each pin
accordingly.

Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230523183151.5460-1-marex@denx.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:34:30 +01:00
Azeem Shaikh bf4a35e920 leds: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
No return values were used, so direct replacement is safe.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230523021451.2406362-1-azeemshaikh38@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:31:55 +01:00
Azeem Shaikh d6e3896b7c leds: blinkm: Replace all non-returning strlcpy with strscpy
strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
No return values were used, so direct replacement is safe.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230523021228.2406112-1-azeemshaikh38@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:31:18 +01:00
Niklas Schnelle 0113cea8fd leds: Add HAS_IOPORT dependencies
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Link: https://lore.kernel.org/r/20230522105049.1467313-18-schnelle@linux.ibm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:20:47 +01:00
Yang Li af7320ecae leds: trigger: netdev: Remove NULL check before dev_{put, hold}
The call netdev_{put, hold} of dev_{put, hold} will check NULL,
so there is no need to check before using dev_{put, hold},
remove it to silence the warnings:

./drivers/leds/trigger/ledtrig-netdev.c:291:3-10: WARNING: NULL check before dev_{put, hold} functions is not needed.
./drivers/leds/trigger/ledtrig-netdev.c:401:2-9: WARNING: NULL check before dev_{put, hold} functions is not needed.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=4929
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230511070820.52731-1-yang.lee@linux.alibaba.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:34 +01:00
Hans de Goede 82f80ef5f3 leds: Clear LED_INIT_DEFAULT_TRIGGER when clearing current trigger
Not all triggers use LED_INIT_DEFAULT_TRIGGER, which means that it
will not get cleared when the default trigger is a trigger which
does not use it such as "default-on".

If the default trigger then later gets replaced by a trigger which
does check LED_INIT_DEFAULT_TRIGGER, such as "timer" then that trigger
will behave as if it is the default trigger which it should not do.

To fix this clear the LED_INIT_DEFAULT_TRIGGER flag when clearing
the current trigger, so that it will not be set for any subsequently
set (non default) triggers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Tested-by: Yauhen Kharuzhy <jekhor@gmail.com>
Link: https://lore.kernel.org/r/20230510162234.291439-5-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:33 +01:00
Hans de Goede 22720a87d0 leds: Fix oops about sleeping in led_trigger_blink()
led_trigger_blink() calls led_blink_set() from a RCU read-side critical
section so led_blink_set() must not sleep. Note sleeping was not allowed
before the switch to RCU either because a spinlock was held before.

led_blink_set() does not sleep when sw-blinking is used, but
many LED controller drivers with hw blink support have a blink_set
function which may sleep, leading to an oops like this one:

[  832.605062] ------------[ cut here ]------------
[  832.605085] Voluntary context switch within RCU read-side critical section!
[  832.605119] WARNING: CPU: 2 PID: 370 at kernel/rcu/tree_plugin.h:318 rcu_note_context_switch+0x4ee/0x690
<snip>
[  832.606453] Call Trace:
[  832.606466]  <TASK>
[  832.606487]  __schedule+0x9f/0x1480
[  832.606527]  schedule+0x5d/0xe0
[  832.606549]  schedule_timeout+0x79/0x140
[  832.606572]  ? __pfx_process_timeout+0x10/0x10
[  832.606599]  wait_for_completion_timeout+0x6f/0x140
[  832.606627]  i2c_dw_xfer+0x101/0x460
[  832.606659]  ? psi_group_change+0x168/0x400
[  832.606680]  __i2c_transfer+0x172/0x6d0
[  832.606709]  i2c_smbus_xfer_emulated+0x27d/0x9c0
[  832.606732]  ? __schedule+0x430/0x1480
[  832.606753]  ? preempt_count_add+0x6a/0xa0
[  832.606778]  ? get_nohz_timer_target+0x18/0x190
[  832.606796]  ? lock_timer_base+0x61/0x80
[  832.606817]  ? preempt_count_add+0x6a/0xa0
[  832.606842]  __i2c_smbus_xfer+0xa2/0x3f0
[  832.606862]  i2c_smbus_xfer+0x66/0xf0
[  832.606882]  i2c_smbus_read_byte_data+0x41/0x70
[  832.606901]  ? _raw_spin_unlock_irqrestore+0x23/0x40
[  832.606922]  ? __pm_runtime_suspend+0x46/0xc0
[  832.606946]  cht_wc_byte_reg_read+0x2e/0x60
[  832.606972]  _regmap_read+0x5c/0x120
[  832.606997]  _regmap_update_bits+0x96/0xc0
[  832.607023]  regmap_update_bits_base+0x5b/0x90
[  832.607053]  cht_wc_leds_brightness_get+0x412/0x910 [leds_cht_wcove]
[  832.607094]  led_blink_setup+0x28/0x100
[  832.607119]  led_trigger_blink+0x40/0x70
[  832.607145]  power_supply_update_leds+0x1b7/0x1c0
[  832.607174]  power_supply_changed_work+0x67/0xe0
[  832.607198]  process_one_work+0x1c8/0x3c0
[  832.607222]  worker_thread+0x4d/0x380
[  832.607243]  ? __pfx_worker_thread+0x10/0x10
[  832.607258]  kthread+0xe9/0x110
[  832.607279]  ? __pfx_kthread+0x10/0x10
[  832.607300]  ret_from_fork+0x2c/0x50
[  832.607337]  </TASK>
[  832.607344] ---[ end trace 0000000000000000 ]---

Add a new led_blink_set_nosleep() function which defers the actual
led_blink_set() call to a workqueue when necessary to fix this.

This also fixes an existing race where a pending led_set_brightness() has
been deferred to set_brightness_work and might then race with a later
led_cdev->blink_set() call. Note this race is only an issue with triggers
mixing led_trigger_event() and led_trigger_blink() calls, sysfs API
calls and led_trigger_blink_oneshot() are not affected.

Note rather then adding a separate blink_set_blocking callback this uses
the presence of the already existing brightness_set_blocking callback to
detect if the blinking call should be deferred to set_brightness_work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Tested-by: Yauhen Kharuzhy <jekhor@gmail.com>
Link: https://lore.kernel.org/r/20230510162234.291439-4-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:31 +01:00
Hans de Goede fa15d8c692 leds: Fix set_brightness_delayed() race
When a trigger wants to switch from blinking to LED on it needs to call:
	led_set_brightness(LED_OFF);
	led_set_brightness(LED_FULL);

To first call disables blinking and the second then turns the LED on
(the power-supply charging-blink-full-solid triggers do this).

These calls happen immediately after each other, so it is possible
that set_brightness_delayed() from the first call has not run yet
when the led_set_brightness(LED_FULL) call finishes.

If this race hits then this is causing problems for both
sw- and hw-blinking:

For sw-blinking set_brightness_delayed() clears delayed_set_value
when LED_BLINK_DISABLE is set causing the led_set_brightness(LED_FULL)
call effects to get lost when hitting the race, resulting in the LED
turning off instead of on.

For hw-blinking if the race hits delayed_set_value has been
set to LED_FULL by the time set_brightness_delayed() runs.
So led_cdev->brightness_set_blocking() is never called with
LED_OFF as argument and the hw-blinking is never disabled leaving
the LED blinking instead of on.

Fix both issues by adding LED_SET_BRIGHTNESS and LED_SET_BRIGHTNESS_OFF
work_flags making this 2 separate actions to be run by
set_brightness_delayed().

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Tested-by: Yauhen Kharuzhy <jekhor@gmail.com>
Link: https://lore.kernel.org/r/20230510162234.291439-3-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:30 +01:00
Hans de Goede e298d8a38b leds: Change led_trigger_blink[_oneshot]() delay parameters to pass-by-value
led_blink_set[_oneshot]()'s delay_on and delay_off function parameters
are pass by reference, so that hw-blink implementations can report
back the actual achieved delays when the values have been rounded
to something the hw supports.

This is really only interesting for the sysfs API / the timer trigger.
Other triggers don't really care about this and none of the callers of
led_trigger_blink[_oneshot]() do anything with the returned delay values.

Change the led_trigger_blink[_oneshot]() delay parameters to pass-by-value,
there are 2 reasons for this:

1. led_cdev->blink_set() may sleep, while led_trigger_blink() may not.
So on hw where led_cdev->blink_set() sleeps the call needs to be deferred
to a workqueue, in which case the actual achieved delays are unknown
(this is a preparation patch for the deferring).

2. Since the callers don't care about the actual achieved delays, allowing
callers to directly pass a value leads to simpler code for most callers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Tested-by: Yauhen Kharuzhy <jekhor@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Acked-by: Florian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/20230510162234.291439-2-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:27 +01:00
Uwe Kleine-König d9ff8a8eec leds: Switch i2c drivers back to use .probe()
After commit b8a1a4cd5a ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498 ("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>
Link: https://lore.kernel.org/r/20230517180559.166329-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:22 +01:00
Geert Uytterhoeven b0f379bd6e leds: Make LEDS_TI_LMU_COMMON invisible
Currently, LEDS_LM3697 and LEDS_LM36274 depend on LEDS_TI_LMU_COMMON,
which contains the common code to support TI LMU devices.  This means
the user is asked about the common code first, followed by the
individual drivers, if their dependencies are met.

Simplify this, and reduce the number of questions by making
LEDS_TI_LMU_COMMON invisible, and letting it be selected when needed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Pavel Machek <pavel@ucw.cz>
Link: https://lore.kernel.org/r/91f6efaa48c36320e58b6a312025ae9b39ee206b.1683644796.git.geert+renesas@glider.be
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:21 +01:00
Dylan Van Assche 91fe1bda46 leds: flash: leds-qcom-flash: Disable LED when changing brightness
The Qualcomm PMI8998 PMIC requires the LED to be disabled when configuring
the brightness. Always disable the LED when setting the brightness and
re-enable it afterwards.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
Link: https://lore.kernel.org/r/20230507172941.364852-3-me@dylanvanassche.be
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:20 +01:00
Dylan Van Assche 0ae8dc1a1a leds: flash: leds-qcom-flash: Add PMI8998 support
Add subtype for the Qualcomm PMI8998 PMIC to support it besides the
PM8150 PMIC which has the same registers. Adjust the driver to recognize
both PMIC subtypes as a 3 channel LED driver.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
Link: https://lore.kernel.org/r/20230507172941.364852-2-me@dylanvanassche.be
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:19 +01:00
Hans de Goede ea0c0a8536 leds: cht-wcove: Use breathing when LED_INIT_DEFAULT_TRIGGER is set
The desired default behavior of LED1 / the charge LED is breathing
while charging and on/solid when full. Since triggers cannot select
breathing, blink_set() gets called when charging. Use breathing
when the default "charging-blink-full-solid" trigger is used to
achieve the desired default behavior.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-6-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:18 +01:00
Hans de Goede ca3167f238 leds: cht-wcove: Set default trigger for charging LED
Set a default trigger for the charging LED based on the machine-model
as set by the PMIC MFD driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-5-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:17 +01:00
Hans de Goede 5b916aa755 leds: cht-wcove: Add support for breathing mode use hw_pattern sysfs API
The hw-blinking of the LED controller in the Whiskey Cove PMIC can also
be used for a hw-breathing effect.

As discussed during review of v2 of the submission of the new
leds-cht-wcove driver, the LED subsystem already supports breathing mode
on several other LED controllers using the hw_pattern interface.

Implement a pattern_set callback to implement breathing mode modelled
after the breathing mode supported by the SC27xx breathing light and
Crane EL15203000 LED drivers. The Whiskey Cove PMIC's breathing mode
is closer to the EL15203000 one then to the SC27xx one since it does
not support staying high / low for a specific time, it only supports
rise and fall times.

As such the supported hw_pattern and the documentation for this is almost
a 1:1 copy of the pattern/docs for the EL15203000 breathing mode.

Suggested-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Link: https://lore.kernel.org/all/6beed61c-1fc6-6525-e873-a8978f5fbffb@gmail.com/
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-4-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:15 +01:00
Hans de Goede 9697e2f01f leds: cht-wcove: Add suspend/resume handling
When LED1 is showing the tablet is charging and then the device gets
suspended followed by unplugging the charger, then it will incorrectly
still show it is charging.

To avoid this turn both LEDs off on suspend, just like the PMIC always
turns them off when the tablet is powered off (even if the tablet is
charging). If hw-control is supported for LED1, then restore the
initial hw-control settings to let the hw control LED1 while suspended.

To restore the state the LEDs had before suspending, save it before
turning the LEDs off and restore it on resume.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-3-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:14 +01:00
Yauhen Kharuzhy 047da762b9 leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver
Add support for LEDs connected to the Intel Cherry Trail Whiskey Cove
PMIC. Charger and general-purpose LEDs are supported. Hardware blinking
is implemented, breathing is not.

This driver was tested with Lenovo Yoga Book notebook.

Changes by Hans de Goede (in response to review of v2):
- Since the PMIC is connected to the battery any changes we make to
  the LED settings are permanent, even surviving reboot / poweroff.
  Save LED1 register settings on probe() and if auto-/hw-control was
  enabled on probe() restore the settings on remove() and shutdown().
- Delay switching LED1 to software control mode to first brightness write.
- Use dynamically allocated drvdata instead of a global drvdata variable.
- Ensure the LED is on when activating blinking.
- Fix CHT_WC_LED_EFF_BREATHING val ((3 << 1) rather then BIT(3)).

Link: https://lore.kernel.org/r/20190212205901.13037-2-jekhor@gmail.com
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-2-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
2023-05-25 12:16:11 +01:00
Luca Weiss d11a79dd04 leds: qcom-lpg: Add support for PMI632 LPG
The PMI632 PMIC contains 5 PWM channels, 3 of which can be used for
LEDs.

For the LED pattern it doesn't have LUT like other PMICs but uses SDAM
instead. This is not currently implemented in the driver but since LPG
works fine without it, add support for the PMIC now.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230414-pmi632-v2-4-98bafa909c36@z3ntu.xyz
2023-05-25 12:16:07 +01:00
Maarten Zanders 54a7bef5aa leds: lp55xx: Configure internal charge pump
The LP55xx range of devices have an internal charge pump which
can (automatically) increase the output voltage towards the
LED's, boosting the output voltage to 4.5V.

Implement this option from the devicetree. When the setting
is not present it will operate in automatic mode as before.

Tested on LP55231. Datasheet analysis shows that LP5521, LP5523
and LP8501 are identical in topology and are modified in the
same way.

Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230421075305.37597-3-maarten.zanders@mind.be
2023-05-25 12:16:05 +01:00
Christian Marangi d1b9e1391a leds: trigger: netdev: Use mutex instead of spinlocks
Some LEDs may require to sleep while doing some operation like setting
brightness and other cleanup.

For this reason, using a spinlock will cause a sleep under spinlock
warning.

It should be safe to convert this to a sleepable lock since:
- sysfs read/write can sleep
- netdev_trig_work is a work queue and can sleep
- netdev _trig_notify can sleep

The spinlock was used when brightness didn't support sleeping, but this
changed and now it supported with brightness_set_blocking().

Convert to mutex lock to permit sleeping using brightness_set_blocking().

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-6-ansuelsmth@gmail.com
2023-05-25 12:07:38 +01:00
Christian Marangi 164b67d534 leds: trigger: netdev: Convert device attr to macro
Convert link tx and rx device attr to a common macro to reduce common
code and in preparation for additional attr.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-5-ansuelsmth@gmail.com
2023-05-25 12:07:37 +01:00
Christian Marangi bdec9cb839 leds: trigger: netdev: Rename add namespace to netdev trigger enum modes
Rename NETDEV trigger enum modes to a more symbolic name and add a
namespace to them.

Also add __TRIGGER_NETDEV_MAX to identify the max modes of the netdev
trigger.

This is a cleanup to drop the define and no behaviour change are
intended.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-4-ansuelsmth@gmail.com
2023-05-25 12:07:36 +01:00
Christian Marangi e2f24cb1b5 leds: trigger: netdev: Drop NETDEV_LED_MODE_LINKUP from mode
Putting NETDEV_LED_MODE_LINKUP in the same list of the netdev trigger
modes is wrong as it's used to set the link state of the device and not
to set a blink mode as it's done by NETDEV_LED_LINK, NETDEV_LED_TX and
NETDEV_LED_RX. It's also wrong to put this state in the same bitmap of the
netdev trigger mode and should be external to it.

Drop NETDEV_LED_MODE_LINKUP from mode list and convert to a simple bool
that will be true or false based on the carrier link. No functional
change intended.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-3-ansuelsmth@gmail.com
2023-05-25 12:07:35 +01:00
Christian Marangi cee4bd16c3 leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename
Dev can be renamed also while up for supported device. We currently
wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
event.

Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
correctly set the NETDEV_LED_MODE_LINKUP bit.

Fixes: 5f820ed523 ("leds: trigger: netdev: fix handling on interface rename")
Cc: stable@vger.kernel.org # v5.5+
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-2-ansuelsmth@gmail.com
2023-05-25 12:07:34 +01:00
Linus Torvalds c5eb8bf767 - New Drivers
- Add support for MediaTek MT6370 LED Indicator
    - Add support for MediaTek MT6370 Flashlight
    - Add support for QCOM PMIC Flash
    - Add support for Rohm BD2606MVV Charge Pump LED
 
  - New Device Support
    - Add support for PMK8550 PWM to QCOM LPG
 
  - New Functionality
    - Add support for high resolution PWM to QCOM LPG
 
  - Fix-ups
    - Kconfig 'depends' and 'select' dependency changes
    - Remove unused / irrelevant includes
    - Remove unnecessary checks (already performed further into the call stack)
    - Trivial: Fix commentary, simplify error messages
    - Rid 'defined but not used' warnings
    - Provide documentation
    - Explicitly provide include files
 
  - Bug Fixes
    - Mark GPIO LED as BROKEN
    - Fix Kconfig entries
    - Fix various Smatch staticify reports
    - Fix error handling (or a lack there of)
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmRRONwACgkQUa+KL4f8
 d2Er8w/+Iu6LK+NvxSvELKzyuUw8gsJxCmAYSTFc2ywjFKPJK91giAXYBhvFFhlv
 mduJkO+Mbz3yFdXTmG3OjTs/K9J/XIjOl0mB4FTWLsthyytJwUbZIdr9La60/LF/
 0ExWCI3lRPEFLC1kbODmgpDrBmlegqH5vzvGStmy3r4HbDvBVXl1No5ArWYXMof1
 e4W7p0tCQNOKaSDLpbQNcFzZ5682h/CY/+R6UQzTiI+6/3g+3IqHa4qqtcXGI0Tk
 7UtPuGd5f7Gm+1iQO+gxXAlOPictOI5SfHIVWJqtfAEY4RetBulyxkOaG+dw/LN3
 pp77yF6b4DU7P89jb/cKL1lD5y3SCYJpNwZrkkytGDqeS4C2J218RTPGzvrJLAtj
 tNa65SC7fM6Qh/Mv8b5A7wMrysAF2JAusP8UEBamVNlyt2jTY/MwO3EgTNVFuNGo
 um88Cia1BIQMSej0GpRFbOqflbrGEVqJjh/ag7ftGp9jnO4gmCSB5LuNN6QGhtQ8
 0T2agMZ9udd2nNKlgbfxvAM+rqGq0/KSgX6nt7XRDDfw5rOI5YZORUFNmo4IKVyx
 bfzPW8QOpL6fbtfbFktJDgndV4bKJ1zRLUgk9PhfL23tiSo3HuC+0NdFqG0UCaEy
 RnNm8k4Q5SD+OfnzstMF9Zq0cXWCjFm7QVVElRBSFs/fzP5iHfE=
 =aJQw
 -----END PGP SIGNATURE-----

Merge tag 'leds-next-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds

Pull LED updates from Lee Jones:
 "New Drivers:
   - Add support for MediaTek MT6370 LED Indicator
   - Add support for MediaTek MT6370 Flashlight
   - Add support for QCOM PMIC Flash
   - Add support for Rohm BD2606MVV Charge Pump LED

  New Device Support:
   - Add support for PMK8550 PWM to QCOM LPG

  New Functionality:
   - Add support for high resolution PWM to QCOM LPG

  Fix-ups:
   - Kconfig 'depends' and 'select' dependency changes
   - Remove unused / irrelevant includes
   - Remove unnecessary checks (already performed further into the call stack)
   - Trivial: Fix commentary, simplify error messages
   - Rid 'defined but not used' warnings
   - Provide documentation
   - Explicitly provide include files

  Bug Fixes:
   - Mark GPIO LED as BROKEN
   - Fix Kconfig entries
   - Fix various Smatch staticify reports
   - Fix error handling (or a lack there of)"

* tag 'leds-next-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds: (30 commits)
  leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
  dt-bindings: leds: Add ROHM BD2606MVV LED
  docs: leds: ledtrig-oneshot: Fix spelling mistake
  leds: pwm-multicolor: Simplify an error message
  dt-bindings: leds: Convert PCA9532 to dtschema
  leds: rgb: leds-qcom-lpg: Add support for PMK8550 PWM
  leds: rgb: leds-qcom-lpg: Add support for high resolution PWM
  dt-bindings: leds-qcom-lpg: Add qcom,pmk8550-pwm compatible string
  leds: tca6507: Fix error handling of using fwnode_property_read_string
  leds: flash: Set variables mvflash_{3,4}ch_regs storage-class-specifier to static
  leds: rgb: mt6370: Correct config name to select in LEDS_MT6370_RGB
  MAINTAINERS: Add entry for LED devices documentation
  Documentation: leds: MT6370: Use bullet lists for timing variables
  Documentation: leds: mt6370: Properly wrap hw_pattern chart
  Documentation: leds: Add MT6370 doc to the toctree
  leds: rgb: mt6370: Fix implicit declaration for FIELD_GET
  docs: leds: Add MT6370 RGB LED pattern document
  leds: flash: mt6370: Add MediaTek MT6370 flashlight support
  leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support
  dt-bindings: leds: spmi-flash-led: Add pm6150l compatible
  ...
2023-05-02 10:36:02 -07:00
Andreas Kemnade 8325642d27 leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
The device provides 6 channels which can be individually
turned off and on but groups of two channels share a common brightness
register.

Limitation: The GPIO to enable the device is not used yet.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419111806.1100437-3-andreas@kemnade.info
2023-04-27 17:42:33 +01:00
Christophe JAILLET f3ef9d668b leds: pwm-multicolor: Simplify an error message
dev_err_probe() already display the error code. There is no need to
duplicate it explicitly in the error message.

While at it, add a missing \n at the end of the message.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/07d35e221faaa380fd11cd4597e42354c8eb350c.1681576017.git.christophe.jaillet@wanadoo.fr
2023-04-20 12:32:14 +01:00
Anjelique Melendez 7fec651554 leds: rgb: leds-qcom-lpg: Add support for PMK8550 PWM
Add support for pmk8550 compatible and lpg_data.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230407223849.17623-4-quic_amelende@quicinc.com
2023-04-20 11:10:33 +01:00
Anjelique Melendez b00d2ed376 leds: rgb: leds-qcom-lpg: Add support for high resolution PWM
Certain PMICs like PMK8550 have a high resolution PWM module which can
support from 8-bit to 15-bit PWM. Add support for it.

Signed-off-by: Anjelique Melendez <quic_amelende@quicinc.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230407223849.17623-3-quic_amelende@quicinc.com
2023-04-20 11:09:34 +01:00
H. Nikolaus Schaller c1087c29e9 leds: tca6507: Fix error handling of using fwnode_property_read_string
Commit 96f524105b ("leds: tca6507: use fwnode API instead of OF")

changed to fwnode API but did not take into account that a missing property
"linux,default-trigger" now seems to return an error and as a side effect
sets value to -1. This seems to be different from of_get_property() which
always returned NULL in any case of error.

Neglecting this side-effect leads to

[   11.201965] Unable to handle kernel paging request at virtual address ffffffff when read

in the strcmp() of led_trigger_set_default() if there is no led-trigger
defined in the DTS.

I don't know if this was recently introduced somewhere in the fwnode lib
or if the effect was missed in initial testing. Anyways it seems to be a
bug to ignore the error return value of an optional value here in the
driver.

Fixes: 96f524105b ("leds: tca6507: use fwnode API instead of OF")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/cbae7617db83113de726fcc423a805ebaa1bfca6.1680433978.git.hns@goldelico.com
2023-04-05 16:28:42 +01:00
Tom Rix 22dc3789b7 leds: flash: Set variables mvflash_{3,4}ch_regs storage-class-specifier to static
Smatch reports:

  drivers/leds/flash/leds-qcom-flash.c:103:18: warning:
    symbol 'mvflash_3ch_regs' was not declared. Should it be static?
  drivers/leds/flash/leds-qcom-flash.c:115:18: warning:
    symbol 'mvflash_4ch_regs' was not declared. Should it be static?

These variables are only used locally, so it should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230317191341.1670660-1-trix@redhat.com
2023-03-30 13:58:24 +01:00
Lukas Bulwahn 560f2eb7d6 leds: rgb: mt6370: Correct config name to select in LEDS_MT6370_RGB
Commit 55a8a5c16eb3 ("leds: rgb: mt6370: Add MediaTek MT6370 current sink
type LED Indicator support") introduces the config LEDS_MT6370_RGB, which
selects the non-existing config LINEAR_RANGE. As the driver includes
linux/linear_range.h, it is a safe guess that the config actually intends
to select LINEAR_RANGES, which provides the library implementation for the
function prototypes defined in the linear_range header file.

Correct this naming confusion in the LEDS_MT6370_RGB config definition.

Fixes: 55a8a5c16eb3 ("leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support")
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230323105410.10396-1-lukas.bulwahn@gmail.com
2023-03-30 13:42:56 +01:00
ChiYuan Huang 4793b19ef0 leds: rgb: mt6370: Fix implicit declaration for FIELD_GET
0-DAY CI Kernel Test Service reported the implicit declaration error below:

drivers/leds/rgb/leds-mt6370-rgb.c: In function'mt6370_check_vendor_info':
>> drivers/leds/rgb/leds-mt6370-rgb.c:889:15: error: implicit  declaration
   of function 'FIELD_GET' [-Werror=implicit-function-declaration]
  889 |         vid = FIELD_GET(MT6370_VENDOR_ID_MASK, devinfo);
      |

Add the missing header 'bitfield.h' to fix it.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202303171729.CcgyFx17-lkp@intel.com/
Fixes: 55a8a5c16eb3 ("leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support")
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/1679067760-19098-1-git-send-email-cy_huang@richtek.com
2023-03-23 14:54:14 +00:00
ChiYuan Huang fa31e4221c leds: flash: mt6370: Add MediaTek MT6370 flashlight support
The MediaTek MT6370 is a highly-integrated smart power management IC,
which includes a single cell Li-Ion/Li-Polymer switching battery
charger, a USB Type-C & Power Delivery (PD) controller, dual Flash
LED current sources, a RGB LED driver, a backlight WLED driver,
a display bias driver and a general LDO for portable devices.

Add support for the MT6370 Flash LED driver. Flash LED in MT6370
has 2 channels and support torch/strobe mode.

Co-developed-by: Alice Chen <alice_chen@richtek.com>
Signed-off-by: Alice Chen <alice_chen@richtek.com>
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/52480420a160e5a4c71715fbbf105e684a16e7c2.1678430444.git.chiaen_wu@richtek.com
2023-03-23 14:54:08 +00:00
ChiYuan Huang 5c38376ef5 leds: rgb: mt6370: Add MediaTek MT6370 current sink type LED Indicator support
The MediaTek MT6370 is a highly-integrated smart power management IC,
which includes a single cell Li-Ion/Li-Polymer switching battery
charger, a USB Type-C & Power Delivery (PD) controller, dual
Flash LED current sources, a RGB LED driver, a backlight WLED driver,
a display bias driver and a general LDO for portable devices.

Add support for the MediaTek MT6370 Current Sink Type LED Indicator
driver. It can control four channels current-sink RGB LEDs with 3 modes:
constant current, PWM, and breath mode.

Co-developed-by: Alice Chen <alice_chen@richtek.com>
Signed-off-by: Alice Chen <alice_chen@richtek.com>
Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Signed-off-by: ChiaEn Wu <chiaen_wu@richtek.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/1df93a583c3f508a7158b83b95857e9bce235e1b.1678430444.git.chiaen_wu@richtek.com
2023-03-23 14:54:02 +00:00
Greg Kroah-Hartman 1aaba11da9 driver core: class: remove module * from class_create()
The module pointer in class_create() never actually did anything, and it
shouldn't have been requred to be set as a parameter even if it did
something.  So just remove it and fix up all callers of the function in
the kernel tree at the same time.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link: https://lore.kernel.org/r/20230313181843.1207845-4-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-17 15:16:33 +01:00
Fenglin Wu 96a2e242a5 leds: flash: Add driver to support flash LED module in QCOM PMICs
Add initial driver to support flash LED module found in Qualcomm
Technologies, Inc. PMICs. The flash module can have 3 or 4 channels
and each channel can be controlled indepedently and support full scale
current up to 1.5 A. It also supports connecting two channels together
to supply one LED component with full scale current up to 2 A. In that
case, the current will be split on each channel symmetrically and the
channels will be enabled and disabled at the same time.

Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sm7225-fairphone-fp4 + pm6150l
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230303095023.538917-2-quic_fenglinw@quicinc.com
2023-03-16 15:08:45 +00:00
Linus Walleij 8f0adae1cb leds: Mark GPIO LED trigger broken
The GPIO LED trigger exposes a userspace ABI where a user
can echo a GPIO number from the global GPIO numberspace into
a file that will trigger a certain LED when active.

This is problematic because the global GPIO numberspace is
inherently instable. The trigger came about at a time when
systems had one GPIO controller that defined hard-wired
GPIOs numbered 0..N and this number space was stable.

We have since moved to dynamic allocation of GPIO numbers
and there is no real guarantee that a GPIO number will stay
consistent even across a reboot: consider a USB attached
GPIO controller for example. Or two. Or the effect of
probe order after adding -EPROBE_DEFER to the kernel.

The trigger was added to support keypad LEDs on the Nokia
n810 from the GPIO event when a user slides up/down the
keypad. This is arch/arm/boot/dts/omap2420-n810.dts.
A userspace script is needed to activate the trigger.
This will be broken unless the script was updated recently
since the OMAP GPIO controller now uses dynamic GPIO
number allocations.

I want to know that this trigger has active users that
cannot live without it if we are to continue to support it.

Option if this is really needed: I can develop a new trigger
that can associate GPIOs with LEDs as triggers using device
tree, which should also remove the use of userspace custom
scripts to achieve this and be much more trustworthy, if
someone with the Nokia n810 or a device with a similar need
is willing to test it.

Suggested-by Pavel Machek <pavel@ucw.cz>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230314210059.419159-1-linus.walleij@linaro.org
2023-03-16 15:08:44 +00:00
Krzysztof Kozlowski e0248a258c leds: tlc591xx: Mark OF related data as maybe unused
The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/leds/leds-tlc591xx.c:138:34: error: ‘of_tlc591xx_leds_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230311111717.252019-1-krzysztof.kozlowski@linaro.org
2023-03-16 15:08:43 +00:00
Andy Shevchenko 6d19367b9e leds: lp8860: Remove duplicate NULL checks for gpio_desc
gpiod_*() API check already for the NULL, no need
to repeat that in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230215170403.84449-2-andriy.shevchenko@linux.intel.com
2023-03-16 15:08:40 +00:00
Andy Shevchenko 2956ad80fc leds: lp8860: 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: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230215170403.84449-1-andriy.shevchenko@linux.intel.com
2023-03-16 15:08:39 +00:00