Re: [PATCH v2 2/2] hwmon: ltc4282: add support for the LTC4282 chip

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2023-11-30 at 15:36 +0200, Andy Shevchenko wrote:
> On Thu, Nov 30, 2023 at 11:20:32AM +0100, Nuno Sá wrote:
> > On Wed, 2023-11-29 at 21:55 +0100, Linus Walleij wrote:
> > > On Wed, Nov 29, 2023 at 5:08 PM Nuno Sá <noname.nuno@xxxxxxxxx> wrote:
> > > 
> > > > Cool, I actually thought that having the direction + get/set stuff would be
> > > > weird
> > > > given the fact that we can only PULL_LOW or HIGH_Z the pins.
> > > 
> > > There are several drivers in the kernel that implement .set_config(),
> > > it's existing and should be enabled if it has uses.
> > 
> > Yeah, it might make sense to support it specially for the input case. AFAICT, if
> > I
> > use the .set_config() (but from a quick look I think we will need to add support
> > for
> > it in gpiolib for the high-z configuration), then I can't use the gpio_regmap
> > stuff.
> > As the driver stands I don't think I could do it anyways because setting gpio2-3
> > and
> > alert requires to write 0 on the register rather than 1. But again, I'm still
> > very
> > suspicious about the whole thing. The datasheet states:
> > 
> > "GPIO1-GPIO3 and ALERT all have comparators monitoring
> > the voltage on these pins with a threshold of 1.28V even when
> > the pins are configured as outputs."
> > 
> > But we can't really set the direction for gpio2-3 and the alert pins (only
> > getting
> > the level and setting it as PULL_LOW or HIGH_Z. gpio1 is the only one where we
> > can
> > configure it as input or open drain ouput. Bah, I'll try to see if someone
> > internally
> > can shed some light on this.
> 
> I have better proposal. If these GPIOs are not needed for the main
> functionality of the hardware, can we just left it out for now and implement
> later if required?
> 

Well, I did spent some time on the gpio thing so I would like to have it in but yeah,
no hard feelings if it does not go in.

So, I actually talk with some hw guys and the pull_low is not really like a pull_low
resistor. These pins are effectively an open drain. Which means, setting them as
input means setting them in high-z (turning off the mosffet) - and I do have a bug in
my code regarding this - Or if you want them as outputs you can set the level low
(and it will always be low - just turn on the mosffet) or you can also set high-z
which means it will be either low or high depending on your external circuitry. The
point is, you can still have your pin acting as a normal gpo if you accommodate your
circuitry for it (can also use these pins for things like buses).

Also got me thinking if a gpi vs gpo devicetree property would make sense. But I
would likely leave it more generic/relaxed for now (even though I think you would
need to be creative and actually use more HW to have the possibility of using these
pins as GPIs and GPOs at the same time).

- Nuno Sá





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux