Commit c7138f7a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'platform-drivers-x86-v6.8-3' of...

Merge tag 'platform-drivers-x86-v6.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86

Pull x86 platform driver fixes from Hans de Goede:
 "Regression fixes:

   - Fix INT0002 vGPIO events no longer working after 6.8 ACPI SCI
     changes

   - AMD-PMF: Fix laptops (e.g. Framework 13 AMD) hanging on suspend

   - x86-android-tablets: Fix touchscreen no longer working on Lenovo
     Yogabook

   - x86-android-tablets: Fix serdev instantiation regression

   - intel-vbtn: Fix ThinkPad X1 Tablet Gen2 no longer suspending

  Bug fixes:

   - think-lmi: Fix changing BIOS settings on Lenovo workstations

   - touchscreen_dmi: Fix Hi8 Air touchscreen data sometimes missing

   - AMD-PMF: Fix Smart PC support not working after suspend/resume

  Other misc small fixes"

* tag 'platform-drivers-x86-v6.8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
  platform/x86: thinkpad_acpi: Only update profile if successfully converted
  platform/x86: intel-vbtn: Stop calling "VBDL" from notify_handler
  platform/x86: x86-android-tablets: Fix acer_b1_750_goodix_gpios name
  platform/x86: x86-android-tablets: Fix serdev instantiation no longer working
  platform/x86: Add new get_serdev_controller() helper
  platform/x86: x86-android-tablets: Fix keyboard touchscreen on Lenovo Yogabook1 X90
  platform/x86/amd/pmf: Fix a potential race with policy binary sideload
  platform/x86/amd/pmf: Fixup error handling for amd_pmf_init_smart_pc()
  platform/x86/amd/pmf: Add debugging message for missing policy data
  platform/x86/amd/pmf: Fix a suspend hang on Framework 13
  platform/x86/amd/pmf: Fix TEE enact command failure after suspend and resume
  platform/x86/amd/pmf: Remove smart_pc_status enum
  platform/x86: touchscreen_dmi: Consolidate Goodix upside-down touchscreen data
  platform/x86: touchscreen_dmi: Allow partial (prefix) matches for ACPI names
  platform/x86: intel: int0002_vgpio: Pass IRQF_ONESHOT to request_irq()
  platform/x86: think-lmi: Fix password opcode ordering for workstations
