[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1315412387-5765-2-git-send-email-jic23@cam.ac.uk>
Date: Wed, 7 Sep 2011 17:19:42 +0100
From: Jonathan Cameron <jic23@....ac.uk>
To: broonie@...nsource.wolfsonmicro.com
Cc: linux-kernel@...r.kernel.org, Michael.Hennerich@...log.com,
linux-iio@...r.kernel.org, Jonathan Cameron <jic23@....ac.uk>
Subject: [PATCH 1/6] SPI: add ability to say we want a cs change after every transfer.
This allows a number of drivers to make use of utility functions
such spi_write_then_read as well as making use of regmap possible.
Signed-off-by: Jonathan Cameron <jic23@....ac.uk>
---
drivers/spi/spi.c | 8 ++++++++
include/linux/spi/spi.h | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 4d1b9f5..bee8aee 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -781,6 +781,14 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
}
}
+ if (spi->cs_between_transfers) {
+ struct spi_transfer *xfer;
+ list_for_each_entry(xfer, &message->transfers, transfer_list) {
+ if (!list_is_last(&xfer->transfer_list, &message->transfers))
+ xfer->cs_change = 1;
+ }
+ }
+
message->spi = spi;
message->status = -EINPROGRESS;
return master->transfer(spi, message);
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index bb4f5fb..f1e378d 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -90,6 +90,8 @@ struct spi_device {
void *controller_data;
char modalias[SPI_NAME_SIZE];
+ unsigned cs_between_transfers:1;
+
/*
* likely need more hooks for more protocol options affecting how
* the controller talks to each chip, like:
--
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists