linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Chen-Yu Tsai <wens@csie.org>, Mark Rutland <mark.rutland@arm.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-sunxi@googlegroups.com,
	Johannes Berg <johannes@sipsolutions.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	linux-gpio@vger.kernel.org,
	linux-wireless <linux-wireless@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	devicetree <devicetree@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [linux-sunxi] Re: [PATCH 7/7] ARM: sun7i: cubietruck: enable bluetooth module
Date: Wed, 16 Apr 2014 11:44:28 +0200	[thread overview]
Message-ID: <20140416094428.GK3207@lukather> (raw)
In-Reply-To: <CAGb2v643HyvFdhQ0znreB8ENXHWpcx6tFwdeU7VuU8KYWcT4ZA@mail.gmail.com>

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

Hi,

Please try to keep me in CC, even though the ML doesn't make it easy..

On Wed, Apr 16, 2014 at 12:06:59AM +0800, Chen-Yu Tsai wrote:
> >> @@ -139,4 +152,16 @@
> >>       reg_usb2_vbus: usb2-vbus {
> >>               status = "okay";
> >>       };
> >> +
> >> +     rfkill_bt {
> >> +             compatible = "rfkill-gpio";
> >> +             pinctrl-names = "default";
> >> +             pinctrl-0 = <&bt_pwr_pin_cubietruck>, <&clk_out_a_pins_a>;
> >> +             clocks = <&clk_out_a>;
> >> +             clock-frequency = <32768>;
> >> +             gpios = <&pio 7 18 0>; /* PH18 */
> >> +             gpio-names = "reset";
> >> +             rfkill-name = "bt";
> >> +             rfkill-type = <2>;
> >> +     };
> >
> > Hmmm, I don't think that's actually right.
> >
> > If you have such a device, then I'd expect it to be represented as a
> > full device in the DT, probably with one part for the WiFi, one part
> > for the Bluetooth, and here the definition of the rfkill device that
> > controls it.
> 
> The AP6210 is not one device, but 2 separate chips in one module. Each
> chip has its own controls and interface. They just so happen to share
> the same enclosure. Even 2-in-1 chips by Broadcom have separate controls
> and interfaces. The WiFi side is most likely connected via SDIO, while
> the Bluetooth side is connected to a UART, and optionally I2S for sound.

It's even easier to represent then.

> > But tying parts of the device to the rfkill that controls it, such as
> > the clocks, or the frequency it runs at seems just wrong.
> 
> I understand where you're coming from. For devices on buses that require
> drivers (such as USB, SDIO) these properties probably should be tied to
> the device node.
> 
> For our use case here, which is a bluetooth chip connected on the UART,
> there is no in kernel representation or driver to tie them to. Same goes
> for UART based GPS chips. They just so happen to require toggling a GPIO,
> and maybe enabling a specific clock, to get it running. Afterwards,
> accessing it is done solely from userspace. For our Broadcom chips, the
> user has to upload its firmware first, then designate the tty as a Bluetooth
> HCI using hciattach.
> 
> We are using the rfkill device as a on-off switch.

I understand your point, but the fact that it's implemented in
user-space, or that UART is not a bus (which probably should be), is
only a Linux specific story, and how it's implemented in Linux (even
if the whole rfkill node is another one, but let's stay on topic).

This is a huge abstraction leak.

Let's say you need the I2S stream you mentionned for some
reason. Would you tie the audio stream to the rfkill node as well?
I'm sorry, but from an hardware description perspective, it makes no
sense.

What's the feeling of the DT maintainers?

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  parent reply	other threads:[~2014-04-16  9:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15  6:41 [PATCH 0/7] net: rfkill: gpio: Add device tree support Chen-Yu Tsai
2014-04-15  6:41 ` [PATCH 1/7] gpiolib: gpiolib-of: Implement device tree gpio-names based lookup Chen-Yu Tsai
2014-04-15 14:20   ` Maxime Ripard
2014-04-16  6:12     ` Alexandre Courbot
2014-04-16  7:06       ` Alexandre Courbot
2014-04-16  9:56         ` Chen-Yu Tsai
2014-04-22 15:02   ` Linus Walleij
2014-04-23  1:49     ` Alexandre Courbot
2014-04-28 16:19       ` [linux-sunxi] " Chen-Yu Tsai
2014-04-15  6:41 ` [PATCH 2/7] gpiolib: Support purely name based gpiod lookup in device trees Chen-Yu Tsai
2014-04-22 15:00   ` Linus Walleij
2014-04-22 15:18     ` Maxime Ripard
2014-04-23 13:55       ` Linus Walleij
2014-04-15  6:41 ` [PATCH 3/7] net: rfkill: gpio: use clk_prepare_enable/clk_disable_unprepare Chen-Yu Tsai
2014-04-15 14:26   ` Maxime Ripard
2014-04-15  6:41 ` [PATCH 4/7] net: rfkill: gpio: fix reversed clock enable state Chen-Yu Tsai
2014-04-15 14:27   ` Maxime Ripard
2014-04-15  6:41 ` [PATCH 5/7] net: rfkill: gpio: add device tree support Chen-Yu Tsai
2014-04-15 21:00   ` Stephen Warren
2014-04-15 21:01   ` Stephen Warren
2014-04-15  6:41 ` [PATCH 6/7] net: rfkill: gpio: add clock-frequency device tree property Chen-Yu Tsai
2014-04-15 14:44   ` Maxime Ripard
2014-04-15  6:41 ` [PATCH 7/7] ARM: sun7i: cubietruck: enable bluetooth module Chen-Yu Tsai
2014-04-15 14:42   ` Maxime Ripard
2014-04-15 16:06     ` [linux-sunxi] " Chen-Yu Tsai
2014-04-15 16:18       ` One Thousand Gnomes
2014-04-16  9:44       ` Maxime Ripard [this message]
2014-04-16 10:39         ` Chen-Yu Tsai
2014-04-18 17:47           ` maxime.ripard
     [not found]           ` <534E8102.4070404@redhat.com>
     [not found]             ` <534F862C.8010604@broadcom.com>
2014-04-18 17:49               ` maxime.ripard
2014-04-16 13:08         ` Hans de Goede
2014-04-22 15:06 ` [PATCH 0/7] net: rfkill: gpio: Add device tree support Johannes Berg

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=20140416094428.GK3207@lukather \
    --to=maxime.ripard@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=gnurou@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=johannes@sipsolutions.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=mark.rutland@arm.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=wens@csie.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).