mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	hwmon: (gsc-hwmon) Scale temperature to millidegrees
The GSC registers report temperature in decidegrees celcius so we
need to scale it to represent the hwmon sysfs API of millidegrees.
Cc: stable@vger.kernel.org
Fixes: 3bce5377ef ("hwmon: Add Gateworks System Controller support")
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Link: https://lore.kernel.org/r/1598548824-16898-1-git-send-email-tharvey@gateworks.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
			
			
This commit is contained in:
		
							parent
							
								
									cecf7560f0
								
							
						
					
					
						commit
						c1ae18d313
					
				
					 1 changed files with 1 additions and 0 deletions
				
			
		| 
						 | 
					@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
 | 
				
			||||||
	case mode_temperature:
 | 
						case mode_temperature:
 | 
				
			||||||
		if (tmp > 0x8000)
 | 
							if (tmp > 0x8000)
 | 
				
			||||||
			tmp -= 0xffff;
 | 
								tmp -= 0xffff;
 | 
				
			||||||
 | 
							tmp *= 100; /* convert to millidegrees celsius */
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case mode_voltage_raw:
 | 
						case mode_voltage_raw:
 | 
				
			||||||
		tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
 | 
							tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue