forked from mirrors/linux
		
	hwmon: (max34440) Add support for 'lowest' output voltage attribute
MAX34440 and compatibles support reporting the lowest measured output voltage. Add support for it. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
		
							parent
							
								
									f15df57ded
								
							
						
					
					
						commit
						56aad5d143
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		|  | @ -56,6 +56,7 @@ in[1-6]_min_alarm	Voltage low alarm. From VOLTAGE_UV_WARNING status. | ||||||
| in[1-6]_max_alarm	Voltage high alarm. From VOLTAGE_OV_WARNING status. | in[1-6]_max_alarm	Voltage high alarm. From VOLTAGE_OV_WARNING status. | ||||||
| in[1-6]_lcrit_alarm	Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | in[1-6]_lcrit_alarm	Voltage critical low alarm. From VOLTAGE_UV_FAULT status. | ||||||
| in[1-6]_crit_alarm	Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | in[1-6]_crit_alarm	Voltage critical high alarm. From VOLTAGE_OV_FAULT status. | ||||||
|  | in[1-6]_lowest		Historical minimum voltage. | ||||||
| in[1-6]_highest		Historical maximum voltage. | in[1-6]_highest		Historical maximum voltage. | ||||||
| in[1-6]_reset_history	Write any value to reset history. | in[1-6]_reset_history	Write any value to reset history. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ enum chips { max34440, max34441 }; | ||||||
| #define MAX34440_MFR_VOUT_PEAK		0xd4 | #define MAX34440_MFR_VOUT_PEAK		0xd4 | ||||||
| #define MAX34440_MFR_IOUT_PEAK		0xd5 | #define MAX34440_MFR_IOUT_PEAK		0xd5 | ||||||
| #define MAX34440_MFR_TEMPERATURE_PEAK	0xd6 | #define MAX34440_MFR_TEMPERATURE_PEAK	0xd6 | ||||||
|  | #define MAX34440_MFR_VOUT_MIN		0xd7 | ||||||
| 
 | 
 | ||||||
| #define MAX34440_STATUS_OC_WARN		(1 << 0) | #define MAX34440_STATUS_OC_WARN		(1 << 0) | ||||||
| #define MAX34440_STATUS_OC_FAULT	(1 << 1) | #define MAX34440_STATUS_OC_FAULT	(1 << 1) | ||||||
|  | @ -41,6 +42,10 @@ static int max34440_read_word_data(struct i2c_client *client, int page, int reg) | ||||||
| 	int ret; | 	int ret; | ||||||
| 
 | 
 | ||||||
| 	switch (reg) { | 	switch (reg) { | ||||||
|  | 	case PMBUS_VIRT_READ_VOUT_MIN: | ||||||
|  | 		ret = pmbus_read_word_data(client, page, | ||||||
|  | 					   MAX34440_MFR_VOUT_MIN); | ||||||
|  | 		break; | ||||||
| 	case PMBUS_VIRT_READ_VOUT_MAX: | 	case PMBUS_VIRT_READ_VOUT_MAX: | ||||||
| 		ret = pmbus_read_word_data(client, page, | 		ret = pmbus_read_word_data(client, page, | ||||||
| 					   MAX34440_MFR_VOUT_PEAK); | 					   MAX34440_MFR_VOUT_PEAK); | ||||||
|  | @ -72,6 +77,10 @@ static int max34440_write_word_data(struct i2c_client *client, int page, | ||||||
| 
 | 
 | ||||||
| 	switch (reg) { | 	switch (reg) { | ||||||
| 	case PMBUS_VIRT_RESET_VOUT_HISTORY: | 	case PMBUS_VIRT_RESET_VOUT_HISTORY: | ||||||
|  | 		ret = pmbus_write_word_data(client, page, | ||||||
|  | 					    MAX34440_MFR_VOUT_MIN, 0x7fff); | ||||||
|  | 		if (ret) | ||||||
|  | 			break; | ||||||
| 		ret = pmbus_write_word_data(client, page, | 		ret = pmbus_write_word_data(client, page, | ||||||
| 					    MAX34440_MFR_VOUT_PEAK, 0); | 					    MAX34440_MFR_VOUT_PEAK, 0); | ||||||
| 		break; | 		break; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Guenter Roeck
						Guenter Roeck