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.
Unified · Split
| @@ -212,7 +212,7 @@ static void int3472_get_con_id_and_polarity(struct int3472_discrete_device *int3 · 211 unmodified lines | |||
| 212 | *gpio_flags = GPIO_ACTIVE_HIGH; | 212 | *gpio_flags = GPIO_ACTIVE_HIGH; |
| 213 | break; | 213 | break; |
| 214 | case INT3472_GPIO_TYPE_PRIVACY_LED: | 214 | case INT3472_GPIO_TYPE_PRIVACY_LED: |
| 215 | *con_id = "privacy-led"; | 215 | *con_id = "privacy"; |
| 216 | *gpio_flags = GPIO_ACTIVE_HIGH; | 216 | *gpio_flags = GPIO_ACTIVE_HIGH; |
| 217 | break; | 217 | break; |
| 218 | case INT3472_GPIO_TYPE_HOTPLUG_DETECT: | 218 | case INT3472_GPIO_TYPE_HOTPLUG_DETECT: |
| @@ -354,7 +354,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 135 unmodified lines | |||
| 354 | 354 | ||
| 355 | break; | 355 | break; |
| 356 | case INT3472_GPIO_TYPE_PRIVACY_LED: | 356 | case INT3472_GPIO_TYPE_PRIVACY_LED: |
| 357 | ret = skl_int3472_register_led(int3472, gpio); | 357 | ret = skl_int3472_register_led(int3472, gpio, con_id); |
| 358 | if (ret) | 358 | if (ret) |
| 359 | err_msg = "Failed to register LED\n"; | 359 | err_msg = "Failed to register LED\n"; |
| 360 | 360 | ||
| @@ -14,7 +14,8 @@ static int int3472_led_set(struct led_classdev *led_cdev, enum led_brightness br · 13 unmodified lines | |||
| 14 | return 0; | 14 | return 0; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 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) | ||
| 18 | { | 19 | { |
| 19 | struct int3472_led *led = &int3472->led; | 20 | struct int3472_led *led = &int3472->led; |
| 20 | char *p; | 21 | char *p; |
| @@ -27,7 +28,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi · 6 unmodified lines | |||
| 27 | 28 | ||
| 28 | /* Generate the name, replacing the ':' in the ACPI devname with '_' */ | 29 | /* Generate the name, replacing the ':' in the ACPI devname with '_' */ |
| 29 | snprintf(led->name, sizeof(led->name), | 30 | 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); |
| 31 | p = strchr(led->name, ':'); | 32 | p = strchr(led->name, ':'); |
| 32 | if (p) | 33 | if (p) |
| 33 | *p = '_'; | 34 | *p = '_'; |
| @@ -42,7 +43,7 @@ int skl_int3472_register_led(struct int3472_discrete_device *int3472, struct gpi · 8 unmodified lines | |||
| 42 | 43 | ||
| 43 | led->lookup.provider = led->name; | 44 | led->lookup.provider = led->name; |
| 44 | led->lookup.dev_id = int3472->sensor_name; | 45 | led->lookup.dev_id = int3472->sensor_name; |
| 45 | led->lookup.con_id = "privacy"; | 46 | led->lookup.con_id = con_id; |
| 46 | led_add_lookup(&led->lookup); | 47 | led_add_lookup(&led->lookup); |
| 47 | 48 | ||
| 48 | return 0; | 49 | return 0; |
| @@ -161,7 +161,8 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472, · 160 unmodified lines | |||
| 161 | const char *second_sensor); | 161 | const char *second_sensor); |
| 162 | void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472); | 162 | void skl_int3472_unregister_regulator(struct int3472_discrete_device *int3472); |
| 163 | 163 | ||
| 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); | ||
| 165 | void skl_int3472_unregister_led(struct int3472_discrete_device *int3472); | 166 | void skl_int3472_unregister_led(struct int3472_discrete_device *int3472); |
| 166 | 167 | ||
| 167 | #endif | 168 | #endif |