summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-sun50i-a100.c
AgeCommit message (Collapse)AuthorFilesLines
2024-10-15leds: Switch back to struct platform_driver::remove()Uwe Kleine-König1-1/+1
After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers. Convert all platform drivers below drivers/leds/ to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer. While touching these files, make indention of the struct initializer consistent in several files. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://lore.kernel.org/r/20241010203622.839625-5-u.kleine-koenig@baylibre.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-10-09leds: sun50i-a100: Switch to device_for_each_child_node_scoped()Javier Carrasco1-18/+9
Switch to device_for_each_child_node_scoped() to simplify the code by removing the need for calls to fwnode_handle_put() in the error paths. This also prevents possible memory leaks if new error paths are added without the required call to fwnode_handle_put(). The error handling after 'err_put_child' has been moved to the only goto that jumps to it (second device_for_each_child_node()), and the call to fwnode_handle_put() has been removed accordingly. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Link: https://lore.kernel.org/r/20240927-leds_device_for_each_child_node_scoped-v1-15-95c0614b38c8@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-08-22leds: sun50i-a100: Replace msleep() with usleep_range()Abhishek Tamboli1-1/+1
Replace msleep() with usleep_range() in sun50i_a100_ledc_suspend() to address the checkpatch.pl warning. msleep() for such short delay can lead to inaccurate sleep times. Switch to usleep_range() provide more precise delay. Fix the following warning from checkpatch.pl: WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst + msleep(1); Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20240816171129.6411-1-abhishektamboli9@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-02leds: sun50i-a100: Use match_string() helper to simplify the codeAndy Shevchenko1-8/+6
match_string() returns the array index of a matching string. Use it instead of the open-coded implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20240426152515.872917-1-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-21leds: sun50i-a100: Convert to be agnostic to property providerAndy Shevchenko1-23/+23
Convert the driver to be agnostic to the property provider. LEDS subsytem is not dependent on OF, so no need to make drivers be a such. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20231214192131.1309912-1-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-13leds: sun50i-a100: Avoid division-by-zero warningArnd Bergmann1-1/+5
When CONFIG_COMMON_CLK is disabled, e.g. on an x86 randconfig compile test, clang reports a field overflow from propagating the result of a division by zero: drivers/leds/leds-sun50i-a100.c:309:12: error: call to '__compiletime_assert_265' declared with 'error' attribute: FIELD_PREP: value too large for the field control = FIELD_PREP(LEDC_T01_TIMING_CTRL_REG_T1H, timing->t1h_ns / cycle_ns) | Avoid the problem by adding an explicit check for the zero value here. Alternatively the assertion could be avoided with a Kconfig dependency on COMMON_CLK. Fixes: 090a25ad9798 ("leds: sun50i-a100: New driver for the A100 LED controller") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Guo Ren <guoren@kernel.org> Link: https://lore.kernel.org/r/20231212214536.175327-1-arnd@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2023-12-13leds: sun50i-a100: New driver for the A100 LED controllerSamuel Holland1-0/+580
Some Allwinner sunxi SoCs, starting with the A100, contain an LED controller designed to drive RGB LED pixels. Add a driver for it using the multicolor LED framework, and with LEDs defined in the device tree. Acked-by: Guo Ren <guoren@kernel.org> Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com> Acked-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Link: https://lore.kernel.org/r/20231029212738.7871-3-samuel@sholland.org Signed-off-by: Lee Jones <lee@kernel.org>