Lines Matching +full:leds +full:- +full:active +full:- +full:low

1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/leds.h>
35 #define LEDOUT_OFF 0x0 /* Output LOW */
36 #define LEDOUT_ON 0x1 /* Output HI-Z */
44 bool active; member
51 struct tlc591xx_led leds[TLC591XX_MAX_LEDS]; member
90 unsigned int i = (led->led_no % 4) * 2; in tlc591xx_set_ledout()
92 unsigned int addr = priv->reg_ledout_offset + (led->led_no >> 2); in tlc591xx_set_ledout()
96 return regmap_update_bits(priv->regmap, addr, mask, val); in tlc591xx_set_ledout()
103 u8 pwm = TLC591XX_REG_PWM(led->led_no); in tlc591xx_set_pwm()
105 return regmap_write(priv->regmap, pwm, brightness); in tlc591xx_set_pwm()
113 struct tlc591xx_priv *priv = led->priv; in tlc591xx_brightness_set()
151 struct device_node *np = dev_of_node(&client->dev), *child; in tlc591xx_probe()
152 struct device *dev = &client->dev; in tlc591xx_probe()
159 return -ENODEV; in tlc591xx_probe()
162 if (!count || count > tlc591xx->max_leds) in tlc591xx_probe()
163 return -EINVAL; in tlc591xx_probe()
167 return -ENOMEM; in tlc591xx_probe()
169 priv->regmap = devm_regmap_init_i2c(client, &tlc591xx_regmap); in tlc591xx_probe()
170 if (IS_ERR(priv->regmap)) { in tlc591xx_probe()
171 err = PTR_ERR(priv->regmap); in tlc591xx_probe()
175 priv->reg_ledout_offset = tlc591xx->reg_ledout_offset; in tlc591xx_probe()
179 err = tlc591xx_set_mode(priv->regmap, MODE2_DIM); in tlc591xx_probe()
194 if (reg < 0 || reg >= tlc591xx->max_leds || in tlc591xx_probe()
195 priv->leds[reg].active) { in tlc591xx_probe()
197 return -EINVAL; in tlc591xx_probe()
199 led = &priv->leds[reg]; in tlc591xx_probe()
201 led->active = true; in tlc591xx_probe()
202 led->priv = priv; in tlc591xx_probe()
203 led->led_no = reg; in tlc591xx_probe()
204 led->ldev.brightness_set_blocking = tlc591xx_brightness_set; in tlc591xx_probe()
205 led->ldev.max_brightness = TLC591XX_MAX_BRIGHTNESS; in tlc591xx_probe()
206 err = devm_led_classdev_register_ext(dev, &led->ldev, in tlc591xx_probe()
212 led->ldev.name); in tlc591xx_probe()