From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: Basavaraj Natikar <Basavaraj.Natikar@amd.com>,
jikos@kernel.org, benjamin.tissoires@redhat.com,
jic23@kernel.org, lars@metafoo.de, linux-input@vger.kernel.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 1/9] iio: hid-sensor-als: Use channel index to support more hub attributes
Date: Wed, 20 Sep 2023 09:59:21 -0700 [thread overview]
Message-ID: <0cbd0b164462c0b857c45117fdf267710566e055.camel@linux.intel.com> (raw)
In-Reply-To: <20230919081054.2050714-2-Basavaraj.Natikar@amd.com>
On Tue, 2023-09-19 at 13:40 +0530, Basavaraj Natikar wrote:
> Sensor hub attributes can be extended to support more channels.
> Repeat
> the reading for the two existing channels and store them separately.
> It
> still operates in the same manner as before where there was just one
> entry. So in order to support more sensor hub attributes for ALS use
> channel index to get specific sensor hub attributes.
>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Acked-by: Srinivas Pandruvada<srinivas.pandruvada@linux.intel.com>
> ---
> drivers/iio/light/hid-sensor-als.c | 38 ++++++++++++++++------------
> --
> 1 file changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/iio/light/hid-sensor-als.c
> b/drivers/iio/light/hid-sensor-als.c
> index eb1aedad7edc..efb1f8862b28 100644
> --- a/drivers/iio/light/hid-sensor-als.c
> +++ b/drivers/iio/light/hid-sensor-als.c
> @@ -24,7 +24,7 @@ enum {
> struct als_state {
> struct hid_sensor_hub_callbacks callbacks;
> struct hid_sensor_common common_attributes;
> - struct hid_sensor_hub_attribute_info als_illum;
> + struct hid_sensor_hub_attribute_info
> als[CHANNEL_SCAN_INDEX_MAX];
> struct {
> u32 illum[CHANNEL_SCAN_INDEX_MAX];
> u64 timestamp __aligned(8);
> @@ -99,8 +99,8 @@ static int als_read_raw(struct iio_dev *indio_dev,
> switch (chan->scan_index) {
> case CHANNEL_SCAN_INDEX_INTENSITY:
> case CHANNEL_SCAN_INDEX_ILLUM:
> - report_id = als_state->als_illum.report_id;
> - min = als_state->als_illum.logical_minimum;
> + report_id = als_state->als[chan-
> >scan_index].report_id;
> + min = als_state->als[chan-
> >scan_index].logical_minimum;
> address = HID_USAGE_SENSOR_LIGHT_ILLUM;
> break;
> default:
> @@ -242,22 +242,24 @@ static int als_parse_report(struct
> platform_device *pdev,
> struct als_state *st)
> {
> int ret;
> + int i;
> +
> + for (i = 0; i <= CHANNEL_SCAN_INDEX_ILLUM; ++i) {
> + ret = sensor_hub_input_get_attribute_info(hsdev,
> + HID_INPUT_REPORT,
> + usage_id,
> + HID_USAGE_SENSOR_LIGH
> T_ILLUM,
> + &st->als[i]);
> + if (ret < 0)
> + return ret;
> + als_adjust_channel_bit_mask(channels, i, st-
> >als[i].size);
> +
> + dev_dbg(&pdev->dev, "als %x:%x\n", st->als[i].index,
> + st->als[i].report_id);
> + }
>
> - ret = sensor_hub_input_get_attribute_info(hsdev,
> HID_INPUT_REPORT,
> - usage_id,
> - HID_USAGE_SENSOR_LIGHT_ILLUM,
> - &st->als_illum);
> - if (ret < 0)
> - return ret;
> - als_adjust_channel_bit_mask(channels,
> CHANNEL_SCAN_INDEX_INTENSITY,
> - st->als_illum.size);
> - als_adjust_channel_bit_mask(channels,
> CHANNEL_SCAN_INDEX_ILLUM,
> - st->als_illum.size);
> -
> - dev_dbg(&pdev->dev, "als %x:%x\n", st->als_illum.index,
> - st->als_illum.report_id);
> -
> - st->scale_precision = hid_sensor_format_scale(usage_id, &st-
> >als_illum,
> + st->scale_precision = hid_sensor_format_scale(usage_id,
> + &st-
> >als[CHANNEL_SCAN_INDEX_INTENSITY],
> &st->scale_pre_decml, &st-
> >scale_post_decml);
>
> return ret;
next prev parent reply other threads:[~2023-09-20 16:59 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 8:10 [PATCH v2 0/9] Support light color temperature and chromaticity Basavaraj Natikar
2023-09-19 8:10 ` [PATCH v2 1/9] iio: hid-sensor-als: Use channel index to support more hub attributes Basavaraj Natikar
2023-09-20 16:59 ` srinivas pandruvada [this message]
2023-09-19 8:10 ` [PATCH v2 2/9] iio: Add channel type light color temperature Basavaraj Natikar
2023-09-19 8:10 ` [PATCH v2 3/9] iio: hid-sensor-als: Add light color temperature support Basavaraj Natikar
2023-09-20 17:00 ` srinivas pandruvada
2023-09-19 8:10 ` [PATCH v2 4/9] HID: amd_sfh: Add support for light color temperature Basavaraj Natikar
2023-09-20 15:25 ` Jiri Kosina
2023-09-19 8:10 ` [PATCH v2 5/9] HID: amd_sfh: Add support for SFH1.1 " Basavaraj Natikar
2023-09-20 15:25 ` Jiri Kosina
2023-09-19 8:10 ` [PATCH v2 6/9] iio: Add channel type for chromaticity Basavaraj Natikar
2023-09-24 12:31 ` Jonathan Cameron
2023-09-19 8:10 ` [PATCH v2 7/9] iio: hid-sensor-als: Add light chromaticity support Basavaraj Natikar
2023-09-20 17:10 ` srinivas pandruvada
2023-09-19 8:10 ` [PATCH v2 8/9] HID: amd_sfh: " Basavaraj Natikar
2023-09-20 15:25 ` Jiri Kosina
2023-09-19 8:10 ` [PATCH v2 9/9] HID: amd_sfh: Add light chromaticity for SFH1.1 Basavaraj Natikar
2023-09-20 15:26 ` Jiri Kosina
2023-09-20 14:13 ` [PATCH v2 0/9] Support light color temperature and chromaticity Jiri Kosina
2023-09-20 15:23 ` Basavaraj Natikar
2023-09-24 12:42 ` Jonathan Cameron
2023-09-24 14:20 ` Basavaraj Natikar
2023-12-06 23:39 ` Thomas Weißschuh
2023-12-10 11:07 ` Jonathan Cameron
2023-12-15 10:04 ` Linux regression tracking (Thorsten Leemhuis)
2023-12-15 17:33 ` srinivas pandruvada
2023-12-23 8:14 ` Linux regression tracking #update (Thorsten Leemhuis)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cbd0b164462c0b857c45117fdf267710566e055.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=Basavaraj.Natikar@amd.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jic23@kernel.org \
--cc=jikos@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).