This contains quite a lot of fixes, with more fixes in my inbox that

did not make it (sorry).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAmDgZvIACgkQMOfwapXb+vISigCfVeKFG7NYmG4ZX9+CwECvJdVd
 /gAAnA5NoYTl7j/rIvSIRmdDma9b2CSg
 =4mD9
 -----END PGP SIGNATURE-----

Merge tag 'leds-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds

Pull LED updates from Pavel Machek:
 "This contains quite a lot of fixes, with more fixes in my inbox that
  did not make it (sorry)"

* tag 'leds-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds: (36 commits)
  leds: lgm: Fix up includes
  leds: ktd2692: Fix an error handling path
  leds: as3645a: Fix error return code in as3645a_parse_node()
  leds: turris-omnia: add missing MODULE_DEVICE_TABLE
  leds: lp55xx: Initialize enable GPIO direction to output
  leds: lm36274: Add missed property.h
  leds: el15203000: Make error handling more robust
  leds: pwm: Make error handling more robust
  leds: lt3593: Make use of device properties
  leds: lp50xx: Put fwnode in error case during ->probe()
  leds: lm3697: Don't spam logs when probe is deferred
  leds: lm3692x: Put fwnode in any case during ->probe()
  leds: lm36274: Correct headers (of*.h -> mod_devicetable.h)
  leds: lm36274: Put fwnode in error case during ->probe()
  leds: lm3532: Make error handling more robust
  leds: lm3532: select regmap I2C API
  leds: lgm-sso: Drop duplicate NULL check for GPIO operations
  leds: lgm-sso: Remove unneeded of_match_ptr()
  leds: lgm-sso: Fix clock handling
  leds: el15203000: Introduce to_el15203000_led() helper
  ...
This commit is contained in:
Linus Torvalds 2021-07-03 11:57:42 -07:00
commit 303392fd5c
26 changed files with 145 additions and 147 deletions

View File

@ -199,6 +199,7 @@ config LEDS_LM3530
config LEDS_LM3532 config LEDS_LM3532
tristate "LCD Backlight driver for LM3532" tristate "LCD Backlight driver for LM3532"
select REGMAP_I2C
depends on LEDS_CLASS depends on LEDS_CLASS
depends on I2C depends on I2C
help help
@ -616,7 +617,6 @@ config LEDS_LT3593
tristate "LED driver for LT3593 controllers" tristate "LED driver for LT3593 controllers"
depends on LEDS_CLASS depends on LEDS_CLASS
depends on GPIOLIB || COMPILE_TEST depends on GPIOLIB || COMPILE_TEST
depends on OF
help help
This option enables support for LEDs driven by a Linear Technology This option enables support for LEDs driven by a Linear Technology
LT3593 controller. This controller uses a special one-wire pulse LT3593 controller. This controller uses a special one-wire pulse

View File

@ -7,7 +7,8 @@
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h> #include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/leds.h> #include <linux/leds.h>
@ -132,8 +133,7 @@ struct sso_led_priv {
struct regmap *mmap; struct regmap *mmap;
struct device *dev; struct device *dev;
struct platform_device *pdev; struct platform_device *pdev;
struct clk *gclk; struct clk_bulk_data clocks[2];
struct clk *fpid_clk;
u32 fpid_clkrate; u32 fpid_clkrate;
u32 gptc_clkrate; u32 gptc_clkrate;
u32 freq[MAX_FREQ_RANK]; u32 freq[MAX_FREQ_RANK];
@ -259,7 +259,7 @@ static void sso_led_brightness_set(struct led_classdev *led_cdev,
1 << desc->pin); 1 << desc->pin);
} }
if (!desc->hw_trig && led->gpiod) if (!desc->hw_trig)
gpiod_set_value(led->gpiod, val); gpiod_set_value(led->gpiod, val);
} }
@ -423,7 +423,7 @@ static void sso_gpio_free(struct gpio_chip *chip, unsigned int offset)
static int sso_gpio_get_dir(struct gpio_chip *chip, unsigned int offset) static int sso_gpio_get_dir(struct gpio_chip *chip, unsigned int offset)
{ {
return GPIOF_DIR_OUT; return GPIO_LINE_DIRECTION_OUT;
} }
static int static int
@ -763,12 +763,11 @@ static int sso_probe_gpios(struct sso_led_priv *priv)
return sso_gpio_gc_init(dev, priv); return sso_gpio_gc_init(dev, priv);
} }
static void sso_clk_disable(void *data) static void sso_clock_disable_unprepare(void *data)
{ {
struct sso_led_priv *priv = data; struct sso_led_priv *priv = data;
clk_disable_unprepare(priv->fpid_clk); clk_bulk_disable_unprepare(ARRAY_SIZE(priv->clocks), priv->clocks);
clk_disable_unprepare(priv->gclk);
} }
static int intel_sso_led_probe(struct platform_device *pdev) static int intel_sso_led_probe(struct platform_device *pdev)
@ -785,36 +784,30 @@ static int intel_sso_led_probe(struct platform_device *pdev)
priv->dev = dev; priv->dev = dev;
/* gate clock */ /* gate clock */
priv->gclk = devm_clk_get(dev, "sso"); priv->clocks[0].id = "sso";
if (IS_ERR(priv->gclk)) {
dev_err(dev, "get sso gate clock failed!\n");
return PTR_ERR(priv->gclk);
}
ret = clk_prepare_enable(priv->gclk); /* fpid clock */
priv->clocks[1].id = "fpid";
ret = devm_clk_bulk_get(dev, ARRAY_SIZE(priv->clocks), priv->clocks);
if (ret) { if (ret) {
dev_err(dev, "Failed to prepare/enable sso gate clock!\n"); dev_err(dev, "Getting clocks failed!\n");
return ret; return ret;
} }
priv->fpid_clk = devm_clk_get(dev, "fpid"); ret = clk_bulk_prepare_enable(ARRAY_SIZE(priv->clocks), priv->clocks);
if (IS_ERR(priv->fpid_clk)) {
dev_err(dev, "Failed to get fpid clock!\n");
return PTR_ERR(priv->fpid_clk);
}
ret = clk_prepare_enable(priv->fpid_clk);
if (ret) { if (ret) {
dev_err(dev, "Failed to prepare/enable fpid clock!\n"); dev_err(dev, "Failed to prepare and enable clocks!\n");
return ret; return ret;
} }
priv->fpid_clkrate = clk_get_rate(priv->fpid_clk);
ret = devm_add_action_or_reset(dev, sso_clk_disable, priv); ret = devm_add_action_or_reset(dev, sso_clock_disable_unprepare, priv);
if (ret) { if (ret)
dev_err(dev, "Failed to devm_add_action_or_reset, %d\n", ret);
return ret; return ret;
}
priv->fpid_clkrate = clk_get_rate(priv->clocks[1].clk);
priv->mmap = syscon_node_to_regmap(dev->of_node);
priv->mmap = syscon_node_to_regmap(dev->of_node); priv->mmap = syscon_node_to_regmap(dev->of_node);
if (IS_ERR(priv->mmap)) { if (IS_ERR(priv->mmap)) {
@ -859,8 +852,6 @@ static int intel_sso_led_remove(struct platform_device *pdev)
sso_led_shutdown(led); sso_led_shutdown(led);
} }
clk_disable_unprepare(priv->fpid_clk);
clk_disable_unprepare(priv->gclk);
regmap_exit(priv->mmap); regmap_exit(priv->mmap);
return 0; return 0;
@ -878,7 +869,7 @@ static struct platform_driver intel_sso_led_driver = {
.remove = intel_sso_led_remove, .remove = intel_sso_led_remove,
.driver = { .driver = {
.name = "lgm-ssoled", .name = "lgm-ssoled",
.of_match_table = of_match_ptr(of_sso_led_match), .of_match_table = of_sso_led_match,
}, },
}; };

View File

