Bug 115271

Summary: ACPI: fails to initialise GPIO controller(s) on Intel Baytrail tablet
Product: ACPI Reporter: TJ (linux)
Component: Config-OtherAssignee: Zhang Rui (rui.zhang)
Status: CLOSED DOCUMENTED    
Severity: high CC: rui.zhang, russianneuromancer
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: v4.5 Subsystem:
Regression: No Bisected commit-id:
Attachments: Binary ACPI tables
v4.5 dmesg
dmesg witn 4.5
dsdt.dsl
dmesg 4.8.7

Description TJ 2016-03-26 13:41:14 UTC
Created attachment 210721 [details]
Binary ACPI tables

I've been assisting a user with a Intel Baytrail tablet that fails to enable its GPIO controllers with the knock-on effect that many integrated devices (WLAN, Touch, etc.) - some under the SDIO controllers - are not found.

This is using Ubuntu builds of vanilla mainline. dmesg shows a couple of bugs during boot, summary here:

[    0.000000] Linux version 4.5.0-040500-generic
...
[    0.203730] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.206857] ACPI: Power Resource [USBC] (on)
[    0.207758] ACPI: Power Resource [WWPR] (off)
[    0.215906] ACPI: Power Resource [PLPE] (on)
[    0.225903] ACPI: Power Resource [CLK0] (on)
[    0.226154] ACPI: Power Resource [P28P] (off)
[    0.226287] ACPI: Power Resource [P18P] (off)
[    0.229423] ACPI: Power Resource [CLK0] (on)
[    0.229559] ACPI: Power Resource [CLK1] (on)
[    0.237713] ACPI: Power Resource [P28X] (off)
[    0.237848] ACPI: Power Resource [P18X] (off)
[    0.237998] ACPI: Power Resource [P28T] (off)
[    0.238129] ACPI: Power Resource [P18T] (off)
[    0.238272] ACPI: Power Resource [P1XT] (off)
...
[    0.248729] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.248745] acpi PNP0A08:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    0.248878] \_SB_.PCI0 (33DB4D5B-1FF7-401C-9657-7441C03DD766): _OSC invalid UUID
[    0.248883] _OSC request data: 1 1e 0
[    0.248895] acpi PNP0A08:00: _OSC failed (AE_ERROR); disabling ASPM
[    0.248927] acpi PNP0A08:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
...
[    2.300194] WARNING: CPU: 2 PID: 1 at /home/kernel/COD/linux/drivers/pinctrl/intel/pinctrl-baytrail.c:212 byt_gpio_request+0xb0/0xe0()
[    2.300198] Modules linked in:
[    2.300207] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.5.0-040500-generic #201603140130
[    2.300211] Hardware name: LARK Ultimate 7i win/Ultimate 7i win, BIOS LARK.W71JABMR02 04/16/2015
[    2.300215]  0000000000000086 00000000add99c59 ffff88003b75ad78 ffffffff813e0233
[    2.300223]  0000000000000000 ffffffff81d3cf88 ffff88003b75adb0 ffffffff81080e72
[    2.300230]  ffffc900001e6610 ffff88003c229818 0000000000000064 0000000000000001
[    2.300237] Call Trace:
[    2.300248]  [<ffffffff813e0233>] dump_stack+0x63/0x90
[    2.300257]  [<ffffffff81080e72>] warn_slowpath_common+0x82/0xc0
[    2.300263]  [<ffffffff81080fba>] warn_slowpath_null+0x1a/0x20
[    2.300269]  [<ffffffff8141ae60>] byt_gpio_request+0xb0/0xe0
[    2.300276]  [<ffffffff8141b603>] __gpiod_request+0x73/0x100
[    2.300282]  [<ffffffff8141bb65>] gpiochip_request_own_desc+0x35/0x60
[    2.300289]  [<ffffffff81420761>] acpi_gpio_adr_space_handler+0x1c1/0x300
[    2.300295]  [<ffffffff814205a0>] ? acpi_gpiochip_request_interrupt+0x2b0/0x2b0
[    2.300303]  [<ffffffff81489d44>] acpi_ev_address_space_dispatch+0x1fb/0x25a
[    2.300310]  [<ffffffff8148d885>] acpi_ex_access_region+0x1e1/0x26d
[    2.300316]  [<ffffffff8148d5f1>] acpi_ex_write_data_to_field+0x1a2/0x20c
[    2.300324]  [<ffffffff81485283>] ? acpi_ds_init_object_from_op+0x33/0x272
[    2.300331]  [<ffffffff81491830>] acpi_ex_store_object_to_node+0x153/0x183
[    2.300338]  [<ffffffff8149192c>] acpi_ex_store+0xcc/0x25a
[    2.300344]  [<ffffffff81486540>] ? acpi_ds_create_operands+0x7b/0xe0
[    2.300351]  [<ffffffff8148f301>] acpi_ex_opcode_1A_1T_1R+0x3eb/0x520
[    2.300357]  [<ffffffff814913a5>] ? acpi_ex_resolve_operands+0x20c/0x4e1
[    2.300364]  [<ffffffff81486a48>] acpi_ds_exec_end_op+0xcd/0x3e4
[    2.300370]  [<ffffffff8149979a>] acpi_ps_parse_loop+0x522/0x588
...
[    8.235763] WARNING: CPU: 1 PID: 339 at /home/kernel/COD/linux/drivers/pinctrl/intel/pinctrl-baytrail.c:212 byt_gpio_request+0xb0/0xe0()
[    8.235766] Modules linked in: dw_dmac(+) snd_seq_midi_event 8250_fintek tpm_crb(+) soc_button_array(+) dw_dmac_core hci_uart snd_rawmidi btbcm btqca snd_seq btintel bluetooth snd_seq_device snd_timer snd rfkill_gpio soundcore int3400_thermal processor_thermal_device int3403_thermal int3402_thermal intel_soc_dts_iosf acpi_thermal_rel int340x_thermal_zone i2c_designware_platform(+) pwm_lpss_platform 8250_dw pwm_lpss spi_pxa2xx_platform i2c_designware_core acpi_pad parport_pc ppdev lp parport autofs4 hid_generic usbhid hid mmc_block i915 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm fjes video sdhci_acpi sdhci
[    8.235835] CPU: 1 PID: 339 Comm: systemd-udevd Tainted: G        W       4.5.0-040500-generic #201603140130
[    8.235839] Hardware name: LARK Ultimate 7i win/Ultimate 7i win, BIOS LARK.W71JABMR02 04/16/2015
[    8.235842]  0000000000000086 0000000020dc95c1 ffff880039a1b968 ffffffff813e0233
[    8.235849]  0000000000000000 ffffffff81d3cf88 ffff880039a1b9a0 ffffffff81080e72
[    8.235855]  ffffc900001ea020 ffff88003c31e418 0000000000000015 0000000000000000
[    8.235861] Call Trace:
[    8.235871]  [<ffffffff813e0233>] dump_stack+0x63/0x90
[    8.235878]  [<ffffffff81080e72>] warn_slowpath_common+0x82/0xc0
[    8.235884]  [<ffffffff81080fba>] warn_slowpath_null+0x1a/0x20
[    8.235889]  [<ffffffff8141ae60>] byt_gpio_request+0xb0/0xe0
[    8.235896]  [<ffffffff8141b603>] __gpiod_request+0x73/0x100
[    8.235902]  [<ffffffff8141e22b>] gpiod_request+0x5b/0xf0
[    8.235907]  [<ffffffff8141e58c>] gpiod_get_index+0x1fc/0x3d0
[    8.235917]  [<ffffffffc02c8128>] soc_button_probe+0xe8/0x29e [soc_button_array]
[    8.235924]  [<ffffffff8154692b>] platform_drv_probe+0x3b/0xa0
[    8.235931]  [<ffffffff8154476c>] driver_probe_device+0x22c/0x440
[    8.235938]  [<ffffffff81544a04>] __driver_attach+0x84/0x90
[    8.235944]  [<ffffffff81544980>] ? driver_probe_device+0x440/0x440


