linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Specifying a valid pullup value for pinctrl_intel from an ACPI table
@ 2020-10-08  5:57 Jamie McClymont
  2020-10-09 18:48 ` Andy Shevchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Jamie McClymont @ 2020-10-08  5:57 UTC (permalink / raw)
  To: linux-gpio

Background
==========

Hi all

I am looking to write a driver for a fingerprint sensor found in my laptop. The
device has an SPI plus interrupt and reset lines, specified like so:

   Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
   {
       Name (RBUF, ResourceTemplate ()
       {
           // SPI
           SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
               ControllerInitiated, 0x00989680, ClockPolarityLow,
               ClockPhaseFirst, "\\_SB.PCI0.SPI1",
               0x00, ResourceConsumer, , Exclusive,
               )

           // Interrupt
           GpioInt (Level, ActiveLow, ExclusiveAndWake, PullUp, 0x0000,
               "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer, ,
               )
               {   // Pin list
                   0x0000
               }

           // Reset
           GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
               "\\_SB.PCI0.GPI0", 0x00, ResourceConsumer, ,
               )
               {   // Pin list
                   0x0008
               }
       })
       CreateWordField (RBUF, 0x3B, GPIN)
       CreateWordField (RBUF, 0x63, SPIN)
       GPIN = GNUM (0x02000017)
       SPIN = GNUM (0x0202000A)
       Return (RBUF) /* \_SB_.SPBA._CRS.RBUF */
   }

The issue
=========

Currently, I call devm_acpi_dev_add_driver_gpios (index 1 for the reset line),
then try to access it with devm_gpoid_get, which fails with -EINVAL.

From some kprobe use, I see that the EINVAL appears to stem from
intel_config_set, which gpiod_direction_output calls (indirectly) with the
config 0x205 -- I understand this to mean PIN_CONFIG_BIAS_PULL_UP with the
argument 1, whereas the function expects a specific resistance value; one of {20000,
5000, 2000, 1000}.

The problematic call stack, as ftrace sees it (the leaf function is in fact
intel_config_set_pull):

    devm_gpiod_get
    devm_gpiod_get_index
    gpiod_get_index
    gpiod_configure_flags
    gpiod_direction_output
    gpio_set_bias
    gpiochip_generic_config
    pinctrl_gpio_set_config
    pinconf_set_config
    intel_config_set

The question
============

Any suggestions as to how this invalid configuration gets produced from the
DSDT, and what the best workaround would be?

I'm assuming that pullups sometimes get correctly configured purely from ACPI,
and this is hitting some edge-case?

I'm running 5.8.13 -- if anyone has an inkling that this is a bug that has since
been fixed, I'm happy to try and use a more recent kernel.

Hardware
========

Laptop is a Huawei Matebook X Pro
CPU is an Intel i5-8250U (the specific pinctrl is pinctrl_sunrisepoint)
Peripheral is a Goodix GXFP5187
The pin number is 58, seemingly named UART0_RTSB

Disclaimer
==========

This is my first foray into kernel development and I've been guessing at a lot of things -- please excuse any silly mistakes :)



Thanks
- Jamie McClymont

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-14 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-08  5:57 Specifying a valid pullup value for pinctrl_intel from an ACPI table Jamie McClymont
2020-10-09 18:48 ` Andy Shevchenko
2020-10-09 22:57   ` Jamie McClymont
2020-10-14 10:50     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).