]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: iio: isl29028: Prefix #defines
authorPeter Meerwald-Stadler <pmeerw@pmeerw.net>
Tue, 5 Jul 2016 11:55:41 +0000 (13:55 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 10 Jul 2016 13:49:27 +0000 (14:49 +0100)
and drop unused PROX_DRIVE

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/isl29028.c

index 2e3b1d64e32ad7b45795f0ea056ac3909d332668..79f41ee54fed68903b06807d08d54550f05aa936 100644 (file)
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 
-#define CONVERSION_TIME_MS             100
+#define ISL29028_CONV_TIME_MS          100
 
 #define ISL29028_REG_CONFIGURE         0x01
 
-#define CONFIGURE_ALS_IR_MODE_ALS      0
-#define CONFIGURE_ALS_IR_MODE_IR       BIT(0)
-#define CONFIGURE_ALS_IR_MODE_MASK     BIT(0)
+#define ISL29028_CONF_ALS_IR_MODE_ALS  0
+#define ISL29028_CONF_ALS_IR_MODE_IR   BIT(0)
+#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0)
 
-#define CONFIGURE_ALS_RANGE_LOW_LUX    0
-#define CONFIGURE_ALS_RANGE_HIGH_LUX   BIT(1)
-#define CONFIGURE_ALS_RANGE_MASK       BIT(1)
+#define ISL29028_CONF_ALS_RANGE_LOW_LUX        0
+#define ISL29028_CONF_ALS_RANGE_HIGH_LUX       BIT(1)
+#define ISL29028_CONF_ALS_RANGE_MASK   BIT(1)
 
-#define CONFIGURE_ALS_DIS              0
-#define CONFIGURE_ALS_EN               BIT(2)
-#define CONFIGURE_ALS_EN_MASK          BIT(2)
+#define ISL29028_CONF_ALS_DIS          0
+#define ISL29028_CONF_ALS_EN           BIT(2)
+#define ISL29028_CONF_ALS_EN_MASK      BIT(2)
 
-#define CONFIGURE_PROX_DRIVE           BIT(3)
+#define ISL29028_CONF_PROX_SLP_SH      4
+#define ISL29028_CONF_PROX_SLP_MASK    (7 << ISL29028_CONF_PROX_SLP_SH)
 
-#define CONFIGURE_PROX_SLP_SH          4
-#define CONFIGURE_PROX_SLP_MASK                (7 << CONFIGURE_PROX_SLP_SH)
-
-#define CONFIGURE_PROX_EN              BIT(7)
-#define CONFIGURE_PROX_EN_MASK         BIT(7)
+#define ISL29028_CONF_PROX_EN          BIT(7)
+#define ISL29028_CONF_PROX_EN_MASK     BIT(7)
 
 #define ISL29028_REG_INTERRUPT         0x02
 
@@ -91,7 +89,8 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip *chip,
                        break;
        }
        return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                       CONFIGURE_PROX_SLP_MASK, sel << CONFIGURE_PROX_SLP_SH);
+                                 ISL29028_CONF_PROX_SLP_MASK,
+                                 sel << ISL29028_CONF_PROX_SLP_SH);
 }
 
 static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable)
@@ -100,9 +99,9 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable)
        int val = 0;
 
        if (enable)
-               val = CONFIGURE_PROX_EN;
+               val = ISL29028_CONF_PROX_EN;
        ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                                CONFIGURE_PROX_EN_MASK, val);
+                                ISL29028_CONF_PROX_EN_MASK, val);
        if (ret < 0)
                return ret;
 
@@ -113,11 +112,11 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable)
 
 static int isl29028_set_als_scale(struct isl29028_chip *chip, int lux_scale)
 {
-       int val = (lux_scale == 2000) ? CONFIGURE_ALS_RANGE_HIGH_LUX :
-                                       CONFIGURE_ALS_RANGE_LOW_LUX;
+       int val = (lux_scale == 2000) ? ISL29028_CONF_ALS_RANGE_HIGH_LUX :
+                                       ISL29028_CONF_ALS_RANGE_LOW_LUX;
 
        return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-               CONFIGURE_ALS_RANGE_MASK, val);
+               ISL29028_CONF_ALS_RANGE_MASK, val);
 }
 
 static int isl29028_set_als_ir_mode(struct isl29028_chip *chip,
@@ -128,25 +127,25 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip *chip,
        switch (mode) {
        case MODE_ALS:
                ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                                        CONFIGURE_ALS_IR_MODE_MASK,
-                                        CONFIGURE_ALS_IR_MODE_ALS);
+                                        ISL29028_CONF_ALS_IR_MODE_MASK,
+                                        ISL29028_CONF_ALS_IR_MODE_ALS);
                if (ret < 0)
                        return ret;
 
                ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                                        CONFIGURE_ALS_RANGE_MASK,
-                                        CONFIGURE_ALS_RANGE_HIGH_LUX);
+                                        ISL29028_CONF_ALS_RANGE_MASK,
+                                        ISL29028_CONF_ALS_RANGE_HIGH_LUX);
                break;
 
        case MODE_IR:
                ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                                        CONFIGURE_ALS_IR_MODE_MASK,
-                                        CONFIGURE_ALS_IR_MODE_IR);
+                                        ISL29028_CONF_ALS_IR_MODE_MASK,
+                                        ISL29028_CONF_ALS_IR_MODE_IR);
                break;
 
        case MODE_NONE:
                return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                       CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_DIS);
+                       ISL29028_CONF_ALS_EN_MASK, ISL29028_CONF_ALS_DIS);
        }
 
        if (ret < 0)
@@ -154,12 +153,13 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip *chip,
 
        /* Enable the ALS/IR */
        ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE,
-                                CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_EN);
+                                ISL29028_CONF_ALS_EN_MASK,
+                                ISL29028_CONF_ALS_EN);
        if (ret < 0)
                return ret;
 
        /* Need to wait for conversion time if ALS/IR mode enabled */
-       mdelay(CONVERSION_TIME_MS);
+       mdelay(ISL29028_CONV_TIME_MS);
        return 0;
 }