From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 08/12] spi: allow reporting the effectivly used speed_hz for a transfer
Date: Mon, 16 Dec 2024 14:03:20 +0100 [thread overview]
Message-ID: <20241216130324.1592755-8-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20241216130324.1592755-1-m.felsch@pengutronix.de>
This is a copy of Linux commit:
8<-------------------------------------------------------------------------
commit 5d7e2b5ed5858fe739d4cb8ad22dcce7bd9dbe7b
Author: Martin Sperl <kernel@martin.sperl.org>
Date: Sat Feb 23 08:49:49 2019 +0000
spi: core: allow reporting the effectivly used speed_hz for a transfer
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>
8<-------------------------------------------------------------------------
to sync the spi core more with Linux which is required for the later
core common message handling.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
Changelog:
v2:
- no changes
drivers/spi/spi.c | 1 +
include/spi/spi.h | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index e8a0b1b84be5..78569301776f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -415,6 +415,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
message->spi = spi;
list_for_each_entry(xfer, &message->transfers, transfer_list) {
+ xfer->effective_speed_hz = 0;
if (!xfer->bits_per_word)
xfer->bits_per_word = spi->bits_per_word;
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 2061a44134d0..8458d890f4e6 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -333,6 +333,9 @@ static inline size_t spi_max_transfer_size(struct spi_device *spi)
* @len: size of rx and tx buffers (in bytes)
* @speed_hz: Select a speed other then the device default for this
* transfer. If 0 the default (from @spi_device) is used.
+ * @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.
* @bits_per_word: select a bits_per_word other then the device default
* for this transfer. If 0 the default (from @spi_device) is used.
* @cs_change: affects chipselect after this transfer completes
@@ -402,6 +405,8 @@ struct spi_transfer {
u16 delay_usecs;
u32 speed_hz;
+ u32 effective_speed_hz;
+
struct list_head transfer_list;
};
--
2.39.5
next prev parent reply other threads:[~2024-12-16 13:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-16 13:03 [PATCH v2 01/12] spi: cosmetic style fixes Marco Felsch
2024-12-16 13:03 ` [PATCH v2 02/12] spi: fix spi_message init during __spi_validate Marco Felsch
2024-12-16 13:03 ` [PATCH v2 03/12] spi: add spi_{set,get}_ctldata accessors Marco Felsch
2024-12-16 13:03 ` [PATCH v2 04/12] gpiolib: add support for gpiod_get_index and gpiod_get_index_optional Marco Felsch
2024-12-16 13:03 ` [PATCH v2 05/12] gpiolib: add support for gpiod_set_consumer_name Marco Felsch
2024-12-16 13:03 ` [PATCH v2 06/12] spi: add support to handle cs-gpios Marco Felsch
2024-12-20 9:51 ` Sascha Hauer
2024-12-16 13:03 ` [PATCH v2 07/12] spi: add support to setup spi-cs-{setup,hold,inactive}-delay-ns Marco Felsch
2024-12-16 13:03 ` Marco Felsch [this message]
2024-12-16 13:03 ` [PATCH v2 09/12] spi: import spi_controller::flags Marco Felsch
2024-12-16 13:03 ` [PATCH v2 10/12] spi: add support for spi_controller::set_cs_timing Marco Felsch
2024-12-16 13:03 ` [PATCH v2 11/12] spi: Provide common spi_message processing loop Marco Felsch
2024-12-16 13:03 ` [PATCH v2 12/12] spi: add support for BCM2835 SPI controller Marco Felsch
2024-12-20 9:16 ` [PATCH v2 01/12] spi: cosmetic style fixes Sascha Hauer
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=20241216130324.1592755-8-m.felsch@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=barebox@lists.infradead.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