1616#include <linux/thermal.h>
1717#include "acpi_thermal_rel.h"
1818
19+ #define INT3400_THERMAL_TABLE_CHANGED 0x83
20+
1921enum int3400_thermal_uuid {
2022 INT3400_THERMAL_PASSIVE_1 ,
2123 INT3400_THERMAL_ACTIVE ,
@@ -104,7 +106,7 @@ static struct attribute *uuid_attrs[] = {
104106 NULL
105107};
106108
107- static struct attribute_group uuid_attribute_group = {
109+ static const struct attribute_group uuid_attribute_group = {
108110 .attrs = uuid_attrs ,
109111 .name = "uuids"
110112};
@@ -185,6 +187,35 @@ static int int3400_thermal_run_osc(acpi_handle handle,
185187 return result ;
186188}
187189
190+ static void int3400_notify (acpi_handle handle ,
191+ u32 event ,
192+ void * data )
193+ {
194+ struct int3400_thermal_priv * priv = data ;
195+ char * thermal_prop [5 ];
196+
197+ if (!priv )
198+ return ;
199+
200+ switch (event ) {
201+ case INT3400_THERMAL_TABLE_CHANGED :
202+ thermal_prop [0 ] = kasprintf (GFP_KERNEL , "NAME=%s" ,
203+ priv -> thermal -> type );
204+ thermal_prop [1 ] = kasprintf (GFP_KERNEL , "TEMP=%d" ,
205+ priv -> thermal -> temperature );
206+ thermal_prop [2 ] = kasprintf (GFP_KERNEL , "TRIP=" );
207+ thermal_prop [3 ] = kasprintf (GFP_KERNEL , "EVENT=%d" ,
208+ THERMAL_TABLE_CHANGED );
209+ thermal_prop [4 ] = NULL ;
210+ kobject_uevent_env (& priv -> thermal -> device .kobj , KOBJ_CHANGE ,
211+ thermal_prop );
212+ break ;
213+ default :
214+ dev_err (& priv -> adev -> dev , "Unsupported event [0x%x]\n" , event );
215+ break ;
216+ }
217+ }
218+
188219static int int3400_thermal_get_temp (struct thermal_zone_device * thermal ,
189220 int * temp )
190221{
@@ -290,6 +321,12 @@ static int int3400_thermal_probe(struct platform_device *pdev)
290321 if (result )
291322 goto free_zone ;
292323
324+ result = acpi_install_notify_handler (
325+ priv -> adev -> handle , ACPI_DEVICE_NOTIFY , int3400_notify ,
326+ (void * )priv );
327+ if (result )
328+ goto free_zone ;
329+
293330 return 0 ;
294331
295332free_zone :
@@ -306,6 +343,10 @@ static int int3400_thermal_remove(struct platform_device *pdev)
306343{
307344 struct int3400_thermal_priv * priv = platform_get_drvdata (pdev );
308345
346+ acpi_remove_notify_handler (
347+ priv -> adev -> handle , ACPI_DEVICE_NOTIFY ,
348+ int3400_notify );
349+
309350 if (!priv -> rel_misc_dev_res )
310351 acpi_thermal_rel_misc_device_remove (priv -> adev -> handle );
311352
0 commit comments