mfd: twl4030-madc: Add support for raw value in twl4030_madc_conversion
Subsystems (2)
PATCH 1/2 mfd: twl4030-madc: Add support for raw value in twl4030_madc_conversion
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).
For Nokia RX-51 there is rx51_battery power_supply driver which reporting battery information via twl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to struct twl4030_madc_request which tell twl4030-madc driver to not convert values, but rather return raw.
--- drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/mfd/twl4030-madc.c +10 -4
@@ -211,12 +211,14 @@ static int twl4030battery_current(int raw_volt)* @reg_base - Base address of the first channel * @Channels - 16 bit bitmap. If the bit is set, channel value is read * @buf - The channel values are stored here. if read fails error +* @raw - Return raw values without conversion * value is stored * Returns the number of successfully read channels. */ static int twl4030_madc_read_channels (struct twl4030_madc_data *madc,u8 reg_base,unsigned -long channels,int *buf) +long channels,int *buf, +bool raw) {int count =0 , count_req =0 , i;u8 reg;
@@ -230,6 +232,10 @@ static int twl4030_madc_read_channels(struct twl4030_madc_data *madc, count_req++;continue ; } +if (raw) { + count++; +continue ; + }switch (i) {case 10 : buf[i] =twl4030battery_current (buf[i]);
@@ -371,7 +377,7 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc) method = &twl4030_conversion_methods[r->method];/* Read results */ len =twl4030_madc_read_channels (madc, method->rbase, - r->channels, r->rbuf); + r->channels, r->rbuf, r->raw);/* Return results to caller */ if (r->func_cb !=NULL ) { r->func_cb (len, r->channels, r->rbuf);
@@ -397,7 +403,7 @@ err_i2c: method = &twl4030_conversion_methods[r->method];/* Read results */ len =twl4030_madc_read_channels (madc, method->rbase, - r->channels, r->rbuf); + r->channels, r->rbuf, r->raw);/* Return results to caller */ if (r->func_cb !=NULL ) { r->func_cb (len, r->channels, r->rbuf);
@@ -585,7 +591,7 @@ int twl4030_madc_conversion(struct twl4030_madc_request *req) goto out; } ret =twl4030_madc_read_channels (twl4030_madc, method->rbase, - req->channels, req->rbuf); + req->channels, req->rbuf, req->raw); twl4030_madc->requests[req->method].active =0 ; out:
include/linux/i2c/twl4030-madc.h +2 -0
@@ -39,6 +39,7 @@ struct twl4030_madc_conversion_method {* @do_avgP: sample the input channel for 4 consecutive cycles * @method: RT, SW1, SW2 * @type: Polling or interrupt based method +* @raw: Return raw value, do not convert it */ struct twl4030_madc_request {
@@ -48,6 +49,7 @@ struct twl4030_madc_request {u16 type;bool active;bool result_pending; +bool raw;int rbuf[TWL4030_MADC_MAX_CHANNELS ];void (*func_cb)(int len,int channels,int *buf); };
Signature · 1 line
1.7.10.4
PATCH 2/2 power: rx51_battery: Fix reporting correct values
Tell twl4030_madc_conversion that this driver needs raw values. Driver twl4030_madc has some hardcoded values and conversation functions which are incorrect for Nokia RX-51 board. This driver rx51_battery expects raw values which convert itself.
This patch fixing values reported by power supply interface. Before this patch driver reported always incorrect values on 3.8 kernel (sometimes design capacity was negative).
--- drivers/power/rx51_battery.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/rx51_battery.c +1 -0
@@ -42,6 +42,7 @@ static int rx51_battery_read_adc(int channel) req.method =TWL4030_MADC_SW1 ; req.func_cb =NULL ; req.type =TWL4030_MADC_WAIT ; + req.raw = true;if (twl4030_madc_conversion (&req) <=0 )return -ENODATA ;
Signature · 1 line
1.7.10.4
Re: [PATCH 2/2] power: rx51_battery: Fix reporting correct values
Quoted 10 lines · Pali Rohár
Tell
twl4030_madc_conversionthat this driver needs raw values. Drivertwl4030_madchas some hardcoded values and conversation functions which are incorrect for Nokia RX-51 board. This driverrx51_batteryexpects raw values which convert itself.This patch fixing values reported by power supply interface. Before this patch driver reported always incorrect values on 3.8 kernel (sometimes design capacity was negative).
Signed-off-by Pali Rohár <[email protected]>
Assuming you want to pass the series via MFD tree,
Thanks!
Quoted 18 lines
--- drivers/power/rx51_battery.c | 1 + 1 file changed, 1 insertion(+)drivers/power/rx51_battery.c +1
-0@@ -42,6 +42,7 @@ static int rx51_battery_read_adc(int channel) req.method =TWL4030_MADC_SW1 ; req.func_cb =NULL ; req.type =TWL4030_MADC_WAIT ; + req.raw = true;if (twl4030_madc_conversion (&req) <=0 )return -ENODATA ;Signature · 1 line
1.7.10.4
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.
Quoted 6 lines
Signed-off-by Pali Rohár <[email protected]>--- drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
Hello, can somebody review this twl4030-madc patch?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 15 lines · On Saturday 02 March 2013 23:23:05 Pali Rohár wrote:
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)Hello, can somebody review this twl4030-madc patch?
Bump.
Can some of mfd maintainers look at this patch and include it to mfd tree? It is needed for rx51_battery power supply driver.
Signature · 2 lines
Pali Rohár [email protected]
Quoted 23 lines · On Sunday 24 March 2013 15:03:29 Pali Rohár wrote:
Quoted 22 lines · On Saturday 02 March 2013 23:23:05 Pali Rohár wrote:
Quoted 20 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 1 line
Hello, can somebody review this twl4030-madc patch?
Bump.
Can some of mfd maintainers look at this patch and include it to mfd tree? It is needed for
rx51_batterypower supply driver.
CCing Tony, can you look at this patch?
Signature · 2 lines
Pali Rohár [email protected]
Tony Lindgren
maintainerQuoted 26 lines · Pali Rohár
Quoted 25 lines · On Sunday 24 March 2013 15:03:29 Pali Rohár wrote:
Quoted 23 lines · On Saturday 02 March 2013 23:23:05 Pali Rohár wrote:
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Quoted 6 lines
Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)Hello, can somebody review this twl4030-madc patch?
Quoted 7 lines
Quoted 5 lines
Bump.
Can some of mfd maintainers look at this patch and include it to mfd tree? It is needed for
rx51_batterypower supply driver.CCing Tony, can you look at this patch?
Sorry for the delay in replying, I've been going through my inbox for the merge window and noticed this.
I suggest resend with Peter Ujfalusi cc:d as he is the de-facto twl/tps maintainer and expert by now.
Regards,
Tony
Quoted 39 lines · On Monday 08 April 2013 20:15:24 Tony Lindgren wrote:
Quoted 27 lines · Pali Rohár
Quoted 26 lines · On Sunday 24 March 2013 15:03:29 Pali Rohár wrote:
Quoted 24 lines · On Saturday 02 March 2013 23:23:05 Pali Rohár wrote:
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Quoted 7 lines
Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)Hello, can somebody review this twl4030-madc patch?
Quoted 7 lines
Quoted 5 lines
Bump.
Can some of mfd maintainers look at this patch and include it to mfd tree? It is needed for
rx51_batterypower supply driver.CCing Tony, can you look at this patch?
Sorry for the delay in replying, I've been going through my inbox for the merge window and noticed this.
Quoted 6 lines
I suggest resend with Peter Ujfalusi cc:d as he is the de-facto twl/tps maintainer and expert by now.
Regards,
Tony
Ok, both patches are now in mfd-next tree.
Signature · 2 lines
Pali Rohár [email protected]
Tony Lindgren
maintainerQuoted 40 lines · Pali Rohár
Quoted 39 lines · On Monday 08 April 2013 20:15:24 Tony Lindgren wrote:
Quoted 27 lines · Pali Rohár
Quoted 26 lines · On Sunday 24 March 2013 15:03:29 Pali Rohár wrote:
Quoted 24 lines · On Saturday 02 March 2013 23:23:05 Pali Rohár wrote:
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Quoted 7 lines
Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)Hello, can somebody review this twl4030-madc patch?
Quoted 7 lines
Quoted 5 lines
Bump.
Can some of mfd maintainers look at this patch and include it to mfd tree? It is needed for
rx51_batterypower supply driver.CCing Tony, can you look at this patch?
Sorry for the delay in replying, I've been going through my inbox for the merge window and noticed this.
Quoted 8 lines
Quoted 6 lines
I suggest resend with Peter Ujfalusi cc:d as he is the de-facto twl/tps maintainer and expert by now.
Regards,
Tony
Ok, both patches are now in mfd-next tree.
Great thanks!
Tony
Hi Pali,
Quoted 15 lines · Pali Rohár
Quoted 14 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Pali Rohár <[email protected]>--- drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)Hello, can somebody review this twl4030-madc patch?
I'll look at all my pending MFD patches starting from tomorrow.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Quoted 25 lines · On Thursday 04 April 2013 11:38:47 Samuel Ortiz wrote:
Hi Pali,
Quoted 22 lines · Pali Rohár
Quoted 20 lines · On Friday 15 February 2013 23:56:49 Pali Rohár wrote:
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Signed-off-by Pali Rohár <[email protected]>---
drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 1 line
Hello, can somebody review this twl4030-madc patch?
I'll look at all my pending MFD patches starting from tomorrow.
Cheers,
Samuel.
Hi Samuel, did you look at this patch?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 5 lines · Pali Rohár
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).
Quoted 7 lines
For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.Signed-off-by Pali Rohár <[email protected]>
It looks good to me; glancing around, I don't see any better way to do it. So,
Thanks!
Anton
Hi Pali,
Quoted 11 lines · Pali Rohár
Driver twl4030-madc has hardcoded channel types (10 - battery current, 1 - battery temperature) and also conversation data in variable
twl4030_divider_ratios. These hardcoded channels are incorrect for Nokia RX-51 board (where is channel 0 - battery temperature).For Nokia RX-51 there is
rx51_batterypower_supplydriver which reporting battery information viatwl4030_madc_conversion. But this driver needs raw values (not converted via some hardcoded functions). So this patch adding new parameter "raw" to structtwl4030_madc_requestwhich tell twl4030-madc driver to not convert values, but rather return raw.
Quoted 5 lines
Signed-off-by Pali Rohár <[email protected]>--- drivers/mfd/twl4030-madc.c | 14 ++++++++++---- include/linux/i2c/twl4030-madc.h | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-)
I appled this patch and the power one to my mfd-next tree.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/