Skip to content

Commit a585d2b

Browse files
committed
Merge tag 'platform-drivers-x86-v4.2-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
Pull late x86 platform driver updates from Darren Hart: "The following came in a bit later and I wanted them to bake in next a few more days before submitting, thus the second pull. A new intel_pmc_ipc driver, a symmetrical allocation and free fix in dell-laptop, a couple minor fixes, and some updated documentation in the dell-laptop comments. intel_pmc_ipc: - Add Intel Apollo Lake PMC IPC driver tc1100-wmi: - Delete an unnecessary check before the function call "kfree" dell-laptop: - Fix allocating & freeing SMI buffer page - Show info about WiGig and UWB in debugfs - Update information about wireless control" * tag 'platform-drivers-x86-v4.2-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: intel_pmc_ipc: Add Intel Apollo Lake PMC IPC driver tc1100-wmi: Delete an unnecessary check before the function call "kfree" dell-laptop: Fix allocating & freeing SMI buffer page dell-laptop: Show info about WiGig and UWB in debugfs dell-laptop: Update information about wireless control
2 parents 1dc51b8 + 0a8b835 commit a585d2b

File tree

7 files changed

+1004
-45
lines changed

7 files changed

+1004
-45
lines changed

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5470,6 +5470,13 @@ F: include/linux/mei_cl_bus.h
54705470
F: drivers/misc/mei/*
54715471
F: Documentation/misc-devices/mei/*
54725472

5473+
INTEL PMC IPC DRIVER
5474+
M: Zha Qipeng<[email protected]>
5475+
5476+
S: Maintained
5477+
F: drivers/platform/x86/intel_pmc_ipc.c
5478+
F: arch/x86/include/asm/intel_pmc_ipc.h
5479+
54735480
IOC3 ETHERNET DRIVER
54745481
M: Ralf Baechle <[email protected]>
54755482

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
@@ -912,4 +912,11 @@ config PVPANIC
912912
a paravirtualized device provided by QEMU; it lets a virtual machine
913913
(guest) communicate panic events to the host.
914914

915+
config INTEL_PMC_IPC
916+
tristate "Intel PMC IPC Driver"
917+
---help---
918+
This driver provides support for PMC control on some Intel platforms.
919+
The PMC is an ARC processor which defines IPC commands for communication
920+
with other entities in the CPU.
921+
915922
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

drivers/platform/x86/dell-laptop.c

Lines changed: 139 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
307307
};
308308

309309
static struct calling_interface_buffer *buffer;
310-
static struct page *bufferpage;
311310
static DEFINE_MUTEX(buffer_mutex);
312311

313312
static int hwswitch_state;
@@ -424,45 +423,125 @@ static inline int dell_smi_error(int value)
424423
}
425424
}
426425

427-
/* Derived from information in DellWirelessCtl.cpp:
428-
Class 17, select 11 is radio control. It returns an array of 32-bit values.
429-
430-
Input byte 0 = 0: Wireless information
431-
432-
result[0]: return code
433-
result[1]:
434-
Bit 0: Hardware switch supported
435-
Bit 1: Wifi locator supported
436-
Bit 2: Wifi is supported
437-
Bit 3: Bluetooth is supported
438-
Bit 4: WWAN is supported
439-
Bit 5: Wireless keyboard supported
440-
Bits 6-7: Reserved
441-
Bit 8: Wifi is installed
442-
Bit 9: Bluetooth is installed
443-
Bit 10: WWAN is installed
444-
Bits 11-15: Reserved
445-
Bit 16: Hardware switch is on
446-
Bit 17: Wifi is blocked
447-
Bit 18: Bluetooth is blocked
448-
Bit 19: WWAN is blocked
449-
Bits 20-31: Reserved
450-
result[2]: NVRAM size in bytes
451-
result[3]: NVRAM format version number
452-
453-
Input byte 0 = 2: Wireless switch configuration
454-
result[0]: return code
455-
result[1]:
456-
Bit 0: Wifi controlled by switch
457-
Bit 1: Bluetooth controlled by switch
458-
Bit 2: WWAN controlled by switch
459-
Bits 3-6: Reserved
460-
Bit 7: Wireless switch config locked
461-
Bit 8: Wifi locator enabled
462-
Bits 9-14: Reserved
463-
Bit 15: Wifi locator setting locked
464-
Bits 16-31: Reserved
465-
*/
426+
/*
427+
* Derived from information in smbios-wireless-ctl:
428+
*
429+
* cbSelect 17, Value 11
430+
*
431+
* Return Wireless Info
432+
* cbArg1, byte0 = 0x00
433+
*
434+
* cbRes1 Standard return codes (0, -1, -2)
435+
* cbRes2 Info bit flags:
436+
*
437+
* 0 Hardware switch supported (1)
438+
* 1 WiFi locator supported (1)
439+
* 2 WLAN supported (1)
440+
* 3 Bluetooth (BT) supported (1)
441+
* 4 WWAN supported (1)
442+
* 5 Wireless KBD supported (1)
443+
* 6 Uw b supported (1)
444+
* 7 WiGig supported (1)
445+
* 8 WLAN installed (1)
446+
* 9 BT installed (1)
447+
* 10 WWAN installed (1)
448+
* 11 Uw b installed (1)
449+
* 12 WiGig installed (1)
450+
* 13-15 Reserved (0)
451+
* 16 Hardware (HW) switch is On (1)
452+
* 17 WLAN disabled (1)
453+
* 18 BT disabled (1)
454+
* 19 WWAN disabled (1)
455+
* 20 Uw b disabled (1)
456+
* 21 WiGig disabled (1)
457+
* 20-31 Reserved (0)
458+
*
459+
* cbRes3 NVRAM size in bytes
460+
* cbRes4, byte 0 NVRAM format version number
461+
*
462+
*
463+
* Set QuickSet Radio Disable Flag
464+
* cbArg1, byte0 = 0x01
465+
* cbArg1, byte1
466+
* Radio ID value:
467+
* 0 Radio Status
468+
* 1 WLAN ID
469+
* 2 BT ID
470+
* 3 WWAN ID
471+
* 4 UWB ID
472+
* 5 WIGIG ID
473+
* cbArg1, byte2 Flag bits:
474+
* 0 QuickSet disables radio (1)
475+
* 1-7 Reserved (0)
476+
*
477+
* cbRes1 Standard return codes (0, -1, -2)
478+
* cbRes2 QuickSet (QS) radio disable bit map:
479+
* 0 QS disables WLAN
480+
* 1 QS disables BT
481+
* 2 QS disables WWAN
482+
* 3 QS disables UWB
483+
* 4 QS disables WIGIG
484+
* 5-31 Reserved (0)
485+
*
486+
* Wireless Switch Configuration
487+
* cbArg1, byte0 = 0x02
488+
*
489+
* cbArg1, byte1
490+
* Subcommand:
491+
* 0 Get config
492+
* 1 Set config
493+
* 2 Set WiFi locator enable/disable
494+
* cbArg1,byte2
495+
* Switch settings (if byte 1==1):
496+
* 0 WLAN sw itch control (1)
497+
* 1 BT sw itch control (1)
498+
* 2 WWAN sw itch control (1)
499+
* 3 UWB sw itch control (1)
500+
* 4 WiGig sw itch control (1)
501+
* 5-7 Reserved (0)
502+
* cbArg1, byte2 Enable bits (if byte 1==2):
503+
* 0 Enable WiFi locator (1)
504+
*
505+
* cbRes1 Standard return codes (0, -1, -2)
506+
* cbRes2 QuickSet radio disable bit map:
507+
* 0 WLAN controlled by sw itch (1)
508+
* 1 BT controlled by sw itch (1)
509+
* 2 WWAN controlled by sw itch (1)
510+
* 3 UWB controlled by sw itch (1)
511+
* 4 WiGig controlled by sw itch (1)
512+
* 5-6 Reserved (0)
513+
* 7 Wireless sw itch config locked (1)
514+
* 8 WiFi locator enabled (1)
515+
* 9-14 Reserved (0)
516+
* 15 WiFi locator setting locked (1)
517+
* 16-31 Reserved (0)
518+
*
519+
* Read Local Config Data (LCD)
520+
* cbArg1, byte0 = 0x10
521+
* cbArg1, byte1 NVRAM index low byte
522+
* cbArg1, byte2 NVRAM index high byte
523+
* cbRes1 Standard return codes (0, -1, -2)
524+
* cbRes2 4 bytes read from LCD[index]
525+
* cbRes3 4 bytes read from LCD[index+4]
526+
* cbRes4 4 bytes read from LCD[index+8]
527+
*
528+
* Write Local Config Data (LCD)
529+
* cbArg1, byte0 = 0x11
530+
* cbArg1, byte1 NVRAM index low byte
531+
* cbArg1, byte2 NVRAM index high byte
532+
* cbArg2 4 bytes to w rite at LCD[index]
533+
* cbArg3 4 bytes to w rite at LCD[index+4]
534+
* cbArg4 4 bytes to w rite at LCD[index+8]
535+
* cbRes1 Standard return codes (0, -1, -2)
536+
*
537+
* Populate Local Config Data from NVRAM
538+
* cbArg1, byte0 = 0x12
539+
* cbRes1 Standard return codes (0, -1, -2)
540+
*
541+
* Commit Local Config Data to NVRAM
542+
* cbArg1, byte0 = 0x13
543+
* cbRes1 Standard return codes (0, -1, -2)
544+
*/
466545

