[<prev] [next>] [day] [month] [year] [list]
Message-ID: <E1322B23-1B84-4E72-A106-1F6B1F6F8504@marvell.com>
Date: Thu, 1 Sep 2011 19:10:29 -0700
From: Philip Rakity <prakity@...vell.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] power: max8925_power: Do not read random data from
chip registers
Reading the voltage, charge etc requires that we tell the chip
what property we want to read before reading it according to
maxim.
Signed-off-by: Philip Rakity <prakity@...vell.com>
Signed-off-by: Thomas Liu <Thomas.Liu@...im-ic.com>
Tested-by: Ted Bennett <tbennett@...vell.com>
---
drivers/power/max8925_power.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c
index f808608..b56c78a 100644
--- a/drivers/power/max8925_power.c
+++ b/drivers/power/max8925_power.c
@@ -245,25 +245,30 @@ irqreturn_t max8925_charger_handler(int irq, void *data)
static int start_measure(struct max8925_power_info *info, int type)
{
unsigned char buf[2] = {0, 0};
- int meas_reg = 0, ret;
+ int meas_reg = 0, meas_cmd = 0, ret;
switch (type) {
case MEASURE_VCHG:
+ meas_cmd = MAX8925_CMD_VCHG;
meas_reg = MAX8925_ADC_VCHG;
break;
case MEASURE_VBBATT:
+ meas_cmd = MAX8925_CMD_VBBATT;
meas_reg = MAX8925_ADC_VBBATT;
break;
case MEASURE_VMBATT:
+ meas_cmd = MAX8925_CMD_VMBATT;
meas_reg = MAX8925_ADC_VMBATT;
break;
case MEASURE_ISNS:
+ meas_cmd = MAX8925_CMD_ISNS;
meas_reg = MAX8925_ADC_ISNS;
break;
default:
return -EINVAL;
}
+ max8925_reg_write(info->adc, meas_cmd, 0);
max8925_bulk_read(info->adc, meas_reg, 2, buf);
ret = ((buf[0]<<8) | buf[1]) >> 4;
--
1.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists