diff mbox series

[v2,4/7] platform/x86: ideapad-laptop: Add new _CFG bit numbers for future use

Message ID 20221029120311.11152-5-erayorcunus@gmail.com (mailing list archive)
State Mainlined
Commit be5dd7d8359de9fb22115a63f09981cdf689db4f
Headers show
Series Add camera access keys, IdeaPad driver improvements | expand

Commit Message

Eray Orçunus Oct. 29, 2022, 12:03 p.m. UTC
Later IdeaPads report various things in last 8 bits of _CFG, at least
5 of them represent supported on-screen-displays. Add those bit numbers
to the enum, and use CFG_OSD_ as prefix of their names. Also expose
the values of these bits to debugfs, since they can be useful.

Signed-off-by: Eray Orçunus <erayorcunus@gmail.com>
---
 drivers/platform/x86/ideapad-laptop.c | 33 +++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

Comments

Hans de Goede Nov. 15, 2022, 8:36 p.m. UTC | #1
Hi,

On 10/29/22 14:03, Eray Orçunus wrote:
> Later IdeaPads report various things in last 8 bits of _CFG, at least
> 5 of them represent supported on-screen-displays. Add those bit numbers
> to the enum, and use CFG_OSD_ as prefix of their names. Also expose
> the values of these bits to debugfs, since they can be useful.
> 
> Signed-off-by: Eray Orçunus <erayorcunus@gmail.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



> ---
>  drivers/platform/x86/ideapad-laptop.c | 33 +++++++++++++++++++++++----
>  1 file changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
> index 0ef40b88b240..f3d4f2beda07 100644
> --- a/drivers/platform/x86/ideapad-laptop.c
> +++ b/drivers/platform/x86/ideapad-laptop.c
> @@ -46,10 +46,22 @@ static const char *const ideapad_wmi_fnesc_events[] = {
>  #endif
>  
>  enum {
> -	CFG_CAP_BT_BIT   = 16,
> -	CFG_CAP_3G_BIT   = 17,
> -	CFG_CAP_WIFI_BIT = 18,
> -	CFG_CAP_CAM_BIT  = 19,
> +	CFG_CAP_BT_BIT       = 16,
> +	CFG_CAP_3G_BIT       = 17,
> +	CFG_CAP_WIFI_BIT     = 18,
> +	CFG_CAP_CAM_BIT      = 19,
> +
> +	/*
> +	 * These are OnScreenDisplay support bits that can be useful to determine
> +	 * whether a hotkey exists/should show OSD. But they aren't particularly
> +	 * meaningful since they were introduced later, i.e. 2010 IdeaPads
> +	 * don't have these, but they still have had OSD for hotkeys.
> +	 */
> +	CFG_OSD_NUMLK_BIT    = 27,
> +	CFG_OSD_CAPSLK_BIT   = 28,
> +	CFG_OSD_MICMUTE_BIT  = 29,
> +	CFG_OSD_TOUCHPAD_BIT = 30,
> +	CFG_OSD_CAM_BIT      = 31,
>  };
>  
>  enum {
> @@ -368,6 +380,19 @@ static int debugfs_cfg_show(struct seq_file *s, void *data)
>  		seq_puts(s, " camera");
>  	seq_puts(s, "\n");
>  
> +	seq_puts(s, "OSD support:");
> +	if (test_bit(CFG_OSD_NUMLK_BIT, &priv->cfg))
> +		seq_puts(s, " num-lock");
> +	if (test_bit(CFG_OSD_CAPSLK_BIT, &priv->cfg))
> +		seq_puts(s, " caps-lock");
> +	if (test_bit(CFG_OSD_MICMUTE_BIT, &priv->cfg))
> +		seq_puts(s, " mic-mute");
> +	if (test_bit(CFG_OSD_TOUCHPAD_BIT, &priv->cfg))
> +		seq_puts(s, " touchpad");
> +	if (test_bit(CFG_OSD_CAM_BIT, &priv->cfg))
> +		seq_puts(s, " camera");
> +	seq_puts(s, "\n");
> +
>  	seq_puts(s, "Graphics: ");
>  	switch (priv->cfg & 0x700) {
>  	case 0x100:
diff mbox series

Patch

diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 0ef40b88b240..f3d4f2beda07 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -46,10 +46,22 @@  static const char *const ideapad_wmi_fnesc_events[] = {
 #endif
 
 enum {
-	CFG_CAP_BT_BIT   = 16,
-	CFG_CAP_3G_BIT   = 17,
-	CFG_CAP_WIFI_BIT = 18,
-	CFG_CAP_CAM_BIT  = 19,
+	CFG_CAP_BT_BIT       = 16,
+	CFG_CAP_3G_BIT       = 17,
+	CFG_CAP_WIFI_BIT     = 18,
+	CFG_CAP_CAM_BIT      = 19,
+
+	/*
+	 * These are OnScreenDisplay support bits that can be useful to determine
+	 * whether a hotkey exists/should show OSD. But they aren't particularly
+	 * meaningful since they were introduced later, i.e. 2010 IdeaPads
+	 * don't have these, but they still have had OSD for hotkeys.
+	 */
+	CFG_OSD_NUMLK_BIT    = 27,
+	CFG_OSD_CAPSLK_BIT   = 28,
+	CFG_OSD_MICMUTE_BIT  = 29,
+	CFG_OSD_TOUCHPAD_BIT = 30,
+	CFG_OSD_CAM_BIT      = 31,
 };
 
 enum {
@@ -368,6 +380,19 @@  static int debugfs_cfg_show(struct seq_file *s, void *data)
 		seq_puts(s, " camera");
 	seq_puts(s, "\n");
 
+	seq_puts(s, "OSD support:");
+	if (test_bit(CFG_OSD_NUMLK_BIT, &priv->cfg))
+		seq_puts(s, " num-lock");
+	if (test_bit(CFG_OSD_CAPSLK_BIT, &priv->cfg))
+		seq_puts(s, " caps-lock");
+	if (test_bit(CFG_OSD_MICMUTE_BIT, &priv->cfg))
+		seq_puts(s, " mic-mute");
+	if (test_bit(CFG_OSD_TOUCHPAD_BIT, &priv->cfg))
+		seq_puts(s, " touchpad");
+	if (test_bit(CFG_OSD_CAM_BIT, &priv->cfg))
+		seq_puts(s, " camera");
+	seq_puts(s, "\n");
+
 	seq_puts(s, "Graphics: ");
 	switch (priv->cfg & 0x700) {
 	case 0x100: