From 354572a5e66e6f865f908f7b8a6e5a867ef0c7b6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 16 May 2004 16:21:19 +0000 Subject: [PATCH] Lower conversion rate when forcibly enabling monitoring of battery voltage. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2540 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/pc87360.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/kernel/chips/pc87360.c b/kernel/chips/pc87360.c index bd046698..9eddccfb 100644 --- a/kernel/chips/pc87360.c +++ b/kernel/chips/pc87360.c @@ -157,6 +157,7 @@ static inline u8 PWM_TO_REG(int val, int inv) * Voltage registers and conversions */ +#define PC87365_REG_IN_CONVRATE 0x07 #define PC87365_REG_IN_CONFIG 0x08 #define PC87365_REG_IN 0x0B #define PC87365_REG_IN_MIN 0x0D @@ -662,8 +663,8 @@ static int pc87360_detach_client(struct i2c_client *client) return 0; } -/* ldi is the logical device index: - bank is for voltages and temperatures only. */ +/* ldi is the logical device index + bank is for voltages and temperatures only */ static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank, u8 reg) { @@ -697,6 +698,20 @@ static void pc87360_init_client(struct i2c_client *client) const u8 init_temp[3] = { 2, 2, 1 }; u8 reg; + if (init >= 3) { + reg = pc87360_read_value(data, LD_IN, NO_BANK, + PC87365_REG_IN_CONVRATE); + if (reg & 0x06) { +#ifdef DEBUG + printk(KERN_DEBUG "pc87360.o: Setting " + "VLM conversion period to 1 second\n"); +#endif + pc87360_write_value(data, LD_IN, NO_BANK, + PC87365_REG_IN_CONVRATE, + (reg & 0xF8) | 0x01); + } + } + for (i=0; iinnr; i++) { if (init >= init_in[i]) { /* Forcibly enable voltage channel */