Skip to content

Commit 83c2713

Browse files
committed
Merge tag 'platform-drivers-x86-v5.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: "This consists of various build- and bug-fixes as well as a few hardware-id additions. Highlights: - Bunch of fixes for the new x86-android-tablets module - Misc other fixes - A couple of hw-id additions" * tag 'platform-drivers-x86-v5.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86: thinkpad_acpi: Fix incorrect use of platform profile on AMD platforms platform/x86: amd-pmc: Correct usage of SMU version platform/x86: asus-tf103c-dock: Make 2 global structs static platform/x86: amd-pmc: Make amd_pmc_stb_debugfs_fops static platform/x86: ISST: Fix possible circular locking dependency detected platform/x86: intel_crystal_cove_charger: Fix IRQ masking / unmasking platform/x86: thinkpad_acpi: Add quirk for ThinkPads without a fan platform/x86: touchscreen_dmi: Add info for the RWC NANOTE P8 AY07J 2-in-1 platform/surface: Reinstate platform dependency platform/x86: x86-android-tablets: Trivial typo fix for MODULE_AUTHOR platform/x86: x86-android-tablets: Fix the buttons on CZC P10T tablet platform/x86: x86-android-tablets: Constify the gpiod_lookup_tables arrays platform/x86: x86-android-tablets: Add an init() callback to struct x86_dev_info platform/x86: x86-android-tablets: Add support for disabling ACPI _AEI handlers platform/x86: x86-android-tablets: Correct crystal_cove_charger module name
2 parents 24d7f48 + 836f35f commit 83c2713

File tree

8 files changed

+229
-68
lines changed

8 files changed

+229
-68
lines changed

drivers/platform/surface/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
menuconfig SURFACE_PLATFORMS
77
bool "Microsoft Surface Platform-Specific Device Drivers"
8+
depends on ARM64 || X86 || COMPILE_TEST
89
default y
910
help
1011
Say Y here to get to see options for platform-specific device drivers

drivers/platform/x86/amd-pmc.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ struct amd_pmc_dev {
124124
u32 cpu_id;
125125
u32 active_ips;
126126
/* SMU version information */
127-
u16 major;
128-
u16 minor;
129-
u16 rev;
127+
u8 smu_program;
128+
u8 major;
129+
u8 minor;
130+
u8 rev;
130131
struct device *dev;
131132
struct pci_dev *rdev;
132133
struct mutex lock; /* generic mutex lock */
@@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
180181
if (rc)
181182
return rc;
182183

183-
dev->major = (val >> 16) & GENMASK(15, 0);
184+
dev->smu_program = (val >> 24) & GENMASK(7, 0);
185+
dev->major = (val >> 16) & GENMASK(7, 0);
184186
dev->minor = (val >> 8) & GENMASK(7, 0);
185187
dev->rev = (val >> 0) & GENMASK(7, 0);
186188

187-
dev_dbg(dev->dev, "SMU version is %u.%u.%u\n", dev->major, dev->minor, dev->rev);
189+
dev_dbg(dev->dev, "SMU program %u version is %u.%u.%u\n",
190+
dev->smu_program, dev->major, dev->minor, dev->rev);
188191

189192
return 0;
190193
}
@@ -226,7 +229,7 @@ static int amd_pmc_stb_debugfs_release(struct inode *inode, struct file *filp)
226229
return 0;
227230
}
228231

