summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@linaro.org>2012-04-18 15:52:59 +0200
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:01:42 +0200
commit3fc05771a4957963c8108ecbdc0308f02e21a935 (patch)
treeab8d317a29db2f7c9c777de3599f7e541cffbbe7
parentc5030b1731024660f643f8481237fddf1770248d (diff)
ab8500: gpadc: Use new mainline ab8500_gpadc_get() with name parameter
Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
-rw-r--r--drivers/hwmon/ab8500.c2
-rw-r--r--drivers/mfd/ab8500-debugfs.c26
-rw-r--r--drivers/mfd/ab8500-gpadc.c10
-rw-r--r--include/linux/mfd/abx500/ab8500-gpadc.h2
4 files changed, 22 insertions, 18 deletions
diff --git a/drivers/hwmon/ab8500.c b/drivers/hwmon/ab8500.c
index 8204af594a9..65a0f381d01 100644
--- a/drivers/hwmon/ab8500.c
+++ b/drivers/hwmon/ab8500.c
@@ -139,7 +139,7 @@ static int ab8500_temp_irq_handler(int irq, struct abx500_temp *data)
int __init ab8500_hwmon_init(struct abx500_temp *data)
{
- data->ab8500_gpadc = ab8500_gpadc_get();
+ data->ab8500_gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
if (IS_ERR(data->ab8500_gpadc))
return PTR_ERR(data->ab8500_gpadc);
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c
index 595b41800b4..7b912afd664 100644
--- a/drivers/mfd/ab8500-debugfs.c
+++ b/drivers/mfd/ab8500-debugfs.c
@@ -805,7 +805,7 @@ static int ab8500_gpadc_bat_ctrl_print(struct seq_file *s, void *p)
int bat_ctrl_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
bat_ctrl_raw = ab8500_gpadc_read_raw(gpadc, BAT_CTRL);
bat_ctrl_convert = ab8500_gpadc_ad_to_voltage(gpadc,
BAT_CTRL, bat_ctrl_raw);
@@ -833,7 +833,7 @@ static int ab8500_gpadc_btemp_ball_print(struct seq_file *s, void *p)
int btemp_ball_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
btemp_ball_raw = ab8500_gpadc_read_raw(gpadc, BTEMP_BALL);
btemp_ball_convert = ab8500_gpadc_ad_to_voltage(gpadc, BTEMP_BALL,
btemp_ball_raw);
@@ -862,7 +862,7 @@ static int ab8500_gpadc_main_charger_v_print(struct seq_file *s, void *p)
int main_charger_v_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
main_charger_v_raw = ab8500_gpadc_read_raw(gpadc, MAIN_CHARGER_V);
main_charger_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
MAIN_CHARGER_V, main_charger_v_raw);
@@ -892,7 +892,7 @@ static int ab8500_gpadc_acc_detect1_print(struct seq_file *s, void *p)
int acc_detect1_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
acc_detect1_raw = ab8500_gpadc_read_raw(gpadc, ACC_DETECT1);
acc_detect1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ACC_DETECT1,
acc_detect1_raw);
@@ -922,7 +922,7 @@ static int ab8500_gpadc_acc_detect2_print(struct seq_file *s, void *p)
int acc_detect2_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
acc_detect2_raw = ab8500_gpadc_read_raw(gpadc, ACC_DETECT2);
acc_detect2_convert = ab8500_gpadc_ad_to_voltage(gpadc,
ACC_DETECT2, acc_detect2_raw);
@@ -952,7 +952,7 @@ static int ab8500_gpadc_aux1_print(struct seq_file *s, void *p)
int aux1_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
aux1_raw = ab8500_gpadc_read_raw(gpadc, ADC_AUX1);
aux1_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX1,
aux1_raw);
@@ -980,7 +980,7 @@ static int ab8500_gpadc_aux2_print(struct seq_file *s, void *p)
int aux2_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
aux2_raw = ab8500_gpadc_read_raw(gpadc, ADC_AUX2);
aux2_convert = ab8500_gpadc_ad_to_voltage(gpadc, ADC_AUX2,
aux2_raw);
@@ -1008,7 +1008,7 @@ static int ab8500_gpadc_main_bat_v_print(struct seq_file *s, void *p)
int main_bat_v_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
main_bat_v_raw = ab8500_gpadc_read_raw(gpadc, MAIN_BAT_V);
main_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, MAIN_BAT_V,
main_bat_v_raw);
@@ -1037,7 +1037,7 @@ static int ab8500_gpadc_vbus_v_print(struct seq_file *s, void *p)
int vbus_v_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
vbus_v_raw = ab8500_gpadc_read_raw(gpadc, VBUS_V);
vbus_v_convert = ab8500_gpadc_ad_to_voltage(gpadc, VBUS_V,
vbus_v_raw);
@@ -1065,7 +1065,7 @@ static int ab8500_gpadc_main_charger_c_print(struct seq_file *s, void *p)
int main_charger_c_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
main_charger_c_raw = ab8500_gpadc_read_raw(gpadc, MAIN_CHARGER_C);
main_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
MAIN_CHARGER_C, main_charger_c_raw);
@@ -1095,7 +1095,7 @@ static int ab8500_gpadc_usb_charger_c_print(struct seq_file *s, void *p)
int usb_charger_c_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
usb_charger_c_raw = ab8500_gpadc_read_raw(gpadc, USB_CHARGER_C);
usb_charger_c_convert = ab8500_gpadc_ad_to_voltage(gpadc,
USB_CHARGER_C, usb_charger_c_raw);
@@ -1125,7 +1125,7 @@ static int ab8500_gpadc_bk_bat_v_print(struct seq_file *s, void *p)
int bk_bat_v_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
bk_bat_v_raw = ab8500_gpadc_read_raw(gpadc, BK_BAT_V);
bk_bat_v_convert = ab8500_gpadc_ad_to_voltage(gpadc,
BK_BAT_V, bk_bat_v_raw);
@@ -1153,7 +1153,7 @@ static int ab8500_gpadc_die_temp_print(struct seq_file *s, void *p)
int die_temp_convert;
struct ab8500_gpadc *gpadc;
- gpadc = ab8500_gpadc_get();
+ gpadc = ab8500_gpadc_get("ab8500-gpadc.0");
die_temp_raw = ab8500_gpadc_read_raw(gpadc, DIE_TEMP);
die_temp_convert = ab8500_gpadc_ad_to_voltage(gpadc, DIE_TEMP,
die_temp_raw);
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index d4135706529..d06f4826619 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -136,12 +136,16 @@ static LIST_HEAD(ab8500_gpadc_list);
* ab8500_gpadc_get() - returns a reference to the primary AB8500 GPADC
* (i.e. the first GPADC in the instance list)
*/
-struct ab8500_gpadc *ab8500_gpadc_get(void)
+struct ab8500_gpadc *ab8500_gpadc_get(char *name)
{
struct ab8500_gpadc *gpadc;
- gpadc = list_first_entry(&ab8500_gpadc_list, struct ab8500_gpadc, node);
- return gpadc;
+ list_for_each_entry(gpadc, &ab8500_gpadc_list, node) {
+ if (!strcmp(name, dev_name(gpadc->dev)))
+ return gpadc;
+ }
+
+ return ERR_PTR(-ENOENT);
}
EXPORT_SYMBOL(ab8500_gpadc_get);
diff --git a/include/linux/mfd/abx500/ab8500-gpadc.h b/include/linux/mfd/abx500/ab8500-gpadc.h
index fa706c5a04a..252966769d9 100644
--- a/include/linux/mfd/abx500/ab8500-gpadc.h
+++ b/include/linux/mfd/abx500/ab8500-gpadc.h
@@ -26,7 +26,7 @@
struct ab8500_gpadc;
-struct ab8500_gpadc *ab8500_gpadc_get(void);
+struct ab8500_gpadc *ab8500_gpadc_get(char *name);
int ab8500_gpadc_convert(struct ab8500_gpadc *gpadc, u8 channel);
int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel);
int ab8500_gpadc_ad_to_voltage(struct ab8500_gpadc *gpadc,