314314#define LED_CHANNELS 3
315315#define LED_MAX_BRIGHTNESS 200
316316
317- #define UNIWILL_FEATURE_FN_LOCK_TOGGLE BIT(0)
318- #define UNIWILL_FEATURE_SUPER_KEY_TOGGLE BIT(1)
317+ #define UNIWILL_FEATURE_FN_LOCK BIT(0)
318+ #define UNIWILL_FEATURE_SUPER_KEY BIT(1)
319319#define UNIWILL_FEATURE_TOUCHPAD_TOGGLE BIT(2)
320320#define UNIWILL_FEATURE_LIGHTBAR BIT(3)
321321#define UNIWILL_FEATURE_BATTERY BIT(4)
@@ -377,11 +377,15 @@ static const struct key_entry uniwill_keymap[] = {
377377 { KE_IGNORE , UNIWILL_OSD_CAPSLOCK , { KEY_CAPSLOCK }},
378378 { KE_IGNORE , UNIWILL_OSD_NUMLOCK , { KEY_NUMLOCK }},
379379
380- /* Reported when the user locks/unlocks the super key */
381- { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_LOCK_ENABLE , { KEY_UNKNOWN }},
382- { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_LOCK_DISABLE , { KEY_UNKNOWN }},
380+ /*
381+ * Reported when the user enables/disables the super key.
382+ * Those events might even be reported when the change was done
383+ * using the sysfs attribute!
384+ */
385+ { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_DISABLE , { KEY_UNKNOWN }},
386+ { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_ENABLE , { KEY_UNKNOWN }},
383387 /* Optional, might not be reported by all devices */
384- { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_LOCK_CHANGED , { KEY_UNKNOWN }},
388+ { KE_IGNORE , UNIWILL_OSD_SUPER_KEY_STATE_CHANGED , { KEY_UNKNOWN }},
385389
386390 /* Reported in manual mode when toggling the airplane mode status */
387391 { KE_KEY , UNIWILL_OSD_RFKILL , { KEY_RFKILL }},
@@ -600,8 +604,8 @@ static const struct regmap_config uniwill_ec_config = {
600604 .use_single_write = true,
601605};
602606
603- static ssize_t fn_lock_toggle_enable_store (struct device * dev , struct device_attribute * attr ,
604- const char * buf , size_t count )
607+ static ssize_t fn_lock_store (struct device * dev , struct device_attribute * attr , const char * buf ,
608+ size_t count )
605609{
606610 struct uniwill_data * data = dev_get_drvdata (dev );
607611 unsigned int value ;
@@ -624,8 +628,7 @@ static ssize_t fn_lock_toggle_enable_store(struct device *dev, struct device_att
624628 return count ;
625629}
626630
627- static ssize_t fn_lock_toggle_enable_show (struct device * dev , struct device_attribute * attr ,
628- char * buf )
631+ static ssize_t fn_lock_show (struct device * dev , struct device_attribute * attr , char * buf )
629632{
630633 struct uniwill_data * data = dev_get_drvdata (dev );
631634 unsigned int value ;
@@ -638,10 +641,10 @@ static ssize_t fn_lock_toggle_enable_show(struct device *dev, struct device_attr
638641 return sysfs_emit (buf , "%d\n" , !!(value & FN_LOCK_STATUS ));
639642}
640643
641- static DEVICE_ATTR_RW (fn_lock_toggle_enable );
644+ static DEVICE_ATTR_RW (fn_lock );
642645
643- static ssize_t super_key_toggle_enable_store (struct device * dev , struct device_attribute * attr ,
644- const char * buf , size_t count )
646+ static ssize_t super_key_enable_store (struct device * dev , struct device_attribute * attr ,
647+ const char * buf , size_t count )
645648{
646649 struct uniwill_data * data = dev_get_drvdata (dev );
647650 unsigned int value ;
@@ -673,8 +676,7 @@ static ssize_t super_key_toggle_enable_store(struct device *dev, struct device_a
673676 return count ;
674677}
675678
676- static ssize_t super_key_toggle_enable_show (struct device * dev , struct device_attribute * attr ,
677- char * buf )
679+ static ssize_t super_key_enable_show (struct device * dev , struct device_attribute * attr , char * buf )
678680{
679681 struct uniwill_data * data = dev_get_drvdata (dev );
680682 unsigned int value ;
@@ -687,7 +689,7 @@ static ssize_t super_key_toggle_enable_show(struct device *dev, struct device_at
687689 return sysfs_emit (buf , "%d\n" , !(value & SUPER_KEY_LOCK_STATUS ));
688690}
689691
690- static DEVICE_ATTR_RW (super_key_toggle_enable );
692+ static DEVICE_ATTR_RW (super_key_enable );
691693
692694static ssize_t touchpad_toggle_enable_store (struct device * dev , struct device_attribute * attr ,
693695 const char * buf , size_t count )
@@ -881,8 +883,8 @@ static int uniwill_nvidia_ctgp_init(struct uniwill_data *data)
881883
882884static struct attribute * uniwill_attrs [] = {
883885 /* Keyboard-related */
884- & dev_attr_fn_lock_toggle_enable .attr ,
885- & dev_attr_super_key_toggle_enable .attr ,
886+ & dev_attr_fn_lock .attr ,
887+ & dev_attr_super_key_enable .attr ,
886888 & dev_attr_touchpad_toggle_enable .attr ,
887889 /* Lightbar-related */
888890 & dev_attr_rainbow_animation .attr ,
@@ -897,13 +899,13 @@ static umode_t uniwill_attr_is_visible(struct kobject *kobj, struct attribute *a
897899 struct device * dev = kobj_to_dev (kobj );
898900 struct uniwill_data * data = dev_get_drvdata (dev );
899901
900- if (attr == & dev_attr_fn_lock_toggle_enable .attr ) {
901- if (uniwill_device_supports (data , UNIWILL_FEATURE_FN_LOCK_TOGGLE ))
902+ if (attr == & dev_attr_fn_lock .attr ) {
903+ if (uniwill_device_supports (data , UNIWILL_FEATURE_FN_LOCK ))
902904 return attr -> mode ;
903905 }
904906
905- if (attr == & dev_attr_super_key_toggle_enable .attr ) {
906- if (uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY_TOGGLE ))
907+ if (attr == & dev_attr_super_key_enable .attr ) {
908+ if (uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY ))
907909 return attr -> mode ;
908910 }
909911
@@ -1505,7 +1507,7 @@ static void uniwill_shutdown(struct platform_device *pdev)
15051507
15061508static int uniwill_suspend_keyboard (struct uniwill_data * data )
15071509{
1508- if (!uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY_TOGGLE ))
1510+ if (!uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY ))
15091511 return 0 ;
15101512
15111513 /*
@@ -1565,7 +1567,7 @@ static int uniwill_resume_keyboard(struct uniwill_data *data)
15651567 unsigned int value ;
15661568 int ret ;
15671569
1568- if (!uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY_TOGGLE ))
1570+ if (!uniwill_device_supports (data , UNIWILL_FEATURE_SUPER_KEY ))
15691571 return 0 ;
15701572
15711573 ret = regmap_read (data -> regmap , EC_ADDR_SWITCH_STATUS , & value );
@@ -1643,16 +1645,16 @@ static struct platform_driver uniwill_driver = {
16431645};
16441646
16451647static struct uniwill_device_descriptor lapac71h_descriptor __initdata = {
1646- .features = UNIWILL_FEATURE_FN_LOCK_TOGGLE |
1647- UNIWILL_FEATURE_SUPER_KEY_TOGGLE |
1648+ .features = UNIWILL_FEATURE_FN_LOCK |
1649+ UNIWILL_FEATURE_SUPER_KEY |
16481650 UNIWILL_FEATURE_TOUCHPAD_TOGGLE |
16491651 UNIWILL_FEATURE_BATTERY |
16501652 UNIWILL_FEATURE_HWMON ,
16511653};
16521654
16531655static struct uniwill_device_descriptor lapkc71f_descriptor __initdata = {
1654- .features = UNIWILL_FEATURE_FN_LOCK_TOGGLE |
1655- UNIWILL_FEATURE_SUPER_KEY_TOGGLE |
1656+ .features = UNIWILL_FEATURE_FN_LOCK |
1657+ UNIWILL_FEATURE_SUPER_KEY |
16561658 UNIWILL_FEATURE_TOUCHPAD_TOGGLE |
16571659 UNIWILL_FEATURE_LIGHTBAR |
16581660 UNIWILL_FEATURE_BATTERY |
0 commit comments