[PATCH v9 6/8] platform/x86: asus-armoury: add screen auto-brightness toggle

Denis Benato posted 8 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH v9 6/8] platform/x86: asus-armoury: add screen auto-brightness toggle
Posted by Denis Benato 3 months, 1 week ago
From: "Luke D. Jones" <luke@ljones.dev>

Add screen_auto_brightness toggle supported on some laptops.

Signed-off-by: Luke D. Jones <luke@ljones.dev>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
 drivers/platform/x86/asus-armoury.c        | 3 +++
 include/linux/platform_data/x86/asus-wmi.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/platform/x86/asus-armoury.c b/drivers/platform/x86/asus-armoury.c
index c94643138fbb..33d71bf64468 100644
--- a/drivers/platform/x86/asus-armoury.c
+++ b/drivers/platform/x86/asus-armoury.c
@@ -733,6 +733,9 @@ ATTR_GROUP_BOOL_RW(panel_od, "panel_overdrive", ASUS_WMI_DEVID_PANEL_OD,
 		   "Set the panel refresh overdrive");
 ATTR_GROUP_BOOL_RW(panel_hd_mode, "panel_hd_mode", ASUS_WMI_DEVID_PANEL_HD,
 		   "Set the panel HD mode to UHD<0> or FHD<1>");
+ATTR_GROUP_BOOL_RW(screen_auto_brightness, "screen_auto_brightness",
+		   ASUS_WMI_DEVID_SCREEN_AUTO_BRIGHTNESS,
+		   "Set the panel brightness to Off<0> or On<1>");
 ATTR_GROUP_BOOL_RO(egpu_connected, "egpu_connected", ASUS_WMI_DEVID_EGPU_CONNECTED,
 		   "Show the eGPU connection status");
 
diff --git a/include/linux/platform_data/x86/asus-wmi.h b/include/linux/platform_data/x86/asus-wmi.h
index d356dfe5ee7c..72fd2fc88bb1 100644
--- a/include/linux/platform_data/x86/asus-wmi.h
+++ b/include/linux/platform_data/x86/asus-wmi.h
@@ -83,6 +83,7 @@
 #define ASUS_WMI_DEVID_LID_FLIP_ROG	0x00060077
 #define ASUS_WMI_DEVID_MINI_LED_MODE	0x0005001E
 #define ASUS_WMI_DEVID_MINI_LED_MODE2	0x0005002E
+#define ASUS_WMI_DEVID_SCREEN_AUTO_BRIGHTNESS	0x0005002A
 
 /* Storage */
 #define ASUS_WMI_DEVID_CARDREADER	0x00080013
-- 
2.50.0

Re: [PATCH v9 6/8] platform/x86: asus-armoury: add screen auto-brightness toggle
Posted by kernel test robot 3 months, 1 week ago
Hi Denis,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.16-rc4 next-20250630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Denis-Benato/platform-x86-asus-wmi-export-symbols-used-for-read-write-WMI/20250629-211651
base:   linus/master
patch link:    https://lore.kernel.org/r/20250629131423.9013-7-benato.denis96%40gmail.com
patch subject: [PATCH v9 6/8] platform/x86: asus-armoury: add screen auto-brightness toggle
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20250630/202506301802.LV9RYF0b-lkp@intel.com/config)
compiler: clang version 20.1.7 (https://github.com/llvm/llvm-project 6146a88f60492b520a36f8f8f3231e15f3cc6082)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250630/202506301802.LV9RYF0b-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506301802.LV9RYF0b-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/platform/x86/asus-armoury.c:736:1: warning: unused variable 'screen_auto_brightness_attr_group' [-Wunused-const-variable]
     736 | ATTR_GROUP_BOOL_RW(screen_auto_brightness, "screen_auto_brightness",
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     737 |                    ASUS_WMI_DEVID_SCREEN_AUTO_BRIGHTNESS,
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     738 |                    "Set the panel brightness to Off<0> or On<1>");
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/asus-armoury.h:128:2: note: expanded from macro 'ATTR_GROUP_BOOL_RW'
     128 |         __ATTR_RW_INT_GROUP_ENUM(_attrname, 0, 1, _wmi, _fsname, "0;1", _dispname)
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/asus-armoury.h:102:38: note: expanded from macro '__ATTR_RW_INT_GROUP_ENUM'
     102 |         static const struct attribute_group _attrname##_attr_group = {  \
         |                                             ^~~~~~~~~~~~~~~~~~~~~~
   <scratch space>:34:1: note: expanded from here
      34 | screen_auto_brightness_attr_group
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +/screen_auto_brightness_attr_group +736 drivers/platform/x86/asus-armoury.c

   708	
   709	static ssize_t cores_efficiency_current_value_store(struct kobject *kobj,
   710							    struct kobj_attribute *attr, const char *buf,
   711							    size_t count)
   712	{
   713		int err;
   714	
   715		err = cores_current_value_store(kobj, attr, buf, CPU_CORE_POWER);
   716		if (err)
   717			return err;
   718	
   719		return count;
   720	}
   721	ATTR_GROUP_CORES_RW(cores_efficiency, "cores_efficiency",
   722			    "Set the max available efficiency cores");
   723	
   724	/* Simple attribute creation */
   725	ATTR_GROUP_ENUM_INT_RO(charge_mode, "charge_mode", ASUS_WMI_DEVID_CHARGE_MODE, "0;1;2",
   726			       "Show the current mode of charging");
   727	
   728	ATTR_GROUP_BOOL_RW(boot_sound, "boot_sound", ASUS_WMI_DEVID_BOOT_SOUND,
   729			   "Set the boot POST sound");
   730	ATTR_GROUP_BOOL_RW(mcu_powersave, "mcu_powersave", ASUS_WMI_DEVID_MCU_POWERSAVE,
   731			   "Set MCU powersaving mode");
   732	ATTR_GROUP_BOOL_RW(panel_od, "panel_overdrive", ASUS_WMI_DEVID_PANEL_OD,
   733			   "Set the panel refresh overdrive");
   734	ATTR_GROUP_BOOL_RW(panel_hd_mode, "panel_hd_mode", ASUS_WMI_DEVID_PANEL_HD,
   735			   "Set the panel HD mode to UHD<0> or FHD<1>");
 > 736	ATTR_GROUP_BOOL_RW(screen_auto_brightness, "screen_auto_brightness",
   737			   ASUS_WMI_DEVID_SCREEN_AUTO_BRIGHTNESS,
   738			   "Set the panel brightness to Off<0> or On<1>");
   739	ATTR_GROUP_BOOL_RO(egpu_connected, "egpu_connected", ASUS_WMI_DEVID_EGPU_CONNECTED,
   740			   "Show the eGPU connection status");
   741	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki