Lines Matching +full:led +full:- +full:8
1 // SPDX-License-Identifier: GPL-2.0-only
34 /* LED Driver Output State, determine the source that drives LED outputs */
36 #define LEDOUT_ON 0x1 /* Output HI-Z */
67 .max_leds = 8,
87 tlc591xx_set_ledout(struct tlc591xx_priv *priv, struct tlc591xx_led *led, in tlc591xx_set_ledout() argument
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()
100 tlc591xx_set_pwm(struct tlc591xx_priv *priv, struct tlc591xx_led *led, in tlc591xx_set_pwm() argument
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()
112 struct tlc591xx_led *led = ldev_to_led(led_cdev); in tlc591xx_brightness_set() local
113 struct tlc591xx_priv *priv = led->priv; in tlc591xx_brightness_set()
118 err = tlc591xx_set_ledout(priv, led, LEDOUT_OFF); in tlc591xx_brightness_set()
121 err = tlc591xx_set_ledout(priv, led, LEDOUT_ON); in tlc591xx_brightness_set()
124 err = tlc591xx_set_ledout(priv, led, LEDOUT_DIM); in tlc591xx_brightness_set()
126 err = tlc591xx_set_pwm(priv, led, brightness); in tlc591xx_brightness_set()
133 .reg_bits = 8,
134 .val_bits = 8,
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()
184 struct tlc591xx_led *led; in tlc591xx_probe() local
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()
211 "couldn't register LED %s\n", in tlc591xx_probe()
212 led->ldev.name); in tlc591xx_probe()
238 MODULE_DESCRIPTION("TLC591XX LED driver");