summaryrefslogtreecommitdiff
path: root/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
diff options
context:
space:
mode:
authorBasavaraj Natikar <Basavaraj.Natikar@amd.com>2021-08-02 17:03:38 +0300
committerJiri Kosina <jkosina@suse.cz>2021-08-20 15:48:48 +0300
commit173709f50e98df4c49c2776834605a2f7ed3e681 (patch)
tree35f592444d0dd61cbf9b5239102c84e8604d8b0b /drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
parent3978f54817559b28535c58a00d3d31bbd5d0b65a (diff)
downloadlinux-173709f50e98df4c49c2776834605a2f7ed3e681.tar.xz
HID: amd_sfh: Add command response to check command status
Sometimes sensor enable/disable may take time, without checking the actual status bits from MP2 FW can lead the amd-sfh to misbehave. Hence add a status check of enable/disable command by waiting on the command response before sending the next command to FW. Reviewed-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> 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/amd_sfh_pcie.h')
-rw-r--r--drivers/hid/amd-sfh-hid/amd_sfh_pcie.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
index 2d5c57e3782d..21ef55da712a 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.h
@@ -24,12 +24,16 @@
#define AMD_C2P_MSG2 0x10508
#define AMD_C2P_MSG(regno) (0x10500 + ((regno) * 4))
+#define AMD_P2C_MSG(regno) (0x10680 + ((regno) * 4))
/* MP2 P2C Message Registers */
#define AMD_P2C_MSG3 0x1068C /* Supported Sensors info */
#define V2_STATUS 0x2
+#define SENSOR_ENABLED 4
+#define SENSOR_DISABLED 5
+
#define HPD_IDX 16
/* SFH Command register */
@@ -51,6 +55,19 @@ union sfh_cmd_base {
} cmd_v2;
};
+union cmd_response {
+ u32 resp;
+ struct {
+ u32 status : 2;
+ u32 out_in_c2p : 1;
+ u32 rsvd1 : 1;
+ u32 response : 4;
+ u32 sub_cmd : 8;
+ u32 sensor_id : 6;
+ u32 rsvd2 : 10;
+ } response_v2;
+};
+
union sfh_cmd_param {
u32 ul;
struct {
@@ -117,5 +134,6 @@ struct amd_mp2_ops {
void (*start)(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info);
void (*stop)(struct amd_mp2_dev *privdata, u16 sensor_idx);
void (*stop_all)(struct amd_mp2_dev *privdata);
+ int (*response)(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts);
};
#endif