• João Paulo Rechi Vita's avatar
    asus-wireless: Toggle airplane mode LED · 2c1a49c9
    João Paulo Rechi Vita authored
    In the ASHS device we have the HSWC method, which calls either OWGD or
    OWGS, depending on its parameter:
    
    	Device (ASHS)
    	{
    		Name (_HID, "ATK4002")  // _HID: Hardware ID
    		Method (HSWC, 1, Serialized)
    		{
    			If ((Arg0 < 0x02))
    			{
    				OWGD (Arg0)
    				Return (One)
    			}
    			If ((Arg0 == 0x02))
    			{
    				Local0 = OWGS ()
    				If (Local0)
    				{
    					Return (0x05)
    				}
    				Else
    				{
    					Return (0x04)
    				}
    			}
    			If ((Arg0 == 0x03))
    			{
    				Return (0xFF)
    			}
    			If ((Arg0 == 0x04))
    			{
    				OWGD (Zero)
    				Return (One)
    			}
    			If ((Arg0 == 0x05))
    			{
    				OWGD (One)
    				Return (One)
    			}
    			If ((Arg0 == 0x80))
    			{
    				Return (One)
    			}
    		}
    		Method (_STA, 0, NotSerialized)  // _STA: Status
    		{
    			If ((MSOS () >= OSW8))
    			{
    				Return (0x0F)
    			}
    			Else
    			{
    				Return (Zero)
    			}
    		}
    	}
    
    On the Asus laptops that do not have an airplane mode LED, OWGD has an
    empty implementation and OWGS simply returns 0. On the ones that have an
    airplane mode LED these methods have the following implementation:
    
    	Method (OWGD, 1, Serialized)
    	{
    		SGPL (0x0203000F, Arg0)
    		SGPL (0x0203000F, Arg0)
    	}
    
    	Method (OWGS, 0, Serialized)
    	{
    		Store (RGPL (0x0203000F), Local0)
    		Return (Local0)
    	}
    
    Where OWGD(1) sets the airplane mode LED ON, OWGD(0) set it off, and
    OWGS() returns its state.
    
    This commit exposes the airplane mode indicator LED to userspace under
    the name asus-wireless::airplane, so it can be driven according to
    userspace's policy.
    Signed-off-by: default avatarJoão Paulo Rechi Vita <jprvita@endlessm.com>
    Reviewed-by: default avatarCorentin Chary <corentin.chary@gmail.com>
    Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
    2c1a49c9
asus-wireless.c 4.48 KB