devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	marius.cristea@microchip.com, lars@metafoo.de,
	robh+dt@kernel.org, jdelvare@suse.com, linux@roeck-us.net,
	linux-hwmon@vger.kernel.org, krzysztof.kozlowski+dt@linaro.org,
	conor+dt@kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC193X
Date: Thu, 30 Nov 2023 15:53:27 +0000	[thread overview]
Message-ID: <20231130-obedient-pointer-6b4470a85c63@spud> (raw)
In-Reply-To: <20231126160438.01ff57d7@jic23-huawei>

[-- Attachment #1: Type: text/plain, Size: 4361 bytes --]

On Sun, Nov 26, 2023 at 04:04:38PM +0000, Jonathan Cameron wrote:
> On Sun, 26 Nov 2023 11:24:56 +0000
> Conor Dooley <conor@kernel.org> wrote:
> > On Sat, Nov 25, 2023 at 07:47:54PM +0000, Jonathan Cameron wrote:
> > > On Thu, 16 Nov 2023 18:21:33 +0000
> > > Conor Dooley <conor@kernel.org> wrote:  
> > > > On Thu, Nov 16, 2023 at 04:01:43PM +0100, Krzysztof Kozlowski wrote:  
> > > > > On 15/11/2023 14:44, marius.cristea@microchip.com wrote:    
> > > > > > From: Marius Cristea <marius.cristea@microchip.com>  
> > > > > > +patternProperties:
> > > > > > +  "^channel@[1-4]+$":
> > > > > > +    type: object
> > > > > > +    $ref: adc.yaml
> > > > > > +    description: Represents the external channels which are connected to the ADC.
> > > > > > +
> > > > > > +    properties:
> > > > > > +      reg:
> > > > > > +        items:
> > > > > > +          minimum: 1
> > > > > > +          maximum: 4
> > > > > > +
> > > > > > +      shunt-resistor-micro-ohms:
> > > > > > +        description: |
> > > > > > +          Value in micro Ohms of the shunt resistor connected between
> > > > > > +          the SENSE+ and SENSE- inputs, across which the current is measured. Value
> > > > > > +          is needed to compute the scaling of the measured current.
> > > > > > +
> > > > > > +    required:
> > > > > > +      - reg
> > > > > > +      - shunt-resistor-micro-ohms
> > > > > > +
> > > > > > +    unevaluatedProperties: false
> > > > > > +
> > > > > > +required:
> > > > > > +  - compatible
> > > > > > +  - reg
> > > > > > +  - "#address-cells"
> > > > > > +  - "#size-cells"
> > > > > > +
> > > > > > +allOf:
> > > > > > +  - if:
> > > > > > +      properties:
> > > > > > +        compatible:
> > > > > > +          contains:
> > > > > > +            const: interrupts    
> > > > > 
> > > > > 
> > > > > I don't understand what do you want to say here. I am also 100% sure you
> > > > > did not test it on a real case (maybe example passes but nothing more).    
> > > > 
> > > > As far as I understand, the same pin on the device is used for both an
> > > > output or an input depending on the configuration. As an input, it is
> > > > the "slow-io" control, and as an output it is an interrupt.
> > > > I think Marius is trying to convey that either this pin can be in
> > > > exclusively one state or another.
> > > > 
> > > > _However_ I am not sure that that is really the right thing to do - they
> > > > might well be mutually exclusive modes, but I think the decision can be
> > > > made at runtime, rather than at devicetree creation time. Say for
> > > > example the GPIO controller this is connected to is capable of acting as
> > > > an interrupt controller. Unless I am misunderstanding the runtime
> > > > configurability of this hardware, I think it is possible to actually
> > > > provide a "slow-io-gpios" and an interrupt property & let the operating
> > > > system decide at runtime which mode it wants to work in.  
> > > 
> > > I'll admit I've long forgotten what was going on here, but based just on
> > > this bit of text I agree. There is nothing 'stopping' us having a pin
> > > uses as either / or / both interrupt and gpio.
> > > 
> > > It'll be a bit messy to support in the driver as IIRC there are some sanity
> > > checks that limit combinations on IRQs and output GPIOS.  Can't remember
> > > how bad the dance to navigate it safely is.
> > > 
> > > First version I'd just say pick one option if both are provided and
> > > don't support configuring it at runtime.  
> > 
> > Just to be clear, you are suggesting having the
> > "microchip,slow-io-gpios" and "interrupts" properties in the binding,
> > but the driver will just (for example) put that pin into alert mode
> > always & leave it there?
> 
> Yes.
> 
> > If that is what you are suggesting, that seems pragmatic to me.
> 
> If a use case to do something else comes along later, then we can
> be smarter, but I'd like to keep it simple initially at least.

Sounds good to me, thanks Jonathan. Seems like a good compromise of
depicting the hardware accurately and not overcomplicating the driver
implementation.

Marius, I completely forgot to get in touch with you about this - give
me a shout on teams if there's anything outstanding that I can help you
with.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-11-30 15:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 13:44 [PATCH v3 0/2] adding support for Microchip PAC193X Power Monitor marius.cristea
2023-11-15 13:44 ` [PATCH v3 1/2] dt-bindings: iio: adc: adding support for PAC193X marius.cristea
2023-11-16 15:01   ` Krzysztof Kozlowski
2023-11-16 18:21     ` Conor Dooley
2023-11-16 20:00       ` Krzysztof Kozlowski
2023-11-16 21:31         ` Conor Dooley
2023-11-25 19:47       ` Jonathan Cameron
2023-11-26 11:24         ` Conor Dooley
2023-11-26 16:04           ` Jonathan Cameron
2023-11-30 15:53             ` Conor Dooley [this message]
2023-11-15 13:44 ` [PATCH v3 2/2] iio: adc: adding support for PAC193x marius.cristea
2023-11-21 15:56   ` kernel test robot
2023-11-25 20:37   ` Jonathan Cameron
2023-11-15 19:38 ` [PATCH v3 0/2] adding support for Microchip PAC193X Power Monitor Guenter Roeck

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=20231130-obedient-pointer-6b4470a85c63@spud \
    --to=conor@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=marius.cristea@microchip.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).