From: Kent Gibson <warthog618@gmail.com>
To: Riz <mdrizwan827@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>, linux-gpio@vger.kernel.org
Subject: Re: Regarding export of GPIOs
Date: Wed, 1 Sep 2021 14:28:58 +0800 [thread overview]
Message-ID: <20210901062858.GA30669@sol> (raw)
In-Reply-To: <CA+FSg4rE8h0hdGa2UmvNyX1B2ChjJPfwobRdEsi_dSnyvT0p=Q@mail.gmail.com>
On Tue, Aug 31, 2021 at 08:38:01PM +0530, Riz wrote:
> Sorry the kernel log was:
> [ 0.251788] GPIO line <num> (name) hogged as output/low
>
It is a bit of a worry that you are editing logs, rather than just
copying them verbatim. That is just another source of error and
confusion.
The only info you would be leaking here are the num and name, and neither
are significant.
If you are still concerned you can always make the name in your dts
something anonymous but still more meaningful than "name".
Call it "foobar" or something.
> Regards.
>
> On Tue, Aug 31, 2021 at 8:35 PM Riz <mdrizwan827@gmail.com> wrote:
> >
> > Hi Kent,
> > Thank you for your response.
> >
> > I am observing a strange thing here.
> >
> > The kernel logs for the hogged GPIO reports as:
> > [ 0.251788] GPIO line <num> (name) hogged as output/high
> >
> > The corresponding dts changes are:
> > >
> > > pNum {
> > > gpio-hog;
> > > gpios = <num GPIO_ACTIVE_LOW>;
> > > output-low;
> > > line-name = "name";
> > > };
> >
Just to re-iterate Andy's response - if you intend to make active use of
the line then hogging is not the way to go - it is for statically
setting lines for which no driver exists.
And setting GPIO_ACTIVE_LOW makes no sense in this context. That inverts
the polarity when mapping between logical and physical values, but for
hogs you are not actively using the line so the logical value is not
relevant.
The output-low sets the physical level to low, and an output-high would
set it high. No logical value involved.
The remainder of the response assumes you just want to determine why the
kernel is not reporting what you expect on a hogged line.
> >
> > Based on the kernel log, I could say that it is hogging the GPIO as expected.
> >
> > But using the gpioinfo and lsgpio tools always show the direction as
> > "input" for the hogged GPIO.
> > gpioinfo <chipname>:
> > line X: "pX" "name" input active-low [used]
> >
> > lsgpio -n <chipname>:
> > line X: "pX" "name" [kernel active-low]
> >
So lsgpio agrees with gpioinfo in that FLAG_IS_OUT is not set, and the
problem you are seeing is almost certainly on the kernel side.
> > I tried following the kernel by adding some logs, it seems to set the
> > correct direction.
To absolutely confirm that you could add debugging to the kernel to
report the desc->flags after the line is hogged, so in gpiod_hog(), and
where the info is read in gpiolib-cdev lineinfo_get() or
lineinfo_get_v1(), as appropriate.
If those differ then I would add debugging to all the places the
FLAG_IS_OUT is cleared to see if they are somehow being called and
clearing the flag after it is set by gpiod_hog().
If that doesn't turn up anything then the last resort is using a debugger
to put a hardware breakpoint on the desc->flags to identify how it is
being changed.
Cheers,
Kent.
prev parent reply other threads:[~2021-09-01 6:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 3:25 Regarding export of GPIOs Riz
2021-08-20 14:04 ` Andy Shevchenko
2021-08-27 2:21 ` Kent Gibson
2021-08-31 15:05 ` Riz
2021-08-31 15:08 ` Riz
2021-09-01 6:28 ` Kent Gibson [this message]
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=20210901062858.GA30669@sol \
--to=warthog618@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=mdrizwan827@gmail.com \
/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).