summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-is31fl319x.c
AgeCommit message (Collapse)Author
2023-05-25leds: Switch i2c drivers back to use .probe()Uwe Kleine-König
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> Link: https://lore.kernel.org/r/20230517180559.166329-1-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org>
2023-01-30leds: is31fl319x: Wrap mutex_destroy() for devm_add_action_or_rest()Andy Shevchenko
Clang complains that devm_add_action() takes a parameter with a wrong type: warning: cast from 'void (*)(struct mutex *)' to 'void (*)(void *)' converts to incompatible function type [-Wcast-function-type-strict] err = devm_add_action(dev, (void (*)(void *))mutex_destroy, &is31->lock); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. It appears that the commit e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering") missed two things: - whilst the commit mentions devm_add_action_or_reset() the actual change utilised devm_add_action() call by mistake - strictly speaking the parameter is not compatible by type Fix both issues by switching to devm_add_action_or_reset() and adding a wrapper for mutex_destroy() call. Reported-by: kernel test robot <lkp@intel.com> Fixes: e1af5c815586 ("leds: is31fl319x: Fix devm vs. non-devm ordering") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20221228093238.82713-1-andriy.shevchenko@linux.intel.com
2022-12-07leds: is31fl319x: Fix setting current limit for is31fl319{0,1,3}Luca Weiss
The current setting lives in bits 4:2 (as also defined by the mask) but the current limit defines in the driver use bits 2:0 which should be shifted over so they don't get masked out completely (except for 17.5mA which became 10mA). Now checking /sys/kernel/debug/regmap/1-0068/registers shows that the current limit is applied correctly and doesn't take the default b000 = 42mA. Fixes: fa877cf1abb9 ("leds: is31fl319x: Add support for is31fl319{0,1,3} chips") Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: use simple i2c probe functionAndy Shevchenko
The i2c probe functions here don't use the id information provided in their second argument, so the single-parameter i2c probe function ("probe_new") can be used instead. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Fix devm vs. non-devm orderingAndy Shevchenko
When non-devm resources are allocated they mustn't be followed by devm allocations, otherwise it will break the tear down ordering and might lead to crashes or other bugs during ->remove() stage. Fix this by wrapping mutex_destroy() call with devm_add_action_or_reset(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Make use of dev_err_probe()Andy Shevchenko
Simplify the error handling in probe function by switching from dev_err() to dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Make use of device propertiesAndy Shevchenko
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Add mod_devicetable.h include. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Cleanup formatting and dev_dbg callsVincent Knecht
Fix remaining non-standard place for comments. Remove remaining dev_dbg after regmap_read in is31fl3196_brightness_set. Remove __func__ in dev_dbg calls, instead adding "channel" string to describe the first displayed value. Change remaining container_of() call to be on one line, as well as a few others. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Add support for is31fl319{0,1,3} chipsVincent Knecht
Set specific chipset structs values for is31fl319{0,1,3} so that those chips can actually work. Datasheets: https://lumissil.com/assets/pdf/core/IS31FL3190_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3191_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3193_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3196_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3199_DS.pdf Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Move chipset-specific values in chipdef structVincent Knecht
Allow setting chips' specifics in chipdef struct by adding fields for: - the reset register address - a pointer to a regmap_config struct - a pointer to a brightness_set function - current default, min and max values - a boolean to distinguish 319{0,1,3} and 319{6,9} chips and use those fields in places where distinction has to be made. The fields for 319{0,1,3} still point to 319{6,9} values. No functional change. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Use non-wildcard names for vars, structs and definesVincent Knecht
In order to add real support for is31fl3190, is31fl3191 and is31fl3193, rename variant-dependent elements to not use 319X where needed. 3190 suffix is used for is31fl3190, is31fl3191 and is31fl3193 circuits. 3196 suffix is used for is31fl3196 and is31fl3199. Those two groups have different register maps, current settings and even a different interpretation of the software shutdown bit: https://lumissil.com/assets/pdf/core/IS31FL3190_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3191_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3193_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3196_DS.pdf https://lumissil.com/assets/pdf/core/IS31FL3199_DS.pdf Rename variables, structures and defines in preparation of the splitting. No functional nor behaviour change. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2022-08-02leds: is31fl319x: Add missing si-en compatiblesVincent Knecht
Add si-en compatibles for all chip variants. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: use only available OF childrenMarek Behún
Various drivers count and iterate over OF children nodes via of_get_child_count and for_each_child_of_node. Instead they should use of_get_available_child_count and for_each_available_child_of_node, so that if a given node has the `status` property set to `disabled`, the child will be ignored. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Andrey Utkin <andrey_utkin@fastmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Dan Murphy <dmurphy@ti.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Haojian Zhuang <haojian.zhuang@marvell.com> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Milo Kim <milo.kim@ti.com> Cc: NeilBrown <neilb@suse.de> Cc: Nikita Travkin <nikitos.tr@gmail.com> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Philippe Retornaz <philippe.retornaz@epfl.ch> Cc: Riku Voipio <riku.voipio@iki.fi> Cc: Simon Guinot <sguinot@lacie.com> Cc: Simon Shields <simon@lineageos.org> Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Cc: Xiaotong Lu <xiaotong.lu@spreadtrum.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: use dev_of_node(dev) instead of dev->of_nodeMarek Behún
The dev_of_node function should be preferred. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: Orson Zhai <orsonzhai@gmail.com> Cc: Baolin Wang <baolin.wang7@gmail.com> Cc: Chunyan Zhang <zhang.lyra@gmail.com> Cc: Sean Wang <sean.wang@mediatek.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-26leds: various: use device_get_match_dataMarek Behún
Simply use device_get_match_data instead of matching against the match table again. Signed-off-by: Marek Behún <marek.behun@nic.cz> Cc: H. Nikolaus Schaller <hns@goldelico.com> Cc: David Rivshin <drivshin@allworx.com> Cc: Sebastian Reichel <sre@kernel.org> Cc: Christian Mauderer <oss@c-mauderer.de> Cc: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2020-09-09leds: is31fl319x: Add shutdown pin and generate a 5ms low pulse when startupGrant Feng
generate a 5ms low pulse on shutdown pin when startup, then the chip becomes more stable in the complex EM environment. Signed-off-by: Grant Feng <von81@163.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
2019-07-23leds: is31fl319x: simplify getting the adapter of a clientWolfram Sang
We have a dedicated pointer for that, so use it. Much easier to read and less computation involved. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330Thomas Gleixner
Based on 1 normalized pattern(s): this file is subject to the terms and conditions of version 2 of the gnu general public license see the file copying in the main directory of this archive 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 55 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.108941081@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15leds: is31fl319x: 1/3/6/9-channel light effect led driverH. Nikolaus Schaller
This is a driver for the Integrated Silicon Solution Inc. LED driver chips series IS31FL319x. They can drive 1, 3, 6 or up to 9 LEDs. Each LED is individually controllable in brightness (through pwm) in 256 steps so that RGB LEDs can show any of ca. 16 Mio colors. The maximum current of the LEDs can be programmed and limited to 5 .. 40mA through a device tree property. The chip is connected through I2C and can have one of 4 addresses in the range 0x64 .. 0x67 depending on how the AD pin is connected. The address is defined by the reg property as usual. The chip also has a shutdown input which could be connected to a GPIO, but this driver uses software shutdown if all LEDs are inactivated. The chip also has breathing and audio features which are not fully supported by this driver. Tested-on: OMAP5 based Pyra handheld prototype. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Andrey Utkin <andrey_utkin@fastmail.com> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>