All of lore.kernel.org
 help / color / mirror / Atom feed
From: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
To: <jikos@kernel.org>, <benjamin.tissoires@redhat.com>,
	<jic23@kernel.org>, <lars@metafoo.de>,
	<srinivas.pandruvada@linux.intel.com>,
	<linux-input@vger.kernel.org>, <linux-iio@vger.kernel.org>
Cc: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Subject: [PATCH v2 8/9] HID: amd_sfh: Add light chromaticity support
Date: Tue, 19 Sep 2023 13:40:53 +0530	[thread overview]
Message-ID: <20230919081054.2050714-9-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20230919081054.2050714-1-Basavaraj.Natikar@amd.com>

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 light chromaticity x and y.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c  |  5 ++++-
 .../amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h  |  2 ++
 .../hid_descriptor/amd_sfh_hid_report_desc.h       | 14 ++++++++++++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
index b7e732ec4806..ef1f9be8b893 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
@@ -258,8 +258,11 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
 			als_input.illuminance_value =
 				(int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER;
 
-		if (sensor_idx == ACS_IDX)
+		if (sensor_idx == ACS_IDX) {
 			als_input.light_color_temp = sensor_virt_addr[1];
+			als_input.chromaticity_x_value = sensor_virt_addr[2];
+			als_input.chromaticity_y_value = sensor_virt_addr[3];
+		}
 
 		report_size = sizeof(als_input);
 		memcpy(input_report, &als_input, sizeof(als_input));
diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
index a7fc50deca4d..882434b1501f 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
@@ -100,6 +100,8 @@ struct als_input_report {
 	/* values specific to this sensor */
 	int illuminance_value;
 	int light_color_temp;
+	int chromaticity_x_value;
+	int chromaticity_y_value;
 } __packed;
 
 struct hpd_feature_report {
diff --git a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
index 26e994e54ded..67ec2d6a417d 100644
--- a/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
+++ b/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h
@@ -648,6 +648,20 @@ static const u8 als_report_descriptor[] = {
 0x75, 32,		/* HID report size(32) */
 0x95, 1,		/* HID report count (1) */
 0X81, 0x02,		/* HID Input (Data_Arr_Abs) */
+0x0A, 0xD4, 0x04,       /* HID usage sensor data light chromaticity_x */
+0x17, 0x00, 0x00, 0x01, 0x80,	 /* HID logical Min_32 */
+0x27, 0xFF, 0xFF, 0xFF, 0x7F,	 /* HID logical Max_32 */
+0x55, 0x0,		/* HID unit exponent(0x0) */
+0x75, 32,		/* HID report size(32) */
+0x95, 1,		/* HID report count(1) */
+0X81, 0x02,		/* HID Input (Data_Var_Abs) */
+0x0A, 0xD5, 0x04,       /* HID usage sensor data light chromaticity_y */
+0x17, 0x00, 0x00, 0x01, 0x80,	 /* HID logical Min_32 */
+0x27, 0xFF, 0xFF, 0xFF, 0x7F,	 /* HID logical Max_32 */
+0x55, 0x0,		/* HID unit exponent(0x0) */
+0x75, 32,		/* HID report size(32) */
+0x95, 1,		/* HID report count (1) */
+0X81, 0x02,		/* HID Input (Data_Var_Abs) */
 0xC0			/* HID end collection */
 };
 
-- 
2.25.1


  parent reply	other threads:[~2023-09-19  8:12 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
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 ` Basavaraj Natikar [this message]
2023-09-20 15:25   ` [PATCH v2 8/9] HID: amd_sfh: " 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=20230919081054.2050714-9-Basavaraj.Natikar@amd.com \
    --to=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 \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.