Re: [PATCH v2 5/9] HID: amd_sfh: Add support for SFH1.1 light color temperature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 19 Sep 2023, Basavaraj Natikar wrote:

> 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@xxxxxxx>

Acked-by: Jiri Kosina <jkosina@xxxxxxx>

> ---
>  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
> 

-- 
Jiri Kosina
SUSE Labs




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux