mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sekhar Nori <nsekhar@ti.com>
To: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: David Lechner <david@lechnology.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Patrick Titiano <ptitiano@baylibre.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-devicetree <devicetree@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	arm-soc <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 4/4] ARM: dts: da850-evm: add the UI expander node
Date: Tue, 21 Feb 2017 10:33:10 +0530	[thread overview]
Message-ID: <2d708416-401a-d2df-5694-9896df47a673@ti.com> (raw)
In-Reply-To: <CAMpxmJX3p03YiPL5X9=pKud4A7bXh9bV=qk7qAEAnA3OF3Hgbw@mail.gmail.com>

On Monday 20 February 2017 09:08 PM, Bartosz Golaszewski wrote:
> 2017-02-20 10:36 GMT+01:00 Sekhar Nori <nsekhar@ti.com>:
>> On Thursday 16 February 2017 11:45 PM, Bartosz Golaszewski wrote:
>>> If we're using the UI board and want vpif capture, we need to select
>>> the video capture functionality by driving the sel_c pin low on the
>>> tca6416 expander and sel_a & sel_b pins high. Do it statically by
>>> hogging relevant GPIOs in the device tree.
>>>
>>> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>> ---
> 
> [snip]
> 
>>>
>>> +                             sel_a {
>>> +                                     gpio-hog;
>>> +                                     gpios = <7 GPIO_ACTIVE_HIGH>;
>>> +                                     output-high;
>>> +                                     line-name = "sel_a";
>>> +                             };
>>> +
>>> +                             sel_b {
>>> +                                     gpio-hog;
>>> +                                     gpios = <6 GPIO_ACTIVE_HIGH>;
>>> +                                     output-high;
>>> +                                     line-name = "sel_b";
>>> +                             };
>>> +
>>> +                             sel_c {
>>> +                                     gpio-hog;
>>> +                                     gpios = <5 GPIO_ACTIVE_HIGH>;
>>> +                                     output-low;
>>> +                                     line-name = "sel_c";
>>
>> I think this is better handled by using an enable-gpios property in vpif
>> capture device-tree node. So in the vpif capture node you would have:
>>
>>         enable-gpios =  <&tca6416 7 GPIO_ACTIVE_HIGH
>>                          &tca6416 6 GPIO_ACTIVE_HIGH
>>                          &tca6416 5 GPIO_ACTIVE_LOW>;
>>
>> and in the vpif capture driver, you would request each of these gpios
>> using: devm_gpiod_get_array_optional(.., .., GPIOD_OUT_HIGH);
>>
> 
> I'm not sure about this one - the result is the same (function still
> defined statically in the DT) while now it requires changes to the
> vpif driver too.
> 
> Is there any other reason we'd prefer this approach?

The GPIO hog functionality can race with driver probe. Based on probe
order, you may have a situation where VPIF probes before tca6416 so we
have an erroneous situation where probe is successful, but hardware is
not really available.

Using enable-gpios lets you handle probe deferral so VPIF capture probe
completes only when hardware is ready. So if for some reason tca6416
driver or hardware is misbehaving, VPIF will know about it through some
error value rather than just assuming that everything went well.

So, yes, in the "all goes well" scenario, there is not much difference
in the two approaches. But the difference will be apparent when
something goes wrong.

Probe order will also influence the shutdown and suspend order. So
kernel will automatically make sure that shutdown happens in reverse
probe order. This may or may not matter in this case. But in  general,
it will be nice to make sure VPIF shuts down before tca6416 does so that
hardware is available for VPIF to cleanly shutdown (and not disconnected
behind its back because tca6416 decided to put all its lines to off as
part of its shutdown).

I think GPIO hog should only be used for pins which are really "system
level". IOW, not related to any driver functionality.

Thanks,
Sekhar

  reply	other threads:[~2017-02-21  5:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 18:15 [PATCH 0/4] ARM: dts: da850-evm: vpif DT changes Bartosz Golaszewski
2017-02-16 18:15 ` [PATCH 1/4] ARM: dts: da850-evm: fix whitespace errors Bartosz Golaszewski
2017-02-16 18:15 ` [PATCH 2/4] ARM: dts: da850: add vpif video display pins Bartosz Golaszewski
2017-02-20 10:29   ` Sekhar Nori
2017-02-20 15:42     ` Bartosz Golaszewski
2017-02-21  4:49       ` Sekhar Nori
2017-02-21  9:23         ` Bartosz Golaszewski
2017-02-22  5:59           ` Sekhar Nori
2017-02-16 18:15 ` [PATCH 3/4] ARM: dts: da850-evm: add the output port to the vpif node Bartosz Golaszewski
2017-02-16 18:15 ` [PATCH 4/4] ARM: dts: da850-evm: add the UI expander node Bartosz Golaszewski
2017-02-20  9:36   ` Sekhar Nori
2017-02-20 15:38     ` Bartosz Golaszewski
2017-02-21  5:03       ` Sekhar Nori [this message]
2017-02-21  9:22         ` Bartosz Golaszewski

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=2d708416-401a-d2df-5694-9896df47a673@ti.com \
    --to=nsekhar@ti.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=david@lechnology.com \
    --cc=devicetree@vger.kernel.org \
    --cc=khilman@baylibre.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=ptitiano@baylibre.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

all inboxes | Powered by JetHome®