@ -285,10 +285,6 @@ struct led_classdev *__must_check devm_of_led_get(struct device *dev,
if (!dev) if (!dev)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
/* Not using device tree? */
if (!IS_ENABLED(CONFIG_OF) || !dev->of_node)
return ERR_PTR(-ENOTSUPP);
led = of_led_get(dev->of_node, index); led = of_led_get(dev->of_node, index);
if (IS_ERR(led)) if (IS_ERR(led))
return led; return led;
@ -513,7 +509,7 @@ static int devm_led_classdev_match(struct device *dev, void *res, void *data)
/** /**
* devm_led_classdev_unregister() - resource managed led_classdev_unregister() * devm_led_classdev_unregister() - resource managed led_classdev_unregister()
* @parent: The device to unregister. * @dev: The device to unregister.
* @led_cdev: the led_classdev structure for this device. * @led_cdev: the led_classdev structure for this device.
*/ */
void devm_led_classdev_unregister(struct device *dev, void devm_led_classdev_unregister(struct device *dev,

View File

@ -185,7 +185,7 @@ static int as3645a_read(struct as3645a *flash, u8 addr)
*/ */
/** /**
* as3645a_set_config - Set flash configuration registers * as3645a_set_current - Set flash configuration registers
* @flash: The flash * @flash: The flash
* *
* Configure the hardware with flash, assist and indicator currents, as well as * Configure the hardware with flash, assist and indicator currents, as well as
@ -545,6 +545,7 @@ static int as3645a_parse_node(struct as3645a *flash,
if (!flash->indicator_node) { if (!flash->indicator_node) {
dev_warn(&flash->client->dev, dev_warn(&flash->client->dev,
"can't find indicator node\n"); "can't find indicator node\n");
rval = -ENODEV;
goto out_err; goto out_err;
} }

View File

@ -93,7 +93,7 @@ static unsigned long bcm6328_led_read(void __iomem *reg)
#endif #endif
} }
/** /*
* LEDMode 64 bits / 24 LEDs * LEDMode 64 bits / 24 LEDs
* bits [31:0] -> LEDs 8-23 * bits [31:0] -> LEDs 8-23
* bits [47:32] -> LEDs 0-7 * bits [47:32] -> LEDs 0-7

View File

@ -480,9 +480,8 @@ static int blinkm_led_blue_set(struct led_classdev *led_cdev,
static void blinkm_init_hw(struct i2c_client *client) static void blinkm_init_hw(struct i2c_client *client)
{ {
int ret; blinkm_transfer_hw(client, BLM_STOP_SCRIPT);
ret = blinkm_transfer_hw(client, BLM_STOP_SCRIPT); blinkm_transfer_hw(client, BLM_GO_RGB);
ret = blinkm_transfer_hw(client, BLM_GO_RGB);
} }
static int blinkm_test_run(struct i2c_client *client) static int blinkm_test_run(struct i2c_client *client)

View File

@ -68,8 +68,8 @@ enum el15203000_command {
}; };
struct el15203000_led { struct el15203000_led {
struct el15203000 *priv;
struct led_classdev ldev; struct led_classdev ldev;
struct el15203000 *priv;
u32 reg; u32 reg;
}; };
@ -82,6 +82,8 @@ struct el15203000 {
struct el15203000_led leds[]; struct el15203000_led leds[];
}; };
#define to_el15203000_led(d) container_of(d, struct el15203000_led, ldev)
static int el15203000_cmd(struct el15203000_led *led, u8 brightness) static int el15203000_cmd(struct el15203000_led *led, u8 brightness)
{ {
int ret; int ret;
@ -128,9 +130,7 @@ static int el15203000_cmd(struct el15203000_led *led, u8 brightness)
static int el15203000_set_blocking(struct led_classdev *ldev, static int el15203000_set_blocking(struct led_classdev *ldev,
enum led_brightness brightness) enum led_brightness brightness)
{ {
struct el15203000_led *led = container_of(ldev, struct el15203000_led *led = to_el15203000_led(ldev);
struct el15203000_led,
ldev);
return el15203000_cmd(led, brightness == LED_OFF ? EL_OFF : EL_ON); return el15203000_cmd(led, brightness == LED_OFF ? EL_OFF : EL_ON);
} }
@ -139,9 +139,7 @@ static int el15203000_pattern_set_S(struct led_classdev *ldev,
struct led_pattern *pattern, struct led_pattern *pattern,
u32 len, int repeat) u32 len, int repeat)
{ {
struct el15203000_led *led = container_of(ldev, struct el15203000_led *led = to_el15203000_led(ldev);
struct el15203000_led,
ldev);
if (repeat > 0 || len != 2 || if (repeat > 0 || len != 2 ||
pattern[0].delta_t != 4000 || pattern[0].brightness != 0 || pattern[0].delta_t != 4000 || pattern[0].brightness != 0 ||
@ -192,10 +190,8 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev,
struct led_pattern *pattern, struct led_pattern *pattern,
u32 len, int repeat) u32 len, int repeat)
{ {
struct el15203000_led *led = to_el15203000_led(ldev);
u8 cmd; u8 cmd;
struct el15203000_led *led = container_of(ldev,
struct el15203000_led,
ldev);
if (repeat > 0) if (repeat > 0)
return -EINVAL; return -EINVAL;
@ -232,9 +228,7 @@ static int el15203000_pattern_set_P(struct led_classdev *ldev,
static int el15203000_pattern_clear(struct led_classdev *ldev) static int el15203000_pattern_clear(struct led_classdev *ldev)
{ {
struct el15203000_led *led = container_of(ldev, struct el15203000_led *led = to_el15203000_led(ldev);
struct el15203000_led,
ldev);
return el15203000_cmd(led, EL_OFF); return el15203000_cmd(led, EL_OFF);
} }
@ -251,16 +245,13 @@ static int el15203000_probe_dt(struct el15203000 *priv)
ret = fwnode_property_read_u32(child, "reg", &led->reg); ret = fwnode_property_read_u32(child, "reg", &led->reg);
if (ret) { if (ret) {
dev_err(priv->dev, "LED without ID number"); dev_err(priv->dev, "LED without ID number");
fwnode_handle_put(child); goto err_child_out;
break;
} }
if (led->reg > U8_MAX) { if (led->reg > U8_MAX) {
dev_err(priv->dev, "LED value %d is invalid", led->reg); dev_err(priv->dev, "LED value %d is invalid", led->reg);
fwnode_handle_put(child); ret = -EINVAL;
goto err_child_out;
return -EINVAL;
} }
led->priv = priv; led->priv = priv;
@ -282,14 +273,16 @@ static int el15203000_probe_dt(struct el15203000 *priv)
dev_err(priv->dev, dev_err(priv->dev,
"failed to register LED device %s, err %d", "failed to register LED device %s, err %d",
led->ldev.name, ret); led->ldev.name, ret);
fwnode_handle_put(child); goto err_child_out;
break;
} }
led++; led++;
} }
return 0;
err_child_out:
fwnode_handle_put(child);
return ret; return ret;
} }

View File

@ -11,6 +11,7 @@
/** /**
* gpio_led_register_device - register a gpio-led device * gpio_led_register_device - register a gpio-led device
* @pdata: the platform data used for the new device * @pdata: the platform data used for the new device
* @id: platform ID
* *
* Makes a copy of pdata and pdata->leds and registers a new leds-gpio device * Makes a copy of pdata and pdata->leds and registers a new leds-gpio device
* with the result. This allows to have pdata and pdata-leds in .init.rodata * with the result. This allows to have pdata and pdata-leds in .init.rodata

View File

@ -58,7 +58,8 @@ struct is31fl32xx_priv {
* @pwm_registers_reversed: : true if PWM registers count down instead of up * @pwm_registers_reversed: : true if PWM registers count down instead of up
* @led_control_register_base : address of first LED control register (optional) * @led_control_register_base : address of first LED control register (optional)
* @enable_bits_per_led_control_register: number of LEDs enable bits in each * @enable_bits_per_led_control_register: number of LEDs enable bits in each
* @reset_func: : pointer to reset function * @reset_func : pointer to reset function
* @sw_shutdown_func : pointer to software shutdown function
* *
* For all optional register addresses, the sentinel value %IS31FL32XX_REG_NONE * For all optional register addresses, the sentinel value %IS31FL32XX_REG_NONE
* indicates that this chip has no such register. * indicates that this chip has no such register.

View File

@ -256,6 +256,17 @@ static void ktd2692_setup(struct ktd2692_context *led)
| KTD2692_REG_FLASH_CURRENT_BASE); | KTD2692_REG_FLASH_CURRENT_BASE);
} }
static void regulator_disable_action(void *_data)
{
struct device *dev = _data;
struct ktd2692_context *led = dev_get_drvdata(dev);
int ret;
ret = regulator_disable(led->regulator);
if (ret)
dev_err(dev, "Failed to disable supply: %d\n", ret);
}
static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev, static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
struct ktd2692_led_config_data *cfg) struct ktd2692_led_config_data *cfg)
{ {
@ -286,8 +297,14 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
if (led->regulator) { if (led->regulator) {
ret = regulator_enable(led->regulator); ret = regulator_enable(led->regulator);
if (ret) if (ret) {
dev_err(dev, "Failed to enable supply: %d\n", ret); dev_err(dev, "Failed to enable supply: %d\n", ret);
} else {
ret = devm_add_action_or_reset(dev,
regulator_disable_action, dev);
if (ret)
return ret;
}
} }
child_node = of_get_next_available_child(np, NULL); child_node = of_get_next_available_child(np, NULL);
@ -377,17 +394,9 @@ static int ktd2692_probe(struct platform_device *pdev)
static int ktd2692_remove(struct platform_device *pdev) static int ktd2692_remove(struct platform_device *pdev)
{ {
struct ktd2692_context *led = platform_get_drvdata(pdev); struct ktd2692_context *led = platform_get_drvdata(pdev);
int ret;
led_classdev_flash_unregister(&led->fled_cdev); led_classdev_flash_unregister(&led->fled_cdev);
if (led->regulator) {
ret = regulator_disable(led->regulator);
if (ret)
dev_err(&pdev->dev,
"Failed to disable supply: %d\n", ret);
}
mutex_destroy(&led->lock); mutex_destroy(&led->lock);
return 0; return 0;

View File

@ -99,7 +99,7 @@ static struct lm3530_mode_map mode_map[] = {
* @pdata: LM3530 platform data * @pdata: LM3530 platform data
* @mode: mode of operation - manual, ALS, PWM * @mode: mode of operation - manual, ALS, PWM
* @regulator: regulator * @regulator: regulator
* @brighness: previous brightness value * @brightness: previous brightness value
* @enable: regulator is enabled * @enable: regulator is enabled
*/ */
struct lm3530_data { struct lm3530_data {

View File

@ -586,7 +586,6 @@ static int lm3532_parse_node(struct lm3532_data *priv)
ret = fwnode_property_read_u32(child, "reg", &control_bank); ret = fwnode_property_read_u32(child, "reg", &control_bank);
if (ret) { if (ret) {
dev_err(&priv->client->dev, "reg property missing\n"); dev_err(&priv->client->dev, "reg property missing\n");
fwnode_handle_put(child);
goto child_out; goto child_out;
} }
@ -601,7 +600,6 @@ static int lm3532_parse_node(struct lm3532_data *priv)
&led->mode); &led->mode);
if (ret) { if (ret) {
dev_err(&priv->client->dev, "ti,led-mode property missing\n"); dev_err(&priv->client->dev, "ti,led-mode property missing\n");
fwnode_handle_put(child);
goto child_out; goto child_out;
} }
@ -636,7 +634,6 @@ static int lm3532_parse_node(struct lm3532_data *priv)
led->num_leds); led->num_leds);
if (ret) { if (ret) {
dev_err(&priv->client->dev, "led-sources property missing\n"); dev_err(&priv->client->dev, "led-sources property missing\n");
fwnode_handle_put(child);
goto child_out; goto child_out;
} }
@ -647,7 +644,6 @@ static int lm3532_parse_node(struct lm3532_data *priv)
if (ret) { if (ret) {
dev_err(&priv->client->dev, "led register err: %d\n", dev_err(&priv->client->dev, "led register err: %d\n",
ret); ret);
fwnode_handle_put(child);
goto child_out; goto child_out;
} }
@ -655,14 +651,15 @@ static int lm3532_parse_node(struct lm3532_data *priv)
if (ret) { if (ret) {
dev_err(&priv->client->dev, "register init err: %d\n", dev_err(&priv->client->dev, "register init err: %d\n",
ret); ret);
fwnode_handle_put(child);
goto child_out; goto child_out;
} }
i++; i++;
} }
return 0;
child_out: child_out:
fwnode_handle_put(child);
return ret; return ret;
} }

