mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			56 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
	
		
			1.6 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From aa97a44297179ab6ba1aa8f59e781541a320066b Mon Sep 17 00:00:00 2001
 | |
| From: Frank Wunderlich <frank-w@public-files.de>
 | |
| Date: Fri, 31 Jan 2020 17:28:04 +0100
 | |
| Subject: [PATCH] thermal: mediatek: add sensors-support
 | |
| 
 | |
| ---
 | |
|  drivers/thermal/mtk_thermal.c | 22 ++++++++++++++++++++++
 | |
|  1 file changed, 22 insertions(+)
 | |
| 
 | |
| diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
 | |
| index d1b066383c45..8cf3a69bfa46 100644
 | |
| --- a/drivers/thermal/mtk_thermal.c
 | |
| +++ b/drivers/thermal/mtk_thermal.c
 | |
| @@ -23,6 +23,8 @@
 | |
|  #include <linux/reset.h>
 | |
|  #include <linux/types.h>
 | |
|  
 | |
| +#include "thermal_hwmon.h"
 | |
| +
 | |
|  /* AUXADC Registers */
 | |
|  #define AUXADC_CON1_SET_V	0x008
 | |
|  #define AUXADC_CON1_CLR_V	0x00c
 | |
| @@ -990,6 +992,13 @@ static void mtk_thermal_release_periodic_ts(struct mtk_thermal *mt,
 | |
|  	writel((tmp & (~0x10e)), mt->thermal_base + TEMP_MSRCTL1);
 | |
|  }
 | |
|  
 | |
| +static void mtk_thermal_hwmon_action(void *data)
 | |
| +{
 | |
| +	struct thermal_zone_device *zone = data;
 | |
| +
 | |
| +	thermal_remove_hwmon_sysfs(zone);
 | |
| +}
 | |
| +
 | |
|  static int mtk_thermal_probe(struct platform_device *pdev)
 | |
|  {
 | |
|  	int ret, i, ctrl_id;
 | |
| @@ -1094,6 +1103,19 @@ static int mtk_thermal_probe(struct platform_device *pdev)
 | |
|  		goto err_disable_clk_peri_therm;
 | |
|  	}
 | |
|  
 | |
| +	tzdev->tzp->no_hwmon = false;
 | |
| +	ret = thermal_add_hwmon_sysfs(tzdev);
 | |
| +	if (ret)
 | |
| +		dev_err(&pdev->dev,"error in thermal_add_hwmon_sysfs");
 | |
| +		//goto err_disable_clk_peri_therm;
 | |
| +
 | |
| +	ret = devm_add_action(&pdev->dev, mtk_thermal_hwmon_action, tzdev);
 | |
| +	if (ret) {
 | |
| +		dev_err(&pdev->dev,"error in devm_add_action");
 | |
| +		mtk_thermal_hwmon_action(tzdev);
 | |
| +		//goto err_disable_clk_peri_therm;
 | |
| +	}
 | |
| +
 | |
|  	return 0;
 | |
|  
 | |
|  err_disable_clk_peri_therm:
 |