I've dumped and disassembled the ACPI tables and we're in the process of building and installing a kernel with ACPI_DEBUG=y to gather more detail. Binary ACPI tables are attached.

The "_OSC invalid UUID" error can be ignored; the _OSC() method returns OSC_INVALID_UUID_ERROR (4) from an Else clause because the related "If (((Arg0 == GUID) && NEXP))" clause tests both for a matching _OSC UUID (which matches the GUID variable) *and* an internal NEXP which is, I think, the 'Native PCI Express control' flag and will be Zero.

It feels to me as if the problem is in the initial failure to correctly power-up or configure the GPIO pin control.
Comment 1 TJ 2016-03-26 13:42:23 UTC
Created attachment 210731 [details]
v4.5 dmesg
Comment 2 RussianNeuroMancer 2016-03-26 20:10:56 UTC
Seems like I have similar issue, except for me WiFi and touch is working with right drivers. But there is bunch of other issues with this tablet (not working buttons, suspens, etc.) so I guess some this issuies could be related to this gpio error.
Comment 3 RussianNeuroMancer 2016-03-26 20:11:15 UTC
Seems like I have similar issue, except for me WiFi and touch is working with right drivers. But there is bunch of other issues with this tablet (not working buttons, suspens, etc.) so I guess some this issuies could be related to this gpio error.
Comment 4 RussianNeuroMancer 2016-03-26 20:12:11 UTC
Created attachment 210751 [details]
dmesg witn 4.5
Comment 5 RussianNeuroMancer 2016-03-26 20:16:50 UTC
Created attachment 210761 [details]
dsdt.dsl
Comment 6 Zhang Rui 2016-05-10 08:49:46 UTC
I don't know if the warning is the root cause of the problem.
But it seems to be possible according to the comments in 
static int byt_gpio_request(struct gpio_chip *chip, unsigned offset)
{
        ...

        /*
         * In most cases, func pin mux 000 means GPIO function.
         * But, some pins may have func pin mux 001 represents
         * GPIO function.
         *
         * Because there are devices out there where some pins were not
         * configured correctly we allow changing the mux value from
         * request (but print out warning about that).
         */
        value = readl(reg) & BYT_PIN_MUX;
        gpio_mux = byt_get_gpio_mux(vg, offset);
        if (WARN_ON(gpio_mux != value)) {
                value = readl(reg) & ~BYT_PIN_MUX;
                value |= gpio_mux;
                writel(value, reg);

                dev_warn(&vg->pdev->dev,
                         "pin %u forcibly re-configured as GPIO\n", offset);
        }
        ...
}

