diff options
Diffstat (limited to 'drivers/platform/x86/dell')
-rw-r--r-- | drivers/platform/x86/dell/dcdbas.c | 6 | ||||
-rw-r--r-- | drivers/platform/x86/dell/dell-laptop.c | 42 | ||||
-rw-r--r-- | drivers/platform/x86/dell/dell-smbios.h | 2 | ||||
-rw-r--r-- | drivers/platform/x86/dell/dell-smo8800.c | 5 |
4 files changed, 48 insertions, 7 deletions
diff --git a/drivers/platform/x86/dell/dcdbas.c b/drivers/platform/x86/dell/dcdbas.c index 0ecb7b164750..76787369d7fa 100644 --- a/drivers/platform/x86/dell/dcdbas.c +++ b/drivers/platform/x86/dell/dcdbas.c @@ -698,12 +698,10 @@ static int dcdbas_probe(struct platform_device *dev) return 0; } -static int dcdbas_remove(struct platform_device *dev) +static void dcdbas_remove(struct platform_device *dev) { unregister_reboot_notifier(&dcdbas_reboot_nb); sysfs_remove_group(&dev->dev.kobj, &dcdbas_attr_group); - - return 0; } static struct platform_driver dcdbas_driver = { @@ -711,7 +709,7 @@ static struct platform_driver dcdbas_driver = { .name = DRIVER_NAME, }, .probe = dcdbas_probe, - .remove = dcdbas_remove, + .remove_new = dcdbas_remove, }; static const struct platform_device_info dcdbas_dev_info __initconst = { diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c index e92c3ad06d69..6586438356de 100644 --- a/drivers/platform/x86/dell/dell-laptop.c +++ b/drivers/platform/x86/dell/dell-laptop.c @@ -97,6 +97,7 @@ static struct rfkill *bluetooth_rfkill; static struct rfkill *wwan_rfkill; static bool force_rfkill; static bool micmute_led_registered; +static bool mute_led_registered; module_param(force_rfkill, bool, 0444); MODULE_PARM_DESC(force_rfkill, "enable rfkill on non whitelisted models"); @@ -2177,6 +2178,34 @@ static struct led_classdev micmute_led_cdev = { .default_trigger = "audio-micmute", }; +static int mute_led_set(struct led_classdev *led_cdev, + enum led_brightness brightness) +{ + struct calling_interface_buffer buffer; + struct calling_interface_token *token; + int state = brightness != LED_OFF; + + if (state == 0) + token = dell_smbios_find_token(GLOBAL_MUTE_DISABLE); + else + token = dell_smbios_find_token(GLOBAL_MUTE_ENABLE); + + if (!token) + return -ENODEV; + + dell_fill_request(&buffer, token->location, token->value, 0, 0); + dell_send_request(&buffer, CLASS_TOKEN_WRITE, SELECT_TOKEN_STD); + + return 0; +} + +static struct led_classdev mute_led_cdev = { + .name = "platform::mute", + .max_brightness = 1, + .brightness_set_blocking = mute_led_set, + .default_trigger = "audio-mute", +}; + static int __init dell_init(void) { struct calling_interface_token *token; @@ -2230,6 +2259,15 @@ static int __init dell_init(void) micmute_led_registered = true; } + if (dell_smbios_find_token(GLOBAL_MUTE_DISABLE) && + dell_smbios_find_token(GLOBAL_MUTE_ENABLE)) { + mute_led_cdev.brightness = ledtrig_audio_get(LED_AUDIO_MUTE); + ret = led_classdev_register(&platform_device->dev, &mute_led_cdev); + if (ret < 0) + goto fail_backlight; + mute_led_registered = true; + } + if (acpi_video_get_backlight_type() != acpi_backlight_vendor) return 0; @@ -2277,6 +2315,8 @@ fail_get_brightness: fail_backlight: if (micmute_led_registered) led_classdev_unregister(&micmute_led_cdev); + if (mute_led_registered) + led_classdev_unregister(&mute_led_cdev); fail_led: dell_cleanup_rfkill(); fail_rfkill: @@ -2299,6 +2339,8 @@ static void __exit dell_exit(void) backlight_device_unregister(dell_backlight_device); if (micmute_led_registered) led_classdev_unregister(&micmute_led_cdev); + if (mute_led_registered) + led_classdev_unregister(&mute_led_cdev); dell_cleanup_rfkill(); if (platform_device) { platform_device_unregister(platform_device); diff --git a/drivers/platform/x86/dell/dell-smbios.h b/drivers/platform/x86/dell/dell-smbios.h index 75fa8ea0476d..eb341bf000c6 100644 --- a/drivers/platform/x86/dell/dell-smbios.h +++ b/drivers/platform/x86/dell/dell-smbios.h @@ -34,6 +34,8 @@ #define KBD_LED_AUTO_100_TOKEN 0x02F6 #define GLOBAL_MIC_MUTE_ENABLE 0x0364 #define GLOBAL_MIC_MUTE_DISABLE 0x0365 +#define GLOBAL_MUTE_ENABLE 0x058C +#define GLOBAL_MUTE_DISABLE 0x058D struct notifier_block; diff --git a/drivers/platform/x86/dell/dell-smo8800.c b/drivers/platform/x86/dell/dell-smo8800.c index 8d6b7a83cf24..f7ec17c56833 100644 --- a/drivers/platform/x86/dell/dell-smo8800.c +++ b/drivers/platform/x86/dell/dell-smo8800.c @@ -154,14 +154,13 @@ error: return err; } -static int smo8800_remove(struct platform_device *device) +static void smo8800_remove(struct platform_device *device) { struct smo8800_device *smo8800 = platform_get_drvdata(device); free_irq(smo8800->irq, smo8800); misc_deregister(&smo8800->miscdev); dev_dbg(&device->dev, "device /dev/freefall unregistered\n"); - return 0; } /* NOTE: Keep this list in sync with drivers/i2c/busses/i2c-i801.c */ @@ -180,7 +179,7 @@ MODULE_DEVICE_TABLE(acpi, smo8800_ids); static struct platform_driver smo8800_driver = { .probe = smo8800_probe, - .remove = smo8800_remove, + .remove_new = smo8800_remove, .driver = { .name = DRIVER_NAME, .acpi_match_table = smo8800_ids, |