68 lines
2.4 KiB
Diff
68 lines
2.4 KiB
Diff
From 1df3aa945b6da52d88e2bcfd53a103a55366c4d7 Mon Sep 17 00:00:00 2001
|
|
From: Martin Sperl <kernel@martin.sperl.org>
|
|
Date: Sat, 23 Feb 2019 08:49:49 +0000
|
|
Subject: [PATCH 101/109] spi: core: allow reporting the effectivly used
|
|
speed_hz for a transfer
|
|
|
|
mainline inclusion
|
|
from mainline-v5.3-rc1
|
|
commit 5d7e2b5ed5858fe739d4cb8ad22dcce7bd9dbe7b
|
|
category: feature
|
|
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I8DDF5
|
|
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5d7e2b5ed5858fe739d4cb8ad22dcce7bd9dbe7b
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Provide a means for the spi bus driver to report the effectively used
|
|
spi clock frequency used for each spi_transfer.
|
|
|
|
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
|
|
Signed-off-by: Mark Brown <broonie@kernel.org>
|
|
Signed-off-by: YunYi Yang <yangyunyi2@huawei.com>
|
|
|
|
Conflicts:
|
|
include/linux/spi/spi.h
|
|
---
|
|
drivers/spi/spi.c | 1 +
|
|
include/linux/spi/spi.h | 5 +++++
|
|
2 files changed, 6 insertions(+)
|
|
|
|
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
|
|
index f0f21f93d293..c79bf015b4b2 100644
|
|
--- a/drivers/spi/spi.c
|
|
+++ b/drivers/spi/spi.c
|
|
@@ -2892,6 +2892,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
|
|
*/
|
|
message->frame_length = 0;
|
|
list_for_each_entry(xfer, &message->transfers, transfer_list) {
|
|
+ xfer->effective_speed_hz = 0;
|
|
message->frame_length += xfer->len;
|
|
if (!xfer->bits_per_word)
|
|
xfer->bits_per_word = spi->bits_per_word;
|
|
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
|
|
index a64235e05321..ec795c5304f0 100644
|
|
--- a/include/linux/spi/spi.h
|
|
+++ b/include/linux/spi/spi.h
|
|
@@ -711,6 +711,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
|
|
* @delay_usecs: microseconds to delay after this transfer before
|
|
* (optionally) changing the chipselect status, then starting
|
|
* the next transfer or completing this @spi_message.
|
|
+ * @effective_speed_hz: the effective SCK-speed that was used to
|
|
+ * transfer this transfer. Set to 0 if the spi bus driver does
|
|
+ * not support it.
|
|
* @transfer_list: transfers are sequenced through @spi_message.transfers
|
|
* @tx_sg: Scatterlist for transmit, currently not for client use
|
|
* @rx_sg: Scatterlist for receive, currently not for client use
|
|
@@ -794,6 +797,8 @@ struct spi_transfer {
|
|
u16 delay_usecs;
|
|
u32 speed_hz;
|
|
|
|
+ u32 effective_speed_hz;
|
|
+
|
|
struct list_head transfer_list;
|
|
};
|
|
|
|
--
|
|
2.23.0
|
|
|