aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-10-11 10:03:51 -0400
committerGuenter Roeck <linux@roeck-us.net>2012-12-05 13:55:55 -0500
commitd9b24e373d160ffd56633cc9a4b2e4013c2682d1 (patch)
treeb6b3ff4d07309a29f8cad97e673ff04bbeb10513 /drivers/hwmon
parent72cbdddcc158fa52056619b81624df0cd9125a26 (diff)
hwmon: da9052: Use da9052_reg_update for rmw operations
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/da9052-hwmon.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c
index b8d01c5f5713..19704948801c 100644
--- a/drivers/hwmon/da9052-hwmon.c
+++ b/drivers/hwmon/da9052-hwmon.c
@@ -60,30 +60,17 @@ static inline int vbbat_reg_to_mV(int value)
60 return DIV_ROUND_CLOSEST(value * 2500, 512); 60 return DIV_ROUND_CLOSEST(value * 2500, 512);
61} 61}
62 62
63static int da9052_enable_vddout_channel(struct da9052 *da9052) 63static inline int da9052_enable_vddout_channel(struct da9052 *da9052)
64{ 64{
65 int ret; 65 return da9052_reg_update(da9052, DA9052_ADC_CONT_REG,
66 66 DA9052_ADCCONT_AUTOVDDEN,
67 ret = da9052_reg_read(da9052, DA9052_ADC_CONT_REG); 67 DA9052_ADCCONT_AUTOVDDEN);
68 if (ret < 0)
69 return ret;
70
71 ret |= DA9052_ADCCONT_AUTOVDDEN;
72
73 return da9052_reg_write(da9052, DA9052_ADC_CONT_REG, ret);
74} 68}
75 69
76static int da9052_disable_vddout_channel(struct da9052 *da9052) 70static inline int da9052_disable_vddout_channel(struct da9052 *da9052)
77{ 71{
78 int ret; 72 return da9052_reg_update(da9052, DA9052_ADC_CONT_REG,
79 73 DA9052_ADCCONT_AUTOVDDEN, 0);
80 ret = da9052_reg_read(da9052, DA9052_ADC_CONT_REG);
81 if (ret < 0)
82 return ret;
83
84 ret &= ~DA9052_ADCCONT_AUTOVDDEN;
85
86 return da9052_reg_write(da9052, DA9052_ADC_CONT_REG, ret);
87} 74}
88 75
89static ssize_t da9052_read_vddout(struct device *dev, 76static ssize_t da9052_read_vddout(struct device *dev,