View File

@ -7,9 +7,10 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/leds-ti-lmu-common.h> #include <linux/leds-ti-lmu-common.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/mfd/ti-lmu.h> #include <linux/mfd/ti-lmu.h>
#include <linux/mfd/ti-lmu-register.h> #include <linux/mfd/ti-lmu-register.h>
@ -127,6 +128,7 @@ static int lm36274_probe(struct platform_device *pdev)
ret = lm36274_init(chip); ret = lm36274_init(chip);
if (ret) { if (ret) {
fwnode_handle_put(init_data.fwnode);
dev_err(chip->dev, "Failed to init the device\n"); dev_err(chip->dev, "Failed to init the device\n");
return ret; return ret;
} }

View File

@ -96,15 +96,15 @@
#define LM3692X_FAULT_FLAG_OPEN BIT(4) #define LM3692X_FAULT_FLAG_OPEN BIT(4)
/** /**
* struct lm3692x_led - * struct lm3692x_led
* @lock - Lock for reading/writing the device * @lock: Lock for reading/writing the device
* @client - Pointer to the I2C client * @client: Pointer to the I2C client
* @led_dev - LED class device pointer * @led_dev: LED class device pointer
* @regmap - Devices register map * @regmap: Devices register map
* @enable_gpio - VDDIO/EN gpio to enable communication interface * @enable_gpio: VDDIO/EN gpio to enable communication interface
* @regulator - LED supply regulator pointer * @regulator: LED supply regulator pointer
* @led_enable - LED sync to be enabled * @led_enable: LED sync to be enabled
* @model_id - Current device model ID enumerated * @model_id: Current device model ID enumerated
*/ */
struct lm3692x_led { struct lm3692x_led {
struct mutex lock; struct mutex lock;
@ -435,6 +435,7 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)
ret = fwnode_property_read_u32(child, "reg", &led->led_enable); ret = fwnode_property_read_u32(child, "reg", &led->led_enable);
if (ret) { if (ret) {
fwnode_handle_put(child);
dev_err(&led->client->dev, "reg DT property missing\n"); dev_err(&led->client->dev, "reg DT property missing\n");
return ret; return ret;
} }
@ -449,12 +450,11 @@ static int lm3692x_probe_dt(struct lm3692x_led *led)
ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev, ret = devm_led_classdev_register_ext(&led->client->dev, &led->led_dev,
&init_data); &init_data);
if (ret) { if (ret)
dev_err(&led->client->dev, "led register err: %d\n", ret); dev_err(&led->client->dev, "led register err: %d\n", ret);
return ret;
}
return 0; fwnode_handle_put(init_data.fwnode);
return ret;
} }
static int lm3692x_probe(struct i2c_client *client, static int lm3692x_probe(struct i2c_client *client,

View File

@ -47,6 +47,8 @@
* @lmu_data: Register and setting values for common code * @lmu_data: Register and setting values for common code
* @control_bank: Control bank the LED is associated to. 0 is control bank A * @control_bank: Control bank the LED is associated to. 0 is control bank A
* 1 is control bank B * 1 is control bank B
* @enabled: LED brightness level (or LED_OFF)
* @num_leds: Number of LEDs available
*/ */
struct lm3697_led { struct lm3697_led {
u32 hvled_strings[LM3697_MAX_LED_STRINGS]; u32 hvled_strings[LM3697_MAX_LED_STRINGS];
@ -68,6 +70,8 @@ struct lm3697_led {
* @dev: Pointer to the devices device struct * @dev: Pointer to the devices device struct
* @lock: Lock for reading/writing the device * @lock: Lock for reading/writing the device
* @leds: Array of LED strings * @leds: Array of LED strings
* @bank_cfg: OUTPUT_CONFIG register values
* @num_banks: Number of control banks
*/ */
struct lm3697 { struct lm3697 {
struct gpio_desc *enable_gpio; struct gpio_desc *enable_gpio;
@ -203,11 +207,9 @@ static int lm3697_probe_dt(struct lm3697 *priv)
priv->enable_gpio = devm_gpiod_get_optional(dev, "enable", priv->enable_gpio = devm_gpiod_get_optional(dev, "enable",
GPIOD_OUT_LOW); GPIOD_OUT_LOW);
if (IS_ERR(priv->enable_gpio)) { if (IS_ERR(priv->enable_gpio))
ret = PTR_ERR(priv->enable_gpio); return dev_err_probe(dev, PTR_ERR(priv->enable_gpio),
dev_err(dev, "Failed to get enable gpio: %d\n", ret); "Failed to get enable GPIO\n");
return ret;
}
priv->regulator = devm_regulator_get(dev, "vled"); priv->regulator = devm_regulator_get(dev, "vled");
if (IS_ERR(priv->regulator)) if (IS_ERR(priv->regulator))

View File

@ -92,7 +92,7 @@ static int lp3944_reg_write(struct i2c_client *client, u8 reg, u8 value)
} }
/** /**
* Set the period for DIM status * lp3944_dim_set_period() - Set the period for DIM status
* *
* @client: the i2c client * @client: the i2c client
* @dim: either LP3944_DIM0 or LP3944_DIM1 * @dim: either LP3944_DIM0 or LP3944_DIM1
@ -123,7 +123,7 @@ static int lp3944_dim_set_period(struct i2c_client *client, u8 dim, u16 period)
} }
/** /**
* Set the duty cycle for DIM status * lp3944_dim_set_dutycycle - Set the duty cycle for DIM status
* *
* @client: the i2c client * @client: the i2c client
* @dim: either LP3944_DIM0 or LP3944_DIM1 * @dim: either LP3944_DIM0 or LP3944_DIM1
@ -155,7 +155,7 @@ static int lp3944_dim_set_dutycycle(struct i2c_client *client, u8 dim,
} }
/** /**
* Set the led status * lp3944_led_set() - Set the led status
* *
* @led: a lp3944_led_data structure * @led: a lp3944_led_data structure
* @status: one of LP3944_LED_STATUS_OFF * @status: one of LP3944_LED_STATUS_OFF

View File

@ -490,6 +490,7 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
ret = fwnode_property_read_u32(led_node, "color", ret = fwnode_property_read_u32(led_node, "color",
&color_id); &color_id);
if (ret) { if (ret) {
fwnode_handle_put(led_node);
dev_err(priv->dev, "Cannot read color\n"); dev_err(priv->dev, "Cannot read color\n");
goto child_out; goto child_out;
} }
@ -512,7 +513,6 @@ static int lp50xx_probe_dt(struct lp50xx *priv)
goto child_out; goto child_out;
} }
i++; i++;
fwnode_handle_put(child);
} }
return 0; return 0;

View File

@ -694,7 +694,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
of_property_read_u8(np, "clock-mode", &pdata->clock_mode); of_property_read_u8(np, "clock-mode", &pdata->clock_mode);
pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable", pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable",
GPIOD_ASIS); GPIOD_OUT_LOW);
if (IS_ERR(pdata->enable_gpiod)) if (IS_ERR(pdata->enable_gpiod))
return ERR_CAST(pdata->enable_gpiod); return ERR_CAST(pdata->enable_gpiod);

View File

@ -85,14 +85,14 @@
#define LP8860_NAME "lp8860" #define LP8860_NAME "lp8860"
/** /**
* struct lp8860_led - * struct lp8860_led
* @lock - Lock for reading/writing the device * @lock: Lock for reading/writing the device
* @client - Pointer to the I2C client * @client: Pointer to the I2C client
* @led_dev - led class device pointer * @led_dev: led class device pointer
* @regmap - Devices register map * @regmap: Devices register map
* @eeprom_regmap - EEPROM register map * @eeprom_regmap: EEPROM register map
* @enable_gpio - VDDIO/EN gpio to enable communication interface * @enable_gpio: VDDIO/EN gpio to enable communication interface
* @regulator - LED supply regulator pointer * @regulator: LED supply regulator pointer
*/ */
struct lp8860_led { struct lp8860_led {
struct mutex lock; struct mutex lock;

View File

@ -7,8 +7,9 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/property.h>
#define LED_LT3593_NAME "lt3593" #define LED_LT3593_NAME "lt3593"
@ -68,9 +69,6 @@ static int lt3593_led_probe(struct platform_device *pdev)
struct led_init_data init_data = {}; struct led_init_data init_data = {};
const char *tmp; const char *tmp;
if (!dev_of_node(dev))
return -ENODEV;
led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL); led_data = devm_kzalloc(dev, sizeof(*led_data), GFP_KERNEL);
if (!led_data) if (!led_data)
return -ENOMEM; return -ENOMEM;
@ -119,7 +117,7 @@ static struct platform_driver lt3593_led_driver = {
.probe = lt3593_led_probe, .probe = lt3593_led_probe,
.driver = { .driver = {
.name = "leds-lt3593", .name = "leds-lt3593",
.of_match_table = of_match_ptr(of_lt3593_leds_match), .of_match_table = of_lt3593_leds_match,
}, },
}; };

View File

@ -64,10 +64,10 @@
#define MLXCPLD_LED_BLINK_6HZ 83 /* ~83 msec off/on */ #define MLXCPLD_LED_BLINK_6HZ 83 /* ~83 msec off/on */
/** /**
* mlxcpld_param - LED access parameters: * struct mlxcpld_param - LED access parameters:
* @offset - offset for LED access in CPLD device * @offset: offset for LED access in CPLD device
* @mask - mask for LED access in CPLD device * @mask: mask for LED access in CPLD device
* @base_color - base color code for LED * @base_color: base color code for LED
**/ **/
struct mlxcpld_param { struct mlxcpld_param {
u8 offset; u8 offset;
@ -76,9 +76,9 @@ struct mlxcpld_param {
}; };
/** /**
* mlxcpld_led_priv - LED private data: * struct mlxcpld_led_priv - LED private data:
* @cled - LED class device instance * @cled: LED class device instance
* @param - LED CPLD access parameters * @param: LED CPLD access parameters
**/ **/
struct mlxcpld_led_priv { struct mlxcpld_led_priv {
struct led_classdev cdev; struct led_classdev cdev;
@ -88,12 +88,12 @@ struct mlxcpld_led_priv {
#define cdev_to_priv(c) container_of(c, struct mlxcpld_led_priv, cdev) #define cdev_to_priv(c) container_of(c, struct mlxcpld_led_priv, cdev)
/** /**
* mlxcpld_led_profile - system LED profile (defined per system class): * struct mlxcpld_led_profile - system LED profile (defined per system class):
* @offset - offset for LED access in CPLD device * @offset: offset for LED access in CPLD device
* @mask - mask for LED access in CPLD device * @mask: mask for LED access in CPLD device
* @base_color - base color code * @base_color: base color code
* @brightness - default brightness setting (on/off) * @brightness: default brightness setting (on/off)
* @name - LED name * @name: LED name
**/ **/
struct mlxcpld_led_profile { struct mlxcpld_led_profile {
u8 offset; u8 offset;
@ -104,12 +104,12 @@ struct mlxcpld_led_profile {
}; };
/** /**
* mlxcpld_led_pdata - system LED private data * struct mlxcpld_led_pdata - system LED private data
* @pdev - platform device pointer * @pdev: platform device pointer
* @pled - LED class device instance * @pled: LED class device instance
* @profile - system configuration profile * @profile: system configuration profile
* @num_led_instances - number of LED instances * @num_led_instances: number of LED instances
* @lock - device access lock * @lock: device access lock
**/ **/
struct mlxcpld_led_pdata { struct mlxcpld_led_pdata {
struct platform_device *pdev; struct platform_device *pdev;

View File

@ -28,10 +28,11 @@
* struct mlxreg_led_data - led control data: * struct mlxreg_led_data - led control data:
* *
* @data: led configuration data; * @data: led configuration data;
* @led_classdev: led class data; * @led_cdev: led class data;
* @base_color: base led color (other colors have constant offset from base); * @base_color: base led color (other colors have constant offset from base);
* @led_data: led data; * @led_data: led data;
* @data_parent: pointer to private device control data of parent; * @data_parent: pointer to private device control data of parent;
* @led_cdev_name: class device name
*/ */
struct mlxreg_led_data { struct mlxreg_led_data {
struct mlxreg_core_data *data; struct mlxreg_core_data *data;

View File

@ -101,7 +101,7 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
{ {
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
struct led_pwm led; struct led_pwm led;
int ret = 0; int ret;
memset(&led, 0, sizeof(led)); memset(&led, 0, sizeof(led));
@ -111,8 +111,8 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
led.name = to_of_node(fwnode)->name; led.name = to_of_node(fwnode)->name;
if (!led.name) { if (!led.name) {
fwnode_handle_put(fwnode); ret = EINVAL;
return -EINVAL; goto err_child_out;
} }
led.active_low = fwnode_property_read_bool(fwnode, led.active_low = fwnode_property_read_bool(fwnode,
@ -121,12 +121,14 @@ static int led_pwm_create_fwnode(struct device *dev, struct led_pwm_priv *priv)
&led.max_brightness); &led.max_brightness);
ret = led_pwm_add(dev, priv, &led, fwnode); ret = led_pwm_add(dev, priv, &led, fwnode);
if (ret) { if (ret)
fwnode_handle_put(fwnode); goto err_child_out;
break;
}
} }
return 0;
err_child_out:
fwnode_handle_put(fwnode);
return ret; return ret;
} }

View File

@ -148,16 +148,20 @@ static int
tlc591xx_probe(struct i2c_client *client, tlc591xx_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct device_node *np = dev_of_node(&client->dev), *child; struct device_node *np, *child;
struct device *dev = &client->dev; struct device *dev = &client->dev;
const struct tlc591xx *tlc591xx; const struct tlc591xx *tlc591xx;
struct tlc591xx_priv *priv; struct tlc591xx_priv *priv;
int err, count, reg; int err, count, reg;
tlc591xx = device_get_match_data(dev); np = dev_of_node(dev);
if (!np) if (!np)
return -ENODEV; return -ENODEV;
tlc591xx = device_get_match_data(dev);
if (!tlc591xx)
return -ENODEV;
count = of_get_available_child_count(np); count = of_get_available_child_count(np);
if (!count || count > tlc591xx->max_leds) if (!count || count > tlc591xx->max_leds)
return -EINVAL; return -EINVAL;

View File

@ -274,6 +274,7 @@ static const struct i2c_device_id omnia_id[] = {
{ "omnia", 0 }, { "omnia", 0 },
{ } { }
}; };
MODULE_DEVICE_TABLE(i2c, omnia_id);
static struct i2c_driver omnia_leds_driver = { static struct i2c_driver omnia_leds_driver = {
.probe = omnia_leds_probe, .probe = omnia_leds_probe,

View File

@ -43,7 +43,7 @@ static atomic_t num_active_cpus = ATOMIC_INIT(0);
/** /**
* ledtrig_cpu - emit a CPU event as a trigger * ledtrig_cpu - emit a CPU event as a trigger
* @evt: CPU event to be emitted * @ledevt: CPU event to be emitted
* *
* Emit a CPU event on a CPU core, which will trigger a * Emit a CPU event on a CPU core, which will trigger a
* bound LED to turn on or turn off. * bound LED to turn on or turn off.