Re: [PATCH 4/6] platform/x86: x86-android-tablets: Add lid-switch gpio-keys pdev to Asus ME176C + TF103C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2/5/22 21:40, Andy Shevchenko wrote:
> On Sat, Feb 5, 2022 at 9:14 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>>
>> The Asus ME176C + TF103C both have a lid-switch (for a cover in the ME176C
>> case), add a gpio-keys platform-device and platform-data describing the
>> lid-switch on both.
> 
> USB ID change is not described here.

There is no USB-ID change, the

-       .pdev_info = int3496_pdevs,
-       .pdev_count = ARRAY_SIZE(int3496_pdevs),

members of struct x86_dev_info used to point to int3496_pdevs which
is a generic pdev array with just the single:

/* Generic pdevs array and gpio-lookups for micro USB ID pin handling */
static const struct platform_device_info int3496_pdevs[] __initconst = {
        {
                /* For micro USB ID pin handling */
                .name = "intel-int3496",
                .id = PLATFORM_DEVID_NONE,
        },
};

entry in there.

Since adding lid_switch support involves adding a second pdev,
the contents of the generic int3496_pdevs now gets duplicated into
the new pdevs array which adds the lid gpio_keys pdev:

static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = {
        {
                .name = "gpio-keys",
                .id = PLATFORM_DEVID_AUTO,
                .data = &asus_me176c_tf103c_lid_pdata,
                .size_data = sizeof(asus_me176c_tf103c_lid_pdata),
        },
        {
                /* For micro USB ID pin handling */
                .name = "intel-int3496",
                .id = PLATFORM_DEVID_NONE,
        },
};

So only the "gpio-keys" pdev is new, the other one just needs to be duplicated
because pdev_info now points to the new asus_me176c_tf103c_pdevs array:

+       .pdev_info = asus_me176c_tf103c_pdevs,
+       .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs),

And without the duplication the dropping of the reference to the old array
would cause the "intel-int3496" pdev to go away. So what looks like an
extra change actually is there to avoid changing behavior.

> ...
> 
>  +/* Asus ME176C and TF103C tablets shared data */
>> +static struct gpio_keys_button asus_me176c_tf103c_lid = {
>> +       .code = SW_LID,
> 
>> +       /* .gpio gets filled in by asus_me176c_tf103c_init() */
> 
> I'm wondering if we can switch gpio_keys*.c drivers to accept GPIO
> descriptor directly.

The current gpio_keys_platform_data struct which expects an
old style gpio integer number is used in a ton of places:

drivers/platform/surface/surface3_button.c
drivers/platform/x86/meraki-mx100.c
drivers/platform/x86/barco-p50-gpio.c
drivers/platform/x86/pcengines-apuv2.c
drivers/platform/x86/x86-android-tablets.c
drivers/mfd/rohm-bd718x7.c
drivers/mfd/rohm-bd71828.c
drivers/mfd/ucb1x00-assabet.c
drivers/input/keyboard/gpio_keys_polled.c
drivers/input/keyboard/gpio_keys.c
drivers/input/misc/soc_button_array.c
arch/x86/platform/geode/net5501.c
arch/x86/platform/geode/alix.c
arch/x86/platform/geode/geos.c
arch/sh/boards/mach-x3proto/setup.c
arch/sh/boards/mach-rsk/devices-rsk7203.c
arch/arm/mach-sa1100/h3xxx.c
arch/arm/mach-sa1100/collie.c
arch/arm/mach-sa1100/assabet.c
arch/arm/mach-sa1100/simpad.c
arch/arm/mach-omap1/board-htcherald.c
arch/arm/mach-orion5x/ls_hgl-setup.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/net2big-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-orion5x/ts209-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/mach-s3c/mach-h1940.c
arch/arm/mach-s3c/mach-rx1950.c
arch/arm/mach-s3c/mach-mini2440.c
arch/arm/mach-s3c/mach-gta02.c
arch/arm/mach-s3c/mach-n30.c
arch/arm/mach-s3c/mach-smartq7.c
arch/arm/mach-s3c/mach-smartq5.c
arch/arm/mach-s3c/mach-crag6410.c
arch/arm/mach-pxa/hx4700.c
arch/arm/mach-pxa/palmld.c
arch/arm/mach-pxa/tosa.c
arch/arm/mach-pxa/palmt5.c
arch/arm/mach-pxa/magician.c
arch/arm/mach-pxa/csb701.c
arch/arm/mach-pxa/vpac270.c
arch/arm/mach-pxa/z2.c
arch/arm/mach-pxa/palmtx.c
arch/arm/mach-pxa/palmte2.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/palmtc.c
arch/arm/mach-pxa/mioa701.c
arch/arm/mach-pxa/spitz.c
arch/arm/mach-pxa/ezx.c
arch/arm/mach-pxa/mainstone.c
arch/arm/mach-davinci/board-da850-evm.c
arch/mips/bcm47xx/buttons.c
arch/mips/alchemy/board-mtx1.c
arch/mips/alchemy/devboards/db1300.c

So changing this is going to be a lot of work, it certainly is
out of scope for this patch-set.

Regards,

Hans




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux