Lines Matching +full:led +full:- +full:active +full:- +full:low
1 // SPDX-License-Identifier: GPL-2.0-only
33 /* LED Driver Output State, determine the source that drives LED outputs */
34 #define LEDOUT_OFF 0x0 /* Output LOW */
35 #define LEDOUT_ON 0x1 /* Output HI-Z */
43 bool active; member
86 tlc591xx_set_ledout(struct tlc591xx_priv *priv, struct tlc591xx_led *led, in tlc591xx_set_ledout() argument
89 unsigned int i = (led->led_no % 4) * 2; in tlc591xx_set_ledout()
91 unsigned int addr = priv->reg_ledout_offset + (led->led_no >> 2); in tlc591xx_set_ledout()
95 return regmap_update_bits(priv->regmap, addr, mask, val); in tlc591xx_set_ledout()
99 tlc591xx_set_pwm(struct tlc591xx_priv *priv, struct tlc591xx_led *led, in tlc591xx_set_pwm() argument
102 u8 pwm = TLC591XX_REG_PWM(led->led_no); in tlc591xx_set_pwm()
104 return regmap_write(priv->regmap, pwm, brightness); in tlc591xx_set_pwm()
111 struct tlc591xx_led *led = ldev_to_led(led_cdev); in tlc591xx_brightness_set() local
112 struct tlc591xx_priv *priv = led->priv; in tlc591xx_brightness_set()
117 err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF); in tlc591xx_brightness_set()
120 err = tlc591xx_set_ledout(priv, led, LEDOUT_ON); in tlc591xx_brightness_set()
123 err = tlc591xx_set_ledout(priv, led, LEDOUT_DIM); in tlc591xx_brightness_set()
125 err = tlc591xx_set_pwm(priv, led, brightness); in tlc591xx_brightness_set()
150 struct device *dev = &client->dev; in tlc591xx_probe()
157 return -ENODEV; in tlc591xx_probe()
161 return -ENODEV; in tlc591xx_probe()
164 if (!count || count > tlc591xx->max_leds) in tlc591xx_probe()
165 return -EINVAL; in tlc591xx_probe()
169 return -ENOMEM; in tlc591xx_probe()
171 priv->regmap = devm_regmap_init_i2c(client, &tlc591xx_regmap); in tlc591xx_probe()
172 if (IS_ERR(priv->regmap)) { in tlc591xx_probe()
173 err = PTR_ERR(priv->regmap); in tlc591xx_probe()
177 priv->reg_ledout_offset = tlc591xx->reg_ledout_offset; in tlc591xx_probe()
181 err = tlc591xx_set_mode(priv->regmap, MODE2_DIM); in tlc591xx_probe()
186 struct tlc591xx_led *led; in tlc591xx_probe() local
195 if (reg < 0 || reg >= tlc591xx->max_leds || in tlc591xx_probe()
196 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()
210 "couldn't register LED %s\n", in tlc591xx_probe()
211 led->ldev.name); in tlc591xx_probe()
236 MODULE_DESCRIPTION("TLC591XX LED driver");