HID: amd_sfh: Add support for light color temperature
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>
Tue, 19 Sep 2023 08:10:49 +0000 (13:40 +0530)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 24 Sep 2023 12:22:52 +0000 (13:22 +0100)
In most cases, ambient color sensors also support light color temperature.
As a result, add support of light color temperature.

Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Link: https://lore.kernel.org/r/20230919081054.2050714-5-Basavaraj.Natikar@amd.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_report_desc.h

index 8716a05950c82e8ff4512da09cd004990a1fbafa..b7e732ec4806826bf2514fd88ed310d11b758352 100644 (file)
@@ -257,6 +257,10 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
                else
                        als_input.illuminance_value =
                                (int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER;
+
+               if (sensor_idx == ACS_IDX)
+                       als_input.light_color_temp = sensor_virt_addr[1];
+
                report_size = sizeof(als_input);
                memcpy(input_report, &als_input, sizeof(als_input));
                break;
index ebd55675eb623c364c39368b6cc912cb70501d1c..a7fc50deca4dc22e8c603a6bd6ea4ac759f8f92f 100644 (file)
@@ -99,6 +99,7 @@ struct als_input_report {
        struct common_input_property common_property;
        /* values specific to this sensor */
        int illuminance_value;
+       int light_color_temp;
 } __packed;
 
 struct hpd_feature_report {
index 697f2791ea9cbb989a9ce63ff1a1c4dc0c9a438a..26e994e54dedbdf509176783cea23ea247f19c5f 100644 (file)
@@ -641,6 +641,13 @@ 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, 0xD2, 0x04,      /* HID usage sensor data light temperature */
+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_Arr_Abs) */
 0xC0                   /* HID end collection */
 };