Re: [PATCH v3] spi: create a message queueing infrastructure

2012-03-07 Thread Grant Likely
On Tue, Mar 06, 2012 at 12:35:08PM +, Mark Brown wrote:
 On Tue, Mar 06, 2012 at 01:26:46PM +0100, Linus Walleij wrote:
  On Wed, Feb 22, 2012 at 10:05 AM, Linus Walleij
 
   Cc: Mark Brown broo...@opensource.wolfsonmicro.com
 
  Mark can we have your explicit ACK?
 
 I'm pretty sure I already said
 
 Tested-by: Mark Brown broo...@opensource.wolfsonmicro.com
 Reviewed-by: Mark Brown broo...@opensource.wolfsonmicro.com

Applied, thanks.

g.

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


Re: [PATCH v3] spi: create a message queueing infrastructure

2012-03-06 Thread Linus Walleij
On Wed, Feb 22, 2012 at 10:05 AM, Linus Walleij
linus.wall...@stericsson.com wrote:

 From: Linus Walleij linus.wall...@linaro.org

 This rips the message queue in the PL022 driver out and pushes
 it into (optional) common infrastructure. Drivers that want to
 use the message pumping thread will need to define the new
 per-messags transfer methods and leave the deprecated transfer()
 method as NULL.

 Most of the design is described in the documentation changes that
 are included in this patch.

 Since there is a queue that need to be stopped when the system
 is suspending/resuming, two new calls are implemented for the
 device drivers to call in their suspend()/resume() functions:
 spi_master_suspend() and spi_master_resume().

 ChangeLog v1-v2:
 - Remove Kconfig entry and do not make the queue support optional
  at all, instead be more agressive and have it as part of the
  compulsory infrastructure.
 - If the .transfer() method is implemented, delete print a small
  deprecation notice and do not start the transfer pump.
 - Fix a bitrotted comment.
 ChangeLog v2-v3:
 - Fix up a problematic sequence courtesy of Chris Blair.
 - Stop rather than destroy the queue on suspend() courtesy of
  Chris Blair.

Ping on this! Would be nice to see in linux-next if we go for this.

 Cc: Mark Brown broo...@opensource.wolfsonmicro.com

Mark can we have your explicit ACK?

Yours,
Linus Walleij

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general


[PATCH v3] spi: create a message queueing infrastructure

2012-02-22 Thread Linus Walleij
From: Linus Walleij linus.wall...@linaro.org

This rips the message queue in the PL022 driver out and pushes
it into (optional) common infrastructure. Drivers that want to
use the message pumping thread will need to define the new
per-messags transfer methods and leave the deprecated transfer()
method as NULL.

Most of the design is described in the documentation changes that
are included in this patch.

Since there is a queue that need to be stopped when the system
is suspending/resuming, two new calls are implemented for the
device drivers to call in their suspend()/resume() functions:
spi_master_suspend() and spi_master_resume().

ChangeLog v1-v2:
- Remove Kconfig entry and do not make the queue support optional
  at all, instead be more agressive and have it as part of the
  compulsory infrastructure.
- If the .transfer() method is implemented, delete print a small
  deprecation notice and do not start the transfer pump.
- Fix a bitrotted comment.
ChangeLog v2-v3:
- Fix up a problematic sequence courtesy of Chris Blair.
- Stop rather than destroy the queue on suspend() courtesy of
  Chris Blair.

Cc: Mark Brown broo...@opensource.wolfsonmicro.com
Signed-off-by: Chris Blair chris.bl...@stericsson.com
Signed-off-by: Linus Walleij linus.wall...@linaro.org
---
 Documentation/spi/spi-summary |   58 ++--
 drivers/spi/spi-pl022.c   |  303 +++--
 drivers/spi/spi.c |  339 -
 include/linux/spi/spi.h   |   51 ++
 4 files changed, 487 insertions(+), 264 deletions(-)

diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary
index 4884cb3..7312ec1 100644
--- a/Documentation/spi/spi-summary
+++ b/Documentation/spi/spi-summary
@@ -1,7 +1,7 @@
 Overview of Linux kernel SPI support
 
 
-21-May-2007
+02-Feb-2012
 
 What is SPI?
 
@@ -483,9 +483,9 @@ also initialize its own internal state.  (See below about 
bus numbering
 and those methods.)
 
 After you initialize the spi_master, then use spi_register_master() to
-publish it to the rest of the system.  At that time, device nodes for
-the controller and any predeclared spi devices will be made available,
-and the driver model core will take care of binding them to drivers.
+publish it to the rest of the system. At that time, device nodes for the
+controller and any predeclared spi devices will be made available, and
+the driver model core will take care of binding them to drivers.
 
 If you need to remove your SPI controller driver, spi_unregister_master()
 will reverse the effect of spi_register_master().
@@ -521,21 +521,53 @@ SPI MASTER METHODS
** When you code setup(), ASSUME that the controller
** is actively processing transfers for another device.
 
-master-transfer(struct spi_device *spi, struct spi_message *message)
-   This must not sleep.  Its responsibility is arrange that the
-   transfer happens and its complete() callback is issued.  The two
-   will normally happen later, after other transfers complete, and
-   if the controller is idle it will need to be kickstarted.
-
 master-cleanup(struct spi_device *spi)
Your controller driver may use spi_device.controller_state to hold
state it dynamically associates with that device.  If you do that,
be sure to provide the cleanup() method to free that state.
 
+master-prepare_transfer_hardware(struct spi_master *master)
+   This will be called by the queue mechanism to signal to the driver
+   that a message is coming in soon, so the subsystem requests the
+   driver to prepare the transfer hardware by issuing this call.
+   This may sleep.
+
+master-unprepare_transfer_hardware(struct spi_master *master)
+   This will be called by the queue mechanism to signal to the driver
+   that there are no more messages pending in the queue and it may
+   relax the hardware (e.g. by power management calls). This may sleep.
+
+master-transfer_one_message(struct spi_master *master,
+struct spi_message *mesg)
+   The subsystem calls the driver to transfer a single message while
+   queuing transfers that arrive in the meantime. When the driver is
+   finished with this message, it must call
+   spi_finalize_current_message() so the subsystem can issue the next
+   transfer. This may sleep.
+
+DEPRECATED METHODS
+
+master-transfer(struct spi_device *spi, struct spi_message *message)
+   This must not sleep. Its responsibility is arrange that the
+   transfer happens and its complete() callback is issued. The two
+   will normally happen later, after other transfers complete, and
+   if the controller is idle it will need to be kickstarted. This
+   method is not used on queued controllers and must be NULL if
+   transfer_one_message() and