@@ -238,6 +238,7 @@ struct asus_wmi {
238
238
struct led_classdev lightbar_led ;
239
239
int lightbar_led_wk ;
240
240
struct led_classdev micmute_led ;
241
+ struct led_classdev camera_led ;
241
242
struct workqueue_struct * led_workqueue ;
242
243
struct work_struct tpd_led_work ;
243
244
struct work_struct wlan_led_work ;
@@ -1642,13 +1643,35 @@ static int micmute_led_set(struct led_classdev *led_cdev,
1642
1643
return err < 0 ? err : 0 ;
1643
1644
}
1644
1645
1646
+ static enum led_brightness camera_led_get (struct led_classdev * led_cdev )
1647
+ {
1648
+ struct asus_wmi * asus ;
1649
+ u32 result ;
1650
+
1651
+ asus = container_of (led_cdev , struct asus_wmi , camera_led );
1652
+ asus_wmi_get_devstate (asus , ASUS_WMI_DEVID_CAMERA_LED , & result );
1653
+
1654
+ return result & ASUS_WMI_DSTS_BRIGHTNESS_MASK ;
1655
+ }
1656
+
1657
+ static int camera_led_set (struct led_classdev * led_cdev ,
1658
+ enum led_brightness brightness )
1659
+ {
1660
+ int state = brightness != LED_OFF ;
1661
+ int err ;
1662
+
1663
+ err = asus_wmi_set_devstate (ASUS_WMI_DEVID_CAMERA_LED , state , NULL );
1664
+ return err < 0 ? err : 0 ;
1665
+ }
1666
+
1645
1667
static void asus_wmi_led_exit (struct asus_wmi * asus )
1646
1668
{
1647
1669
led_classdev_unregister (& asus -> kbd_led );
1648
1670
led_classdev_unregister (& asus -> tpd_led );
1649
1671
led_classdev_unregister (& asus -> wlan_led );
1650
1672
led_classdev_unregister (& asus -> lightbar_led );
1651
1673
led_classdev_unregister (& asus -> micmute_led );
1674
+ led_classdev_unregister (& asus -> camera_led );
1652
1675
1653
1676
if (asus -> led_workqueue )
1654
1677
destroy_workqueue (asus -> led_workqueue );
@@ -1740,6 +1763,18 @@ static int asus_wmi_led_init(struct asus_wmi *asus)
1740
1763
goto error ;
1741
1764
}
1742
1765
1766
+ if (asus_wmi_dev_is_present (asus , ASUS_WMI_DEVID_CAMERA_LED )) {
1767
+ asus -> camera_led .name = "asus::camera" ;
1768
+ asus -> camera_led .max_brightness = 1 ;
1769
+ asus -> camera_led .brightness_get = camera_led_get ;
1770
+ asus -> camera_led .brightness_set_blocking = camera_led_set ;
1771
+
1772
+ rv = led_classdev_register (& asus -> platform_device -> dev ,
1773
+ & asus -> camera_led );
1774
+ if (rv )
1775
+ goto error ;
1776
+ }
1777
+
1743
1778
error :
1744
1779
if (rv )
1745
1780
asus_wmi_led_exit (asus );
0 commit comments