linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Jeff LaBundy <jeff@labundy.com>
Cc: Quentin Schulz <foss+kernel@0leil.net>,
	robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
	heiko@sntech.de, dmitry.torokhov@gmail.com,
	klaus.goger@theobroma-systems.com, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCH 1/3] Input: add `SW_BOOT_ALT`
Date: Tue, 27 Sep 2022 10:51:51 +0200	[thread overview]
Message-ID: <af9fa1c4-0db1-6776-c362-d375f934422e@theobroma-systems.com> (raw)
In-Reply-To: <YzJYZrw09dXEihnn@nixie71>

Hi Jeff,

On 9/27/22 03:56, Jeff LaBundy wrote:
> Hi Quentin,
> 
> On Mon, Sep 26, 2022 at 11:37:45AM +0200, Quentin Schulz wrote:
>> Hi all,
>>
>> On 9/23/22 19:19, Jeff LaBundy wrote:
>> [...]
>>>>
>>>> I have this switch on the board and I want to expose its state to the user,
>>>> if this new event code is not possible/a good idea what would you suggest we
>>>> could use?
>>>>
>>>> Note that we already support the same switch but in a different way: https://urldefense.proofpoint.com/v2/url?u=https-3A__git.kernel.org_pub_scm_linux_kernel_git_torvalds_linux.git_tree_arch_arm64_boot_dts_rockchip_rk3399-2Dpuma-2Dhaikou.dts-23n167&d=DwIBAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=vObtDja6hUlL_kVvKRILCvaQfklw1gl7TAW7cm5_9H_Yi00zkzGV6-D3yzazR2gU&s=0Xo-7CDmMoriaTNn_hJdMwftLlcY-tgopPcgzXfQtJE&e=
>>>> We are just configuring the GPIOs into the GPIO mode with a pull-up, and
>>>> then it's up to the user to use gpiod or gpio-sysfs to check the state of
>>>> the GPIO used for this switch. I don't like this, very not user-friendly and
>>>> was looking for something better :)
>>>
>>> Actually, that's exactly what I was going to suggest. What in particular
>>> is not user-friendly about it?
>>>
>>
>> The implementation we currently have in place for Puma Haikou is just muxing
>> the pins in their GPIO function with a pull-up. Nothing else. This means the
>> user still needs to know exactly which GPIO number is for which
>> signal/event. Not that great. Also does not allow for a consistent user
>> "experience" across modules on the same devkit (different GPIOs depending on
>> the SoM).
>>
>> I had hoped gpio-hog in input mode would expose it to userspace but it does
>> not seem to?
> 
> No, I don't believe that is the case. That being said, you should be
> able to grep /sys/kernel/debug/gpio for the hog node's label and get
> the pin state (lo or hi).
> 
>>
>> Anything to recommend so that we can export a GPIO line for a specific
>> function to usersapce without needing the user to know which GPIO number
>> they should look at?
> 
> If debugfs won't work for your purposes, another option is to request
> the GPIO from a general-purpose platform driver and return one of two
> strings via sysfs.
> 

This board will be fully supported upstream and I don't feel like this 
general-purpose platform driver would be accepted, but maybe I'm wrong.

I didn't know about the /sys/kernel/debug/gpio file just yet for some 
reason, so that's one way to do it, thanks for the info.

Good thing is that the kernel requests this pin in GPIO input mode so at 
least that's one less possible misconfiguration from userspace. Not so 
good thing is that you need to grep in this file and it's not that great 
for scripts :) We'll discuss internally what feels the best to us and go 
for it, thanks for the tips!

I'm wondering if allowing sysfs/libgpiod to access the state of GPIOs 
requested by the kernel would make sense on the subsystem level though. 
I'm sure I'm missing obvious security/HW-limitations pitfalls, but I 
think allowing userspace to get the value of a GPIO input pin requested 
by the kernel would be nice? Nothing for the input subsystem folks though :)

>>
>> While I have your attention, I was wondering about the BATTERY event. We
>> have a BATLOW button, following the Q7 standard:
>> """
>> Battery low input. This signal may be driven active low by external
>> circuitry to signal that the system battery is low or may be used to
>> signal some other external battery management event.
>> """
>>
>> Oddly vague, but the EV_BATTERY event is not really more precise though (at
>> least didn't find more precise information and the introducing commit is a
>> bit vague too on the usage). Was just wondering if there was any specific
>> usage for this event or if I'm using it correctly here?
> 
> Do you mean KEY_BATTERY?
> 

Yes sorry.

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-09-27  8:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 10:12 [PATCH 0/3] add support for Theobroma Systems PX30-µQ7 (Ringneck) with Haikou devkit Quentin Schulz
2022-09-22 10:12 ` [PATCH 1/3] Input: add `SW_BOOT_ALT` Quentin Schulz
2022-09-22 17:20   ` Jeff LaBundy
2022-09-23  8:25     ` Quentin Schulz
2022-09-23 17:19       ` Jeff LaBundy
2022-09-23 17:24         ` Dmitry Torokhov
2022-09-26  9:37         ` Quentin Schulz
2022-09-27  1:56           ` Jeff LaBundy
2022-09-27  8:51             ` Quentin Schulz [this message]
2022-09-27 12:57               ` Robin Murphy
2022-09-22 10:12 ` [PATCH 2/3] arm64: dts: rockchip: add PX30-µQ7 (Ringneck) SoM with Haikou baseboard Quentin Schulz
2022-09-22 11:56   ` Quentin Schulz
2022-09-22 12:45   ` Krzysztof Kozlowski
2022-09-23  9:55     ` Quentin Schulz
2022-09-23 10:28       ` Krzysztof Kozlowski
2022-09-22 10:12 ` [PATCH 3/3] dt-bindings: arm: rockchip: add Theobroma Systems PX30-µQ7 (Ringneck) with Haikou Quentin Schulz
2022-09-22 12:40   ` Krzysztof Kozlowski
2022-09-22 12:41     ` Krzysztof Kozlowski

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=af9fa1c4-0db1-6776-c362-d375f934422e@theobroma-systems.com \
    --to=quentin.schulz@theobroma-systems.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=foss+kernel@0leil.net \
    --cc=heiko@sntech.de \
    --cc=jeff@labundy.com \
    --cc=klaus.goger@theobroma-systems.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=robh+dt@kernel.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).