Skip to content

Commit 27d3e73

Browse files
dtorij-intel
authored andcommitted
platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger to GPIO references
Now that gpiolib supports software nodes to describe GPIOs, switch the driver away from using GPIO lookup tables for the fast charger device to using PROPERTY_ENTRY_GPIO(). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Tested-by: Hans de Goede <hansg@kernel.org> Reviewed-by: Hans de Goede <hansg@kernel.org> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Link: https://patch.msgid.link/20250920200713.20193-10-hansg@kernel.org Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 0a2f13e commit 27d3e73

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

drivers/platform/x86/lenovo/yoga-tab2-pro-1380-fastcharger.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ static int yt2_1380_fc_pdev_probe(struct platform_device *pdev)
255255
if (!serdev)
256256
return -ENOMEM;
257257

258+
/* Propagate pdev-fwnode set by x86-android-tablets to serdev */
259+
device_set_node(&serdev->dev, dev_fwnode(&pdev->dev));
260+
/* The fwnode is a managed node, so it will be auto-put on serdev_device_put() */
261+
fwnode_handle_get(dev_fwnode(&serdev->dev));
262+
258263
ret = serdev_device_add(serdev);
259264
if (ret) {
260265
serdev_device_put(serdev);

drivers/platform/x86/x86-android-tablets/lenovo.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,18 @@ static const struct x86_i2c_client_info lenovo_yoga_tab2_1380_i2c_clients[] __in
741741
}
742742
};
743743

744+
static const struct property_entry lenovo_yoga_tab2_1380_fc_props[] __initconst = {
745+
PROPERTY_ENTRY_GPIO("uart3_txd-gpios", &baytrail_gpiochip_nodes[0], 57, GPIO_ACTIVE_HIGH),
746+
PROPERTY_ENTRY_GPIO("uart3_rxd-gpios", &baytrail_gpiochip_nodes[0], 61, GPIO_ACTIVE_HIGH),
747+
{ }
748+
};
749+
744750
static const struct platform_device_info lenovo_yoga_tab2_1380_pdevs[] __initconst = {
745751
{
746752
/* For the Tablet 2 Pro 1380's custom fast charging driver */
747753
.name = "lenovo-yoga-tab2-pro-1380-fastcharger",
748754
.id = PLATFORM_DEVID_NONE,
755+
.properties = lenovo_yoga_tab2_1380_fc_props,
749756
},
750757
};
751758

@@ -775,30 +782,16 @@ static int __init lenovo_yoga_tab2_1380_init(struct device *dev)
775782
return 0;
776783
}
777784

778-
static struct gpiod_lookup_table lenovo_yoga_tab2_1380_fc_gpios = {
779-
.dev_id = "serial0-0",
780-
.table = {
781-
GPIO_LOOKUP("INT33FC:00", 57, "uart3_txd", GPIO_ACTIVE_HIGH),
782-
GPIO_LOOKUP("INT33FC:00", 61, "uart3_rxd", GPIO_ACTIVE_HIGH),
783-
{ }
784-
},
785-
};
786-
787-
static struct gpiod_lookup_table * const lenovo_yoga_tab2_1380_gpios[] = {
788-
&lenovo_yoga_tab2_1380_fc_gpios,
789-
NULL
790-
};
791-
792785
const struct x86_dev_info lenovo_yoga_tab2_1380_info __initconst = {
793786
.i2c_client_info = lenovo_yoga_tab2_1380_i2c_clients,
794787
.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_i2c_clients),
795788
.pdev_info = lenovo_yoga_tab2_1380_pdevs,
796789
.pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_1380_pdevs),
797790
.gpio_button = &lenovo_yoga_tab2_830_1050_lid,
798791
.gpio_button_count = 1,
799-
.gpiod_lookup_tables = lenovo_yoga_tab2_1380_gpios,
800792
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
801793
.modules = lenovo_yoga_tab2_1380_modules,
794+
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
802795
.init = lenovo_yoga_tab2_1380_init,
803796
.exit = lenovo_yoga_tab2_830_1050_exit,
804797
};

0 commit comments

Comments
 (0)