summaryrefslogtreecommitdiff
path: root/drivers/hid/amd-sfh-hid/hid_descriptor
diff options
context:
space:
mode:
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>2022-07-12 21:18:30 +0300
committerJiri Kosina <jkosina@suse.cz>2022-07-21 14:43:58 +0300
commit786aa1b961d1b25f9480ae147e84e146f46fdca2 (patch)
treead02939440165291133687dfcb54ce8fcd6ff550 /drivers/hid/amd-sfh-hid/hid_descriptor
parentc092e274e0fcaae44a9e80a1cc6243b66976ae68 (diff)
downloadlinux-786aa1b961d1b25f9480ae147e84e146f46fdca2.tar.xz
HID: amd_sfh: Add descriptor operations in amd_mp2_ops
Add dynamic descriptor operations as part of amd_mp2_ops structure to support all AMD SOCs and use wherever applicable. Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/amd-sfh-hid/hid_descriptor')
-rw-r--r--drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c17
-rw-r--r--drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h3
2 files changed, 13 insertions, 7 deletions
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 76095bd53c65..f9a8c02d5a7b 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
@@ -29,7 +29,7 @@
#define HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM 0x04
#define ILLUMINANCE_MASK GENMASK(14, 0)
-int get_report_descriptor(int sensor_idx, u8 *rep_desc)
+static int get_report_descriptor(int sensor_idx, u8 *rep_desc)
{
switch (sensor_idx) {
case accel_idx: /* accel */
@@ -63,7 +63,7 @@ int get_report_descriptor(int sensor_idx, u8 *rep_desc)
return 0;
}
-u32 get_descr_sz(int sensor_idx, int descriptor_name)
+static u32 get_descr_sz(int sensor_idx, int descriptor_name)
{
switch (sensor_idx) {
case accel_idx:
@@ -133,7 +133,7 @@ static void get_common_features(struct common_feature_property *common, int repo
common->report_interval = HID_DEFAULT_REPORT_INTERVAL;
}
-u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
+static u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report)
{
struct accel3_feature_report acc_feature;
struct gyro_feature_report gyro_feature;
@@ -200,7 +200,8 @@ static void get_common_inputs(struct common_input_property *common, int report_i
common->event_type = HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM;
}
-u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_input_data *in_data)
+static u8 get_input_report(u8 current_index, int sensor_idx, int report_id,
+ struct amd_input_data *in_data)
{
struct amd_mp2_dev *privdata = container_of(in_data, struct amd_mp2_dev, in_data);
u32 *sensor_virt_addr = in_data->sensor_virt_addr[current_index];
@@ -267,3 +268,11 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_
}
return report_size;
}
+
+void amd_sfh_set_desc_ops(struct amd_mp2_ops *mp2_ops)
+{
+ mp2_ops->get_rep_desc = get_report_descriptor;
+ mp2_ops->get_feat_rep = get_feature_report;
+ mp2_ops->get_in_rep = get_input_report;
+ mp2_ops->get_desc_sz = get_descr_sz;
+}
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 70b1b7abe2c6..ebd55675eb62 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
@@ -111,7 +111,4 @@ struct hpd_input_report {
u8 human_presence;
} __packed;
-int get_report_descriptor(int sensor_idx, u8 rep_desc[]);
-u32 get_descr_sz(int sensor_idx, int descriptor_name);
-u8 get_feature_report(int sensor_idx, int report_id, u8 *feature_report);
#endif