platform/x86: dell-laptop: Add micmute LED trigger support
This patch adds the LED trigger support for audio mic-mute control. As of this patch, the LED device isn't tied with the audio driver, and can be changed via user-space at "platform::micmute" sysfs entry. (This new prefix "platform" is the agreement among people for indicating the generic laptop / system-wide attribute.) The binding with HD-audio is still done via the existing exported dell_micmute_led_set(). It will be replaced with the LED trigger binding in later patches. Also this selects CONFIG_LEDS_TRIGGERS and CONFIG_LEDS_TRIGGERS_AUDIO unconditionally. Strictly speaking, these aren't 100% mandatory, but leaving these manual selections would lead to a functional regression easily once after converting from the dynamic symbol binding to the LEDs trigger in a later patch. Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
faa2541f5b
commit
d00fa46e0a
|
@ -177,6 +177,8 @@ config DELL_LAPTOP
|
||||||
select POWER_SUPPLY
|
select POWER_SUPPLY
|
||||||
select LEDS_CLASS
|
select LEDS_CLASS
|
||||||
select NEW_LEDS
|
select NEW_LEDS
|
||||||
|
select LEDS_TRIGGERS
|
||||||
|
select LEDS_TRIGGER_AUDIO
|
||||||
---help---
|
---help---
|
||||||
This driver adds support for rfkill and backlight control to Dell
|
This driver adds support for rfkill and backlight control to Dell
|
||||||
laptops (except for some models covered by the Compal driver).
|
laptops (except for some models covered by the Compal driver).
|
||||||
|
|
|
@ -2131,6 +2131,23 @@ int dell_micmute_led_set(int state)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(dell_micmute_led_set);
|
EXPORT_SYMBOL_GPL(dell_micmute_led_set);
|
||||||
|
|
||||||
|
static int micmute_led_set(struct led_classdev *led_cdev,
|
||||||
|
enum led_brightness brightness)
|
||||||
|
{
|
||||||
|
int state = brightness != LED_OFF;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = dell_micmute_led_set(state);
|
||||||
|
return err < 0 ? err : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct led_classdev micmute_led_cdev = {
|
||||||
|
.name = "platform::micmute",
|
||||||
|
.max_brightness = 1,
|
||||||
|
.brightness_set_blocking = micmute_led_set,
|
||||||
|
.default_trigger = "audio-micmute",
|
||||||
|
};
|
||||||
|
|
||||||
static int __init dell_init(void)
|
static int __init dell_init(void)
|
||||||
{
|
{
|
||||||
struct calling_interface_token *token;
|
struct calling_interface_token *token;
|
||||||
|
@ -2175,6 +2192,11 @@ static int __init dell_init(void)
|
||||||
|
|
||||||
dell_laptop_register_notifier(&dell_laptop_notifier);
|
dell_laptop_register_notifier(&dell_laptop_notifier);
|
||||||
|
|
||||||
|
micmute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE);
|
||||||
|
ret = led_classdev_register(&platform_device->dev, &micmute_led_cdev);
|
||||||
|
if (ret < 0)
|
||||||
|
goto fail_led;
|
||||||
|
|
||||||
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
|
if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -2220,6 +2242,8 @@ static int __init dell_init(void)
|
||||||
fail_get_brightness:
|
fail_get_brightness:
|
||||||
backlight_device_unregister(dell_backlight_device);
|
backlight_device_unregister(dell_backlight_device);
|
||||||
fail_backlight:
|
fail_backlight:
|
||||||
|
led_classdev_unregister(&micmute_led_cdev);
|
||||||
|
fail_led:
|
||||||
dell_cleanup_rfkill();
|
dell_cleanup_rfkill();
|
||||||
fail_rfkill:
|
fail_rfkill:
|
||||||
platform_device_del(platform_device);
|
platform_device_del(platform_device);
|
||||||
|
@ -2239,6 +2263,7 @@ static void __exit dell_exit(void)
|
||||||
touchpad_led_exit();
|
touchpad_led_exit();
|
||||||
kbd_led_exit();
|
kbd_led_exit();
|
||||||
backlight_device_unregister(dell_backlight_device);
|
backlight_device_unregister(dell_backlight_device);
|
||||||
|
led_classdev_unregister(&micmute_led_cdev);
|
||||||
dell_cleanup_rfkill();
|
dell_cleanup_rfkill();
|
||||||
if (platform_device) {
|
if (platform_device) {
|
||||||
platform_device_unregister(platform_device);
|
platform_device_unregister(platform_device);
|
||||||
|
|
Loading…
Reference in New Issue