Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303663 > unrolled thread

[PATCH] iio: light: acpi-als: Report data as processed rather than raw

Started byGabriele Mazzotta <gabriele.mzt@gmail.com>
First post2016-01-07 16:30 +0100
Last post2016-01-12 16:30 +0100
Articles 10 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] iio: light: acpi-als: Report data as processed rather than raw Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-01-07 16:30 +0100
    Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Jonathan Cameron <jic23@kernel.org> - 2016-01-09 17:40 +0100
      Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw Marek Vasut <marex@denx.de> - 2016-01-09 18:30 +0100
        Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Jonathan Cameron <jic23@kernel.org> - 2016-01-11 20:20 +0100
          Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw Marek Vasut <marex@denx.de> - 2016-01-11 20:30 +0100
          Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-01-12 01:20 +0100
          Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-01-12 16:30 +0100
      Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Crt Mori <cmo@melexis.com> - 2016-01-11 11:20 +0100
        Re: [PATCH] iio: light: acpi-als: Report data as processed rather  than raw Jonathan Cameron <jic23@kernel.org> - 2016-01-11 20:20 +0100
    [PATCH v2] iio: light: acpi-als: Report data as processed Gabriele Mazzotta <gabriele.mzt@gmail.com> - 2016-01-12 16:30 +0100

#1303663 — [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromGabriele Mazzotta <gabriele.mzt@gmail.com>
Date2016-01-07 16:30 +0100
Subject[PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qOkFJ-1wu-45@gated-at.bofh.it>
As per the ACPI specification (Revision 5.0) [1], the data coming
from the sensor represent the ambient light illuminance reading
expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
IIO_CHAN_INFO_RAW to signify that the data are pre-processed.

[1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
---
 drivers/iio/light/acpi-als.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index 60537ec..a53be07 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -54,7 +54,7 @@ static const struct iio_chan_spec acpi_als_channels[] = {
 			.realbits	= 32,
 			.storagebits	= 32,
 		},
-		.info_mask_separate	= BIT(IIO_CHAN_INFO_RAW),
+		.info_mask_separate	= BIT(IIO_CHAN_INFO_PROCESSED),
 	},
 };
 
@@ -152,7 +152,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
 	s32 temp_val;
 	int ret;
 
-	if (mask != IIO_CHAN_INFO_RAW)
+	if (mask != IIO_CHAN_INFO_PROCESSED)
 		return -EINVAL;
 
 	/* we support only illumination (_ALI) so far. */
-- 
2.7.0.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1305299 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromJonathan Cameron <jic23@kernel.org>
Date2016-01-09 17:40 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qP4Iz-87R-49@gated-at.bofh.it>
In reply to#1303663
On 07/01/16 15:21, Gabriele Mazzotta wrote:
> As per the ACPI specification (Revision 5.0) [1], the data coming
> from the sensor represent the ambient light illuminance reading
> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
> 
> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
> 
> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Hm. Whilst it's a fix in a sense, the original didn't really 'break'
the ABI so I worry a little that this change may break others.
Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
(which will then be exactly the same value).
We'll also then need a comment in the code, that leaving the _RAW
elements was for ABI compatibility.

What do others think?

Jonathan
> ---
>  drivers/iio/light/acpi-als.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
> index 60537ec..a53be07 100644
> --- a/drivers/iio/light/acpi-als.c
> +++ b/drivers/iio/light/acpi-als.c
> @@ -54,7 +54,7 @@ static const struct iio_chan_spec acpi_als_channels[] = {
>  			.realbits	= 32,
>  			.storagebits	= 32,
>  		},
> -		.info_mask_separate	= BIT(IIO_CHAN_INFO_RAW),
> +		.info_mask_separate	= BIT(IIO_CHAN_INFO_PROCESSED),
>  	},
>  };
>  
> @@ -152,7 +152,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
>  	s32 temp_val;
>  	int ret;
>  
> -	if (mask != IIO_CHAN_INFO_RAW)
> +	if (mask != IIO_CHAN_INFO_PROCESSED)
>  		return -EINVAL;
>  
>  	/* we support only illumination (_ALI) so far. */
> 

[toc] | [prev] | [next] | [standalone]


#1305329

