Skip to content

Commit 0a8b835

Browse files
qipengzhadvhart
authored andcommitted
intel_pmc_ipc: Add Intel Apollo Lake PMC IPC driver
This driver provides support for PMC control on Apollo Lake platforms. The PMC is an ARC processor which defines some IPC commands for communication with other entities in the CPU. Signed-off-by: qipeng.zha <[email protected]> [[email protected]: Fix Sparse and Cocinelle warnings] Signed-off-by: Fengguang Wu <[email protected]> Signed-off-by: Darren Hart <[email protected]>
1 parent 0d44b41 commit 0a8b835

File tree

5 files changed

+864
-0
lines changed

5 files changed

+864
-0
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5264,6 +5264,13 @@ F: include/uapi/linux/mei.h
52645264
F: drivers/misc/mei/*
52655265
F: Documentation/misc-devices/mei/*
52665266

5267+
INTEL PMC IPC DRIVER
5268+
M: Zha Qipeng<[email protected]>
5269+
5270+
S: Maintained
5271+
F: drivers/platform/x86/intel_pmc_ipc.c
5272+
F: arch/x86/include/asm/intel_pmc_ipc.h
5273+
52675274
IOC3 ETHERNET DRIVER
52685275
M: Ralf Baechle <[email protected]>
52695276

arch/x86/include/asm/intel_pmc_ipc.h

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#ifndef _ASM_X86_INTEL_PMC_IPC_H_
2+
#define _ASM_X86_INTEL_PMC_IPC_H_
3+
4+
/* Commands */
5+
#define PMC_IPC_PMIC_ACCESS 0xFF
6+
#define PMC_IPC_PMIC_ACCESS_READ 0x0
7+
#define PMC_IPC_PMIC_ACCESS_WRITE 0x1
8+
#define PMC_IPC_USB_PWR_CTRL 0xF0
9+
#define PMC_IPC_PMIC_BLACKLIST_SEL 0xEF
10+
#define PMC_IPC_PHY_CONFIG 0xEE
11+
#define PMC_IPC_NORTHPEAK_CTRL 0xED
12+
#define PMC_IPC_PM_DEBUG 0xEC
13+
#define PMC_IPC_PMC_TELEMTRY 0xEB
14+
#define PMC_IPC_PMC_FW_MSG_CTRL 0xEA
15+
16+
/* IPC return code */
17+
#define IPC_ERR_NONE 0
18+
#define IPC_ERR_CMD_NOT_SUPPORTED 1
19+
#define IPC_ERR_CMD_NOT_SERVICED 2
20+
#define IPC_ERR_UNABLE_TO_SERVICE 3
21+
#define IPC_ERR_CMD_INVALID 4
22+
#define IPC_ERR_CMD_FAILED 5
23+
#define IPC_ERR_EMSECURITY 6
24+
#define IPC_ERR_UNSIGNEDKERNEL 7
25+
26+
#if IS_ENABLED(CONFIG_INTEL_PMC_IPC)
27+
28+
/*
29+
* intel_pmc_ipc_simple_command
30+
* @cmd: command
31+
* @sub: sub type
32+
*/
33+
int intel_pmc_ipc_simple_command(int cmd, int sub);
34+
35+
/*
36+
* intel_pmc_ipc_raw_cmd
37+
* @cmd: command
38+
* @sub: sub type
39+
* @in: input data
40+
* @inlen: input length in bytes
41+
* @out: output data
42+
* @outlen: output length in dwords
43+
* @sptr: data writing to SPTR register
44+
* @dptr: data writing to DPTR register
45+
*/
46+
int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
47+
u32 *out, u32 outlen, u32 dptr, u32 sptr);
48+
49+
/*
50+
* intel_pmc_ipc_command
51+
* @cmd: command
52+
* @sub: sub type
53+
* @in: input data
54+
* @inlen: input length in bytes
55+
* @out: output data
56+
* @outlen: output length in dwords
57+
*/
58+
int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
59+
u32 *out, u32 outlen);
60+
61+
#else
62+
63+
static inline int intel_pmc_ipc_simple_command(int cmd, int sub)
64+
{
65+
return -EINVAL;
66+
}
67+
68+
static inline int intel_pmc_ipc_raw_cmd(u32 cmd, u32 sub, u8 *in, u32 inlen,
69+
u32 *out, u32 outlen, u32 dptr, u32 sptr)
70+
{
71+
return -EINVAL;
72+
}
73+
74+
static inline int intel_pmc_ipc_command(u32 cmd, u32 sub, u8 *in, u32 inlen,
75+
u32 *out, u32 outlen)
76+
{
77+
return -EINVAL;
78+
}
79+
80+
#endif /*CONFIG_INTEL_PMC_IPC*/
81+
82+
#endif

drivers/platform/x86/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,4 +901,11 @@ config PVPANIC
901901
a paravirtualized device provided by QEMU; it lets a virtual machine
902902
(guest) communicate panic events to the host.
903903

904+
config INTEL_PMC_IPC
905+
tristate "Intel PMC IPC Driver"
906+
---help---
907+
This driver provides support for PMC control on some Intel platforms.
908+
The PMC is an ARC processor which defines IPC commands for communication
909+
with other entities in the CPU.
910+
904911
endif # X86_PLATFORM_DEVICES

drivers/platform/x86/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ obj-$(CONFIG_INTEL_SMARTCONNECT) += intel-smartconnect.o
5959

6060
obj-$(CONFIG_PVPANIC) += pvpanic.o
6161
obj-$(CONFIG_ALIENWARE_WMI) += alienware-wmi.o
62+
obj-$(CONFIG_INTEL_PMC_IPC) += intel_pmc_ipc.o

0 commit comments

Comments
 (0)