All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Brian Lilly <brian-ZKiFAVwZFM2FeswfMrDH8w@public.gmane.org>
Subject: Re: [PATCH 1/2] spi: spidev: Add device tree bindings
Date: Mon, 29 Oct 2012 16:26:11 +0100	[thread overview]
Message-ID: <508EA013.7050907@free-electrons.com> (raw)
In-Reply-To: <20121027221955.GO4564-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>

Hi Mark,

Le 28/10/2012 00:19, Mark Brown a écrit :
> On Fri, Oct 26, 2012 at 10:07:52AM +0200, Maxime Ripard wrote:
>> This will allow to probe spidev from device tree
> 
> So, this isn't really something we should have in DT in this format
> - the fact that we happen to control some device from userspace
> isn't a generic property of the board really, we may end up
> changing our minds on Linux too.  The most obvious thing for this
> seems to be to add the specific devices to spidev as the OF
> bindings rather than just register as some non-specific "spidev" so
> we can change our minds later about how to handle the devices.  Not
> sure that's urgently tasteful but it does mean we move the "we
> handle this in userspace" bit out of the .dts into the kernel which
> seems better.

Ok, so I guess that leaves us with 2 choices here:
  * Declare the device in the dt as you would have with any other
    driver, with its own compatible string, and we add this compatible
    string to the spidev dt ids array. It allows to use the existing
    code and thus doesn't require any effort at all, but it will
    generate a lot of noise for the spidev driver, since all of us will
    need to add its compatible string to spidev.
  * Rework the spidev code so that it behaves mostly like i2c-dev, that
    is you have an instance of it for every device enumerated in the dt,
    regardless of wether it has a driver loaded or not. If the
    userspace opens the device file corresponding to a device already
    attached to a driver, you return EBUSY, and that's it. I guess it
    would be the cleaner solution, since you only select spidev in
    configuration, but it definitely requires way more development than
    the first one.

What's your views on this?
Did you have in mind another solution?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/

WARNING: multiple messages have this Message-ID (diff)
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] spi: spidev: Add device tree bindings
Date: Mon, 29 Oct 2012 16:26:11 +0100	[thread overview]
Message-ID: <508EA013.7050907@free-electrons.com> (raw)
In-Reply-To: <20121027221955.GO4564@opensource.wolfsonmicro.com>

Hi Mark,

Le 28/10/2012 00:19, Mark Brown a ?crit :
> On Fri, Oct 26, 2012 at 10:07:52AM +0200, Maxime Ripard wrote:
>> This will allow to probe spidev from device tree
> 
> So, this isn't really something we should have in DT in this format
> - the fact that we happen to control some device from userspace
> isn't a generic property of the board really, we may end up
> changing our minds on Linux too.  The most obvious thing for this
> seems to be to add the specific devices to spidev as the OF
> bindings rather than just register as some non-specific "spidev" so
> we can change our minds later about how to handle the devices.  Not
> sure that's urgently tasteful but it does mean we move the "we
> handle this in userspace" bit out of the .dts into the kernel which
> seems better.

Ok, so I guess that leaves us with 2 choices here:
  * Declare the device in the dt as you would have with any other
    driver, with its own compatible string, and we add this compatible
    string to the spidev dt ids array. It allows to use the existing
    code and thus doesn't require any effort at all, but it will
    generate a lot of noise for the spidev driver, since all of us will
    need to add its compatible string to spidev.
  * Rework the spidev code so that it behaves mostly like i2c-dev, that
    is you have an instance of it for every device enumerated in the dt,
    regardless of wether it has a driver loaded or not. If the
    userspace opens the device file corresponding to a device already
    attached to a driver, you return EBUSY, and that's it. I guess it
    would be the cleaner solution, since you only select spidev in
    configuration, but it definitely requires way more development than
    the first one.

What's your views on this?
Did you have in mind another solution?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  parent reply	other threads:[~2012-10-29 15:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26  8:07 [RESEND][PATCH 0/2] Add spidev to the CFA-10049 Maxime Ripard
2012-10-26  8:07 ` Maxime Ripard
     [not found] ` <1351238873-25230-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2012-10-26  8:07   ` [PATCH 1/2] spi: spidev: Add device tree bindings Maxime Ripard
2012-10-26  8:07     ` Maxime Ripard
2012-10-27 22:19     ` Mark Brown
2012-10-27 22:19       ` Mark Brown
     [not found]       ` <20121027221955.GO4564-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-10-29 15:26         ` Maxime Ripard [this message]
2012-10-29 15:26           ` Maxime Ripard
2012-10-29 16:10           ` Mark Brown
2012-10-29 16:10             ` Mark Brown
2012-10-26  8:07   ` [PATCH 2/2] ARM: dts: cfa10049: Add spidev to drive the DAC on SSP3 Maxime Ripard
2012-10-26  8:07     ` Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2012-10-18 13:59 [RESEND][PATCH 0/2] Add spidev to the CFA-10049 Maxime Ripard
     [not found] ` <1350568768-4374-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2012-10-18 13:59   ` [PATCH 1/2] spi: spidev: Add device tree bindings Maxime Ripard
2012-10-18 13:59     ` Maxime Ripard
     [not found]     ` <1350568768-4374-2-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2012-10-19  8:28       ` Shawn Guo
2012-10-19  8:28         ` Shawn Guo
2012-09-28 12:50 [PATCH 0/2] Add spidev to the CFA-10049 Maxime Ripard
     [not found] ` <1348836616-29783-1-git-send-email-maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2012-09-28 12:50   ` [PATCH 1/2] spi: spidev: Add device tree bindings Maxime Ripard
2012-09-28 12:50     ` Maxime Ripard

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=508EA013.7050907@free-electrons.com \
    --to=maxime.ripard-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=brian-ZKiFAVwZFM2FeswfMrDH8w@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.