Skip to content

Commit ef64ca0

Browse files
dtorij-intel
authored andcommitted
platform/x86: x86-android-tablets: convert int3496 devices to GPIO references
Now that gpiolib supports software nodes to describe GPIOs, switch the driver away from using GPIO lookup tables for int3496 devices 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-7-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 e4a7488 commit ef64ca0

5 files changed

Lines changed: 43 additions & 55 deletions

File tree

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

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
#include "x86-android-tablets.h"
1818

1919
/* Asus ME176C and TF103C tablets shared data */
20-
static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = {
21-
.dev_id = "intel-int3496",
22-
.table = {
23-
GPIO_LOOKUP("INT33FC:02", 22, "id", GPIO_ACTIVE_HIGH),
24-
{ }
20+
static const struct property_entry asus_me176c_tf103c_int3496_props[] __initconst = {
21+
PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 22, GPIO_ACTIVE_HIGH),
22+
{ }
23+
};
24+
25+
static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
26+
{
27+
/* For micro USB ID pin handling */
28+
.name = "intel-int3496",
29+
.id = PLATFORM_DEVID_NONE,
30+
.properties = asus_me176c_tf103c_int3496_props,
2531
},
2632
};
2733

@@ -164,21 +170,15 @@ static const struct x86_serdev_info asus_me176c_serdevs[] __initconst = {
164170
},
165171
};
166172

167-
static struct gpiod_lookup_table * const asus_me176c_gpios[] = {
168-
&int3496_gpo2_pin22_gpios,
169-
NULL
170-
};
171-
172173
const struct x86_dev_info asus_me176c_info __initconst = {
173174
.i2c_client_info = asus_me176c_i2c_clients,
174175
.i2c_client_count = ARRAY_SIZE(asus_me176c_i2c_clients),
175-
.pdev_info = int3496_pdevs,
176-
.pdev_count = 1,
176+
.pdev_info = asus_me176c_tf103c_pdevs,
177+
.pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
177178
.serdev_info = asus_me176c_serdevs,
178179
.serdev_count = ARRAY_SIZE(asus_me176c_serdevs),
179180
.gpio_button = &asus_me176c_tf103c_lid,
180181
.gpio_button_count = 1,
181-
.gpiod_lookup_tables = asus_me176c_gpios,
182182
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
183183
.modules = bq24190_modules,
184184
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
@@ -296,19 +296,14 @@ static const struct x86_i2c_client_info asus_tf103c_i2c_clients[] __initconst =
296296
},
297297
};
298298

299-
static struct gpiod_lookup_table * const asus_tf103c_gpios[] = {
300-
&int3496_gpo2_pin22_gpios,
301-
NULL
302-
};
303-
304299
const struct x86_dev_info asus_tf103c_info __initconst = {
305300
.i2c_client_info = asus_tf103c_i2c_clients,
306301
.i2c_client_count = ARRAY_SIZE(asus_tf103c_i2c_clients),
307-
.pdev_info = int3496_pdevs,
308-
.pdev_count = 1,
302+
.pdev_info = asus_me176c_tf103c_pdevs,
303+
.pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),
309304
.gpio_button = &asus_me176c_tf103c_lid,
310305
.gpio_button_count = 1,
311-
.gpiod_lookup_tables = asus_tf103c_gpios,
312306
.bat_swnode = &generic_lipo_4v2_battery_node,
313307
.modules = bq24190_modules,
308+
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
314309
};

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

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,18 @@ static struct x86_i2c_client_info lenovo_yoga_tab2_830_1050_i2c_clients[] __init
366366
},
367367
};
368368

369-
static struct gpiod_lookup_table lenovo_yoga_tab2_830_1050_int3496_gpios = {
370-
.dev_id = "intel-int3496",
371-
.table = {
372-
GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_LOW),
373-
GPIO_LOOKUP("INT33FC:02", 24, "id", GPIO_ACTIVE_HIGH),
374-
{ }
369+
static const struct property_entry lenovo_yoga_tab2_830_1050_int3496_props[] __initconst = {
370+
PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_LOW),
371+
PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 24, GPIO_ACTIVE_HIGH),
372+
{ }
373+
};
374+
375+
static const struct platform_device_info lenovo_yoga_tab2_830_1050_pdevs[] __initconst = {
376+
{
377+
/* For micro USB ID pin handling */
378+
.name = "intel-int3496",
379+
.id = PLATFORM_DEVID_NONE,
380+
.properties = lenovo_yoga_tab2_830_1050_int3496_props,
375381
},
376382
};
377383

@@ -389,7 +395,6 @@ static struct gpiod_lookup_table lenovo_yoga_tab2_830_1050_codec_gpios = {
389395
};
390396