467546
static int dell_rfkill_set(void *data, bool blocked)
468547
{
@@ -550,12 +629,21 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
550629
(status & BIT(4)) >> 4);
551630
seq_printf(s, "Bit 5 : Wireless keyboard supported: %lu\n",
552631
(status & BIT(5)) >> 5);
632+
seq_printf(s, "Bit 6 : UWB supported: %lu\n",
633+
(status & BIT(6)) >> 6);
634+
seq_printf(s, "Bit 7 : WiGig supported: %lu\n",
635+
(status & BIT(7)) >> 7);
553636
seq_printf(s, "Bit 8 : Wifi is installed: %lu\n",
554637
(status & BIT(8)) >> 8);
555638
seq_printf(s, "Bit 9 : Bluetooth is installed: %lu\n",
556639
(status & BIT(9)) >> 9);
557640
seq_printf(s, "Bit 10: WWAN is installed: %lu\n",
558641
(status & BIT(10)) >> 10);
642+
seq_printf(s, "Bit 11: UWB installed: %lu\n",
643+
(status & BIT(11)) >> 11);
644+
seq_printf(s, "Bit 12: WiGig installed: %lu\n",
645+
(status & BIT(12)) >> 12);
646+
559647
seq_printf(s, "Bit 16: Hardware switch is on: %lu\n",
560648
(status & BIT(16)) >> 16);
561649
seq_printf(s, "Bit 17: Wifi is blocked: %lu\n",
@@ -564,6 +652,10 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
564652
(status & BIT(18)) >> 18);
565653
seq_printf(s, "Bit 19: WWAN is blocked: %lu\n",
566654
(status & BIT(19)) >> 19);
655+
seq_printf(s, "Bit 20: UWB is blocked: %lu\n",
656+
(status & BIT(20)) >> 20);
657+
seq_printf(s, "Bit 21: WiGig is blocked: %lu\n",
658+
(status & BIT(21)) >> 21);
567659

