Lines Matching refs:is31

196 	struct is31fl319x_chip *is31 = led->chip;  in is31fl3190_brightness_set()  local
197 int chan = led - is31->leds; in is31fl3190_brightness_set()
202 dev_dbg(&is31->client->dev, "channel %d: %d\n", chan, brightness); in is31fl3190_brightness_set()
204 mutex_lock(&is31->lock); in is31fl3190_brightness_set()
207 ret = regmap_write(is31->regmap, IS31FL3190_PWM(chan), brightness); in is31fl3190_brightness_set()
212 for (i = 0; i < is31->cdef->num_leds; i++) { in is31fl3190_brightness_set()
221 ret = regmap_read(is31->regmap, IS31FL3190_PWM(i), &pwm_value); in is31fl3190_brightness_set()
228 dev_dbg(&is31->client->dev, "power up %02x\n", ctrl); in is31fl3190_brightness_set()
229 regmap_write(is31->regmap, IS31FL3190_LEDCONTROL, ctrl); in is31fl3190_brightness_set()
231 regmap_write(is31->regmap, IS31FL3190_DATA_UPDATE, 0x00); in is31fl3190_brightness_set()
233 ret = regmap_write(is31->regmap, IS31FL319X_SHUTDOWN, 0x20); in is31fl3190_brightness_set()
235 dev_dbg(&is31->client->dev, "power down\n"); in is31fl3190_brightness_set()
237 ret = regmap_write(is31->regmap, IS31FL319X_SHUTDOWN, 0x01); in is31fl3190_brightness_set()
241 mutex_unlock(&is31->lock); in is31fl3190_brightness_set()
250 struct is31fl319x_chip *is31 = led->chip; in is31fl3196_brightness_set() local
251 int chan = led - is31->leds; in is31fl3196_brightness_set()
256 dev_dbg(&is31->client->dev, "channel %d: %d\n", chan, brightness); in is31fl3196_brightness_set()
258 mutex_lock(&is31->lock); in is31fl3196_brightness_set()
261 ret = regmap_write(is31->regmap, IS31FL3196_PWM(chan), brightness); in is31fl3196_brightness_set()
266 for (i = 0; i < is31->cdef->num_leds; i++) { in is31fl3196_brightness_set()
275 ret = regmap_read(is31->regmap, IS31FL3196_PWM(i), &pwm_value); in is31fl3196_brightness_set()
287 dev_dbg(&is31->client->dev, "power up %02x %02x\n", in is31fl3196_brightness_set()
289 regmap_write(is31->regmap, IS31FL3196_CTRL1, ctrl1); in is31fl3196_brightness_set()
290 regmap_write(is31->regmap, IS31FL3196_CTRL2, ctrl2); in is31fl3196_brightness_set()
292 regmap_write(is31->regmap, IS31FL3196_DATA_UPDATE, 0x00); in is31fl3196_brightness_set()
294 ret = regmap_write(is31->regmap, IS31FL319X_SHUTDOWN, 0x01); in is31fl3196_brightness_set()
296 dev_dbg(&is31->client->dev, "power down\n"); in is31fl3196_brightness_set()
298 ret = regmap_write(is31->regmap, IS31FL319X_SHUTDOWN, 0x00); in is31fl3196_brightness_set()
302 mutex_unlock(&is31->lock); in is31fl3196_brightness_set()
369 struct is31fl319x_chip *is31) in is31fl319x_parse_child_fw() argument
381 led->max_microamp = is31->cdef->current_default; in is31fl319x_parse_child_fw()
384 if (led->max_microamp < is31->cdef->current_min) in is31fl319x_parse_child_fw()
387 is31->cdef->current_max); in is31fl319x_parse_child_fw()
393 static int is31fl319x_parse_fw(struct device *dev, struct is31fl319x_chip *is31) in is31fl319x_parse_fw() argument
399 is31->shutdown_gpio = devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); in is31fl319x_parse_fw()
400 if (IS_ERR(is31->shutdown_gpio)) in is31fl319x_parse_fw()
401 return dev_err_probe(dev, PTR_ERR(is31->shutdown_gpio), in is31fl319x_parse_fw()
404 is31->cdef = device_get_match_data(dev); in is31fl319x_parse_fw()
412 if (!count || count > is31->cdef->num_leds) in is31fl319x_parse_fw()
415 is31->cdef->num_leds); in is31fl319x_parse_fw()
427 if (reg < 1 || reg > is31->cdef->num_leds) { in is31fl319x_parse_fw()
432 led = &is31->leds[reg - 1]; in is31fl319x_parse_fw()
439 ret = is31fl319x_parse_child_fw(dev, child, led, is31); in is31fl319x_parse_fw()
448 is31->audio_gain_db = 0; in is31fl319x_parse_fw()
449 if (is31->cdef->is_3196or3199) { in is31fl319x_parse_fw()
450 ret = fwnode_property_read_u32(fwnode, "audio-gain-db", &is31->audio_gain_db); in is31fl319x_parse_fw()
452 is31->audio_gain_db = min(is31->audio_gain_db, in is31fl319x_parse_fw()
505 struct is31fl319x_chip *is31; in is31fl319x_probe() local
514 is31 = devm_kzalloc(&client->dev, sizeof(*is31), GFP_KERNEL); in is31fl319x_probe()
515 if (!is31) in is31fl319x_probe()
518 mutex_init(&is31->lock); in is31fl319x_probe()
519 err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock); in is31fl319x_probe()
523 err = is31fl319x_parse_fw(&client->dev, is31); in is31fl319x_probe()
527 if (is31->shutdown_gpio) { in is31fl319x_probe()
528 gpiod_direction_output(is31->shutdown_gpio, 0); in is31fl319x_probe()
530 gpiod_direction_output(is31->shutdown_gpio, 1); in is31fl319x_probe()
533 is31->client = client; in is31fl319x_probe()
534 is31->regmap = devm_regmap_init_i2c(client, is31->cdef->is31fl319x_regmap_config); in is31fl319x_probe()
535 if (IS_ERR(is31->regmap)) in is31fl319x_probe()
536 return dev_err_probe(dev, PTR_ERR(is31->regmap), "failed to allocate register map\n"); in is31fl319x_probe()
538 i2c_set_clientdata(client, is31); in is31fl319x_probe()
541 err = regmap_write(is31->regmap, is31->cdef->reset_reg, 0x00); in is31fl319x_probe()
550 aggregated_led_microamp = is31->cdef->current_max; in is31fl319x_probe()
551 for (i = 0; i < is31->cdef->num_leds; i++) in is31fl319x_probe()
552 if (is31->leds[i].configured && in is31fl319x_probe()
553 is31->leds[i].max_microamp < aggregated_led_microamp) in is31fl319x_probe()
554 aggregated_led_microamp = is31->leds[i].max_microamp; in is31fl319x_probe()
556 if (is31->cdef->is_3196or3199) in is31fl319x_probe()
557 regmap_write(is31->regmap, IS31FL3196_CONFIG2, in is31fl319x_probe()
559 is31fl3196_db_to_gain(is31->audio_gain_db)); in is31fl319x_probe()
561 regmap_update_bits(is31->regmap, IS31FL3190_CURRENT, IS31FL3190_CURRENT_MASK, in is31fl319x_probe()
564 for (i = 0; i < is31->cdef->num_leds; i++) { in is31fl319x_probe()
565 struct is31fl319x_led *led = &is31->leds[i]; in is31fl319x_probe()
570 led->chip = is31; in is31fl319x_probe()
571 led->cdev.brightness_set_blocking = is31->cdef->brightness_set; in is31fl319x_probe()