Commit 6fa273c1 authored by Peter Meerwald's avatar Peter Meerwald Committed by Jonathan Cameron

iio:tsl2563: Use tsl2563_ prefix for driver's functions

just cleanup, no functional change
Signed-off-by: default avatarPeter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 6b57573b
...@@ -240,7 +240,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id) ...@@ -240,7 +240,7 @@ static int tsl2563_read_id(struct tsl2563_chip *chip, u8 *id)
* convert between normalized values and HW values obtained using given * convert between normalized values and HW values obtained using given
* timing and gain settings. * timing and gain settings.
*/ */
static int adc_shiftbits(u8 timing) static int tsl2563_adc_shiftbits(u8 timing)
{ {
int shift = 0; int shift = 0;
...@@ -263,9 +263,9 @@ static int adc_shiftbits(u8 timing) ...@@ -263,9 +263,9 @@ static int adc_shiftbits(u8 timing)
} }
/* Convert a HW ADC value to normalized scale. */ /* Convert a HW ADC value to normalized scale. */
static u32 normalize_adc(u16 adc, u8 timing) static u32 tsl2563_normalize_adc(u16 adc, u8 timing)
{ {
return adc << adc_shiftbits(timing); return adc << tsl2563_adc_shiftbits(timing);
} }
static void tsl2563_wait_adc(struct tsl2563_chip *chip) static void tsl2563_wait_adc(struct tsl2563_chip *chip)
...@@ -350,8 +350,8 @@ static int tsl2563_get_adc(struct tsl2563_chip *chip) ...@@ -350,8 +350,8 @@ static int tsl2563_get_adc(struct tsl2563_chip *chip)
retry = tsl2563_adjust_gainlevel(chip, adc0); retry = tsl2563_adjust_gainlevel(chip, adc0);
} }
chip->data0 = normalize_adc(adc0, chip->gainlevel->gaintime); chip->data0 = tsl2563_normalize_adc(adc0, chip->gainlevel->gaintime);
chip->data1 = normalize_adc(adc1, chip->gainlevel->gaintime); chip->data1 = tsl2563_normalize_adc(adc1, chip->gainlevel->gaintime);
if (!chip->int_enabled) if (!chip->int_enabled)
schedule_delayed_work(&chip->poweroff_work, 5 * HZ); schedule_delayed_work(&chip->poweroff_work, 5 * HZ);
...@@ -361,13 +361,13 @@ static int tsl2563_get_adc(struct tsl2563_chip *chip) ...@@ -361,13 +361,13 @@ static int tsl2563_get_adc(struct tsl2563_chip *chip)
return ret; return ret;
} }
static inline int calib_to_sysfs(u32 calib) static inline int tsl2563_calib_to_sysfs(u32 calib)
{ {
return (int) (((calib * CALIB_BASE_SYSFS) + return (int) (((calib * CALIB_BASE_SYSFS) +
CALIB_FRAC_HALF) >> CALIB_FRAC_BITS); CALIB_FRAC_HALF) >> CALIB_FRAC_BITS);
} }
static inline u32 calib_from_sysfs(int value) static inline u32 tsl2563_calib_from_sysfs(int value)
{ {
return (((u32) value) << CALIB_FRAC_BITS) / CALIB_BASE_SYSFS; return (((u32) value) << CALIB_FRAC_BITS) / CALIB_BASE_SYSFS;
} }
...@@ -426,7 +426,7 @@ static const struct tsl2563_lux_coeff lux_table[] = { ...@@ -426,7 +426,7 @@ static const struct tsl2563_lux_coeff lux_table[] = {
}; };
/* Convert normalized, scaled ADC values to lux. */ /* Convert normalized, scaled ADC values to lux. */
static unsigned int adc_to_lux(u32 adc0, u32 adc1) static unsigned int tsl2563_adc_to_lux(u32 adc0, u32 adc1)
{ {
const struct tsl2563_lux_coeff *lp = lux_table; const struct tsl2563_lux_coeff *lp = lux_table;
unsigned long ratio, lux, ch0 = adc0, ch1 = adc1; unsigned long ratio, lux, ch0 = adc0, ch1 = adc1;
...@@ -442,7 +442,7 @@ static unsigned int adc_to_lux(u32 adc0, u32 adc1) ...@@ -442,7 +442,7 @@ static unsigned int adc_to_lux(u32 adc0, u32 adc1)
} }
/* Apply calibration coefficient to ADC count. */ /* Apply calibration coefficient to ADC count. */
static u32 calib_adc(u32 adc, u32 calib) static u32 tsl2563_calib_adc(u32 adc, u32 calib)
{ {
unsigned long scaled = adc; unsigned long scaled = adc;
...@@ -463,9 +463,9 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev, ...@@ -463,9 +463,9 @@ static int tsl2563_write_raw(struct iio_dev *indio_dev,
if (mask != IIO_CHAN_INFO_CALIBSCALE) if (mask != IIO_CHAN_INFO_CALIBSCALE)
return -EINVAL; return -EINVAL;
if (chan->channel2 == IIO_MOD_LIGHT_BOTH) if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
chip->calib0 = calib_from_sysfs(val); chip->calib0 = tsl2563_calib_from_sysfs(val);
else if (chan->channel2 == IIO_MOD_LIGHT_IR) else if (chan->channel2 == IIO_MOD_LIGHT_IR)
chip->calib1 = calib_from_sysfs(val); chip->calib1 = tsl2563_calib_from_sysfs(val);
else else
return -EINVAL; return -EINVAL;
...@@ -491,11 +491,11 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, ...@@ -491,11 +491,11 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
ret = tsl2563_get_adc(chip); ret = tsl2563_get_adc(chip);
if (ret) if (ret)
goto error_ret; goto error_ret;
calib0 = calib_adc(chip->data0, chip->calib0) * calib0 = tsl2563_calib_adc(chip->data0, chip->calib0) *
chip->cover_comp_gain; chip->cover_comp_gain;
calib1 = calib_adc(chip->data1, chip->calib1) * calib1 = tsl2563_calib_adc(chip->data1, chip->calib1) *
chip->cover_comp_gain; chip->cover_comp_gain;
*val = adc_to_lux(calib0, calib1); *val = tsl2563_adc_to_lux(calib0, calib1);
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
case IIO_INTENSITY: case IIO_INTENSITY:
...@@ -515,9 +515,9 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev, ...@@ -515,9 +515,9 @@ static int tsl2563_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_CALIBSCALE: case IIO_CHAN_INFO_CALIBSCALE:
if (chan->channel2 == IIO_MOD_LIGHT_BOTH) if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
*val = calib_to_sysfs(chip->calib0); *val = tsl2563_calib_to_sysfs(chip->calib0);
else else
*val = calib_to_sysfs(chip->calib1); *val = tsl2563_calib_to_sysfs(chip->calib1);
ret = IIO_VAL_INT; ret = IIO_VAL_INT;
break; break;
default: default:
...@@ -750,8 +750,8 @@ static int tsl2563_probe(struct i2c_client *client, ...@@ -750,8 +750,8 @@ static int tsl2563_probe(struct i2c_client *client,
chip->high_thres = 0xffff; chip->high_thres = 0xffff;
chip->gainlevel = tsl2563_gainlevel_table; chip->gainlevel = tsl2563_gainlevel_table;
chip->intr = TSL2563_INT_PERSIST(4); chip->intr = TSL2563_INT_PERSIST(4);
chip->calib0 = calib_from_sysfs(CALIB_BASE_SYSFS); chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
chip->calib1 = calib_from_sysfs(CALIB_BASE_SYSFS); chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
if (pdata) if (pdata)
chip->cover_comp_gain = pdata->cover_comp_gain; chip->cover_comp_gain = pdata->cover_comp_gain;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment