Skip to content

Commit 218d3c4

Browse files
mnenciaij-intel
authored andcommitted
platform/x86: int3472: Parameterize LED con_id in registration
Add a con_id parameter to skl_int3472_register_led() to allow callers to specify both the LED name suffix and lookup con_id instead of hardcoding "privacy". This prepares for registering additional LED types with different names. While at it, rename the privacy LED's GPIO con_id from "privacy-led" to "privacy" in int3472_get_con_id_and_polarity() and pass it directly to skl_int3472_register_led(), reducing churn when adding new LED types. No functional change. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com> Signed-off-by: Marco Nenciarini <mnencia@kcore.it> Link: https://patch.msgid.link/20260401203638.1601661-4-mnencia@kcore.it Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 39237e3 commit 218d3c4

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

drivers/platform/x86/intel/int3472/discrete.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3
212212
*gpio_flags = GPIO_ACTIVE_HIGH;
213213
break;
214214
case INT3472_GPIO_TYPE_PRIVACY_LED:
215-
*con_id = "privacy-led";
215+
*con_id = "privacy";
216216
*gpio_flags = GPIO_ACTIVE_HIGH;
217217
break;
218218
case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
@@ -354,7 +354,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
354354

355355
break;
356356
case INT3472_GPIO_TYPE_PRIVACY_LED:
357-
ret = skl_int3472_register_led(int3472, gpio);
357+
ret = skl_int3472_register_led(int3472, gpio, con_id);
358358
if (ret)
359359
err_msg = "Failed to register LED\n";
360360

drivers/platform/x86/intel/int3472/led.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ static int int3472_led_set(struct led_classdev *led_cdev, enum led_brightness br
1414
return 0;
1515
}
1616

17-
int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio)
17+
int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio,
18+
const char *con_id)
1819
{
1920
struct int3472_led *led = &int3472->led;
2021
char *p;
@@ -27,7 +28,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi
2728

2829
/* Generate the name, replacing the ':' in the ACPI devname with '_' */
2930
snprintf(led->name, sizeof(led->name),
30-
"%s::privacy_led", acpi_dev_name(int3472->sensor));
31+
"%s::%s_led", acpi_dev_name(int3472->sensor), con_id);
3132
p = strchr(led->name, ':');
3233
if (p)
3334
*p = '_';
@@ -42,7 +43,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi
4243

4344
led->lookup.provider = led->name;
4445
led->lookup.dev_id = int3472->sensor_name;
45-
led->lookup.con_id = "privacy";
46+
led->lookup.con_id = con_id;
4647
led_add_lookup(&led->lookup);
4748

4849
return 0;

include/linux/platform_data/x86/int3472.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
161161
const char *second_sensor);
162162
void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472);
163163

164-
int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio);
164+
int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpio_desc *gpio,
165+
const char *con_id);
165166
void skl_int3472_unregister_led(struct int3472_discrete_device *int3472);
166167

167168
#endif

0 commit comments

Comments
 (0)