From: Stephan Gerhold <stephan@gerhold.net>
To: Sumit Garg <sumit.garg@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
andersson@kernel.org, konrad.dybcio@linaro.org,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, caleb.connolly@linaro.org,
neil.armstrong@linaro.org, dmitry.baryshkov@linaro.org,
laetitia.mariottini@se.com, pascal.eberhard@se.com,
abdou.saker@se.com, jimmy.lalande@se.com,
benjamin.missey@non.se.com, daniel.thompson@linaro.org,
linux-kernel@vger.kernel.org,
Jagdish Gediya <jagdish.gediya@linaro.org>
Subject: Re: [PATCH v3 3/3] arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS
Date: Thu, 21 Mar 2024 11:33:01 +0100 [thread overview]
Message-ID: <ZfwM3ZrjTWR_QANd@gerhold.net> (raw)
In-Reply-To: <CAFA6WYPzdSHEMmeb_J6LPje8MUkSSq93oN3+O1PMahtZN7hWnA@mail.gmail.com>
On Wed, Mar 20, 2024 at 12:10:32PM +0530, Sumit Garg wrote:
> On Tue, 19 Mar 2024 at 19:43, Stephan Gerhold <stephan@gerhold.net> wrote:
> > On Mon, Mar 18, 2024 at 03:20:46PM +0530, Sumit Garg wrote:
> > > On Fri, 15 Mar 2024 at 20:43, Stephan Gerhold <stephan@gerhold.net> wrote:
> > > > On Fri, Mar 15, 2024 at 11:37:07AM +0530, Sumit Garg wrote:
> > > > > Add Schneider Electric HMIBSC board DTS. The HMIBSC board is an IIoT Edge
> > > > > Box Core board based on the Qualcomm APQ8016E SoC.
> > > > >
> > > > > Support for Schneider Electric HMIBSC. Features:
> > > > > - Qualcomm Snapdragon 410C SoC - APQ8016 (4xCortex A53, Adreno 306)
> > > > > - 1GiB RAM
> > > > > - 8GiB eMMC, SD slot
> > > > > - WiFi and Bluetooth
> > > > > - 2x Host, 1x Device USB port
> > > > > - HDMI
> > > > > - Discrete TPM2 chip over SPI
> > > > > - USB ethernet adaptors (soldered)
> > > > >
> > > > > Co-developed-by: Jagdish Gediya <jagdish.gediya@linaro.org>
> > > > > Signed-off-by: Jagdish Gediya <jagdish.gediya@linaro.org>
> > > > > Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
> > > > > Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
> > > > > ---
> > > > > arch/arm64/boot/dts/qcom/Makefile | 1 +
> > > > > .../dts/qcom/apq8016-schneider-hmibsc.dts | 510 ++++++++++++++++++
> > > > > 2 files changed, 511 insertions(+)
> > > > > create mode 100644 arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
> > > > >
> > > > > diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
> > > > > index 39889d5f8e12..ad55e52e950b 100644
> > > > > --- a/arch/arm64/boot/dts/qcom/Makefile
> > > > > +++ b/arch/arm64/boot/dts/qcom/Makefile
> > > > > @@ -5,6 +5,7 @@ apq8016-sbc-usb-host-dtbs := apq8016-sbc.dtb apq8016-sbc-usb-host.dtbo
> > > > >
> > > > > dtb-$(CONFIG_ARCH_QCOM) += apq8016-sbc-usb-host.dtb
> > > > > dtb-$(CONFIG_ARCH_QCOM) += apq8016-sbc-d3-camera-mezzanine.dtb
> > > > > +dtb-$(CONFIG_ARCH_QCOM) += apq8016-schneider-hmibsc.dtb
> > > > > dtb-$(CONFIG_ARCH_QCOM) += apq8039-t2.dtb
> > > > > dtb-$(CONFIG_ARCH_QCOM) += apq8094-sony-xperia-kitakami-karin_windy.dtb
> > > > > dtb-$(CONFIG_ARCH_QCOM) += apq8096-db820c.dtb
> > > > > diff --git a/arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts b/arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
> > > > > new file mode 100644
> > > > > index 000000000000..9c79a31a04db
> > > > > --- /dev/null
> > > > > +++ b/arch/arm64/boot/dts/qcom/apq8016-schneider-hmibsc.dts
> > > > > @@ -0,0 +1,510 @@
> > > > > [...]
> > > > > +
> > > > > +&pm8916_resin {
> > > > > + interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_FALLING>;
> > > > > + linux,code = <KEY_POWER>;
> > > > > + status = "okay";
> > > > > +};
> > > >
> > > > What is the goal of overriding the interrupt here? It looks like you are
> > > > changing the interrupt type from IRQ_TYPE_EDGE_BOTH to FALLING. This
> > > > sounds a bit like you want the driver to receive just button release
> > > > events (or just press events, not sure about the polarity). I'm not sure
> > > > if the driver will handle this correctly.
> > >
> > > The use-case here is to just act upon button release events and the
> > > driver handles this appropriately. Final use-case of the reset button:
> > >
> > > - Short press and release leads to normal Linux reboot.
> > > - Long press for more than 10 sec or so leads to a hard reset.
> > >
> > > With IRQ_TYPE_EDGE_BOTH, that's not achievable because just a simple
> > > press leads to Linux reboot.
> > >
> >
> > Thanks for explaining your use case. Is the DT really the right place to
> > describe this? In the hardware, this is just a button that provides both
> > press and release events. Linux typically forwards these events to user
> > space, without interpreting them in any way. This means you likely have
> > some user space component that listens to the events (e.g. systemd
> > logind). Ideally that component should be reconfigured to trigger the
> > reboot on release instead of press.
>
> I am not sure if that's really the case. I only see power key value to
> be reported as follows:
>
> input_report_key(pwrkey->input, pwrkey->code, 1);
> or
> input_report_key(pwrkey->input, pwrkey->code, 0);
>
> It's not like a press event being a rising edge (0->1) or a release
> event being a falling edge (1->0) reported. AFAICS, a reboot is issued
> whenever the value of power key is reported as "1".
>
If you look inside the input_report_key() function you can see that the
input subsystem internally tracks the key state. input_get_disposition()
returns INPUT_IGNORE_EVENT if the key bit already has the same value.
Only when the key changes its state, an event is sent to user space.
This means that all events reported to user space are effectively
rising/falling edges (an event with value "1" is a rising edge 0->1, an
event with value "0" is a falling edge 1->0).
The only reason why setting IRQ_TYPE_EDGE_FALLING works here is because
of the workaround added in commit be8fc023ef64 ("Input: pm8941-pwrkey -
simulate missed key press events") [1]. No event is reported when you
start pressing the key. When you release the key, you get a key press
event (rising edge) immediately followed by a key release (falling
edge). But the workaround was added to handle potentially missed
interrupts, not to inhibit reporting key press events.
In my opinion, if you want to perform an action on key release rather
than key press then you should adjust the user space program to do so.
From the point of view of the hardware DT (and even the kernel), the key
press happens when you actually start pressing the key, and not later
when you release it.
Thanks,
Stephan
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=be8fc023ef64dcb11042aaa4bb0f29f7e0335d85
next prev parent reply other threads:[~2024-03-21 10:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 6:07 [PATCH v3 0/3] arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS Sumit Garg
2024-03-15 6:07 ` [PATCH v3 1/3] dt-bindings: vendor-prefixes: Add Schneider Electric Sumit Garg
2024-03-15 6:07 ` [PATCH v3 2/3] dt-bindings: arm: qcom: Add Schneider Electric HMIBSC board Sumit Garg
2024-03-15 6:07 ` [PATCH v3 3/3] arm64: dts: qcom: apq8016: Add Schneider HMIBSC board DTS Sumit Garg
2024-03-15 15:12 ` Stephan Gerhold
2024-03-18 9:50 ` Sumit Garg
2024-03-19 14:12 ` Stephan Gerhold
2024-03-20 6:40 ` Sumit Garg
2024-03-21 10:33 ` Stephan Gerhold [this message]
2024-03-22 6:29 ` Sumit Garg
2024-03-22 12:04 ` Caleb Connolly
2024-03-15 15:50 ` [PATCH v3 0/3] " Rob Herring
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=ZfwM3ZrjTWR_QANd@gerhold.net \
--to=stephan@gerhold.net \
--cc=abdou.saker@se.com \
--cc=andersson@kernel.org \
--cc=benjamin.missey@non.se.com \
--cc=caleb.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=daniel.thompson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=jagdish.gediya@linaro.org \
--cc=jimmy.lalande@se.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=laetitia.mariottini@se.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=pascal.eberhard@se.com \
--cc=robh+dt@kernel.org \
--cc=sumit.garg@linaro.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 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).