diff options
| -rw-r--r-- | drivers/power/rx51_battery.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c index 8a6288d87056..03f57615be56 100644 --- a/drivers/power/rx51_battery.c +++ b/drivers/power/rx51_battery.c | |||
| @@ -25,6 +25,10 @@ | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/i2c/twl4030-madc.h> | 26 | #include <linux/i2c/twl4030-madc.h> |
| 27 | 27 | ||
| 28 | /* RX51 specific channels */ | ||
| 29 | #define TWL4030_MADC_BTEMP_RX51 TWL4030_MADC_ADCIN0 | ||
| 30 | #define TWL4030_MADC_BCI_RX51 TWL4030_MADC_ADCIN4 | ||
| 31 | |||
| 28 | struct rx51_device_info { | 32 | struct rx51_device_info { |
| 29 | struct device *dev; | 33 | struct device *dev; |
| 30 | struct power_supply bat; | 34 | struct power_supply bat; |
| @@ -37,7 +41,7 @@ static int rx51_battery_read_adc(int channel) | |||
| 37 | { | 41 | { |
| 38 | struct twl4030_madc_request req; | 42 | struct twl4030_madc_request req; |
| 39 | 43 | ||
| 40 | req.channels = 1 << channel; | 44 | req.channels = channel; |
| 41 | req.do_avg = 1; | 45 | req.do_avg = 1; |
| 42 | req.method = TWL4030_MADC_SW1; | 46 | req.method = TWL4030_MADC_SW1; |
| 43 | req.func_cb = NULL; | 47 | req.func_cb = NULL; |
| @@ -56,7 +60,7 @@ static int rx51_battery_read_adc(int channel) | |||
| 56 | */ | 60 | */ |
| 57 | static int rx51_battery_read_voltage(struct rx51_device_info *di) | 61 | static int rx51_battery_read_voltage(struct rx51_device_info *di) |
| 58 | { | 62 | { |
| 59 | int voltage = rx51_battery_read_adc(12); | 63 | int voltage = rx51_battery_read_adc(TWL4030_MADC_VBAT); |
| 60 | 64 | ||
| 61 | if (voltage < 0) | 65 | if (voltage < 0) |
| 62 | return voltage; | 66 | return voltage; |
| @@ -108,7 +112,7 @@ static int rx51_battery_read_temperature(struct rx51_device_info *di) | |||
| 108 | { | 112 | { |
| 109 | int min = 0; | 113 | int min = 0; |
| 110 | int max = ARRAY_SIZE(rx51_temp_table2) - 1; | 114 | int max = ARRAY_SIZE(rx51_temp_table2) - 1; |
| 111 | int raw = rx51_battery_read_adc(0); | 115 | int raw = rx51_battery_read_adc(TWL4030_MADC_BTEMP_RX51); |
| 112 | 116 | ||
| 113 | /* Zero and negative values are undefined */ | 117 | /* Zero and negative values are undefined */ |
| 114 | if (raw <= 0) | 118 | if (raw <= 0) |
| @@ -142,7 +146,7 @@ static int rx51_battery_read_temperature(struct rx51_device_info *di) | |||
| 142 | */ | 146 | */ |
| 143 | static int rx51_battery_read_capacity(struct rx51_device_info *di) | 147 | static int rx51_battery_read_capacity(struct rx51_device_info *di) |
| 144 | { | 148 | { |
| 145 | int capacity = rx51_battery_read_adc(4); | 149 | int capacity = rx51_battery_read_adc(TWL4030_MADC_BCI_RX51); |
| 146 | 150 | ||
| 147 | if (capacity < 0) | 151 | if (capacity < 0) |
| 148 | return capacity; | 152 | return capacity; |
