From: "Nuno Sá" <noname.nuno@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Andy Shevchenko <andy@kernel.org>,
nuno.sa@analog.com, linux-hwmon@vger.kernel.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH v2 2/2] hwmon: ltc4282: add support for the LTC4282 chip
Date: Mon, 04 Dec 2023 09:53:09 +0100 [thread overview]
Message-ID: <edc0fe0abf55212131cc1e0ca064df64e8ba14bb.camel@gmail.com> (raw)
In-Reply-To: <CACRpkdYBXVt7KvWfPJj1OhPUB7-QJbKg+74zwnR_=0pszg9APA@mail.gmail.com>
On Mon, 2023-12-04 at 00:03 +0100, Linus Walleij wrote:
> On Fri, Dec 1, 2023 at 4:24 PM Nuno Sá <noname.nuno@gmail.com> wrote:
>
> > > If a pins .direction_output() fails, .set_value() will not be called
> > > on it either.
> >
> > This is where I lost you :(
>
> devm_gpiod_get() (and similar interfaces) will set up the default mode for
> the line, as input or output (with value, calling .direction_output) so most
> likely it will fail already there, and the driver will not probe or
> userspace client
> will fail.
>
> > So, I'm might be overcomplicating things but... Again,
> > the case where someone wired up HW so that we can actually use the pin to drive
> > the
> > line high (having an external pull up). In that case, If I return error, then I
> > won't
> > be able to effectively set the line high (as you said, set_value will not be
> > called
> > on it either).
> >
> > Now, I do understand that if we have the line flagged as GPIO_OPEN_DRAIN, then
> > gpiolib will switch the line to input which means we will set the line in high-z
> > which means that if we have a pull up, then the line will be high. I mean, it
> > works
> > but it would be strange if someone wants to have the line as output high and
> > after
> > trying to set the it high, it sees the pin moving to input. But if this is how it
> > should be, fine by me.
>
> What do you mean by "sees the pin moving to input".
>
> If you mean electrically then yes, it goes to high-Z.
>
Ohh, I know where my failure was!! I was reading gpiod_direction_output(desc, 1) and
following it only till gpiod_direction_input(desc). I was completely missing the
'set_output_flag' jump... All understood now :)
> If you mean logically, as seen by software and GPIO and debugfs, not
> really.
>
> I think a good exercise to see how it works is to just walk through the
> code in drivers/gpio/gpiolib.c for e.g.
> gpiod_set_value()
> gpiod_set_value_nocheck()
> gpio_set_open_drain_value_commit()
>
Hmm, by looking into those, it made me think that I should not even need to implement
the .set() callback...
>
Thanks for all your help!
- Nuno Sá
prev parent reply other threads:[~2023-12-04 8:53 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 14:18 [PATCH v2 0/2] Add support for LTC4282 Nuno Sa via B4 Relay
2023-11-24 14:18 ` [PATCH v2 1/2] dt-bindings: hwmon: Add LTC4282 bindings Nuno Sa via B4 Relay
2023-11-25 11:56 ` Conor Dooley
2023-11-27 7:56 ` Nuno Sá
2023-11-27 17:33 ` Conor Dooley
2023-11-28 15:37 ` Rob Herring
2023-11-28 15:49 ` Nuno Sá
2023-11-24 14:18 ` [PATCH v2 2/2] hwmon: ltc4282: add support for the LTC4282 chip Nuno Sa via B4 Relay
2023-11-24 21:54 ` kernel test robot
2023-11-24 23:39 ` kernel test robot
2023-11-27 7:53 ` Nuno Sá
2023-11-27 8:10 ` Krzysztof Kozlowski
2023-11-27 8:12 ` Krzysztof Kozlowski
2023-11-27 8:44 ` Nuno Sá
2023-11-27 16:03 ` Andy Shevchenko
2023-11-28 16:50 ` Krzysztof Kozlowski
2023-11-28 17:01 ` Andy Shevchenko
2023-11-28 18:03 ` Guenter Roeck
2023-11-29 8:35 ` Nuno Sá
2023-11-29 8:45 ` Krzysztof Kozlowski
2023-11-29 8:56 ` Nuno Sá
2023-11-29 14:10 ` Linus Walleij
2023-11-29 14:13 ` Krzysztof Kozlowski
2023-11-29 14:29 ` Nuno Sá
2023-11-29 14:47 ` Guenter Roeck
2023-11-29 16:09 ` Nuno Sá
2023-11-27 10:20 ` kernel test robot
2023-11-29 14:49 ` Linus Walleij
2023-11-29 16:08 ` Nuno Sá
2023-11-29 16:18 ` Andy Shevchenko
2023-11-29 16:21 ` Nuno Sá
2023-11-29 17:07 ` Andy Shevchenko
2023-11-29 20:55 ` Linus Walleij
2023-11-30 10:20 ` Nuno Sá
2023-11-30 13:36 ` Andy Shevchenko
2023-11-30 14:39 ` Guenter Roeck
2023-11-30 15:20 ` Nuno Sá
2023-11-30 16:28 ` Guenter Roeck
2023-11-30 20:15 ` Linus Walleij
2023-12-01 12:34 ` Nuno Sá
2023-12-01 13:40 ` Linus Walleij
2023-12-01 15:24 ` Nuno Sá
2023-12-01 15:47 ` Andy Shevchenko
2023-12-01 16:04 ` Guenter Roeck
2023-12-01 16:24 ` Andy Shevchenko
2023-12-01 16:36 ` Guenter Roeck
2023-12-01 16:29 ` Nuno Sá
2023-12-01 16:46 ` Guenter Roeck
2023-12-02 9:42 ` Nuno Sá
2023-12-03 23:08 ` Linus Walleij
2023-12-04 8:20 ` Bartosz Golaszewski
2023-12-01 16:19 ` Nuno Sá
2023-12-01 16:23 ` Andy Shevchenko
2023-12-03 23:03 ` Linus Walleij
2023-12-04 8:53 ` Nuno Sá [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=edc0fe0abf55212131cc1e0ca064df64e8ba14bb.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=andy@kernel.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nuno.sa@analog.com \
--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).