Message ID | 20230915051703.1689578-6-Basavaraj.Natikar@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Multiple light sensor support | expand |
On Fri, 15 Sep 2023 10:47:00 +0530 Basavaraj Natikar <Basavaraj.Natikar@amd.com> wrote: > In most cases, ambient color sensors also support the x and y light > colors, which represent the coordinates on the CIE 1931 chromaticity > diagram. Thus, add channel for chromaticity. Adding a channel type. Otherwise looks reasonable to me. > > Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> > --- > Documentation/ABI/testing/sysfs-bus-iio | 8 ++++++++ > drivers/iio/industrialio-core.c | 1 + > include/uapi/linux/iio/types.h | 1 + > tools/iio/iio_event_monitor.c | 2 ++ > 4 files changed, 12 insertions(+) > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio > index a2854dc9a839..6a810771f5e4 100644 > --- a/Documentation/ABI/testing/sysfs-bus-iio > +++ b/Documentation/ABI/testing/sysfs-bus-iio > @@ -2179,3 +2179,11 @@ Contact: linux-iio@vger.kernel.org > Description: > Number of conditions that must occur, during a running > period, before an event is generated. > + > +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_x_raw > +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_y_raw > +KernelVersion: 6.6 > +Contact: linux-iio@vger.kernel.org > +Description: > + The x and y light color coordinate on the CIE 1931 chromaticity > + diagram. > diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c > index d752e9c0499b..c1df66cdfdf6 100644 > --- a/drivers/iio/industrialio-core.c > +++ b/drivers/iio/industrialio-core.c > @@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = { > [IIO_POSITIONRELATIVE] = "positionrelative", > [IIO_PHASE] = "phase", > [IIO_MASSCONCENTRATION] = "massconcentration", > + [IIO_CHROMATICITY] = "chromaticity", > }; > > static const char * const iio_modifier_names[] = { > diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h > index c79f2f046a0b..8952d48cfc64 100644 > --- a/include/uapi/linux/iio/types.h > +++ b/include/uapi/linux/iio/types.h > @@ -47,6 +47,7 @@ enum iio_chan_type { > IIO_POSITIONRELATIVE, > IIO_PHASE, > IIO_MASSCONCENTRATION, > + IIO_CHROMATICITY, > }; > > enum iio_modifier { > diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c > index 0a5c2bb60030..115ba1fbf3ac 100644 > --- a/tools/iio/iio_event_monitor.c > +++ b/tools/iio/iio_event_monitor.c > @@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = { > [IIO_POSITIONRELATIVE] = "positionrelative", > [IIO_PHASE] = "phase", > [IIO_MASSCONCENTRATION] = "massconcentration", > + [IIO_CHROMATICITY] = "chromaticity", > }; > > static const char * const iio_ev_type_text[] = { > @@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event) > case IIO_POSITIONRELATIVE: > case IIO_PHASE: > case IIO_MASSCONCENTRATION: > + case IIO_CHROMATICITY: > break; > default: > return false;
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio index a2854dc9a839..6a810771f5e4 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio +++ b/Documentation/ABI/testing/sysfs-bus-iio @@ -2179,3 +2179,11 @@ Contact: linux-iio@vger.kernel.org Description: Number of conditions that must occur, during a running period, before an event is generated. + +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_x_raw +What: /sys/bus/iio/devices/iio:deviceX/in_chromaticity_y_raw +KernelVersion: 6.6 +Contact: linux-iio@vger.kernel.org +Description: + The x and y light color coordinate on the CIE 1931 chromaticity + diagram. diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index d752e9c0499b..c1df66cdfdf6 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -90,6 +90,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_POSITIONRELATIVE] = "positionrelative", [IIO_PHASE] = "phase", [IIO_MASSCONCENTRATION] = "massconcentration", + [IIO_CHROMATICITY] = "chromaticity", }; static const char * const iio_modifier_names[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index c79f2f046a0b..8952d48cfc64 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -47,6 +47,7 @@ enum iio_chan_type { IIO_POSITIONRELATIVE, IIO_PHASE, IIO_MASSCONCENTRATION, + IIO_CHROMATICITY, }; enum iio_modifier { diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index 0a5c2bb60030..115ba1fbf3ac 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -59,6 +59,7 @@ static const char * const iio_chan_type_name_spec[] = { [IIO_POSITIONRELATIVE] = "positionrelative", [IIO_PHASE] = "phase", [IIO_MASSCONCENTRATION] = "massconcentration", + [IIO_CHROMATICITY] = "chromaticity", }; static const char * const iio_ev_type_text[] = { @@ -173,6 +174,7 @@ static bool event_is_known(struct iio_event_data *event) case IIO_POSITIONRELATIVE: case IIO_PHASE: case IIO_MASSCONCENTRATION: + case IIO_CHROMATICITY: break; default: return false;
In most cases, ambient color sensors also support the x and y light colors, which represent the coordinates on the CIE 1931 chromaticity diagram. Thus, add channel for chromaticity. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> --- Documentation/ABI/testing/sysfs-bus-iio | 8 ++++++++ drivers/iio/industrialio-core.c | 1 + include/uapi/linux/iio/types.h | 1 + tools/iio/iio_event_monitor.c | 2 ++ 4 files changed, 12 insertions(+)