FromMarek Vasut <marex@denx.de>
Date2016-01-09 18:30 +0100
Message-ID<qP5uV-fB-3@gated-at.bofh.it>
In reply to#1305299
On Saturday, January 09, 2016 at 05:31:24 PM, Jonathan Cameron wrote:
> On 07/01/16 15:21, Gabriele Mazzotta wrote:
> > As per the ACPI specification (Revision 5.0) [1], the data coming
> > from the sensor represent the ambient light illuminance reading
> > expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
> > IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
> > 
> > [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
> > 
> > Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> 
> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
> the ABI so I worry a little that this change may break others.
> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
> (which will then be exactly the same value).
> We'll also then need a comment in the code, that leaving the _RAW
> elements was for ABI compatibility.
> 
> What do others think?

I'm not an IIO guru, but this does sound sensible. Do you know if any userland
code which actually uses the ACPI ALS already ?

Best regards,
Marek Vasut

[toc] | [prev] | [next] | [standalone]


#1306612 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromJonathan Cameron <jic23@kernel.org>
Date2016-01-11 20:20 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qPQau-6Em-23@gated-at.bofh.it>
In reply to#1305329
On 09/01/16 17:27, Marek Vasut wrote:
> On Saturday, January 09, 2016 at 05:31:24 PM, Jonathan Cameron wrote:
>> On 07/01/16 15:21, Gabriele Mazzotta wrote:
>>> As per the ACPI specification (Revision 5.0) [1], the data coming
>>> from the sensor represent the ambient light illuminance reading
>>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
>>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
>>>
>>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
>>>
>>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
>>
>> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
>> the ABI so I worry a little that this change may break others.
>> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
>> (which will then be exactly the same value).
>> We'll also then need a comment in the code, that leaving the _RAW
>> elements was for ABI compatibility.
>>
>> What do others think?
> 
> I'm not an IIO guru, but this does sound sensible. Do you know if any userland
> code which actually uses the ACPI ALS already ?
It's more than likely as Gnome at least supports using them to control screen
brightness.  Hopefully that code is able to cope with the correct ABI though as
well as the old one.  Anyhow, we seem to have a reasonable consensus. 
Gabriele, are you happy to do a version of the patch with the _RAW version
left along side your _PROCESSED version and a comment saying that it is for
compatibility only?

Jonathan
> 
> Best regards,
> Marek Vasut
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1306623

FromMarek Vasut <marex@denx.de>
Date2016-01-11 20:30 +0100
Message-ID<qPQka-6HH-27@gated-at.bofh.it>
In reply to#1306612
On Monday, January 11, 2016 at 08:18:27 PM, Jonathan Cameron wrote:
> On 09/01/16 17:27, Marek Vasut wrote:
> > On Saturday, January 09, 2016 at 05:31:24 PM, Jonathan Cameron wrote:
> >> On 07/01/16 15:21, Gabriele Mazzotta wrote:
> >>> As per the ACPI specification (Revision 5.0) [1], the data coming
> >>> from the sensor represent the ambient light illuminance reading
> >>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
> >>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
> >>> 
> >>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
> >>> 
> >>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> >> 
> >> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
> >> the ABI so I worry a little that this change may break others.
> >> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
> >> (which will then be exactly the same value).
> >> We'll also then need a comment in the code, that leaving the _RAW
> >> elements was for ABI compatibility.
> >> 
> >> What do others think?
> > 
> > I'm not an IIO guru, but this does sound sensible. Do you know if any
> > userland code which actually uses the ACPI ALS already ?
> 
> It's more than likely as Gnome at least supports using them to control
> screen brightness.  Hopefully that code is able to cope with the correct
> ABI though as well as the old one.  Anyhow, we seem to have a reasonable
> consensus. Gabriele, are you happy to do a version of the patch with the
> _RAW version left along side your _PROCESSED version and a comment saying
> that it is for compatibility only?

This makes sense in my mind, thanks :)

Best regards,
Marek Vasut

[toc] | [prev] | [next] | [standalone]


#1306847 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromGabriele Mazzotta <gabriele.mzt@gmail.com>
Date2016-01-12 01:20 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qPUQO-1wX-5@gated-at.bofh.it>
In reply to#1306612
2016-01-11 20:18 GMT+01:00 Jonathan Cameron <jic23@kernel.org>:
> On 09/01/16 17:27, Marek Vasut wrote:
>> On Saturday, January 09, 2016 at 05:31:24 PM, Jonathan Cameron wrote:
>>> On 07/01/16 15:21, Gabriele Mazzotta wrote:
>>>> As per the ACPI specification (Revision 5.0) [1], the data coming
>>>> from the sensor represent the ambient light illuminance reading
>>>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
>>>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
>>>>
>>>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
>>>>
>>>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
>>>
>>> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
>>> the ABI so I worry a little that this change may break others.
>>> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
>>> (which will then be exactly the same value).
>>> We'll also then need a comment in the code, that leaving the _RAW
>>> elements was for ABI compatibility.
>>>
>>> What do others think?
>>
>> I'm not an IIO guru, but this does sound sensible. Do you know if any userland
>> code which actually uses the ACPI ALS already ?
> It's more than likely as Gnome at least supports using them to control screen
> brightness.  Hopefully that code is able to cope with the correct ABI though as
> well as the old one.  Anyhow, we seem to have a reasonable consensus.
> Gabriele, are you happy to do a version of the patch with the _RAW version
> left along side your _PROCESSED version and a comment saying that it is for
> compatibility only?

