From: Hans de Goede <hdegoede@redhat.com>
To: Koba Ko <koba.ko@canonical.com>,
Mark Gross <markgross@kernel.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] platform/x86: dell-laptop: Register ctl-led for speaker-mute
Date: Thu, 16 Mar 2023 14:49:44 +0100 [thread overview]
Message-ID: <8df8f02c-6dd0-e9bd-e2de-6b0d132b2b77@redhat.com> (raw)
In-Reply-To: <20230308062414.1048913-1-koba.ko@canonical.com>
Hi,
On 3/8/23 07:24, Koba Ko wrote:
> Some platforms have the speaker-mute led and
> current driver doesn't control it.
>
> If the platform support the control of speaker-mute led, register it
>
> Signed-off-by: Koba Ko <koba.ko@canonical.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
>
> V2: Remove the dell-privacy rule for speaker-mute.
> ---
> drivers/platform/x86/dell/dell-laptop.c | 42 +++++++++++++++++++++++++
> drivers/platform/x86/dell/dell-smbios.h | 2 ++
> 2 files changed, 44 insertions(+)
>
> diff --git a/drivers/platform/x86/dell/dell-laptop.c b/drivers/platform/x86/dell/dell-laptop.c
> index e92c3ad06d696..5ed628617f63c 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_led;
> + mute_led_registered = true;
> + }
> +
> if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
> return 0;
>
> @@ -2277,6 +2315,8 @@ static int __init dell_init(void)
> 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 75fa8ea0476dc..eb341bf000c67 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;
>
prev parent reply other threads:[~2023-03-16 13:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-08 6:24 Koba Ko
2023-03-16 13:49 ` Hans de Goede [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8df8f02c-6dd0-e9bd-e2de-6b0d132b2b77@redhat.com \
--to=hdegoede@redhat.com \
--cc=koba.ko@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®