diff options
author | Zhang Rui <rui.zhang@intel.com> | 2014-03-23 11:34:26 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2014-10-10 01:57:10 -0400 |
commit | c5738dddc01be49cf6712f886371177e8df36291 (patch) | |
tree | 8b82b59db21a16943f4d4d4af143120e0335300f /drivers/thermal | |
parent | 816cab931f288c92a3404b1b984576f4822b0445 (diff) |
Thermal: int3400 thermal: add capability to detect supporting UUIDs
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/int340x_thermal/int3400_thermal.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/thermal/int340x_thermal/int3400_thermal.c b/drivers/thermal/int340x_thermal/int3400_thermal.c index 308c1850edee..65c63ba8b314 100644 --- a/drivers/thermal/int340x_thermal/int3400_thermal.c +++ b/drivers/thermal/int340x_thermal/int3400_thermal.c | |||
@@ -41,14 +41,79 @@ struct trt { | |||
41 | u64 reverved4; | 41 | u64 reverved4; |
42 | }; | 42 | }; |
43 | 43 | ||
44 | enum int3400_thermal_uuid { | ||
45 | INT3400_THERMAL_PASSIVE_1, | ||
46 | INT3400_THERMAL_PASSIVE_2, | ||
47 | INT3400_THERMAL_ACTIVE, | ||
48 | INT3400_THERMAL_CRITICAL, | ||
49 | INT3400_THERMAL_COOLING_MODE, | ||
50 | INT3400_THERMAL_MAXIMUM_UUID, | ||
51 | }; | ||
52 | |||
53 | static u8 *int3400_thermal_uuids[INT3400_THERMAL_MAXIMUM_UUID] = { | ||
54 | "42A441D6-AE6A-462b-A84B-4A8CE79027D3", | ||
55 | "9E04115A-AE87-4D1C-9500-0F3E340BFE75", | ||
56 | "3A95C389-E4B8-4629-A526-C52C88626BAE", | ||
57 | "97C68AE7-15FA-499c-B8C9-5DA81D606E0A", | ||
58 | "16CAF1B7-DD38-40ed-B1C1-1B8A1913D531", | ||
59 | }; | ||
60 | |||
44 | struct int3400_thermal_priv { | 61 | struct int3400_thermal_priv { |
45 | struct acpi_device *adev; | 62 | struct acpi_device *adev; |
46 | int art_count; | 63 | int art_count; |
47 | struct art *arts; | 64 | struct art *arts; |
48 | int trt_count; | 65 | int trt_count; |
49 | struct trt *trts; | 66 | struct trt *trts; |
67 | u8 uuid_bitmap; | ||
50 | }; | 68 | }; |
51 | 69 | ||
70 | static int int3400_thermal_get_uuids(struct int3400_thermal_priv *priv) | ||
71 | { | ||
72 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL}; | ||
73 | union acpi_object *obja, *objb; | ||
74 | int i, j; | ||
75 | int result = 0; | ||
76 | acpi_status status; | ||
77 | |||
78 | status = acpi_evaluate_object(priv->adev->handle, "IDSP", NULL, &buf); | ||
79 | if (ACPI_FAILURE(status)) | ||
80 | return -ENODEV; | ||
81 | |||
82 | obja = (union acpi_object *)buf.pointer; | ||
83 | if (obja->type != ACPI_TYPE_PACKAGE) { | ||
84 | result = -EINVAL; | ||
85 | goto end; | ||
86 | } | ||
87 | |||
88 | for (i = 0; i < obja->package.count; i++) { | ||
89 | objb = &obja->package.elements[i]; | ||
90 | if (objb->type != ACPI_TYPE_BUFFER) { | ||
91 | result = -EINVAL; | ||
92 | goto end; | ||
93 | } | ||
94 | |||
95 | /* UUID must be 16 bytes */ | ||
96 | if (objb->buffer.length != 16) { | ||
97 | result = -EINVAL; | ||
98 | goto end; | ||
99 | } | ||
100 | |||
101 | for (j = 0; j < INT3400_THERMAL_MAXIMUM_UUID; j++) { | ||
102 | u8 uuid[16]; | ||
103 | |||
104 | acpi_str_to_uuid(int3400_thermal_uuids[j], uuid); | ||
105 | if (!strncmp(uuid, objb->buffer.pointer, 16)) { | ||
106 | priv->uuid_bitmap |= (1 << j); | ||
107 | break; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | end: | ||
113 | kfree(buf.pointer); | ||
114 | return result; | ||
115 | } | ||
116 | |||
52 | static int parse_art(struct int3400_thermal_priv *priv) | 117 | static int parse_art(struct int3400_thermal_priv *priv) |
53 | { | 118 | { |
54 | acpi_handle handle = priv->adev->handle; | 119 | acpi_handle handle = priv->adev->handle; |
@@ -193,6 +258,10 @@ static int int3400_thermal_probe(struct platform_device *pdev) | |||
193 | 258 | ||
194 | priv->adev = adev; | 259 | priv->adev = adev; |
195 | 260 | ||
261 | result = int3400_thermal_get_uuids(priv); | ||
262 | if (result) | ||
263 | goto free_priv; | ||
264 | |||
196 | result = parse_art(priv); | 265 | result = parse_art(priv); |
197 | if (result) | 266 | if (result) |
198 | goto free_priv; | 267 | goto free_priv; |