Skip to content

Commit 4bd7635

Browse files
basuamdJiri Kosina
authored andcommitted
HID: amd_sfh: Support for additional light sensor
There is support for additional light sensors in the SFH firmware. As a result, add support for additional light sensors. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 8455cbb commit 4bd7635

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/hid/amd-sfh-hid/amd_sfh_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static const char *get_sensor_name(int idx)
147147
case mag_idx:
148148
return "magnetometer";
149149
case als_idx:
150+
case ACS_IDX: /* ambient color sensor */
150151
return "ALS";
151152
case HPD_IDX:
152153
return "HPD";

drivers/hid/amd-sfh-hid/amd_sfh_pcie.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#define MAGNO_EN BIT(2)
3030
#define HPD_EN BIT(16)
3131
#define ALS_EN BIT(19)
32+
#define ACS_EN BIT(22)
3233

3334
static int sensor_mask_override = -1;
3435
module_param_named(sensor_mask, sensor_mask_override, int, 0444);
@@ -233,6 +234,9 @@ int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id)
233234
if (HPD_EN & activestatus)
234235
sensor_id[num_of_sensors++] = HPD_IDX;
235236

237+
if (ACS_EN & activestatus)
238+
sensor_id[num_of_sensors++] = ACS_IDX;
239+
236240
return num_of_sensors;
237241
}
238242

drivers/hid/amd-sfh-hid/amd_sfh_pcie.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#define V2_STATUS 0x2
2424

2525
#define HPD_IDX 16
26+
#define ACS_IDX 22
2627

2728
#define SENSOR_DISCOVERY_STATUS_MASK GENMASK(5, 3)
2829
#define SENSOR_DISCOVERY_STATUS_SHIFT 3

drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static int get_report_descriptor(int sensor_idx, u8 *rep_desc)
4848
sizeof(comp3_report_descriptor));
4949
break;
5050
case als_idx: /* ambient light sensor */
51+
case ACS_IDX: /* ambient color sensor */
5152
memset(rep_desc, 0, sizeof(als_report_descriptor));
5253
memcpy(rep_desc, als_report_descriptor,
5354
sizeof(als_report_descriptor));
@@ -97,6 +98,7 @@ static u32 get_descr_sz(int sensor_idx, int descriptor_name)
9798
}
9899
break;
99100
case als_idx:
101+
case ACS_IDX: /* ambient color sensor */
100102
switch (descriptor_name) {
101103
case descr_size:
102104
return sizeof(als_report_descriptor);
@@ -174,6 +176,7 @@ static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
174176
report_size = sizeof(magno_feature);
175177
break;
176178
case als_idx: /* ambient light sensor */
179+
case ACS_IDX: /* ambient color sensor */
177180
get_common_features(&als_feature.common_property, report_id);
178181
als_feature.als_change_sesnitivity = HID_DEFAULT_SENSITIVITY;
179182
als_feature.als_sensitivity_min = HID_DEFAULT_MIN_VALUE;
@@ -245,6 +248,7 @@ static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
245248
report_size = sizeof(magno_input);
246249
break;
247250
case als_idx: /* Als */
251+
case ACS_IDX: /* ambient color sensor */
248252
get_common_inputs(&als_input.common_property, report_id);
249253
/* For ALS ,V2 Platforms uses C2P_MSG5 register instead of DRAM access method */
250254
if (supported_input == V2_STATUS)

0 commit comments

Comments
 (0)