Commit 24b9dea7 authored by Andrew F. Davis's avatar Andrew F. Davis Committed by Jonathan Cameron

iio: health/afe440x: Remove channel names

These AFEs have 4 ADC mesuring stages (called LED2, ALED2, LED1, and
ALED1 in the datasheet), we map these as channels, these stages can serve
different purposes depending on the application. For instance the AFE4404
has an additional LED (LED3), this LED can be timed to be active during
stage 2 (or anystage, but the datasheet describes this case and the name
of the stage reflects this use). This ability is used further in upcoming
parts that tie the front-end gain and the LED timings together. For these
reasons we remove explicit naming the channels.

Without channel names it is best that the index numbers are in order to
match the stage number, reorder the channel numbers.
Signed-off-by: default avatarAndrew F. Davis <afd@ti.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 606c7e6c
...@@ -8,38 +8,35 @@ Description: ...@@ -8,38 +8,35 @@ Description:
Transimpedance Amplifier. Y is 1 for Rf1 and Cf1, Y is 2 for Transimpedance Amplifier. Y is 1 for Rf1 and Cf1, Y is 2 for
Rf2 and Cf2 values. Rf2 and Cf2 values.
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_ledY_raw What: /sys/bus/iio/devices/iio:deviceX/in_intensityY_raw
/sys/bus/iio/devices/iio:deviceX/in_intensity_ledY_ambient_raw Date: May 2016
Date: December 2015
KernelVersion: KernelVersion:
Contact: Andrew F. Davis <afd@ti.com> Contact: Andrew F. Davis <afd@ti.com>
Description: Description:
Get measured values from the ADC for these stages. Y is the Get measured values from the ADC for these stages. Y is the
specific LED number. The values are expressed in 24-bit twos specific stage number corresponding to datasheet stage names
complement. as follows:
1 -> LED2
What: /sys/bus/iio/devices/iio:deviceX/in_intensity_ledY-ledY_ambient_raw 2 -> ALED2/LED3
Date: December 2015 3 -> LED1
KernelVersion: 4 -> ALED1/LED4
Contact: Andrew F. Davis <afd@ti.com> Note that channels 5 and 6 represent LED2-ALED2 and LED1-ALED1
Description: respectively which simply helper channels containing the
Get differential values from the ADC for these stages. Y is the calculated difference in the value of stage 1 - 2 and 3 - 4.
specific LED number. The values are expressed in 24-bit twos The values are expressed in 24-bit twos complement.
complement for the specified LEDs.
What: /sys/bus/iio/devices/iio:deviceX/out_current_ledY_offset What: /sys/bus/iio/devices/iio:deviceX/in_intensityY_offset
/sys/bus/iio/devices/iio:deviceX/out_current_ledY_ambient_offset Date: May 2016
Date: December 2015
KernelVersion: KernelVersion:
Contact: Andrew F. Davis <afd@ti.com> Contact: Andrew F. Davis <afd@ti.com>
Description: Description:
Get and set the offset cancellation DAC setting for these Get and set the offset cancellation DAC setting for these
stages. The values are expressed in 5-bit sign-magnitude. stages. The values are expressed in 5-bit sign-magnitude.
What: /sys/bus/iio/devices/iio:deviceX/out_current_ledY_raw What: /sys/bus/iio/devices/iio:deviceX/out_currentY_raw
Date: December 2015 Date: May 2016
KernelVersion: KernelVersion:
Contact: Andrew F. Davis <afd@ti.com> Contact: Andrew F. Davis <afd@ti.com>
Description: Description:
Get and set the LED current for the specified LED. Y is the Get and set the LED current for the specified LED active during
specific LED number. this stage. Y is the specific stage number.
...@@ -121,38 +121,38 @@ struct afe4403_data { ...@@ -121,38 +121,38 @@ struct afe4403_data {
}; };
enum afe4403_chan_id { enum afe4403_chan_id {
LED2 = 1,
ALED2,
LED1, LED1,
ALED1, ALED1,
LED2,
ALED2,
LED1_ALED1,
LED2_ALED2, LED2_ALED2,
LED1_ALED1,
ILED1, ILED1,
ILED2, ILED2,
}; };
static const struct afe440x_reg_info afe4403_reg_info[] = { static const struct afe440x_reg_info afe4403_reg_info[] = {
[LED1] = AFE440X_REG_INFO(AFE440X_LED1VAL, 0, NULL),
[ALED1] = AFE440X_REG_INFO(AFE440X_ALED1VAL, 0, NULL),
[LED2] = AFE440X_REG_INFO(AFE440X_LED2VAL, 0, NULL), [LED2] = AFE440X_REG_INFO(AFE440X_LED2VAL, 0, NULL),
[ALED2] = AFE440X_REG_INFO(AFE440X_ALED2VAL, 0, NULL), [ALED2] = AFE440X_REG_INFO(AFE440X_ALED2VAL, 0, NULL),
[LED1_ALED1] = AFE440X_REG_INFO(AFE440X_LED1_ALED1VAL, 0, NULL), [LED1] = AFE440X_REG_INFO(AFE440X_LED1VAL, 0, NULL),
[ALED1] = AFE440X_REG_INFO(AFE440X_ALED1VAL, 0, NULL),
[LED2_ALED2] = AFE440X_REG_INFO(AFE440X_LED2_ALED2VAL, 0, NULL), [LED2_ALED2] = AFE440X_REG_INFO(AFE440X_LED2_ALED2VAL, 0, NULL),
[LED1_ALED1] = AFE440X_REG_INFO(AFE440X_LED1_ALED1VAL, 0, NULL),
[ILED1] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE440X_LEDCNTRL_LED1), [ILED1] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE440X_LEDCNTRL_LED1),
[ILED2] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE440X_LEDCNTRL_LED2), [ILED2] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE440X_LEDCNTRL_LED2),
}; };
static const struct iio_chan_spec afe4403_channels[] = { static const struct iio_chan_spec afe4403_channels[] = {
/* ADC values */ /* ADC values */
AFE440X_INTENSITY_CHAN(LED1, "led1", 0), AFE440X_INTENSITY_CHAN(LED2, 0),
AFE440X_INTENSITY_CHAN(ALED1, "led1_ambient", 0), AFE440X_INTENSITY_CHAN(ALED2, 0),
AFE440X_INTENSITY_CHAN(LED2, "led2", 0), AFE440X_INTENSITY_CHAN(LED1, 0),
AFE440X_INTENSITY_CHAN(ALED2, "led2_ambient", 0), AFE440X_INTENSITY_CHAN(ALED1, 0),
AFE440X_INTENSITY_CHAN(LED1_ALED1, "led1-led1_ambient", 0), AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
AFE440X_INTENSITY_CHAN(LED2_ALED2, "led2-led2_ambient", 0), AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
/* LED current */ /* LED current */
AFE440X_CURRENT_CHAN(ILED1, "led1"), AFE440X_CURRENT_CHAN(ILED1),
AFE440X_CURRENT_CHAN(ILED2, "led2"), AFE440X_CURRENT_CHAN(ILED2),
}; };
static const struct afe440x_val_table afe4403_res_table[] = { static const struct afe440x_val_table afe4403_res_table[] = {
......
...@@ -122,24 +122,24 @@ struct afe4404_data { ...@@ -122,24 +122,24 @@ struct afe4404_data {
}; };
enum afe4404_chan_id { enum afe4404_chan_id {
LED2 = 1,
ALED2,
LED1, LED1,
ALED1, ALED1,
LED2,
ALED2,
LED1_ALED1,
LED2_ALED2, LED2_ALED2,
LED1_ALED1,
ILED1, ILED1,
ILED2, ILED2,
ILED3, ILED3,
}; };
static const struct afe440x_reg_info afe4404_reg_info[] = { static const struct afe440x_reg_info afe4404_reg_info[] = {
[LED1] = AFE440X_REG_INFO(AFE440X_LED1VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_LED1),
[ALED1] = AFE440X_REG_INFO(AFE440X_ALED1VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_ALED1),
[LED2] = AFE440X_REG_INFO(AFE440X_LED2VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_LED2), [LED2] = AFE440X_REG_INFO(AFE440X_LED2VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_LED2),
[ALED2] = AFE440X_REG_INFO(AFE440X_ALED2VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_ALED2), [ALED2] = AFE440X_REG_INFO(AFE440X_ALED2VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_ALED2),
[LED1_ALED1] = AFE440X_REG_INFO(AFE440X_LED1_ALED1VAL, 0, NULL), [LED1] = AFE440X_REG_INFO(AFE440X_LED1VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_LED1),
[ALED1] = AFE440X_REG_INFO(AFE440X_ALED1VAL, AFE4404_OFFDAC, AFE4404_OFFDAC_CURR_ALED1),
[LED2_ALED2] = AFE440X_REG_INFO(AFE440X_LED2_ALED2VAL, 0, NULL), [LED2_ALED2] = AFE440X_REG_INFO(AFE440X_LED2_ALED2VAL, 0, NULL),
[LED1_ALED1] = AFE440X_REG_INFO(AFE440X_LED1_ALED1VAL, 0, NULL),
[ILED1] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED1), [ILED1] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED1),
[ILED2] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED2), [ILED2] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED2),
[ILED3] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED3), [ILED3] = AFE440X_REG_INFO(AFE440X_LEDCNTRL, 0, AFE4404_LEDCNTRL_ILED3),
...@@ -147,16 +147,16 @@ static const struct afe440x_reg_info afe4404_reg_info[] = { ...@@ -147,16 +147,16 @@ static const struct afe440x_reg_info afe4404_reg_info[] = {
static const struct iio_chan_spec afe4404_channels[] = { static const struct iio_chan_spec afe4404_channels[] = {
/* ADC values */ /* ADC values */
AFE440X_INTENSITY_CHAN(LED1, "led1", BIT(IIO_CHAN_INFO_OFFSET)), AFE440X_INTENSITY_CHAN(LED2, BIT(IIO_CHAN_INFO_OFFSET)),
AFE440X_INTENSITY_CHAN(ALED1, "led1_ambient", BIT(IIO_CHAN_INFO_OFFSET)), AFE440X_INTENSITY_CHAN(ALED2, BIT(IIO_CHAN_INFO_OFFSET)),
AFE440X_INTENSITY_CHAN(LED2, "led2", BIT(IIO_CHAN_INFO_OFFSET)), AFE440X_INTENSITY_CHAN(LED1, BIT(IIO_CHAN_INFO_OFFSET)),
AFE440X_INTENSITY_CHAN(ALED2, "led2_ambient", BIT(IIO_CHAN_INFO_OFFSET)), AFE440X_INTENSITY_CHAN(ALED1, BIT(IIO_CHAN_INFO_OFFSET)),
AFE440X_INTENSITY_CHAN(LED1_ALED1, "led1-led1_ambient", 0), AFE440X_INTENSITY_CHAN(LED2_ALED2, 0),
AFE440X_INTENSITY_CHAN(LED2_ALED2, "led2-led2_ambient", 0), AFE440X_INTENSITY_CHAN(LED1_ALED1, 0),
/* LED current */ /* LED current */
AFE440X_CURRENT_CHAN(ILED1, "led1"), AFE440X_CURRENT_CHAN(ILED1),
AFE440X_CURRENT_CHAN(ILED2, "led2"), AFE440X_CURRENT_CHAN(ILED2),
AFE440X_CURRENT_CHAN(ILED3, "led3"), AFE440X_CURRENT_CHAN(ILED3),
}; };
static const struct afe440x_val_table afe4404_res_table[] = { static const struct afe440x_val_table afe4404_res_table[] = {
......
...@@ -103,7 +103,7 @@ struct afe440x_reg_info { ...@@ -103,7 +103,7 @@ struct afe440x_reg_info {
.mask = _sm ## _MASK, \ .mask = _sm ## _MASK, \
} }
#define AFE440X_INTENSITY_CHAN(_index, _name, _mask) \ #define AFE440X_INTENSITY_CHAN(_index, _mask) \
{ \ { \
.type = IIO_INTENSITY, \ .type = IIO_INTENSITY, \
.channel = _index, \ .channel = _index, \
...@@ -115,20 +115,20 @@ struct afe440x_reg_info { ...@@ -115,20 +115,20 @@ struct afe440x_reg_info {
.storagebits = 32, \ .storagebits = 32, \
.endianness = IIO_CPU, \ .endianness = IIO_CPU, \
}, \ }, \
.extend_name = _name, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
_mask, \ _mask, \
.indexed = true, \
} }
#define AFE440X_CURRENT_CHAN(_index, _name) \ #define AFE440X_CURRENT_CHAN(_index) \
{ \ { \
.type = IIO_CURRENT, \ .type = IIO_CURRENT, \
.channel = _index, \ .channel = _index, \
.address = _index, \ .address = _index, \
.scan_index = -1, \ .scan_index = -1, \
.extend_name = _name, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
BIT(IIO_CHAN_INFO_SCALE), \ BIT(IIO_CHAN_INFO_SCALE), \
.indexed = true, \
.output = true, \ .output = true, \
} }
......
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