Merge tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
[linux-2.6-block.git] / drivers / mfd / tps65911-comparator.c
index c0789f81a1c5ac534876e1c30afad78789e24aa0..33591767fb9b53e1579b5feb00ff1b1d3e69629e 100644 (file)
@@ -22,9 +22,8 @@
 #include <linux/gpio.h>
 #include <linux/mfd/tps65910.h>
 
-#define COMP                                   0
-#define COMP1                                  1
-#define COMP2                                  2
+#define COMP1                                  0
+#define COMP2                                  1
 
 /* Comparator 1 voltage selection table in millivolts */
 static const u16 COMP_VSEL_TABLE[] = {
@@ -63,9 +62,6 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage)
        int ret;
        u8 index = 0, val;
 
-       if (id == COMP)
-               return 0;
-
        while (curr_voltage < tps_comp.uV_max) {
                curr_voltage = tps_comp.vsel_table[index];
                if (curr_voltage >= voltage)
@@ -78,7 +74,7 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage)
                return -EINVAL;
 
        val = index << 1;
-       ret = tps65910->write(tps65910, tps_comp.reg, 1, &val);
+       ret = tps65910_reg_write(tps65910, tps_comp.reg, val);
 
        return ret;
 }
@@ -86,13 +82,10 @@ static int comp_threshold_set(struct tps65910 *tps65910, int id, int voltage)
 static int comp_threshold_get(struct tps65910 *tps65910, int id)
 {
        struct comparator tps_comp = tps_comparators[id];
+       unsigned int val;
        int ret;
-       u8 val;
-
-       if (id == COMP)
-               return 0;
 
-       ret = tps65910->read(tps65910, tps_comp.reg, 1, &val);
+       ret = tps65910_reg_read(tps65910, tps_comp.reg, &val);
        if (ret < 0)
                return ret;