Lines Matching refs:led
105 struct mt6360_led *led = container_of(mccdev, struct mt6360_led, mc); in mt6360_mc_brightness_set() local
106 struct mt6360_priv *priv = led->priv; in mt6360_mc_brightness_set()
139 struct mt6360_led *led = container_of(lcdev, struct mt6360_led, isnk); in mt6360_isnk_brightness_set() local
140 struct mt6360_priv *priv = led->priv; in mt6360_isnk_brightness_set()
141 u32 enable_mask = MT6360_ISNK_ENMASK(led->led_no); in mt6360_isnk_brightness_set()
142 u32 val = level ? MT6360_ISNK_ENMASK(led->led_no) : 0; in mt6360_isnk_brightness_set()
147 ret = regmap_update_bits(priv->regmap, MT6360_REG_ISNK(led->led_no), in mt6360_isnk_brightness_set()
163 struct mt6360_led *led = in mt6360_torch_brightness_set() local
165 struct mt6360_priv *priv = led->priv; in mt6360_torch_brightness_set()
166 u32 enable_mask = MT6360_TORCHEN_MASK | MT6360_FLCSEN_MASK(led->led_no); in mt6360_torch_brightness_set()
167 u32 val = level ? MT6360_FLCSEN_MASK(led->led_no) : 0; in mt6360_torch_brightness_set()
185 curr = prev | BIT(led->led_no); in mt6360_torch_brightness_set()
187 curr = prev & ~BIT(led->led_no); in mt6360_torch_brightness_set()
194 MT6360_REG_FLEDITOR(led->led_no), in mt6360_torch_brightness_set()
227 struct mt6360_led *led = in _mt6360_flash_brightness_set() local
229 struct mt6360_priv *priv = led->priv; in _mt6360_flash_brightness_set()
234 MT6360_REG_FLEDISTRB(led->led_no), in _mt6360_flash_brightness_set()
240 struct mt6360_led *led = in mt6360_strobe_set() local
242 struct mt6360_priv *priv = led->priv; in mt6360_strobe_set()
245 u32 enable_mask = MT6360_STROBEN_MASK | MT6360_FLCSEN_MASK(led->led_no); in mt6360_strobe_set()
246 u32 val = state ? MT6360_FLCSEN_MASK(led->led_no) : 0; in mt6360_strobe_set()
264 curr = prev | BIT(led->led_no); in mt6360_strobe_set()
266 curr = prev & ~BIT(led->led_no); in mt6360_strobe_set()
275 led->led_no, state); in mt6360_strobe_set()
306 struct mt6360_led *led = in mt6360_strobe_get() local
308 struct mt6360_priv *priv = led->priv; in mt6360_strobe_get()
311 *state = !!(priv->fled_strobe_used & BIT(led->led_no)); in mt6360_strobe_get()
319 struct mt6360_led *led = in mt6360_timeout_set() local
321 struct mt6360_priv *priv = led->priv; in mt6360_timeout_set()
336 struct mt6360_led *led = in mt6360_fault_get() local
338 struct mt6360_priv *priv = led->priv; in mt6360_fault_get()
354 if (led->led_no == MT6360_LED_FLASH1) { in mt6360_fault_get()
388 static int mt6360_isnk_init_default_state(struct mt6360_led *led) in mt6360_isnk_init_default_state() argument
390 struct mt6360_priv *priv = led->priv; in mt6360_isnk_init_default_state()
395 ret = regmap_read(priv->regmap, MT6360_REG_ISNK(led->led_no), ®val); in mt6360_isnk_init_default_state()
404 if (!(regval & MT6360_ISNK_ENMASK(led->led_no))) in mt6360_isnk_init_default_state()
407 switch (led->default_state) { in mt6360_isnk_init_default_state()
409 led->isnk.brightness = led->isnk.max_brightness; in mt6360_isnk_init_default_state()
412 led->isnk.brightness = min(level, led->isnk.max_brightness); in mt6360_isnk_init_default_state()
415 led->isnk.brightness = LED_OFF; in mt6360_isnk_init_default_state()
418 return mt6360_isnk_brightness_set(&led->isnk, led->isnk.brightness); in mt6360_isnk_init_default_state()
421 static int mt6360_flash_init_default_state(struct mt6360_led *led) in mt6360_flash_init_default_state() argument
423 struct led_classdev_flash *flash = &led->flash; in mt6360_flash_init_default_state()
424 struct mt6360_priv *priv = led->priv; in mt6360_flash_init_default_state()
425 u32 enable_mask = MT6360_TORCHEN_MASK | MT6360_FLCSEN_MASK(led->led_no); in mt6360_flash_init_default_state()
430 ret = regmap_read(priv->regmap, MT6360_REG_FLEDITOR(led->led_no), in mt6360_flash_init_default_state()
445 switch (led->default_state) { in mt6360_flash_init_default_state()
466 struct mt6360_led *led = container_of(flash, struct mt6360_led, flash); in mt6360_flash_external_strobe_set() local
467 struct mt6360_priv *priv = led->priv; in mt6360_flash_external_strobe_set()
468 u32 mask = MT6360_FLCSEN_MASK(led->led_no); in mt6360_flash_external_strobe_set()
479 priv->fled_strobe_used |= BIT(led->led_no); in mt6360_flash_external_strobe_set()
481 priv->fled_strobe_used &= ~BIT(led->led_no); in mt6360_flash_external_strobe_set()
492 static void mt6360_init_v4l2_flash_config(struct mt6360_led *led, in mt6360_init_v4l2_flash_config() argument
498 lcdev = &led->flash.led_cdev; in mt6360_init_v4l2_flash_config()
514 static void mt6360_init_v4l2_flash_config(struct mt6360_led *led, in mt6360_init_v4l2_flash_config() argument
520 static int mt6360_led_register(struct device *parent, struct mt6360_led *led, in mt6360_led_register() argument
523 struct mt6360_priv *priv = led->priv; in mt6360_led_register()
527 if ((led->led_no == MT6360_LED_ISNK1 || in mt6360_led_register()
528 led->led_no == MT6360_VIRTUAL_MULTICOLOR) && in mt6360_led_register()
543 switch (led->led_no) { in mt6360_led_register()
545 ret = mt6360_mc_brightness_set(&led->mc.led_cdev, LED_OFF); in mt6360_led_register()
553 &led->mc, init_data); in mt6360_led_register()
560 ret = mt6360_isnk_init_default_state(led); in mt6360_led_register()
563 led->led_no); in mt6360_led_register()
567 ret = devm_led_classdev_register_ext(parent, &led->isnk, in mt6360_led_register()
571 led->led_no); in mt6360_led_register()
576 ret = mt6360_flash_init_default_state(led); in mt6360_led_register()
579 led->led_no); in mt6360_led_register()
583 ret = devm_led_classdev_flash_register_ext(parent, &led->flash, in mt6360_led_register()
587 led->led_no); in mt6360_led_register()
591 mt6360_init_v4l2_flash_config(led, &v4l2_config); in mt6360_led_register()
592 led->v4l2_flash = v4l2_flash_init(parent, init_data->fwnode, in mt6360_led_register()
593 &led->flash, in mt6360_led_register()
596 if (IS_ERR(led->v4l2_flash)) { in mt6360_led_register()
598 led->led_no); in mt6360_led_register()
599 return PTR_ERR(led->v4l2_flash); in mt6360_led_register()
617 static int mt6360_init_isnk_properties(struct mt6360_led *led, in mt6360_init_isnk_properties() argument
621 struct mt6360_priv *priv = led->priv; in mt6360_init_isnk_properties()
627 if (led->led_no == MT6360_VIRTUAL_MULTICOLOR) { in mt6360_init_isnk_properties()
647 led->led_no); in mt6360_init_isnk_properties()
663 led->mc.num_colors = num_color; in mt6360_init_isnk_properties()
664 led->mc.subled_info = sub_led; in mt6360_init_isnk_properties()
666 lcdev = &led->mc.led_cdev; in mt6360_init_isnk_properties()
669 if (led->led_no == MT6360_LED_ISNKML) { in mt6360_init_isnk_properties()
674 lcdev = &led->isnk; in mt6360_init_isnk_properties()
695 static int mt6360_init_flash_properties(struct mt6360_led *led, in mt6360_init_flash_properties() argument
698 struct led_classdev_flash *flash = &led->flash; in mt6360_init_flash_properties()
700 struct mt6360_priv *priv = led->priv; in mt6360_init_flash_properties()
763 static int mt6360_init_common_properties(struct mt6360_led *led, in mt6360_init_common_properties() argument
776 led->default_state = ret; in mt6360_init_common_properties()
787 struct mt6360_led *led = priv->leds + i; in mt6360_v4l2_flash_release() local
789 if (led->v4l2_flash) in mt6360_v4l2_flash_release()
790 v4l2_flash_release(led->v4l2_flash); in mt6360_v4l2_flash_release()
825 struct mt6360_led *led = priv->leds + i; in mt6360_led_probe() local
853 led->led_no = reg; in mt6360_led_probe()
854 led->priv = priv; in mt6360_led_probe()
856 ret = mt6360_init_common_properties(led, &init_data); in mt6360_led_probe()
862 ret = mt6360_init_isnk_properties(led, &init_data); in mt6360_led_probe()
864 ret = mt6360_init_flash_properties(led, &init_data); in mt6360_led_probe()
869 ret = mt6360_led_register(&pdev->dev, led, &init_data); in mt6360_led_probe()