Maybe Mika can clarify about this warning message.
Comment 7 Zhang Rui 2016-06-20 02:34:50 UTC
Hi, Mika,

can you please take a look at this issue?
Comment 8 Mika Westerberg 2016-06-20 12:52:07 UTC
The pin in question is requested as GPIO but the BIOS has left it in native mode. This is pretty much BIOS issue to me.

Note that the driver just warns and allows pin to be re-configured.
Comment 9 RussianNeuroMancer 2016-07-14 22:14:22 UTC
Issue in this report looks similar: https://bugzilla.kernel.org/show_bug.cgi?id=90521
It could be related to this one?
Comment 10 Zhang Rui 2016-09-02 07:07:49 UTC
(In reply to Mika Westerberg from comment #8)
> The pin in question is requested as GPIO but the BIOS has left it in native
> mode. This is pretty much BIOS issue to me.

So should I close this bug report?

> 
> Note that the driver just warns and allows pin to be re-configured.

how to re-configure this? Do we have a way to workaround this in Linux kernel?
Comment 11 Mika Westerberg 2016-09-02 08:30:28 UTC
Yes, this is not a kernel bug IMHO.

The driver re-configures the pin already - it just warns first before it actually does it.
Comment 12 Zhang Rui 2016-09-05 05:19:13 UTC
(In reply to Mika Westerberg from comment #11)
> Yes, this is not a kernel bug IMHO.
> 
> The driver re-configures the pin already - it just warns first before it
> actually does it.

Got it, thanks!
Comment 13 Zhang Rui 2016-09-05 05:20:59 UTC
Tj,

I see there are quite some changes in pinctrl-baytrail.c recently, so please confirm if the problem still exists in latest upstream kernel.
Comment 14 RussianNeuroMancer 2016-11-13 03:17:00 UTC
Created attachment 244281 [details]
dmesg 4.8.7

Yes, issue is still reproducible with Linux 4.8.7. dmesg is attached.
Comment 15 Zhang Rui 2016-12-22 01:33:50 UTC
As Mika mentioned above, the GPIO log is just a warning message.

so for any device/driver that is not working properly, please raise the problem to the driver component directly.
Comment 16 RussianNeuroMancer 2017-03-09 11:15:59 UTC
> so for any device/driver that is not working properly, please raise the
> problem to the driver component directly.

That was probably about this issue: https://bugzilla.kernel.org/show_bug.cgi?id=194777