aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2022-02-06 23:02:19 +0100
committerHans de Goede <hdegoede@redhat.com>2022-02-11 10:52:56 +0100
commitbb22fc518c73394f1041fd79a41f300121665796 (patch)
treeb280d08da9b16313f284a12712a72d2d3e74c75f
parentplatform/x86: intel_cht_int33fe: Switch to DMI modalias based loading (diff)
downloadlinux-dev-bb22fc518c73394f1041fd79a41f300121665796.tar.xz
linux-dev-bb22fc518c73394f1041fd79a41f300121665796.zip
platform/x86: intel_cht_int33fe: Drop Lenovo Yogabook YB1-X9x code
Move the Lenovo Yogabook YB1-X9x fuel-gauge instantiation code over to the x86-android-tablets module, which already deals with this for various other devices. This removes the need to have a special intel_cht_int33fe_microb module just for Lenovo Yogabook YB1-X9x laptops. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20220206220220.88491-3-hdegoede@redhat.com
-rw-r--r--drivers/platform/x86/intel/int33fe/Kconfig18
-rw-r--r--drivers/platform/x86/intel/int33fe/Makefile2
-rw-r--r--drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c106
-rw-r--r--drivers/platform/x86/x86-android-tablets.c27
4 files changed, 35 insertions, 118 deletions
diff --git a/drivers/platform/x86/intel/int33fe/Kconfig b/drivers/platform/x86/intel/int33fe/Kconfig
index 2f7329a2e399..60a6cb689299 100644
--- a/drivers/platform/x86/intel/int33fe/Kconfig
+++ b/drivers/platform/x86/intel/int33fe/Kconfig
@@ -6,19 +6,15 @@ config INTEL_CHT_INT33FE
depends on USB_ROLES_INTEL_XHCI=y || (USB_ROLES_INTEL_XHCI=m && m)
depends on TYPEC_MUX_PI3USB30532=y || (TYPEC_MUX_PI3USB30532=m && m)
help
- This driver add support for the INT33FE ACPI device found on
- some Intel Cherry Trail devices.
+ This driver add support for the INT33FE ACPI device found on the
+ GPD win and the GPD pocket.
- There are two kinds of INT33FE ACPI device possible: for hardware
- with USB Type-C and Micro-B connectors. This driver supports both.
-
- The INT33FE ACPI device has a CRS table with I2cSerialBusV2
- resources for Fuel Gauge Controller and (in the Type-C variant)
- FUSB302 USB Type-C Controller and PI3USB30532 USB switch.
+ The INT33FE ACPI device on these mini laptops contains I2cSerialBusV2
+ resources for a MAX17042 Fuel Gauge, FUSB302 USB Type-C Controller
+ and PI3USB30532 USB switch.
This driver instantiates i2c-clients for these, so that standard
i2c drivers for these chips can bind to the them.
If you enable this driver it is advised to also select
- CONFIG_BATTERY_BQ27XXX=m or CONFIG_BATTERY_BQ27XXX_I2C=m for Micro-B
- device and CONFIG_TYPEC_FUSB302=m and CONFIG_BATTERY_MAX17042=m
- for Type-C device.
+ CONFIG_TYPEC_FUSB302=m, CONFIG_TYPEC_MUX_PI3USB30532=m and
+ CONFIG_BATTERY_MAX17042=m.
diff --git a/drivers/platform/x86/intel/int33fe/Makefile b/drivers/platform/x86/intel/int33fe/Makefile
index 4672fcbec896..582aa7808c7a 100644
--- a/drivers/platform/x86/intel/int33fe/Makefile
+++ b/drivers/platform/x86/intel/int33fe/Makefile
@@ -1,2 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_INTEL_CHT_INT33FE) += intel_cht_int33fe_typec.o intel_cht_int33fe_microb.o
+obj-$(CONFIG_INTEL_CHT_INT33FE) += intel_cht_int33fe_typec.o
diff --git a/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c b/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c
deleted file mode 100644
index 6c2feca8a06f..000000000000
--- a/drivers/platform/x86/intel/int33fe/intel_cht_int33fe_microb.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Intel Cherry Trail ACPI INT33FE pseudo device driver for devices with
- * USB Micro-B connector (e.g. without of FUSB302 USB Type-C controller)
- *
- * Copyright (C) 2019 Yauhen Kharuzhy <jekhor@gmail.com>
- *
- * At least one Intel Cherry Trail based device which ship with Windows 10
- * (Lenovo YogaBook YB1-X91L/F tablet), have this weird INT33FE ACPI device
- * with a CRS table with 2 I2cSerialBusV2 resources, for 2 different chips
- * attached to various i2c busses:
- * 1. The Whiskey Cove PMIC, which is also described by the INT34D3 ACPI device
- * 2. TI BQ27542 Fuel Gauge Controller
- *
- * So this driver is a stub / pseudo driver whose only purpose is to
- * instantiate i2c-client for battery fuel gauge, so that standard i2c driver
- * for these chip can bind to the it.
- */
-
-#include <linux/acpi.h>
-#include <linux/dmi.h>
-#include <linux/i2c.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/platform_device.h>
-#include <linux/regulator/consumer.h>
-#include <linux/slab.h>
-#include <linux/usb/pd.h>
-
-struct cht_int33fe_data {
- struct i2c_client *battery_fg;
-};
-
-static const char * const bq27xxx_suppliers[] = { "bq25890-charger" };
-
-static const struct property_entry bq27xxx_props[] = {
- PROPERTY_ENTRY_STRING_ARRAY("supplied-from", bq27xxx_suppliers),
- { }
-};
-
-static const struct software_node bq27xxx_node = {
- .properties = bq27xxx_props,
-};
-
-static const struct dmi_system_id cht_int33fe_microb_ids[] = {
- {
- /* Lenovo Yoga Book X90F / X91F / X91L */
- .matches = {
- /* Non exact match to match all versions */
- DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"),
- },
- },
- { }
-};
-MODULE_DEVICE_TABLE(dmi, cht_int33fe_microb_ids);
-
-static int cht_int33fe_microb_probe(struct platform_device *pdev)
-{
- struct i2c_board_info board_info;
- struct device *dev = &pdev->dev;
- struct cht_int33fe_data *data;
-
- if (!dmi_check_system(cht_int33fe_microb_ids))
- return -ENODEV;
-
- data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
- if (!data)
- return -ENOMEM;
-
- memset(&board_info, 0, sizeof(board_info));
- strscpy(board_info.type, "bq27542", ARRAY_SIZE(board_info.type));
- board_info.dev_name = "bq27542";
- board_info.swnode = &bq27xxx_node;
- data->battery_fg = i2c_acpi_new_device(dev, 1, &board_info);
-
- return PTR_ERR_OR_ZERO(data->battery_fg);
-}
-
-static int cht_int33fe_microb_remove(struct platform_device *pdev)
-{
- struct cht_int33fe_data *data = platform_get_drvdata(pdev);
-
- i2c_unregister_device(data->battery_fg);
-
- return 0;
-}
-
-static const struct acpi_device_id cht_int33fe_acpi_ids[] = {
- { "INT33FE", },
- { }
-};
-
-static struct platform_driver cht_int33fe_microb_driver = {
- .driver = {
- .name = "Intel Cherry Trail ACPI INT33FE micro-B driver",
- .acpi_match_table = ACPI_PTR(cht_int33fe_acpi_ids),
- },
- .probe = cht_int33fe_microb_probe,
- .remove = cht_int33fe_microb_remove,
-};
-
-module_platform_driver(cht_int33fe_microb_driver);
-
-MODULE_DESCRIPTION("Intel Cherry Trail ACPI INT33FE micro-B pseudo device driver");
-MODULE_AUTHOR("Yauhen Kharuzhy <jekhor@gmail.com>");
-MODULE_LICENSE("GPL v2");
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 8e6e4f89220f..f280c82d5ba5 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -679,6 +679,25 @@ static const struct x86_dev_info czc_p10t __initconst = {
.init = czc_p10t_init,
};
+/* Lenovo Yoga Book X90F / X91F / X91L need manual instantiation of the fg client */
+static const struct x86_i2c_client_info lenovo_yogabook_x9x_i2c_clients[] __initconst = {
+ {
+ /* BQ27542 fuel-gauge */
+ .board_info = {
+ .type = "bq27542",
+ .addr = 0x55,
+ .dev_name = "bq27542",
+ .swnode = &fg_bq25890_supply_node,
+ },
+ .adapter_path = "\\_SB_.PCI0.I2C1",
+ },
+};
+
+static const struct x86_dev_info lenovo_yogabook_x9x_info __initconst = {
+ .i2c_client_info = lenovo_yogabook_x9x_i2c_clients,
+ .i2c_client_count = ARRAY_SIZE(lenovo_yogabook_x9x_i2c_clients),
+};
+
/* Nextbook Ares 8 tablets have an Android factory img with everything hardcoded */
static const char * const nextbook_ares8_accel_mount_matrix[] = {
"0", "-1", "0",
@@ -916,6 +935,14 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
.driver_data = (void *)&czc_p10t,
},
{
+ /* Lenovo Yoga Book X90F / X91F / X91L */
+ .matches = {
+ /* Non exact match to match all versions */
+ DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"),
+ },
+ .driver_data = (void *)&lenovo_yogabook_x9x_info,
+ },
+ {
/* Nextbook Ares 8 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),