All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Quentin Schulz <foss+kernel@0leil.net>,
	hadess@hadess.net, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, wens@csie.org,
	jernej.skrabec@gmail.com, samuel@sholland.org, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@somainline.org,
	heiko@sntech.de, linux-input@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	arm-mail-list <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>
Subject: Re: [RFC PATCH 1/7] Input: goodix - fix reset polarity
Date: Mon, 21 Nov 2022 16:06:21 +0100	[thread overview]
Message-ID: <554ebf0a-2304-6fd0-555a-0ce1b4615bf0@theobroma-systems.com> (raw)
In-Reply-To: <16c7f876-102c-60e1-4a81-3378b6c726fb@redhat.com>

Hi Hans,

Sorry for the delay.

On 11/3/22 20:28, Hans de Goede wrote:
[...]
> Ok, so I've been taking a look at how we can invert the 'x' passed
> to the gpiod_direction_output(ts->gpiod_rst, x) calls and not break
> things with ACPI.
> 
> The rst pin is looked up through a acpi_gpio_mapping which
> contains acpi_gpio_params as one of the per pin parameters
> and that does have an active_low flag.
> 

I just read the kernel docs about GPIO and ACPI and I'm not entirely 
sure this is always 100% safe to do:

https://docs.kernel.org/firmware-guide/acpi/gpio-properties.html

Specifically:
"""
The GpioIo() resource unfortunately doesn't explicitly provide an 
initial state of the output pin which driver should use during its 
initialization.

Linux tries to use common sense here and derives the state from the bias 
and polarity settings. The table below shows the expectations:

=========  =============  ==============
Pull Bias     Polarity     Requested...
=========  =============  ==============
Implicit     x            AS IS (assumed firmware configured for us)
Explicit     x (no _DSD)  as Pull Bias (Up == High, Down == Low),
                           assuming non-active (Polarity = !Pull Bias)
Down         Low          as low, assuming active
Down         High         as low, assuming non-active
Up           Low          as high, assuming non-active
Up           High         as high, assuming active
=========  =============  ==============
"""

But since we actually override this during our devm_gpiod_get_optional 
by passing forcing the flag to be either GPIOD_IN or GPIOD_ASIS, we 
should be good for this driver IIUC?

Thanks for the pointers,
Cheers,
Quentin

WARNING: multiple messages have this Message-ID (diff)
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Quentin Schulz <foss+kernel@0leil.net>,
	hadess@hadess.net, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, wens@csie.org,
	jernej.skrabec@gmail.com, samuel@sholland.org, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@somainline.org,
	heiko@sntech.de, linux-input@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	arm-mail-list <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>
Subject: Re: [RFC PATCH 1/7] Input: goodix - fix reset polarity
Date: Mon, 21 Nov 2022 16:06:21 +0100	[thread overview]
Message-ID: <554ebf0a-2304-6fd0-555a-0ce1b4615bf0@theobroma-systems.com> (raw)
In-Reply-To: <16c7f876-102c-60e1-4a81-3378b6c726fb@redhat.com>

Hi Hans,

Sorry for the delay.

On 11/3/22 20:28, Hans de Goede wrote:
[...]
> Ok, so I've been taking a look at how we can invert the 'x' passed
> to the gpiod_direction_output(ts->gpiod_rst, x) calls and not break
> things with ACPI.
> 
> The rst pin is looked up through a acpi_gpio_mapping which
> contains acpi_gpio_params as one of the per pin parameters
> and that does have an active_low flag.
> 

I just read the kernel docs about GPIO and ACPI and I'm not entirely 
sure this is always 100% safe to do:

https://docs.kernel.org/firmware-guide/acpi/gpio-properties.html

Specifically:
"""
The GpioIo() resource unfortunately doesn't explicitly provide an 
initial state of the output pin which driver should use during its 
initialization.

Linux tries to use common sense here and derives the state from the bias 
and polarity settings. The table below shows the expectations:

=========  =============  ==============
Pull Bias     Polarity     Requested...
=========  =============  ==============
Implicit     x            AS IS (assumed firmware configured for us)
Explicit     x (no _DSD)  as Pull Bias (Up == High, Down == Low),
                           assuming non-active (Polarity = !Pull Bias)
Down         Low          as low, assuming active
Down         High         as low, assuming non-active
Up           Low          as high, assuming non-active
Up           High         as high, assuming active
=========  =============  ==============
"""

But since we actually override this during our devm_gpiod_get_optional 
by passing forcing the flag to be either GPIOD_IN or GPIOD_ASIS, we 
should be good for this driver IIUC?

Thanks for the pointers,
Cheers,
Quentin

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Quentin Schulz <foss+kernel@0leil.net>,
	hadess@hadess.net, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, wens@csie.org,
	jernej.skrabec@gmail.com, samuel@sholland.org, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@somainline.org,
	heiko@sntech.de, linux-input@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	arm-mail-list <linux-arm-kernel@lists.infradead.org>,
	linux-sunxi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>
Subject: Re: [RFC PATCH 1/7] Input: goodix - fix reset polarity
Date: Mon, 21 Nov 2022 16:06:21 +0100	[thread overview]
Message-ID: <554ebf0a-2304-6fd0-555a-0ce1b4615bf0@theobroma-systems.com> (raw)
In-Reply-To: <16c7f876-102c-60e1-4a81-3378b6c726fb@redhat.com>

Hi Hans,

Sorry for the delay.

On 11/3/22 20:28, Hans de Goede wrote:
[...]
> Ok, so I've been taking a look at how we can invert the 'x' passed
> to the gpiod_direction_output(ts->gpiod_rst, x) calls and not break
> things with ACPI.
> 
> The rst pin is looked up through a acpi_gpio_mapping which
> contains acpi_gpio_params as one of the per pin parameters
> and that does have an active_low flag.
> 

I just read the kernel docs about GPIO and ACPI and I'm not entirely 
sure this is always 100% safe to do:

https://docs.kernel.org/firmware-guide/acpi/gpio-properties.html

Specifically:
"""
The GpioIo() resource unfortunately doesn't explicitly provide an 
initial state of the output pin which driver should use during its 
initialization.

Linux tries to use common sense here and derives the state from the bias 
and polarity settings. The table below shows the expectations:

=========  =============  ==============
Pull Bias     Polarity     Requested...
=========  =============  ==============
Implicit     x            AS IS (assumed firmware configured for us)
Explicit     x (no _DSD)  as Pull Bias (Up == High, Down == Low),
                           assuming non-active (Polarity = !Pull Bias)
Down         Low          as low, assuming active
Down         High         as low, assuming non-active
Up           Low          as high, assuming non-active
Up           High         as high, assuming active
=========  =============  ==============
"""

But since we actually override this during our devm_gpiod_get_optional 
by passing forcing the flag to be either GPIOD_IN or GPIOD_ASIS, we 
should be good for this driver IIUC?

Thanks for the pointers,
Cheers,
Quentin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-21 15:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 14:43 [RFC PATCH 0/7] fix reset line polarity for Goodix touchscreen controllers Quentin Schulz
2022-11-03 14:43 ` Quentin Schulz
2022-11-03 14:43 ` Quentin Schulz
2022-11-03 17:17 ` Dmitry Torokhov
2022-11-03 17:17   ` Dmitry Torokhov
2022-11-03 17:17   ` Dmitry Torokhov
     [not found] ` <20221103-upstream-goodix-reset-v1-1-87b49ae589f1@theobroma-systems.com>
     [not found]   ` <1fa371bd-78a6-bb7c-4692-1d8132ec2ab1@redhat.com>
     [not found]     ` <Y2P7SsPa04975Rkm@google.com>
     [not found]       ` <692fd16e-4183-d58d-802e-2b83563aee4b@redhat.com>
2022-11-03 18:41         ` [RFC PATCH 1/7] Input: goodix - fix reset polarity Quentin Schulz
2022-11-03 18:41           ` Quentin Schulz
2022-11-03 18:41           ` Quentin Schulz
2022-11-03 19:28           ` Hans de Goede
2022-11-03 19:28             ` Hans de Goede
2022-11-03 19:28             ` Hans de Goede
2022-11-21 15:06             ` Quentin Schulz [this message]
2022-11-21 15:06               ` Quentin Schulz
2022-11-21 15:06               ` Quentin Schulz
2022-11-21 19:24               ` Hans de Goede
2022-11-21 19:24                 ` Hans de Goede
2022-11-21 19:24                 ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554ebf0a-2304-6fd0-555a-0ce1b4615bf0@theobroma-systems.com \
    --to=quentin.schulz@theobroma-systems.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=festevam@gmail.com \
    --cc=foss+kernel@0leil.net \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=samuel@sholland.org \
    --cc=shawnguo@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.