[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 

Re: [PATCH] spi/s3c64xx: Convert to using core message queue

2012-02-22 Thread Linus Walleij
On Wed, Feb 15, 2012 at 11:48 PM, Mark Brown
broo...@opensource.wolfsonmicro.com wrote:

 Convert the s3c64xx driver to using the new message queue factored out of
 the pl022 driver by Linus Walleij, saving us a nice block of code and
 getting the benefits of improvements implemented in the core.

 Signed-off-by: Mark Brown broo...@opensource.wolfsonmicro.com

Hi Mark,

I tried to include this patch for my patch series but it seems it might be
dependent on other stuff already applied in the SPI tree so I couldn't
get it to apply.

However I guess if Grant picks up the latest (v3) version of the
core patch it should apply just as fine on top of that one.

Yours,
Linus Walleij

--
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


Promotion -50% sur tout le site

2012-02-22 Thread Lee Cooper par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTY3NDcmYz0yMTkxNTA3JmQ9MjAxMi0wMi0yMiAxNDoxMDowMSZlPTEmaD02NzQ2JmY9Njc0NyZnPTY3NDc=

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTY3NDcmYz0yMTkxNTA3JmQ9MjAxMi0wMi0yMiAxNDoxMDowMSZlPTEmaD02NzQ2JmY9Njc0NyZnPTY3NDc=


--
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


Jeffrey Eigner/Corp/Celestica is out of the office.

2012-02-22 Thread Jeffrey Eigner

I will be out of the office starting  02/22/2012 and will not return until
03/05/2012.

 I am travelling and will have limited email and phone access. Please
contact John Sandhu for any urgent business matter.


--
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


En 2012, Je change de mutuelle

2012-02-22 Thread Votre conseiller mutuelle par Duano
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0xMyZiPTY3MjcmYz00ODM2MTImZD0yMDEyLTAyLTIzIDAzOjEwOjAxJmU9MSZoPTY3MjYmZj02NzI3Jmc9NjcyNw==

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0xMyZiPTY3MjcmYz00ODM2MTImZD0yMDEyLTAyLTIzIDAzOjEwOjAxJmU9MSZoPTY3MjYmZj02NzI3Jmc9NjcyNw==


--
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


Livraison offerte jusqu'à mercredi !

2012-02-22 Thread Virginie Rendez vous déco
Pour voir le message, veuillez utiliser un lecteur de mail compatible HTML

Lien miroir : 
http://m10-fr.com/mc10_m/YT0yNyZiPTY4MjAmYz0yMzY0MzcmZD0yMDEyLTAyLTIzIDA4OjEwOjAxJmU9MSZoPTY4MTkmZj02ODIwJmc9NjgyMA==

Lien de désinscription : 
http://m10-fr.com/mc10_unsub/YT0yNyZiPTY4MjAmYz0yMzY0MzcmZD0yMDEyLTAyLTIzIDA4OjEwOjAxJmU9MSZoPTY4MTkmZj02ODIwJmc9NjgyMA==


--
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