I'm definitely OK with this and I'll prepare a patch as soon as I can.

> Jonathan
>>
>> Best regards,
>> Marek Vasut
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

[toc] | [prev] | [next] | [standalone]


#1307533 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromGabriele Mazzotta <gabriele.mzt@gmail.com>
Date2016-01-12 16:30 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qQ93r-2Pd-3@gated-at.bofh.it>
In reply to#1306612
2016-01-11 20:18 GMT+01:00 Jonathan Cameron <jic23@kernel.org>:
> On 09/01/16 17:27, Marek Vasut wrote:
>> On Saturday, January 09, 2016 at 05:31:24 PM, Jonathan Cameron wrote:
>>> On 07/01/16 15:21, Gabriele Mazzotta wrote:
>>>> As per the ACPI specification (Revision 5.0) [1], the data coming
>>>> from the sensor represent the ambient light illuminance reading
>>>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
>>>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
>>>>
>>>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
>>>>
>>>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
>>>
>>> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
>>> the ABI so I worry a little that this change may break others.
>>> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
>>> (which will then be exactly the same value).
>>> We'll also then need a comment in the code, that leaving the _RAW
>>> elements was for ABI compatibility.
>>>
>>> What do others think?
>>
>> I'm not an IIO guru, but this does sound sensible. Do you know if any userland
>> code which actually uses the ACPI ALS already ?
> It's more than likely as Gnome at least supports using them to control screen
> brightness.  Hopefully that code is able to cope with the correct ABI though as
> well as the old one.  Anyhow, we seem to have a reasonable consensus.

I looked into this and Gnome uses iio-proxy-sensor to handle iio
devices. As of now it, only looks for in_illuminance_input, so it
currently doesn't work with acpi-als. I've also found a bug report [1]
of an acpi-als user stating the same.

[1] https://github.com/hadess/iio-sensor-proxy/issues/46

> Gabriele, are you happy to do a version of the patch with the _RAW version
> left along side your _PROCESSED version and a comment saying that it is for
> compatibility only?
>
> Jonathan
>>
>> Best regards,
>> Marek Vasut
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

[toc] | [prev] | [next] | [standalone]


#1306011 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromCrt Mori <cmo@melexis.com>
Date2016-01-11 11:20 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qPHJU-UI-7@gated-at.bofh.it>
In reply to#1305299
On 9 January 2016 at 17:31, Jonathan Cameron <jic23@kernel.org> wrote:
> On 07/01/16 15:21, Gabriele Mazzotta wrote:
>> As per the ACPI specification (Revision 5.0) [1], the data coming
>> from the sensor represent the ambient light illuminance reading
>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
>>
>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
>>
>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
> the ABI so I worry a little that this change may break others.
> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
> (which will then be exactly the same value).
> We'll also then need a comment in the code, that leaving the _RAW
> elements was for ABI compatibility.
>
> What do others think?
For this case I agree to keep both for backwards ABI compatibility,
but then other drivers returning the data in basic units, should be
changed from raw to processed? I do not think this was the case
before?

Crt

>
> Jonathan
>> ---
>>  drivers/iio/light/acpi-als.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
>> index 60537ec..a53be07 100644
>> --- a/drivers/iio/light/acpi-als.c
>> +++ b/drivers/iio/light/acpi-als.c
>> @@ -54,7 +54,7 @@ static const struct iio_chan_spec acpi_als_channels[] = {
>>                       .realbits       = 32,
>>                       .storagebits    = 32,
>>               },
>> -             .info_mask_separate     = BIT(IIO_CHAN_INFO_RAW),
>> +             .info_mask_separate     = BIT(IIO_CHAN_INFO_PROCESSED),
>>       },
>>  };
>>
>> @@ -152,7 +152,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
>>       s32 temp_val;
>>       int ret;
>>
>> -     if (mask != IIO_CHAN_INFO_RAW)
>> +     if (mask != IIO_CHAN_INFO_PROCESSED)
>>               return -EINVAL;
>>
>>       /* we support only illumination (_ALI) so far. */
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1306611 — Re: [PATCH] iio: light: acpi-als: Report data as processed rather than raw

