linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Dietrich <marvin24@gmx.de>
To: Olof Johansson <olof@lixom.net>
Cc: Rob Herring <robherring2@gmail.com>,
	Simon Glass <sjg@chromium.org>, Marc Dietrich <marvin24@gmx.de>,
	linux-wireless@vger.kernel.org,
	"John W. Linville" <linville@tuxdriver.com>,
	Colin Cross <ccross@android.com>,
	linux-tegra@vger.kernel.org,
	Johannes Berg <johannes@sipsolutions.net>,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH 2/3] dt: rfkill-gpio: add bindings documentation
Date: Tue, 14 Feb 2012 11:12:41 +0100	[thread overview]
Message-ID: <4F3A3399.2010203@gmx.de> (raw)
In-Reply-To: <CAOesGMjofzC9pp1H9SXS693QR7JU9XjvVLVi6gBSGuqVNJ-rKA@mail.gmail.com>

Am 13.02.2012 20:43, schrieb Olof Johansson:
> On Mon, Feb 13, 2012 at 5:47 AM, Rob Herring<robherring2@gmail.com>  wrote:
>> On 02/12/2012 02:21 PM, Simon Glass wrote:
>>
>>
>> On Sun, Feb 12, 2012 at 11:13 AM, Marc Dietrich<marvin24@gmx.de>  wrote:
>>>> Add device tree bindings information for rfkill gpio switches.
>>>>
>>>> Cc: linux-wireless@vger.kernel.org
>>>> Cc: "John W. Linville"<linville@tuxdriver.com>
>>>> Cc: Johannes Berg<johannes@sipsolutions.net>
>>>> Cc: Rhyland Klein<rklein@nvidia.com>
>>>> Cc: Grant Likely<grant.likely@secretlab.ca>
>>>> Cc: devicetree-discuss@lists.ozlabs.org
>>>> Signed-off-by: Marc Dietrich<marvin24@gmx.de>
>>>> ---
>>>>   Documentation/devicetree/bindings/gpio/rfkill.txt |   38 +++++++++++++++++++++
>>>>   1 files changed, 38 insertions(+), 0 deletions(-)
>>>>   create mode 100644 Documentation/devicetree/bindings/gpio/rfkill.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/gpio/rfkill.txt b/Documentation/devicetree/bindings/gpio/rfkill.txt
>>>> new file mode 100644
>>>> index 0000000..22bf22a
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/gpio/rfkill.txt
>>>> @@ -0,0 +1,38 @@
>>>> +RFKILL switches connected to GPIO lines
>>>> +
>>>> +Required properties:
>>>> +- compatible : should be "rfkill-gpio".
>>>> +
>>>> +Each rfkill switch is represented as a sub-node of the rfkill-gpio device.
>>>> +Each node has a label property which represents the name of the corresponding
>>>> +rfkill device.
>>>> +
>>>> +RFKILL sub-node properties:
>>>> +- label :  (optional) The label for this rfkill switch.  If omitted, the label is
>>>> +  taken from the node name (excluding the unit address).
>>>> +- reset-gpio, shutdown-gpio :  Should specify the rfkill gpios for reset and
>>>> +  shutdown (see "Specifying GPIO information for devices" in
>>> Should that be reset-gpios, shutdown-gpios? Even though you have only
>>> one it seems that people put an 's' on the end.
> Agreed.
>
>>>> +  Documentation/devicetree/booting-without-of.txt).
>>>> +- type : enumerated type of the gpio (see include/linux/rfkill.h).
>>> It would be better I think if this were explicit here. If you have a
>>> number, then what values does it take and what do they mean?
> This should most likely be moved to a set of properties instad of an
> enumerated type, I agree. And/or use a string to encode the type
> simiar to how powerpc does some of the USB interfaces.
>
>>>> +- clock : (optional) name of the clock name associated with the rfkill switch
>>> Can this be a phandle instead of a string?
>> This seems to be in the wrong place altogether. The gpio controller
>> would have a clock, not particular gpio line.
> And either way, this should conform to the standard clock binding, not
> use something locally hacked up.
>
>>>> +  (see include/linux/rfkill-gpio.h)
>>> IMO device tree bindings should be fully documented in this file,
>>> rather than needing to look at a separate header. This is particularly
>>> true if the binding is used in another project.
>>>
>> Correct. A binding should not be Linux specific. It should describe the h/w.
>>
>>>> +
>>>> +Examples:
>>>> +
>>>> +rfkill-switches {
>>>> +       compatible = "rfkill-gpio";
>>>> +
>>>> +       wifi {
>>>> +               label = "wifi";
>>>> +               reset-gpio =<&gpio 25 0>; /* Active high */
>>>> +               shutdown-gpio =<&gpio 85 0>; /* Active high */
>>>> +               type =<1>;
>>>> +       };
>>>> +
>>>> +       bt {
>>>> +               label = "bluetooth";
>>>> +               reset-gpio =<&gpio 17 0>; /* Active high */
>>>> +               shutdown-gpio =<&gpio 35 0>; /* Active high */
>>>> +               type =<1>;
>>>> +       };
>> Why wouldn't the gpio lines just be part of the bt and wifi device nodes
>> themselves? The DT is supposed to describe h/w connections.
> The thing is, that "rfkill" isn't a _device_, and Marc is trying to
> describe it as one. It's really just a software abstraction of a
> collection of power supplies and/or GPIO lines that are used to power
> up/down specific peripherals.

Oh, this gets more complicated than I wanted. First I only translated 
the *existing* platform_data to devicetree format. I understand that 
devicetree needs some more careful thoughts. Let me shortly describe my 
hw setup and lets see how it can me mapped.

> I know that the USB modem, for example, is probed through autoprobing
> the USB bus. So there's no device to associate it with, per se. But
> the USB slot that the modem is connected to, which is also the
> connector that the GPIO controls the power supplies and reset line to,
> are connected directly to one of the USB host controllers, right? So
> maybe describing it there is a better option.

The wifi module (some models also include an additional bluetooth part) 
is plugged into a mini-pci-e like slot. This has pins for usb (the 
module uses usb), dap, sdio, uart, and some other pins which also 
include the gpio lines for rfkill. The other gpio end is directly 
connected to the tegra soc.

So there is no usb slot and a standard usb slot also does not contain 
any gpio lines (just 2 power and 2 data lines). The usb controller also 
sits in the tegra soc (well, more or less because it is the ulpi port 
connected to SMC3315 and later a SMC2512 4-port usb hub). So gpio and 
usb take a totally different path. IMHO, it makes no sense to add a gpio 
to the usb controller, but see below.

> That still leaves the issue of actually having something to bind it
> against. As I already said, rfkill isn't a device, so crafting one
> just because linux wants one is the wrong way to go about. Maybe using
> /chosen to refer to the device nodes for the GPIO lines under USB
> instead, and have rfkill look for those and create a device if they're
> found is a better way to go about it.
To me it looks more like how the LEDs are implemented but with a 
"linux,rfkill_type" property. To me this looks saner than adding a gpio 
to an usb controller, even if there if no physical rfkill device. This 
still leaves the problem of what to do with the clock (it is not used by 
any machine AFAIK).

The main problem here is that usb devices have no device tree entries 
(only the host controllers). Perhaps it is possible to a fake usb device 
as a workaround? This has the advantage that it exists physically, but 
the resources are not taken from the device tree. Instead all other non 
standard properties (gpios, clocks) are.

Marc


  reply	other threads:[~2012-02-14 10:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-12 19:13 [PATCH 1/3] net: rfkill-gpio: add device tree support Marc Dietrich
2012-02-12 19:13 ` [PATCH 2/3] dt: rfkill-gpio: add bindings documentation Marc Dietrich
2012-02-12 20:21   ` Simon Glass
2012-02-13 13:47     ` Rob Herring
2012-02-13 19:43       ` Olof Johansson
2012-02-14 10:12         ` Marc Dietrich [this message]
2012-02-16 10:29         ` Marc Dietrich
2012-02-13 19:25 ` [PATCH 1/3] net: rfkill-gpio: add device tree support Rhyland Klein
2012-02-13 19:36   ` Olof Johansson
2012-02-14 10:14     ` Marc Dietrich
  -- strict thread matches above, loose matches on Subject: below --
2012-02-05 17:18 Marc Dietrich
2012-02-05 17:18 ` [PATCH 2/3] dt: rfkill-gpio: add bindings documentation Marc Dietrich
2012-02-05 22:00   ` Olof Johansson

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=4F3A3399.2010203@gmx.de \
    --to=marvin24@gmx.de \
    --cc=ccross@android.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=olof@lixom.net \
    --cc=robherring2@gmail.com \
    --cc=sjg@chromium.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).