229-
const struct file_operations amd_pmc_stb_debugfs_fops = {
232+
static const struct file_operations amd_pmc_stb_debugfs_fops = {
230233
.owner = THIS_MODULE,
231234
.open = amd_pmc_stb_debugfs_open,
232235
.read = amd_pmc_stb_debugfs_read,

drivers/platform/x86/asus-tf103c-dock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int tf103c_dock_hid_raw_request(struct hid_device *hid, u8 reportnum,
250250
return 0;
251251
}
252252

253-
struct hid_ll_driver tf103c_dock_hid_ll_driver = {
253+
static struct hid_ll_driver tf103c_dock_hid_ll_driver = {
254254
.parse = tf103c_dock_hid_parse,
255255
.start = tf103c_dock_hid_start,
256256
.stop = tf103c_dock_hid_stop,
@@ -921,7 +921,7 @@ static int __maybe_unused tf103c_dock_resume(struct device *dev)
921921
return 0;
922922
}
923923

924-
SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
924+
static SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
925925

926926
static const struct acpi_device_id tf103c_dock_acpi_match[] = {
927927
{"NPCE69A"},

drivers/platform/x86/intel/crystal_cove_charger.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/regmap.h>
1818

1919
#define CHGRIRQ_REG 0x0a
20+
#define MCHGRIRQ_REG 0x17
2021

2122
struct crystal_cove_charger_data {
2223
struct mutex buslock; /* irq_bus_lock */
@@ -25,8 +26,8 @@ struct crystal_cove_charger_data {
2526
struct irq_domain *irq_domain;
2627
int irq;
2728
int charger_irq;
28-
bool irq_enabled;
29-
bool irq_is_enabled;
29+
u8 mask;
30+
u8 new_mask;
3031
};
3132

3233
static irqreturn_t crystal_cove_charger_irq(int irq, void *data)
@@ -53,13 +54,9 @@ static void crystal_cove_charger_irq_bus_sync_unlock(struct irq_data *data)
5354
{
5455
struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
5556

56-
if (charger->irq_is_enabled != charger->irq_enabled) {
57-
if (charger->irq_enabled)
58-
enable_irq(charger->irq);
59-
else
60-
disable_irq(charger->irq);
61-
62-
charger->irq_is_enabled = charger->irq_enabled;
57+
if (charger->mask != charger->new_mask) {
58+
regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask);
59+
charger->mask = charger->new_mask;
6360
}
6461

6562
mutex_unlock(&charger->buslock);
@@ -69,14 +66,14 @@ static void crystal_cove_charger_irq_unmask(struct irq_data *data)
6966
{
7067
struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
7168

72-
charger->irq_enabled = true;
69+
charger->new_mask &= ~BIT(data->hwirq);
7370
}
7471

7572
static void crystal_cove_charger_irq_mask(struct irq_data *data)
7673
{
7774
struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);
7875

79-
charger->irq_enabled = false;
76+
charger->new_mask |= BIT(data->hwirq);
8077
}
8178

8279
static void crystal_cove_charger_rm_irq_domain(void *data)
@@ -130,10 +127,13 @@ static int crystal_cove_charger_probe(struct platform_device *pdev)
130127
irq_set_nested_thread(charger->charger_irq, true);
131128
irq_set_noprobe(charger->charger_irq);
132129

130+
/* Mask the single 2nd level IRQ before enabling the 1st level IRQ */
131+
charger->mask = charger->new_mask = BIT(0);
132+
regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask);
133+
133134
ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL,
134135
crystal_cove_charger_irq,
135-
IRQF_ONESHOT | IRQF_NO_AUTOEN,
136-
KBUILD_MODNAME, charger);
136+
IRQF_ONESHOT, KBUILD_MODNAME, charger);
137137
if (ret)
138138
return dev_err_probe(&pdev->dev, ret, "requesting irq\n");
139139

drivers/platform/x86/intel/speed_select_if/isst_if_common.c

Lines changed: 63 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
596596
return ret;
597597
}
598598

599-
static DEFINE_MUTEX(punit_misc_dev_lock);
599+
/* Lock to prevent module registration when already opened by user space */
600+
static DEFINE_MUTEX(punit_misc_dev_open_lock);
601+
/* Lock to allow one share misc device for all ISST interace */
602+
static DEFINE_MUTEX(punit_misc_dev_reg_lock);
600603
static int misc_usage_count;
601604
static int misc_device_ret;
602605
static int misc_device_open;
@@ -606,7 +609,7 @@ static int isst_if_open(struct inode *inode, struct file *file)
606609
int i, ret = 0;
607610

608611
/* Fail open, if a module is going away */
609-
mutex_lock(&punit_misc_dev_lock);
612+
mutex_lock(&punit_misc_dev_open_lock);
610613
for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
611614
struct isst_if_cmd_cb *cb = &punit_callbacks[i];
612615

@@ -628,7 +631,7 @@ static int isst_if_open(struct inode *inode, struct file *file)
628631
} else {
629632
misc_device_open++;
630633
}
631-
mutex_unlock(&punit_misc_dev_lock);
634+
mutex_unlock(&punit_misc_dev_open_lock);
632635

633636
return ret;
634637
}
@@ -637,15 +640,15 @@ static int isst_if_relase(struct inode *inode, struct file *f)
637640
{
638641
int i;
639642

640-
mutex_lock(&punit_misc_dev_lock);
643+
mutex_lock(&punit_misc_dev_open_lock);
641644
misc_device_open--;
642645
for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
643646
struct isst_if_cmd_cb *cb = &punit_callbacks[i];
644647

645648
if (cb->registered)
646649
module_put(cb->owner);
647650
}
648-
mutex_unlock(&punit_misc_dev_lock);
651+
mutex_unlock(&punit_misc_dev_open_lock);
649652

650653
return 0;
651654
}
@@ -662,6 +665,43 @@ static struct miscdevice isst_if_char_driver = {
662665
.fops = &isst_if_char_driver_ops,
663666
};
664667

668+
static int isst_misc_reg(void)
669+
{
670+
mutex_lock(&punit_misc_dev_reg_lock);
671+
if (misc_device_ret)
672+
goto unlock_exit;
673+
674+
if (!misc_usage_count) {
675+
misc_device_ret = isst_if_cpu_info_init();
676+
if (misc_device_ret)
677+
goto unlock_exit;
678+
679+
misc_device_ret = misc_register(&isst_if_char_driver);
680+
if (misc_device_ret) {
681+
isst_if_cpu_info_exit();
682+
goto unlock_exit;
683+
}
684+
}
685+
misc_usage_count++;
686+
687+
unlock_exit:
688+
mutex_unlock(&punit_misc_dev_reg_lock);
689+
690+
return misc_device_ret;
691+
}
692+
693+
static void isst_misc_unreg(void)
694+
{
695+
mutex_lock(&punit_misc_dev_reg_lock);
696+
if (misc_usage_count)
697+
misc_usage_count--;
698+
if (!misc_usage_count && !misc_device_ret) {
699+
misc_deregister(&isst_if_char_driver);
700+
isst_if_cpu_info_exit();
701+
}
702+
mutex_unlock(&punit_misc_dev_reg_lock);
703+
}
704+
665705
/**
666706
* isst_if_cdev_register() - Register callback for IOCTL
667707
* @device_type: The device type this callback handling.
@@ -679,38 +719,31 @@ static struct miscdevice isst_if_char_driver = {
679719
*/
680720
int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
681721
{
682-
if (misc_device_ret)
683-
return misc_device_ret;
722+
int ret;
684723

685724
if (device_type >= ISST_IF_DEV_MAX)
686725
return -EINVAL;
687726

688-
mutex_lock(&punit_misc_dev_lock);
727+
mutex_lock(&punit_misc_dev_open_lock);
728+
/* Device is already open, we don't want to add new callbacks */
689729
if (misc_device_open) {
690-
mutex_unlock(&punit_misc_dev_lock);
730+
mutex_unlock(&punit_misc_dev_open_lock);
691731
return -EAGAIN;
692732
}
693-
if (!misc_usage_count) {
694-
int ret;
695-
696-
misc_device_ret = misc_register(&isst_if_char_driver);
697-
if (misc_device_ret)
698-
goto unlock_exit;
699-
700-
ret = isst_if_cpu_info_init();
701-
if (ret) {
702-
misc_deregister(&isst_if_char_driver);
703-
misc_device_ret = ret;
704-
goto unlock_exit;
705-
}
706-
}
707733
memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
708734
punit_callbacks[device_type].registered = 1;
709-
misc_usage_count++;
710-
unlock_exit:
711-
mutex_unlock(&punit_misc_dev_lock);
735+
mutex_unlock(&punit_misc_dev_open_lock);
712736

713-
return misc_device_ret;
737+
ret = isst_misc_reg();
738+
if (ret) {
739+
/*
740+
* No need of mutex as the misc device register failed
741+
* as no one can open device yet. Hence no contention.
742+
*/
743+
punit_callbacks[device_type].registered = 0;
744+
return ret;
745+
}
746+
return 0;
714747
}
715748
EXPORT_SYMBOL_GPL(isst_if_cdev_register);
716749

@@ -725,16 +758,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register);
725758
*/
726759
void isst_if_cdev_unregister(int device_type)
727760
{
728-
mutex_lock(&punit_misc_dev_lock);
729-
misc_usage_count--;
761+
isst_misc_unreg();
762+
mutex_lock(&punit_misc_dev_open_lock);
730763
punit_callbacks[device_type].registered = 0;
731764
if (device_type == ISST_IF_DEV_MBOX)
732765
isst_delete_hash();
733-
if (!misc_usage_count && !misc_device_ret) {
734-
misc_deregister(&isst_if_char_driver);
735-
isst_if_cpu_info_exit();
736-
}
737-
mutex_unlock(&punit_misc_dev_lock);
766+
mutex_unlock(&punit_misc_dev_open_lock);
738767
}
739768
EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);
740769

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8679,9 +8679,10 @@ static const struct attribute_group fan_driver_attr_group = {
86798679
.attrs = fan_driver_attributes,
86808680
};
86818681

8682-
#define TPACPI_FAN_Q1 0x0001 /* Unitialized HFSP */
8683-
#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
8684-
#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
8682+
#define TPACPI_FAN_Q1 0x0001 /* Uninitialized HFSP */
8683+
#define TPACPI_FAN_2FAN 0x0002 /* EC 0x31 bit 0 selects fan2 */
8684+
#define TPACPI_FAN_2CTL 0x0004 /* selects fan2 control */
8685+
#define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
86858686

86868687
static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
86878688
TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),
@@ -8702,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
87028703
TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */
87038704
TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */
87048705
TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */
8706+
TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */
87058707
};
87068708

87078709
static int __init fan_init(struct ibm_init_struct *iibm)
@@ -8730,6 +8732,11 @@ static int __init fan_init(struct ibm_init_struct *iibm)
87308732
quirks = tpacpi_check_quirks(fan_quirk_table,
87318733
ARRAY_SIZE(fan_quirk_table));
87328734

8735+
if (quirks & TPACPI_FAN_NOFAN) {
8736+
pr_info("No integrated ThinkPad fan available\n");
8737+
return -ENODEV;
8738+
}
8739+
87338740
if (gfan_handle) {
87348741
/* 570, 600e/x, 770e, 770x */
87358742
fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN;
@@ -10112,6 +10119,9 @@ static struct ibm_struct proxsensor_driver_data = {
1011210119
#define DYTC_CMD_MMC_GET 8 /* To get current MMC function and mode */
1011310120
#define DYTC_CMD_RESET 0x1ff /* To reset back to default */
1011410121

10122+
#define DYTC_CMD_FUNC_CAP 3 /* To get DYTC capabilities */
10123+
#define DYTC_FC_MMC 27 /* MMC Mode supported */
10124+
1011510125
#define DYTC_GET_FUNCTION_BIT 8 /* Bits 8-11 - function setting */
1011610126
#define DYTC_GET_MODE_BIT 12 /* Bits 12-15 - mode setting */
1011710127

@@ -10324,6 +10334,15 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm)
1032410334
if (dytc_version < 5)
1032510335
return -ENODEV;
1032610336

10337+
/* Check what capabilities are supported. Currently MMC is needed */
10338+
err = dytc_command(DYTC_CMD_FUNC_CAP, &output);
10339+
if (err)
10340+
return err;
10341+
if (!(output & BIT(DYTC_FC_MMC))) {
10342+
dbg_printk(TPACPI_DBG_INIT, " DYTC MMC mode not supported\n");
10343+
return -ENODEV;
10344+
}
10345+
1032710346
dbg_printk(TPACPI_DBG_INIT,
1032810347
"DYTC version %d: thermal mode available\n", dytc_version);
1032910348
/*

drivers/platform/x86/touchscreen_dmi.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,21 @@ static const struct ts_dmi_data predia_basic_data = {
770770
.properties = predia_basic_props,
771771
};
772772

773+
static const struct property_entry rwc_nanote_p8_props[] = {
774+
PROPERTY_ENTRY_U32("touchscreen-min-y", 46),
775+
PROPERTY_ENTRY_U32("touchscreen-size-x", 1728),
776+
PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
777+
PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
778+
PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rwc-nanote-p8.fw"),
779+
PROPERTY_ENTRY_U32("silead,max-fingers", 10),
780+
{ }
781+
};
782+
783+
static const struct ts_dmi_data rwc_nanote_p8_data = {
784+
.acpi_name = "MSSL1680:00",
785+
.properties = rwc_nanote_p8_props,
786+
};
787+
773788
static const struct property_entry schneider_sct101ctm_props[] = {
774789
PROPERTY_ENTRY_U32("touchscreen-size-x", 1715),
775790
PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -1394,6 +1409,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
13941409
DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
13951410
},
13961411
},
1412+
{
1413+
/* RWC NANOTE P8 */
1414+
.driver_data = (void *)&rwc_nanote_p8_data,
1415+
.matches = {
1416+
DMI_MATCH(DMI_BOARD_VENDOR, "Default string"),
1417+
DMI_MATCH(DMI_PRODUCT_NAME, "AY07J"),
1418+
DMI_MATCH(DMI_PRODUCT_SKU, "0001")
1419+
},
1420+
},
13971421
{
13981422
/* Schneider SCT101CTM */
13991423
.driver_data = (void *)&schneider_sct101ctm_data,

0 commit comments

Comments
 (0)