2
2
/* Author: Dan Scally <[email protected] > */
3
3
4
4
#include <linux/acpi.h>
5
+ #include <linux/bitfield.h>
5
6
#include <linux/device.h>
6
7
#include <linux/gpio/consumer.h>
7
8
#include <linux/gpio/machine.h>
@@ -25,6 +26,10 @@ static const guid_t int3472_gpio_guid =
25
26
GUID_INIT (0x79234640 , 0x9e10 , 0x4fea ,
26
27
0xa5 , 0xc1 , 0xb5 , 0xaa , 0x8b , 0x19 , 0x75 , 0x6f );
27
28
29
+ #define INT3472_GPIO_DSM_TYPE GENMASK(7, 0)
30
+ #define INT3472_GPIO_DSM_PIN GENMASK(15, 8)
31
+ #define INT3472_GPIO_DSM_SENSOR_ON_VAL GENMASK(31, 24)
32
+
28
33
/*
29
34
* 822ace8f-2814-4174-a56b-5f029fe079ee
30
35
* This _DSM GUID returns a string from the sensor device, which acts as a
@@ -174,12 +179,11 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
174
179
return 1 ;
175
180
}
176
181
177
- type = obj -> integer .value & 0xff ;
182
+ type = FIELD_GET ( INT3472_GPIO_DSM_TYPE , obj -> integer .value ) ;
178
183
179
184
int3472_get_func_and_polarity (type , & func , & polarity );
180
185
181
- /* If bits 31-24 of the _DSM entry are all 0 then the signal is inverted */
182
- active_value = obj -> integer .value >> 24 ;
186
+ active_value = FIELD_GET (INT3472_GPIO_DSM_SENSOR_ON_VAL , obj -> integer .value );
183
187
if (!active_value )
184
188
polarity ^= GPIO_ACTIVE_LOW ;
185
189
0 commit comments