parents 88953761 427c70de
...@@ -296,7 +296,8 @@ static int amd_pmf_suspend_handler(struct device *dev) ...@@ -296,7 +296,8 @@ static int amd_pmf_suspend_handler(struct device *dev)
{ {
struct amd_pmf_dev *pdev = dev_get_drvdata(dev); struct amd_pmf_dev *pdev = dev_get_drvdata(dev);
kfree(pdev->buf); if (pdev->smart_pc_enabled)
cancel_delayed_work_sync(&pdev->pb_work);
return 0; return 0;
} }
...@@ -312,6 +313,9 @@ static int amd_pmf_resume_handler(struct device *dev) ...@@ -312,6 +313,9 @@ static int amd_pmf_resume_handler(struct device *dev)
return ret; return ret;
} }
if (pdev->smart_pc_enabled)
schedule_delayed_work(&pdev->pb_work, msecs_to_jiffies(2000));
return 0; return 0;
} }
...@@ -330,9 +334,14 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev) ...@@ -330,9 +334,14 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n"); dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n");
} }
if (!amd_pmf_init_smart_pc(dev)) { amd_pmf_init_smart_pc(dev);
if (dev->smart_pc_enabled) {
dev_dbg(dev->dev, "Smart PC Solution Enabled\n"); dev_dbg(dev->dev, "Smart PC Solution Enabled\n");
} else if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) { /* If Smart PC is enabled, no need to check for other features */
return;
}
if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {
amd_pmf_init_auto_mode(dev); amd_pmf_init_auto_mode(dev);
dev_dbg(dev->dev, "Auto Mode Init done\n"); dev_dbg(dev->dev, "Auto Mode Init done\n");
} else if (is_apmf_func_supported(dev, APMF_FUNC_DYN_SLIDER_AC) || } else if (is_apmf_func_supported(dev, APMF_FUNC_DYN_SLIDER_AC) ||
...@@ -351,7 +360,7 @@ static void amd_pmf_deinit_features(struct amd_pmf_dev *dev) ...@@ -351,7 +360,7 @@ static void amd_pmf_deinit_features(struct amd_pmf_dev *dev)
amd_pmf_deinit_sps(dev); amd_pmf_deinit_sps(dev);
} }
if (!dev->smart_pc_enabled) { if (dev->smart_pc_enabled) {
amd_pmf_deinit_smart_pc(dev); amd_pmf_deinit_smart_pc(dev);
} else if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) { } else if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {
amd_pmf_deinit_auto_mode(dev); amd_pmf_deinit_auto_mode(dev);
......
...@@ -441,11 +441,6 @@ struct apmf_dyn_slider_output { ...@@ -441,11 +441,6 @@ struct apmf_dyn_slider_output {
struct apmf_cnqf_power_set ps[APMF_CNQF_MAX]; struct apmf_cnqf_power_set ps[APMF_CNQF_MAX];
} __packed; } __packed;
enum smart_pc_status {
PMF_SMART_PC_ENABLED,
PMF_SMART_PC_DISABLED,
};
/* Smart PC - TA internals */ /* Smart PC - TA internals */
enum system_state { enum system_state {
SYSTEM_STATE_S0i3, SYSTEM_STATE_S0i3,
......
...@@ -252,15 +252,17 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) ...@@ -252,15 +252,17 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET); cookie = readl(dev->policy_buf + POLICY_COOKIE_OFFSET);
length = readl(dev->policy_buf + POLICY_COOKIE_LEN); length = readl(dev->policy_buf + POLICY_COOKIE_LEN);
if (cookie != POLICY_SIGN_COOKIE || !length) if (cookie != POLICY_SIGN_COOKIE || !length) {
dev_dbg(dev->dev, "cookie doesn't match\n");
return -EINVAL; return -EINVAL;
}
/* Update the actual length */ /* Update the actual length */
dev->policy_sz = length + 512; dev->policy_sz = length + 512;
res = amd_pmf_invoke_cmd_init(dev); res = amd_pmf_invoke_cmd_init(dev);
if (res == TA_PMF_TYPE_SUCCESS) { if (res == TA_PMF_TYPE_SUCCESS) {
/* Now its safe to announce that smart pc is enabled */ /* Now its safe to announce that smart pc is enabled */
dev->smart_pc_enabled = PMF_SMART_PC_ENABLED; dev->smart_pc_enabled = true;
/* /*
* Start collecting the data from TA FW after a small delay * Start collecting the data from TA FW after a small delay
* or else, we might end up getting stale values. * or else, we might end up getting stale values.
...@@ -268,7 +270,7 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev) ...@@ -268,7 +270,7 @@ static int amd_pmf_start_policy_engine(struct amd_pmf_dev *dev)
schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3)); schedule_delayed_work(&dev->pb_work, msecs_to_jiffies(pb_actions_ms * 3));
} else { } else {
dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res); dev_err(dev->dev, "ta invoke cmd init failed err: %x\n", res);
dev->smart_pc_enabled = PMF_SMART_PC_DISABLED; dev->smart_pc_enabled = false;
return res; return res;
} }
...@@ -336,25 +338,6 @@ static void amd_pmf_remove_pb(struct amd_pmf_dev *dev) {} ...@@ -336,25 +338,6 @@ static void amd_pmf_remove_pb(struct amd_pmf_dev *dev) {}
static void amd_pmf_hex_dump_pb(struct amd_pmf_dev *dev) {} static void amd_pmf_hex_dump_pb(struct amd_pmf_dev *dev) {}
#endif #endif
static int amd_pmf_get_bios_buffer(struct amd_pmf_dev *dev)
{
dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL);
if (!dev->policy_buf)
return -ENOMEM;
dev->policy_base = devm_ioremap(dev->dev, dev->policy_addr, dev->policy_sz);
if (!dev->policy_base)
return -ENOMEM;
memcpy(dev->policy_buf, dev->policy_base, dev->policy_sz);
amd_pmf_hex_dump_pb(dev);
if (pb_side_load)
amd_pmf_open_pb(dev, dev->dbgfs_dir);
return amd_pmf_start_policy_engine(dev);
}
static int amd_pmf_amdtee_ta_match(struct tee_ioctl_version_data *ver, const void *data) static int amd_pmf_amdtee_ta_match(struct tee_ioctl_version_data *ver, const void *data)
{ {
return ver->impl_id == TEE_IMPL_ID_AMDTEE; return ver->impl_id == TEE_IMPL_ID_AMDTEE;
...@@ -453,22 +436,57 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev) ...@@ -453,22 +436,57 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
return ret; return ret;
INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd); INIT_DELAYED_WORK(&dev->pb_work, amd_pmf_invoke_cmd);
amd_pmf_set_dram_addr(dev, true);
amd_pmf_get_bios_buffer(dev); ret = amd_pmf_set_dram_addr(dev, true);
if (ret)
goto error;
dev->policy_base = devm_ioremap(dev->dev, dev->policy_addr, dev->policy_sz);
if (!dev->policy_base) {
ret = -ENOMEM;
goto error;
}
dev->policy_buf = kzalloc(dev->policy_sz, GFP_KERNEL);
if (!dev->policy_buf) {
ret = -ENOMEM;
goto error;
}
memcpy(dev->policy_buf, dev->policy_base, dev->policy_sz);
amd_pmf_hex_dump_pb(dev);
dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL); dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
if (!dev->prev_data) if (!dev->prev_data)
return -ENOMEM; goto error;
ret = amd_pmf_start_policy_engine(dev);
if (ret)
goto error;
return dev->smart_pc_enabled; if (pb_side_load)
amd_pmf_open_pb(dev, dev->dbgfs_dir);
return 0;
error:
amd_pmf_deinit_smart_pc(dev);
return ret;
} }
void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev) void amd_pmf_deinit_smart_pc(struct amd_pmf_dev *dev)
{ {
if (pb_side_load) if (pb_side_load && dev->esbin)
amd_pmf_remove_pb(dev); amd_pmf_remove_pb(dev);
cancel_delayed_work_sync(&dev->pb_work);
kfree(dev->prev_data); kfree(dev->prev_data);
dev->prev_data = NULL;
kfree(dev->policy_buf); kfree(dev->policy_buf);
cancel_delayed_work_sync(&dev->pb_work); dev->policy_buf = NULL;
kfree(dev->buf);
dev->buf = NULL;
amd_pmf_tee_deinit(dev); amd_pmf_tee_deinit(dev);
} }
...@@ -196,7 +196,7 @@ static int int0002_probe(struct platform_device *pdev) ...@@ -196,7 +196,7 @@ static int int0002_probe(struct platform_device *pdev)
* IRQs into gpiolib. * IRQs into gpiolib.
*/ */
ret = devm_request_irq(dev, irq, int0002_irq, ret = devm_request_irq(dev, irq, int0002_irq,
IRQF_SHARED, "INT0002", chip); IRQF_ONESHOT | IRQF_SHARED, "INT0002", chip);
if (ret) { if (ret) {
dev_err(dev, "Error requesting IRQ %d: %d\n", irq, ret); dev_err(dev, "Error requesting IRQ %d: %d\n", irq, ret);
return ret; return ret;
......
...@@ -200,9 +200,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context) ...@@ -200,9 +200,6 @@ static void notify_handler(acpi_handle handle, u32 event, void *context)
autorelease = val && (!ke_rel || ke_rel->type == KE_IGNORE); autorelease = val && (!ke_rel || ke_rel->type == KE_IGNORE);
sparse_keymap_report_event(input_dev, event, val, autorelease); sparse_keymap_report_event(input_dev, event, val, autorelease);
/* Some devices need this to report further events */
acpi_evaluate_object(handle, "VBDL", NULL, NULL);
} }
/* /*
......
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* In some cases UART attached devices which require an in kernel driver,
* e.g. UART attached Bluetooth HCIs are described in the ACPI tables
* by an ACPI device with a broken or missing UartSerialBusV2() resource.
*
* This causes the kernel to create a /dev/ttyS# char-device for the UART
* instead of creating an in kernel serdev-controller + serdev-device pair
* for the in kernel driver.
*
* The quirk handling in acpi_quirk_skip_serdev_enumeration() makes the kernel
* create a serdev-controller device for these UARTs instead of a /dev/ttyS#.
*
* Instantiating the actual serdev-device to bind to is up to pdx86 code,
* this header provides a helper for getting the serdev-controller device.
*/
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/printk.h>
#include <linux/sprintf.h>
#include <linux/string.h>
static inline struct device *
get_serdev_controller(const char *serial_ctrl_hid,
const char *serial_ctrl_uid,
int serial_ctrl_port,
const char *serdev_ctrl_name)
{
struct device *ctrl_dev, *child;
struct acpi_device *ctrl_adev;
char name[32];
int i;
ctrl_adev = acpi_dev_get_first_match_dev(serial_ctrl_hid, serial_ctrl_uid, -1);
if (!ctrl_adev) {
pr_err("error could not get %s/%s serial-ctrl adev\n",
serial_ctrl_hid, serial_ctrl_uid);
return ERR_PTR(-ENODEV);
}
/* get_first_physical_node() returns a weak ref */
ctrl_dev = get_device(acpi_get_first_physical_node(ctrl_adev));
if (!ctrl_dev) {
pr_err("error could not get %s/%s serial-ctrl physical node\n",
serial_ctrl_hid, serial_ctrl_uid);
ctrl_dev = ERR_PTR(-ENODEV);
goto put_ctrl_adev;
}
/* Walk host -> uart-ctrl -> port -> serdev-ctrl */
for (i = 0; i < 3; i++) {
switch (i) {
case 0:
snprintf(name, sizeof(name), "%s:0", dev_name(ctrl_dev));
break;
case 1:
snprintf(name, sizeof(name), "%s.%d",
dev_name(ctrl_dev), serial_ctrl_port);
break;
case 2:
strscpy(name, serdev_ctrl_name, sizeof(name));
break;
}
child = device_find_child_by_name(ctrl_dev, name);
put_device(ctrl_dev);
if (!child) {
pr_err("error could not find '%s' device\n", name);
ctrl_dev = ERR_PTR(-ENODEV);
goto put_ctrl_adev;
}
ctrl_dev = child;
}
put_ctrl_adev:
acpi_dev_put(ctrl_adev);
return ctrl_dev;
}
...@@ -1009,7 +1009,16 @@ static ssize_t current_value_store(struct kobject *kobj, ...@@ -1009,7 +1009,16 @@ static ssize_t current_value_store(struct kobject *kobj,
* Note - this sets the variable and then the password as separate * Note - this sets the variable and then the password as separate
* WMI calls. Function tlmi_save_bios_settings will error if the * WMI calls. Function tlmi_save_bios_settings will error if the
* password is incorrect. * password is incorrect.
* Workstation's require the opcode to be set before changing the
* attribute.
*/ */
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
tlmi_priv.pwd_admin->password);
if (ret)
goto out;
}
set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name, set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name,
new_setting); new_setting);
if (!set_str) { if (!set_str) {
...@@ -1021,17 +1030,10 @@ static ssize_t current_value_store(struct kobject *kobj, ...@@ -1021,17 +1030,10 @@ static ssize_t current_value_store(struct kobject *kobj,
if (ret) if (ret)
goto out; goto out;
if (tlmi_priv.save_mode == TLMI_SAVE_BULK) { if (tlmi_priv.save_mode == TLMI_SAVE_BULK)
tlmi_priv.save_required = true; tlmi_priv.save_required = true;
} else { else
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
tlmi_priv.pwd_admin->password);
if (ret)
goto out;
}
ret = tlmi_save_bios_settings(""); ret = tlmi_save_bios_settings("");
}
} else { /* old non-opcode based authentication method (deprecated) */ } else { /* old non-opcode based authentication method (deprecated) */
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) { if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;", auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
......
...@@ -10308,6 +10308,7 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode, ...@@ -10308,6 +10308,7 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode,
return 0; return 0;
default: default:
/* Unknown function */ /* Unknown function */
pr_debug("unknown function 0x%x\n", funcmode);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return 0; return 0;
...@@ -10493,8 +10494,8 @@ static void dytc_profile_refresh(void) ...@@ -10493,8 +10494,8 @@ static void dytc_profile_refresh(void)
return; return;
perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF; perfmode = (output >> DYTC_GET_MODE_BIT) & 0xF;
convert_dytc_to_profile(funcmode, perfmode, &profile); err = convert_dytc_to_profile(funcmode, perfmode, &profile);
if (profile != dytc_current_profile) { if (!err && profile != dytc_current_profile) {
dytc_current_profile = profile; dytc_current_profile = profile;
platform_profile_notify(); platform_profile_notify();
} }
......
...@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = { ...@@ -81,7 +81,7 @@ static const struct property_entry chuwi_hi8_air_props[] = {
}; };
static const struct ts_dmi_data chuwi_hi8_air_data = { static const struct ts_dmi_data chuwi_hi8_air_data = {
.acpi_name = "MSSL1680:00", .acpi_name = "MSSL1680",
.properties = chuwi_hi8_air_props, .properties = chuwi_hi8_air_props,
}; };
...@@ -415,18 +415,13 @@ static const struct property_entry gdix1001_upside_down_props[] = { ...@@ -415,18 +415,13 @@ static const struct property_entry gdix1001_upside_down_props[] = {
{ } { }
}; };
static const struct ts_dmi_data gdix1001_00_upside_down_data = { static const struct ts_dmi_data gdix1001_upside_down_data = {
.acpi_name = "GDIX1001:00", .acpi_name = "GDIX1001",
.properties = gdix1001_upside_down_props,
};
static const struct ts_dmi_data gdix1001_01_upside_down_data = {
.acpi_name = "GDIX1001:01",
.properties = gdix1001_upside_down_props, .properties = gdix1001_upside_down_props,
}; };
static const struct ts_dmi_data gdix1002_00_upside_down_data = { static const struct ts_dmi_data gdix1002_upside_down_data = {
.acpi_name = "GDIX1002:00", .acpi_name = "GDIX1002",
.properties = gdix1001_upside_down_props, .properties = gdix1001_upside_down_props,
}; };
...@@ -1412,7 +1407,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1412,7 +1407,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* Juno Tablet */ /* Juno Tablet */
.driver_data = (void *)&gdix1002_00_upside_down_data, .driver_data = (void *)&gdix1002_upside_down_data,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Default string"), DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
/* Both product- and board-name being "Default string" is somewhat rare */ /* Both product- and board-name being "Default string" is somewhat rare */
...@@ -1658,7 +1653,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1658,7 +1653,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* Teclast X89 (Android version / BIOS) */ /* Teclast X89 (Android version / BIOS) */
.driver_data = (void *)&gdix1001_00_upside_down_data, .driver_data = (void *)&gdix1001_upside_down_data,
.matches = { .matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "WISKY"), DMI_MATCH(DMI_BOARD_VENDOR, "WISKY"),
DMI_MATCH(DMI_BOARD_NAME, "3G062i"), DMI_MATCH(DMI_BOARD_NAME, "3G062i"),
...@@ -1666,7 +1661,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1666,7 +1661,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* Teclast X89 (Windows version / BIOS) */ /* Teclast X89 (Windows version / BIOS) */
.driver_data = (void *)&gdix1001_01_upside_down_data, .driver_data = (void *)&gdix1001_upside_down_data,
.matches = { .matches = {
/* tPAD is too generic, also match on bios date */ /* tPAD is too generic, also match on bios date */
DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"), DMI_MATCH(DMI_BOARD_VENDOR, "TECLAST"),
...@@ -1684,7 +1679,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1684,7 +1679,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* Teclast X98 Pro */ /* Teclast X98 Pro */
.driver_data = (void *)&gdix1001_00_upside_down_data, .driver_data = (void *)&gdix1001_upside_down_data,
.matches = { .matches = {
/* /*
* Only match BIOS date, because the manufacturers * Only match BIOS date, because the manufacturers
...@@ -1788,7 +1783,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1788,7 +1783,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* "WinBook TW100" */ /* "WinBook TW100" */
.driver_data = (void *)&gdix1001_00_upside_down_data, .driver_data = (void *)&gdix1001_upside_down_data,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
DMI_MATCH(DMI_PRODUCT_NAME, "TW100") DMI_MATCH(DMI_PRODUCT_NAME, "TW100")
...@@ -1796,7 +1791,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = { ...@@ -1796,7 +1791,7 @@ const struct dmi_system_id touchscreen_dmi_table[] = {
}, },
{ {
/* WinBook TW700 */ /* WinBook TW700 */
.driver_data = (void *)&gdix1001_00_upside_down_data, .driver_data = (void *)&gdix1001_upside_down_data,
.matches = { .matches = {
DMI_MATCH(DMI_SYS_VENDOR, "WinBook"), DMI_MATCH(DMI_SYS_VENDOR, "WinBook"),
DMI_MATCH(DMI_PRODUCT_NAME, "TW700") DMI_MATCH(DMI_PRODUCT_NAME, "TW700")
...@@ -1821,7 +1816,7 @@ static void ts_dmi_add_props(struct i2c_client *client) ...@@ -1821,7 +1816,7 @@ static void ts_dmi_add_props(struct i2c_client *client)
int error; int error;
if (has_acpi_companion(dev) && if (has_acpi_companion(dev) &&
!strncmp(ts_data->acpi_name, client->name, I2C_NAME_SIZE)) { strstarts(client->name, ts_data->acpi_name)) {
error = device_create_managed_software_node(dev, ts_data->properties, NULL); error = device_create_managed_software_node(dev, ts_data->properties, NULL);
if (error) if (error)
dev_err(dev, "failed to add properties: %d\n", error); dev_err(dev, "failed to add properties: %d\n", error);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/string.h> #include <linux/string.h>
#include "x86-android-tablets.h" #include "x86-android-tablets.h"
#include "../serdev_helpers.h"
static struct platform_device *x86_android_tablet_device; static struct platform_device *x86_android_tablet_device;
...@@ -113,6 +114,9 @@ int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data) ...@@ -113,6 +114,9 @@ int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data)
if (irq_type != IRQ_TYPE_NONE && irq_type != irq_get_trigger_type(irq)) if (irq_type != IRQ_TYPE_NONE && irq_type != irq_get_trigger_type(irq))
irq_set_irq_type(irq, irq_type); irq_set_irq_type(irq, irq_type);
if (data->free_gpio)
devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
return irq; return irq;
case X86_ACPI_IRQ_TYPE_PMIC: case X86_ACPI_IRQ_TYPE_PMIC:
status = acpi_get_handle(NULL, data->chip, &handle); status = acpi_get_handle(NULL, data->chip, &handle);
...@@ -229,38 +233,20 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i ...@@ -229,38 +233,20 @@ static __init int x86_instantiate_spi_dev(const struct x86_dev_info *dev_info, i
static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int idx) static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int idx)
{ {
struct acpi_device *ctrl_adev, *serdev_adev; struct acpi_device *serdev_adev;
struct serdev_device *serdev; struct serdev_device *serdev;
struct device *ctrl_dev; struct device *ctrl_dev;
int ret = -ENODEV; int ret = -ENODEV;
ctrl_adev = acpi_dev_get_first_match_dev(info->ctrl_hid, info->ctrl_uid, -1); ctrl_dev = get_serdev_controller(info->ctrl_hid, info->ctrl_uid, 0,
if (!ctrl_adev) { info->ctrl_devname);
pr_err("error could not get %s/%s ctrl adev\n", if (IS_ERR(ctrl_dev))
info->ctrl_hid, info->ctrl_uid); return PTR_ERR(ctrl_dev);
return -ENODEV;
}
serdev_adev = acpi_dev_get_first_match_dev(info->serdev_hid, NULL, -1); serdev_adev = acpi_dev_get_first_match_dev(info->serdev_hid, NULL, -1);
if (!serdev_adev) { if (!serdev_adev) {
pr_err("error could not get %s serdev adev\n", info->serdev_hid); pr_err("error could not get %s serdev adev\n", info->serdev_hid);
goto put_ctrl_adev; goto put_ctrl_dev;
}
/* get_first_physical_node() returns a weak ref, no need to put() it */
ctrl_dev = acpi_get_first_physical_node(ctrl_adev);
if (!ctrl_dev) {
pr_err("error could not get %s/%s ctrl physical dev\n",
info->ctrl_hid, info->ctrl_uid);
goto put_serdev_adev;
}
/* ctrl_dev now points to the controller's parent, get the controller */
ctrl_dev = device_find_child_by_name(ctrl_dev, info->ctrl_devname);
if (!ctrl_dev) {
pr_err("error could not get %s/%s %s ctrl dev\n",
info->ctrl_hid, info->ctrl_uid, info->ctrl_devname);
goto put_serdev_adev;
} }
serdev = serdev_device_alloc(to_serdev_controller(ctrl_dev)); serdev = serdev_device_alloc(to_serdev_controller(ctrl_dev));
...@@ -283,8 +269,8 @@ static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int ...@@ -283,8 +269,8 @@ static __init int x86_instantiate_serdev(const struct x86_serdev_info *info, int
put_serdev_adev: put_serdev_adev:
acpi_dev_put(serdev_adev); acpi_dev_put(serdev_adev);
put_ctrl_adev: put_ctrl_dev:
acpi_dev_put(ctrl_adev); put_device(ctrl_dev);
return ret; return ret;
} }
......
...@@ -116,6 +116,7 @@ static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst ...@@ -116,6 +116,7 @@ static const struct x86_i2c_client_info lenovo_yb1_x90_i2c_clients[] __initconst
.trigger = ACPI_EDGE_SENSITIVE, .trigger = ACPI_EDGE_SENSITIVE,
.polarity = ACPI_ACTIVE_LOW, .polarity = ACPI_ACTIVE_LOW,
.con_id = "goodix_ts_irq", .con_id = "goodix_ts_irq",
.free_gpio = true,
}, },
}, { }, {
/* Wacom Digitizer in keyboard half */ /* Wacom Digitizer in keyboard half */
......
...@@ -68,7 +68,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst = ...@@ -68,7 +68,7 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
}, },
}; };
static struct gpiod_lookup_table acer_b1_750_goodix_gpios = { static struct gpiod_lookup_table acer_b1_750_nvt_ts_gpios = {
.dev_id = "i2c-NVT-ts", .dev_id = "i2c-NVT-ts",
.table = { .table = {
GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_LOW), GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_LOW),
...@@ -77,7 +77,7 @@ static struct gpiod_lookup_table acer_b1_750_goodix_gpios = { ...@@ -77,7 +77,7 @@ static struct gpiod_lookup_table acer_b1_750_goodix_gpios = {
}; };
static struct gpiod_lookup_table * const acer_b1_750_gpios[] = { static struct gpiod_lookup_table * const acer_b1_750_gpios[] = {
&acer_b1_750_goodix_gpios, &acer_b1_750_nvt_ts_gpios,
&int3496_reference_gpios, &int3496_reference_gpios,
NULL NULL
}; };
......
...@@ -39,6 +39,7 @@ struct x86_acpi_irq_data { ...@@ -39,6 +39,7 @@ struct x86_acpi_irq_data {
int index; int index;
int trigger; /* ACPI_EDGE_SENSITIVE / ACPI_LEVEL_SENSITIVE */ int trigger; /* ACPI_EDGE_SENSITIVE / ACPI_LEVEL_SENSITIVE */
int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */ int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */
bool free_gpio; /* Release GPIO after getting IRQ (for TYPE_GPIOINT) */
const char *con_id; const char *con_id;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment