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 4/8] HID: amd_sfh: Add support for SFH1.1 light color temperature
Date: Fri, 15 Sep 2023 10:46:59 +0530 [thread overview]
Message-ID: <20230915051703.1689578-5-Basavaraj.Natikar@amd.com> (raw)
In-Reply-To: <20230915051703.1689578-1-Basavaraj.Natikar@amd.com>
In most cases, ambient color sensors also support light color temperature.
As a result, add support of light color temperature for SFH1.1.
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c | 6 ++++++
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h | 13 +++++++++++++
2 files changed, 19 insertions(+)
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
index 06bdcf072d10..f100aaafa167 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_desc.c
@@ -188,6 +188,7 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,
struct sfh_mag_data mag_data;
struct sfh_als_data als_data;
struct hpd_status hpdstatus;
+ struct sfh_base_info binfo;
void __iomem *sensoraddr;
u8 report_size = 0;
@@ -235,6 +236,11 @@ static u8 get_input_rep(u8 current_index, int sensor_idx, int report_id,
memcpy_fromio(&als_data, sensoraddr, sizeof(struct sfh_als_data));
get_common_inputs(&als_input.common_property, report_id);
als_input.illuminance_value = float_to_int(als_data.lux);
+
+ memcpy_fromio(&binfo, mp2->vsbase, sizeof(struct sfh_base_info));
+ if (binfo.sbase.s_prop[ALS_IDX].sf.feat & 0x2)
+ als_input.light_color_temp = als_data.light_color_temp;
+
report_size = sizeof(als_input);
memcpy(input_report, &als_input, sizeof(als_input));
break;
diff --git a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
index 9d31d5b510eb..6f6f5db150c3 100644
--- a/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
+++ b/drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_interface.h
@@ -88,6 +88,16 @@ struct sfh_sensor_list {
};
};
+struct sfh_sensor_prop {
+ union {
+ u32 sprop;
+ struct {
+ u32 elist : 16;
+ u32 feat : 16;
+ } sf;
+ };
+};
+
struct sfh_base_info {
union {
u32 sfh_base[24];
@@ -95,6 +105,8 @@ struct sfh_base_info {
struct sfh_platform_info plat_info;
struct sfh_firmware_info fw_info;
struct sfh_sensor_list s_list;
+ u32 rsvd;
+ struct sfh_sensor_prop s_prop[16];
} sbase;
};
};
@@ -134,6 +146,7 @@ struct sfh_mag_data {
struct sfh_als_data {
struct sfh_common_data commondata;
u32 lux;
+ u32 light_color_temp;
};
struct hpd_status {
--
2.25.1
next prev parent reply other threads:[~2023-09-15 5:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 5:16 [PATCH 0/8] Multiple light sensor support Basavaraj Natikar
2023-09-15 5:16 ` [PATCH 1/8] iio: hid-sensor-als: Use channel index to support more hub attributes Basavaraj Natikar
2023-09-17 10:56 ` Jonathan Cameron
2023-09-15 5:16 ` [PATCH 2/8] iio: hid-sensor-als: Add light color temperature support Basavaraj Natikar
2023-09-17 11:00 ` Jonathan Cameron
2023-09-17 14:43 ` Basavaraj Natikar
2023-09-18 10:58 ` Jonathan Cameron
2023-09-15 5:16 ` [PATCH 3/8] HID: amd_sfh: Add support for light color temperature Basavaraj Natikar
2023-09-15 5:16 ` Basavaraj Natikar [this message]
2023-09-15 5:17 ` [PATCH 5/8] iio: Add channel for chromaticity Basavaraj Natikar
2023-09-17 11:04 ` Jonathan Cameron
2023-09-15 5:17 ` [PATCH 6/8] iio: hid-sensor-als: Add light chromaticity support Basavaraj Natikar
2023-09-15 5:17 ` [PATCH 7/8] HID: amd_sfh: " Basavaraj Natikar
2023-09-15 5:17 ` [PATCH 8/8] HID: amd_sfh: Add light chromaticity for SFH1.1 Basavaraj Natikar
2023-09-17 11:09 ` [PATCH 0/8] Multiple light sensor support Jonathan Cameron
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=20230915051703.1689578-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox