Commit 83c2713a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'platform-drivers-x86-v5.17-2' of...

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
parents 24d7f48c 836f35f7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@

menuconfig SURFACE_PLATFORMS
	bool "Microsoft Surface Platform-Specific Device Drivers"
	depends on ARM64 || X86 || COMPILE_TEST
	default y
	help
	  Say Y here to get to see options for platform-specific device drivers
+9 −6
Original line number Diff line number Diff line
@@ -124,9 +124,10 @@ struct amd_pmc_dev {
	u32 cpu_id;
	u32 active_ips;
/* SMU version information */
	u16 major;
	u16 minor;
	u16 rev;
	u8 smu_program;
	u8 major;
	u8 minor;
	u8 rev;
	struct device *dev;
	struct pci_dev *rdev;
	struct mutex lock; /* generic mutex lock */
@@ -180,11 +181,13 @@ static int amd_pmc_get_smu_version(struct amd_pmc_dev *dev)
	if (rc)
		return rc;

	dev->major = (val >> 16) & GENMASK(15, 0);
	dev->smu_program = (val >> 24) & GENMASK(7, 0);
	dev->major = (val >> 16) & GENMASK(7, 0);
	dev->minor = (val >> 8) & GENMASK(7, 0);
	dev->rev = (val >> 0) & GENMASK(7, 0);

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

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

const struct file_operations amd_pmc_stb_debugfs_fops = {
static const struct file_operations amd_pmc_stb_debugfs_fops = {
	.owner = THIS_MODULE,
	.open = amd_pmc_stb_debugfs_open,
	.read = amd_pmc_stb_debugfs_read,
+2 −2
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ static int tf103c_dock_hid_raw_request(struct hid_device *hid, u8 reportnum,
	return 0;
}

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

SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);
static SIMPLE_DEV_PM_OPS(tf103c_dock_pm_ops, tf103c_dock_suspend, tf103c_dock_resume);

static const struct acpi_device_id tf103c_dock_acpi_match[] = {
	{"NPCE69A"},
+13 −13
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/regmap.h>

#define CHGRIRQ_REG					0x0a
#define MCHGRIRQ_REG					0x17

struct crystal_cove_charger_data {
	struct mutex buslock; /* irq_bus_lock */
@@ -25,8 +26,8 @@ struct crystal_cove_charger_data {
	struct irq_domain *irq_domain;
	int irq;
	int charger_irq;
	bool irq_enabled;
	bool irq_is_enabled;
	u8 mask;
	u8 new_mask;
};

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)
{
	struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);

	if (charger->irq_is_enabled != charger->irq_enabled) {
		if (charger->irq_enabled)
			enable_irq(charger->irq);
		else
			disable_irq(charger->irq);

		charger->irq_is_enabled = charger->irq_enabled;
	if (charger->mask != charger->new_mask) {
		regmap_write(charger->regmap, MCHGRIRQ_REG, charger->new_mask);
		charger->mask = charger->new_mask;
	}

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

	charger->irq_enabled = true;
	charger->new_mask &= ~BIT(data->hwirq);
}

static void crystal_cove_charger_irq_mask(struct irq_data *data)
{
	struct crystal_cove_charger_data *charger = irq_data_get_irq_chip_data(data);

	charger->irq_enabled = false;
	charger->new_mask |= BIT(data->hwirq);
}

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

	/* Mask the single 2nd level IRQ before enabling the 1st level IRQ */
	charger->mask = charger->new_mask = BIT(0);
	regmap_write(charger->regmap, MCHGRIRQ_REG, charger->mask);

	ret = devm_request_threaded_irq(&pdev->dev, charger->irq, NULL,
					crystal_cove_charger_irq,
					IRQF_ONESHOT | IRQF_NO_AUTOEN,
					KBUILD_MODNAME, charger);
					IRQF_ONESHOT, KBUILD_MODNAME, charger);
	if (ret)
		return dev_err_probe(&pdev->dev, ret, "requesting irq\n");

+63 −34
Original line number Diff line number Diff line
@@ -596,7 +596,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,
	return ret;
}

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

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

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

	return ret;
}
@@ -637,7 +640,7 @@ static int isst_if_relase(struct inode *inode, struct file *f)
{
	int i;

	mutex_lock(&punit_misc_dev_lock);
	mutex_lock(&punit_misc_dev_open_lock);
	misc_device_open--;
	for (i = 0; i < ISST_IF_DEV_MAX; ++i) {
		struct isst_if_cmd_cb *cb = &punit_callbacks[i];
@@ -645,7 +648,7 @@ static int isst_if_relase(struct inode *inode, struct file *f)
		if (cb->registered)
			module_put(cb->owner);
	}
	mutex_unlock(&punit_misc_dev_lock);
	mutex_unlock(&punit_misc_dev_open_lock);

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

static int isst_misc_reg(void)
{
	mutex_lock(&punit_misc_dev_reg_lock);
	if (misc_device_ret)
		goto unlock_exit;

	if (!misc_usage_count) {
		misc_device_ret = isst_if_cpu_info_init();
		if (misc_device_ret)
			goto unlock_exit;

		misc_device_ret = misc_register(&isst_if_char_driver);
		if (misc_device_ret) {
			isst_if_cpu_info_exit();
			goto unlock_exit;
		}
	}
	misc_usage_count++;

unlock_exit:
	mutex_unlock(&punit_misc_dev_reg_lock);

	return misc_device_ret;
}

static void isst_misc_unreg(void)
{
	mutex_lock(&punit_misc_dev_reg_lock);
	if (misc_usage_count)
		misc_usage_count--;
	if (!misc_usage_count && !misc_device_ret) {
		misc_deregister(&isst_if_char_driver);
		isst_if_cpu_info_exit();
	}
	mutex_unlock(&punit_misc_dev_reg_lock);
}

/**
 * isst_if_cdev_register() - Register callback for IOCTL
 * @device_type: The device type this callback handling.
@@ -679,38 +719,31 @@ static struct miscdevice isst_if_char_driver = {
 */
int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb)
{
	if (misc_device_ret)
		return misc_device_ret;
	int ret;

	if (device_type >= ISST_IF_DEV_MAX)
		return -EINVAL;

	mutex_lock(&punit_misc_dev_lock);
	mutex_lock(&punit_misc_dev_open_lock);
	/* Device is already open, we don't want to add new callbacks */
	if (misc_device_open) {
		mutex_unlock(&punit_misc_dev_lock);
		mutex_unlock(&punit_misc_dev_open_lock);
		return -EAGAIN;
	}
	if (!misc_usage_count) {
		int ret;

		misc_device_ret = misc_register(&isst_if_char_driver);
		if (misc_device_ret)
			goto unlock_exit;

		ret = isst_if_cpu_info_init();
		if (ret) {
			misc_deregister(&isst_if_char_driver);
			misc_device_ret = ret;
			goto unlock_exit;
		}
	}
	memcpy(&punit_callbacks[device_type], cb, sizeof(*cb));
	punit_callbacks[device_type].registered = 1;
	misc_usage_count++;
unlock_exit:
	mutex_unlock(&punit_misc_dev_lock);
	mutex_unlock(&punit_misc_dev_open_lock);

	return misc_device_ret;
	ret = isst_misc_reg();
	if (ret) {
		/*
		 * No need of mutex as the misc device register failed
		 * as no one can open device yet. Hence no contention.
		 */
		punit_callbacks[device_type].registered = 0;
		return ret;
	}
	return 0;
}
EXPORT_SYMBOL_GPL(isst_if_cdev_register);

@@ -725,16 +758,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register);
 */
void isst_if_cdev_unregister(int device_type)
{
	mutex_lock(&punit_misc_dev_lock);
	misc_usage_count--;
	isst_misc_unreg();
	mutex_lock(&punit_misc_dev_open_lock);
	punit_callbacks[device_type].registered = 0;
	if (device_type == ISST_IF_DEV_MBOX)
		isst_delete_hash();
	if (!misc_usage_count && !misc_device_ret) {
		misc_deregister(&isst_if_char_driver);
		isst_if_cpu_info_exit();
	}
	mutex_unlock(&punit_misc_dev_lock);
	mutex_unlock(&punit_misc_dev_open_lock);
}
EXPORT_SYMBOL_GPL(isst_if_cdev_unregister);

Loading