391397
static struct gpiod_lookup_table * const lenovo_yoga_tab2_830_1050_gpios[] = {
392-
&lenovo_yoga_tab2_830_1050_int3496_gpios,
393398
&lenovo_yoga_tab2_830_1050_codec_gpios,
394399
NULL
395400
};
@@ -400,13 +405,14 @@ static void lenovo_yoga_tab2_830_1050_exit(void);
400405
const struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initconst = {
401406
.i2c_client_info = lenovo_yoga_tab2_830_1050_i2c_clients,
402407
.i2c_client_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_i2c_clients),
403-
.pdev_info = int3496_pdevs,
404-
.pdev_count = 1,
408+
.pdev_info = lenovo_yoga_tab2_830_1050_pdevs,
409+
.pdev_count = ARRAY_SIZE(lenovo_yoga_tab2_830_1050_pdevs),
405410
.gpio_button = &lenovo_yoga_tab2_830_1050_lid,
406411
.gpio_button_count = 1,
407412
.gpiod_lookup_tables = lenovo_yoga_tab2_830_1050_gpios,
408413
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
409414
.modules = bq24190_modules,
415+
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
410416
.init = lenovo_yoga_tab2_830_1050_init,
411417
.exit = lenovo_yoga_tab2_830_1050_exit,
412418
};

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

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,11 @@ static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =
8484
},
8585
};
8686

87-
static struct gpiod_lookup_table * const acer_b1_750_gpios[] = {
88-
&int3496_reference_gpios,
89-
NULL
90-
};
91-
9287
const struct x86_dev_info acer_b1_750_info __initconst = {
9388
.i2c_client_info = acer_b1_750_i2c_clients,
9489
.i2c_client_count = ARRAY_SIZE(acer_b1_750_i2c_clients),
9590
.pdev_info = int3496_pdevs,
9691
.pdev_count = 1,
97-
.gpiod_lookup_tables = acer_b1_750_gpios,
9892
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
9993
};
10094

@@ -407,17 +401,12 @@ static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst
407401
},
408402
};
409403

410-
static struct gpiod_lookup_table * const nextbook_ares8_gpios[] = {
411-
&int3496_reference_gpios,
412-
NULL
413-
};
414-
415404
const struct x86_dev_info nextbook_ares8_info __initconst = {
416405
.i2c_client_info = nextbook_ares8_i2c_clients,
417406
.i2c_client_count = ARRAY_SIZE(nextbook_ares8_i2c_clients),
418407
.pdev_info = int3496_pdevs,
419408
.pdev_count = 1,
420-
.gpiod_lookup_tables = nextbook_ares8_gpios,
409+
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
421410
};
422411

423412
/* Nextbook Ares 8A (CHT) tablets have an Android factory image with everything hardcoded */

drivers/platform/x86/x86-android-tablets/shared-psy-info.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
*/
1010

1111
#include <linux/gpio/machine.h>
12+
#include <linux/gpio/property.h>
1213
#include <linux/platform_device.h>
1314
#include <linux/power/bq24190_charger.h>
1415
#include <linux/property.h>
1516
#include <linux/regulator/machine.h>
1617

1718
#include "shared-psy-info.h"
19+
#include "x86-android-tablets.h"
1820

1921
/* Generic / shared charger / battery settings */
2022
const char * const tusb1211_chg_det_psy[] = { "tusb1211-charger-detect" };
@@ -156,21 +158,19 @@ const char * const bq24190_modules[] __initconst = {
156158
NULL
157159
};
158160

159-
/* Generic platform device array and GPIO lookup table for micro USB ID pin handling */
161+
static const struct property_entry int3496_reference_props[] __initconst = {
162+
PROPERTY_ENTRY_GPIO("vbus-gpios", &baytrail_gpiochip_nodes[1], 15, GPIO_ACTIVE_HIGH),
163+
PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_HIGH),
164+
PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 18, GPIO_ACTIVE_HIGH),
165+
{ }
166+
};
167+
168+
/* Generic pdevs array and gpio-lookups for micro USB ID pin handling */
160169
const struct platform_device_info int3496_pdevs[] __initconst = {
161170
{
162171
/* For micro USB ID pin handling */
163172
.name = "intel-int3496",
164173
.id = PLATFORM_DEVID_NONE,
165-
},
166-
};
167-
168-
struct gpiod_lookup_table int3496_reference_gpios = {
169-
.dev_id = "intel-int3496",
170-
.table = {
171-
GPIO_LOOKUP("INT33FC:01", 15, "vbus", GPIO_ACTIVE_HIGH),
172-
GPIO_LOOKUP("INT33FC:02", 1, "mux", GPIO_ACTIVE_HIGH),
173-
GPIO_LOOKUP("INT33FC:02", 18, "id", GPIO_ACTIVE_HIGH),
174-
{ }
174+
.properties = int3496_reference_props,
175175
},
176176
};

drivers/platform/x86/x86-android-tablets/shared-psy-info.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#define __PDX86_SHARED_PSY_INFO_H
1212

1313
struct bq24190_platform_data;
14-
struct gpiod_lookup_table;
1514
struct platform_device_info;
1615
struct software_node;
1716

@@ -28,6 +27,5 @@ extern struct bq24190_platform_data bq24190_pdata;
2827
extern const char * const bq24190_modules[];
2928

3029
extern const struct platform_device_info int3496_pdevs[];
31-
extern struct gpiod_lookup_table int3496_reference_gpios;
3230

3331
#endif

0 commit comments

Comments
 (0)