hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/leds/leds-aat1290.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * LED Flash class driver for the AAT1290
34 * 1.5A Step-Up Current Regulator for Flash LEDs
45 *
56 * Copyright (C) 2015, Samsung Electronics Co., Ltd.
67 * Author: Jacek Anaszewski <j.anaszewski@samsung.com>
7
- *
8
- * This program is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU General Public License
10
- * version 2 as published by the Free Software Foundation.
118 */
129
1310 #include <linux/delay.h>
....@@ -45,6 +42,8 @@
4542 #define AAT1290_FLASH_TM_NUM_LEVELS 16
4643 #define AAT1290_MM_CURRENT_SCALE_SIZE 15
4744
45
+#define AAT1290_NAME "aat1290"
46
+
4847
4948 struct aat1290_led_config_data {
5049 /* maximum LED current in movie mode */
....@@ -78,7 +77,6 @@
7877 int *mm_current_scale;
7978 /* device mode */
8079 bool movie_mode;
81
-
8280 /* brightness cache */
8381 unsigned int torch_brightness;
8482 };
....@@ -218,7 +216,6 @@
218216 struct aat1290_led_config_data *cfg,
219217 struct device_node **sub_node)
220218 {
221
- struct led_classdev *led_cdev = &led->fled_cdev.led_cdev;
222219 struct device *dev = &led->pdev->dev;
223220 struct device_node *child_node;
224221 #if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS)
....@@ -251,14 +248,11 @@
251248 }
252249 #endif
253250
254
- child_node = of_get_next_available_child(dev->of_node, NULL);
251
+ child_node = of_get_next_available_child(dev_of_node(dev), NULL);
255252 if (!child_node) {
256253 dev_err(dev, "No DT child node found for connected LED.\n");
257254 return -EINVAL;
258255 }
259
-
260
- led_cdev->name = of_get_property(child_node, "label", NULL) ? :
261
- child_node->name;
262256
263257 ret = of_property_read_u32(child_node, "led-max-microamp",
264258 &cfg->max_mm_current);
....@@ -431,7 +425,7 @@
431425 struct led_classdev *led_cdev = &led->fled_cdev.led_cdev;
432426 struct led_flash_setting *s;
433427
434
- strlcpy(v4l2_sd_cfg->dev_name, led_cdev->name,
428
+ strlcpy(v4l2_sd_cfg->dev_name, led_cdev->dev->kobj.name,
435429 sizeof(v4l2_sd_cfg->dev_name));
436430
437431 s = &v4l2_sd_cfg->intensity;
....@@ -469,6 +463,7 @@
469463 struct aat1290_led *led;
470464 struct led_classdev *led_cdev;
471465 struct led_classdev_flash *fled_cdev;
466
+ struct led_init_data init_data = {};
472467 struct aat1290_led_config_data led_cfg = {};
473468 struct v4l2_flash_config v4l2_sd_cfg = {};
474469 int ret;
....@@ -497,8 +492,12 @@
497492
498493 aat1290_init_flash_timeout(led, &led_cfg);
499494
495
+ init_data.fwnode = of_fwnode_handle(sub_node);
496
+ init_data.devicename = AAT1290_NAME;
497
+
500498 /* Register LED Flash class device */
501
- ret = led_classdev_flash_register(&pdev->dev, fled_cdev);
499
+ ret = led_classdev_flash_register_ext(&pdev->dev, fled_cdev,
500
+ &init_data);
502501 if (ret < 0)
503502 goto err_flash_register;
504503