FromJonathan Cameron <jic23@kernel.org>
Date2016-01-11 20:20 +0100
SubjectRe: [PATCH] iio: light: acpi-als: Report data as processed rather than raw
Message-ID<qPQau-6Em-21@gated-at.bofh.it>
In reply to#1306011
On 11/01/16 10:16, Crt Mori wrote:
> On 9 January 2016 at 17:31, Jonathan Cameron <jic23@kernel.org> wrote:
>> On 07/01/16 15:21, Gabriele Mazzotta wrote:
>>> As per the ACPI specification (Revision 5.0) [1], the data coming
>>> from the sensor represent the ambient light illuminance reading
>>> expressed in lux. Use IIO_CHAN_INFO_PROCESSED instead of
>>> IIO_CHAN_INFO_RAW to signify that the data are pre-processed.
>>>
>>> [1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf
>>>
>>> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
>> Hm. Whilst it's a fix in a sense, the original didn't really 'break'
>> the ABI so I worry a little that this change may break others.
>> Irritating as it is, perhaps we should keep the _RAW and add _PROCESSED
>> (which will then be exactly the same value).
>> We'll also then need a comment in the code, that leaving the _RAW
>> elements was for ABI compatibility.
>>
>> What do others think?
> For this case I agree to keep both for backwards ABI compatibility,
> but then other drivers returning the data in basic units, should be
> changed from raw to processed? I do not think this was the case
> before?
It's always been the case that devices that happen to output in the
right units (or do so after a non linear transform as tends to happen
with a lot of light sensors) should mark themselves as processed
to indicate that nothing else needs be done to convert to standard
units.

Sensor hubs in particular often do the unit conversion stuff on
a separate processor, though often their chosen 'base' units differ
from ours (not always though!)

Jonathan
> 
> Crt
> 
>>
>> Jonathan
>>> ---
>>>  drivers/iio/light/acpi-als.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
>>> index 60537ec..a53be07 100644
>>> --- a/drivers/iio/light/acpi-als.c
>>> +++ b/drivers/iio/light/acpi-als.c
>>> @@ -54,7 +54,7 @@ static const struct iio_chan_spec acpi_als_channels[] = {
>>>                       .realbits       = 32,
>>>                       .storagebits    = 32,
>>>               },
>>> -             .info_mask_separate     = BIT(IIO_CHAN_INFO_RAW),
>>> +             .info_mask_separate     = BIT(IIO_CHAN_INFO_PROCESSED),
>>>       },
>>>  };
>>>
>>> @@ -152,7 +152,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
>>>       s32 temp_val;
>>>       int ret;
>>>
>>> -     if (mask != IIO_CHAN_INFO_RAW)
>>> +     if (mask != IIO_CHAN_INFO_PROCESSED)
>>>               return -EINVAL;
>>>
>>>       /* we support only illumination (_ALI) so far. */
>>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1307540 — [PATCH v2] iio: light: acpi-als: Report data as processed

FromGabriele Mazzotta <gabriele.mzt@gmail.com>
Date2016-01-12 16:30 +0100
Subject[PATCH v2] iio: light: acpi-als: Report data as processed
Message-ID<qQ93s-2Pd-27@gated-at.bofh.it>
In reply to#1303663
As per the ACPI specification (Revision 5.0) [1], the data coming
from the sensor represent the ambient light illuminance reading
expressed in lux. So use IIO_CHAN_INFO_PROCESSED to signify that
the data are pre-processed.

However, to keep backward ABI compatibility, the IIO_CHAN_INFO_RAW
bit is not removed.

[1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
---
 drivers/iio/light/acpi-als.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/light/acpi-als.c b/drivers/iio/light/acpi-als.c
index 60537ec..53201d9 100644
--- a/drivers/iio/light/acpi-als.c
+++ b/drivers/iio/light/acpi-als.c
@@ -54,7 +54,9 @@ static const struct iio_chan_spec acpi_als_channels[] = {
 			.realbits	= 32,
 			.storagebits	= 32,
 		},
-		.info_mask_separate	= BIT(IIO_CHAN_INFO_RAW),
+		/* _RAW is here for backward ABI compatibility */
+		.info_mask_separate	= BIT(IIO_CHAN_INFO_RAW) |
+					  BIT(IIO_CHAN_INFO_PROCESSED),
 	},
 };
 
@@ -152,7 +154,7 @@ static int acpi_als_read_raw(struct iio_dev *indio_dev,
 	s32 temp_val;
 	int ret;
 
-	if (mask != IIO_CHAN_INFO_RAW)
+	if ((mask != IIO_CHAN_INFO_PROCESSED) && (mask != IIO_CHAN_INFO_RAW))
 		return -EINVAL;
 
 	/* we support only illumination (_ALI) so far. */
-- 
2.7.0.rc3

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web