From: apronin@chromium.org
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
Andrey Pronin <apronin@chromium.org>
Subject: [PATCH 3/4] spi: Add option to insert delay between transactions
Date: Wed, 29 Jun 2016 20:54:26 -0700 [thread overview]
Message-ID: <1467258867-117727-3-git-send-email-apronin@chromium.org> (raw)
In-Reply-To: <1467258867-117727-1-git-send-email-apronin@chromium.org>
From: Andrey Pronin <apronin@chromium.org>
Some devices may need CS to be deasserted for some time
between transactions. Added a new capability to guarantee
a delay between SPI transactions for the device.
Signed-off-by: Andrey Pronin <apronin@chromium.org>
---
drivers/spi/spi.c | 3 +++
include/linux/spi/spi.h | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index c51c864..639c7bd 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -971,6 +971,9 @@ static int spi_transfer_one_message(struct spi_master *master,
spi_reset_cs_wake_timer(msg->spi);
}
+ if (msg->spi->xfer_delay)
+ mdelay(msg->spi->xfer_delay);
+
spi_set_cs(msg->spi, true);
SPI_STATISTICS_INCREMENT_FIELD(statm, messages);
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4b06ba6..4b1aa13 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -137,6 +137,8 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
* @cs_wake_timer: Timer measuring the delay before the device goes to
* sleep after the last SPI transaction.
*
+ * @xfer_delay: Delay between SPI transactions (msec).
+ *
* @statistics: statistics for the spi_device
*
* A @spi_device is used to interchange data between an SPI slave
@@ -183,6 +185,8 @@ struct spi_device {
bool cs_wake_needed;
struct timer_list cs_wake_timer;
+ u32 xfer_delay;
+
/* the statistics */
struct spi_statistics statistics;
--
2.6.6
next prev parent reply other threads:[~2016-06-30 3:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-30 3:54 [PATCH 1/4] spi: Add option to wake a device by toggling CS apronin-F7+t8E8rja9g9hUCZPvPmw
2016-06-30 3:54 ` [PATCH 2/4] spi: Document " apronin
2016-06-30 7:12 ` Geert Uytterhoeven
[not found] ` <CAMuHMdXCeFMXPczi3b=GpUEzUJiz0+sK_299GY8o-iYgP8G9iA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-01 4:32 ` Doug Anderson
2016-06-30 3:54 ` apronin [this message]
[not found] ` <1467258867-117727-3-git-send-email-apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-07-01 4:44 ` [PATCH 3/4] spi: Add option to insert delay between transactions Doug Anderson
2016-07-01 8:16 ` Mark Brown
2016-06-30 3:54 ` [PATCH 4/4] spi: Document " apronin
[not found] ` <1467258867-117727-4-git-send-email-apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-06-30 7:12 ` Geert Uytterhoeven
[not found] ` <CAMuHMdUBcDUoMok9tkxJzGekkLWA=bya0zHXWqHbGp0BGmeZUg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-01 4:45 ` Doug Anderson
[not found] ` <1467258867-117727-1-git-send-email-apronin-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2016-07-01 4:23 ` [PATCH 1/4] spi: Add option to wake a device by toggling CS Doug Anderson
2016-07-01 8:21 ` Mark Brown
[not found] ` <20160701082101.GD6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-01 17:05 ` Doug Anderson
[not found] ` <CAD=FV=W8gt+xgsJ5pPz1uCXGubDHkOnXoDz0mq--cDvkdf-j9g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-01 17:17 ` Mark Brown
2016-07-02 2:02 ` Andrey Pronin
2016-07-01 8:02 ` Mark Brown
[not found] ` <20160701080230.GB6247-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-02 1:45 ` Andrey Pronin
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=1467258867-117727-3-git-send-email-apronin@chromium.org \
--to=apronin@chromium.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.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).