summaryrefslogtreecommitdiff
path: root/drivers/hid/amd-sfh-hid/amd_sfh_common.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-08-05 04:04:28 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2022-08-05 04:04:28 +0300
commit8d9420ca9bd9bceddcfab3d0263d6a8e073396fe (patch)
tree82a3f0597256bb94455ed772148ebf3fbe0ea7c0 /drivers/hid/amd-sfh-hid/amd_sfh_common.h
parentc040862bfbd9c5f3cb64e1df1c623e20e38fe656 (diff)
parenta60885b6a97b5dc9340dd9310a57b5682c2daf2d (diff)
downloadlinux-8d9420ca9bd9bceddcfab3d0263d6a8e073396fe.tar.xz
Merge tag 'for-linus-2022080201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
Pull HID updates from Jiri Kosina: - support for AMD SOCs using SFH1.1 memory access (Basavaraj Natikar) - XP-PEN Deco L support (José Expósito) - support for Elan eKTH6915 touchscreens (Douglas Anderson) - other small assorted fixes and device ID additions * tag 'for-linus-2022080201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (39 commits) HID: amd_sfh: Handle condition of "no sensors" HID: amd_sfh: Fix implicit declaration error on i386 HID: apple: Add "GANSS" to the non-Apple list HID: alps: Declare U1_UNICORN_LEGACY support HID: wacom: Force pen out of prox if no events have been received in a while HID: nintendo: Add missing array termination HID: lg-g15: Fix comment typo HID: amd_sfh: Implement SFH1.1 functionality HID: amd_sfh: Move interrupt handling to common interface HID: amd_sfh: Move amd_sfh_work to common interface HID: amd_sfh: Move global functions to static HID: amd_sfh: Add remove operation in amd_mp2_ops HID: amd_sfh: Add PM operations in amd_mp2_ops HID: amd_sfh: Add descriptor operations in amd_mp2_ops HID: amd_sfh: Move request_list variable to client data HID: amd_sfh: Move request_list struct to header file HID: amd_sfh: Move common macros and structures HID: amd_sfh: Add NULL check for hid device HID: core: remove unneeded assignment in hid_process_report() ID: intel-ish-hid: hid-client: drop unexpected word "the" in the comments ...
Diffstat (limited to 'drivers/hid/amd-sfh-hid/amd_sfh_common.h')
-rw-r--r--drivers/hid/amd-sfh-hid/amd_sfh_common.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_common.h b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
new file mode 100644
index 000000000000..2643bb14fee2
--- /dev/null
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_common.h
@@ -0,0 +1,76 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * AMD MP2 common macros and structures
+ *
+ * Copyright (c) 2022, Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
+ */
+#ifndef AMD_SFH_COMMON_H
+#define AMD_SFH_COMMON_H
+
+#include <linux/pci.h>
+#include "amd_sfh_hid.h"
+
+#define PCI_DEVICE_ID_AMD_MP2 0x15E4
+#define PCI_DEVICE_ID_AMD_MP2_1_1 0x164A
+
+#define AMD_C2P_MSG(regno) (0x10500 + ((regno) * 4))
+#define AMD_P2C_MSG(regno) (0x10680 + ((regno) * 4))
+
+#define SENSOR_ENABLED 4
+#define SENSOR_DISABLED 5
+
+#define AMD_SFH_IDLE_LOOP 200
+
+enum cmd_id {
+ NO_OP,
+ ENABLE_SENSOR,
+ DISABLE_SENSOR,
+ STOP_ALL_SENSORS = 8,
+};
+
+struct amd_mp2_sensor_info {
+ u8 sensor_idx;
+ u32 period;
+ dma_addr_t dma_address;
+};
+
+struct amd_mp2_dev {
+ struct pci_dev *pdev;
+ struct amdtp_cl_data *cl_data;
+ void __iomem *mmio;
+ void __iomem *vsbase;
+ const struct amd_sfh1_1_ops *sfh1_1_ops;
+ struct amd_mp2_ops *mp2_ops;
+ struct amd_input_data in_data;
+ /* mp2 active control status */
+ u32 mp2_acs;
+};
+
+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);
+ void (*clear_intr)(struct amd_mp2_dev *privdata);
+ int (*init_intr)(struct amd_mp2_dev *privdata);
+ int (*discovery_status)(struct amd_mp2_dev *privdata);
+ void (*suspend)(struct amd_mp2_dev *mp2);
+ void (*resume)(struct amd_mp2_dev *mp2);
+ void (*remove)(void *privdata);
+ int (*get_rep_desc)(int sensor_idx, u8 rep_desc[]);
+ u32 (*get_desc_sz)(int sensor_idx, int descriptor_name);
+ u8 (*get_feat_rep)(int sensor_idx, int report_id, u8 *feature_report);
+ u8 (*get_in_rep)(u8 current_index, int sensor_idx, int report_id,
+ struct amd_input_data *in_data);
+};
+
+void amd_sfh_work(struct work_struct *work);
+void amd_sfh_work_buffer(struct work_struct *work);
+void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata);
+int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata);
+void amd_sfh_clear_intr(struct amd_mp2_dev *privdata);
+int amd_sfh_irq_init(struct amd_mp2_dev *privdata);
+#endif