568660
seq_printf(s, "\nhwswitch_state:\t0x%X\n", hwswitch_state);
569661
seq_printf(s, "Bit 0 : Wifi controlled by switch: %lu\n",
@@ -572,6 +664,10 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
572664
(hwswitch_state & BIT(1)) >> 1);
573665
seq_printf(s, "Bit 2 : WWAN controlled by switch: %lu\n",
574666
(hwswitch_state & BIT(2)) >> 2);
667+
seq_printf(s, "Bit 3 : UWB controlled by switch: %lu\n",
668+
(hwswitch_state & BIT(3)) >> 3);
669+
seq_printf(s, "Bit 4 : WiGig controlled by switch: %lu\n",
670+
(hwswitch_state & BIT(4)) >> 4);
575671
seq_printf(s, "Bit 7 : Wireless switch config locked: %lu\n",
576672
(hwswitch_state & BIT(7)) >> 7);
577673
seq_printf(s, "Bit 8 : Wifi locator enabled: %lu\n",
@@ -1972,12 +2068,11 @@ static int __init dell_init(void)
19722068
* Allocate buffer below 4GB for SMI data--only 32-bit physical addr
19732069
* is passed to SMI handler.
19742070
*/
1975-
bufferpage = alloc_page(GFP_KERNEL | GFP_DMA32);
1976-
if (!bufferpage) {
2071+
buffer = (void *)__get_free_page(GFP_KERNEL | GFP_DMA32);
2072+
if (!buffer) {
19772073
ret = -ENOMEM;
19782074
goto fail_buffer;
19792075
}
1980-
buffer = page_address(bufferpage);
19812076

19822077
ret = dell_setup_rfkill();
19832078

@@ -2034,7 +2129,7 @@ static int __init dell_init(void)
20342129
fail_backlight:
20352130
dell_cleanup_rfkill();
20362131
fail_rfkill:
2037-
free_page((unsigned long)bufferpage);
2132+
free_page((unsigned long)buffer);
20382133
fail_buffer:
20392134
platform_device_del(platform_device);
20402135
fail_platform_device2:

0 commit comments

Comments
 (0)