Commit 5d7e2b5e authored by Martin Sperl's avatar Martin Sperl Committed by Mark Brown

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: default avatarMartin Sperl <kernel@martin.sperl.org>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e727d4cb
...@@ -3126,6 +3126,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) ...@@ -3126,6 +3126,7 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
*/ */
message->frame_length = 0; message->frame_length = 0;
list_for_each_entry(xfer, &message->transfers, transfer_list) { list_for_each_entry(xfer, &message->transfers, transfer_list) {
xfer->effective_speed_hz = 0;
message->frame_length += xfer->len; message->frame_length += xfer->len;
if (!xfer->bits_per_word) if (!xfer->bits_per_word)
xfer->bits_per_word = spi->bits_per_word; xfer->bits_per_word = spi->bits_per_word;
......
...@@ -745,6 +745,9 @@ extern void spi_res_release(struct spi_controller *ctlr, ...@@ -745,6 +745,9 @@ extern void spi_res_release(struct spi_controller *ctlr,
* (set by bits_per_word) transmission. * (set by bits_per_word) transmission.
* @word_delay: clock cycles to inter word delay after each word size * @word_delay: clock cycles to inter word delay after each word size
* (set by bits_per_word) transmission. * (set by bits_per_word) transmission.
* @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 * @transfer_list: transfers are sequenced through @spi_message.transfers
* @tx_sg: Scatterlist for transmit, currently not for client use * @tx_sg: Scatterlist for transmit, currently not for client use
* @rx_sg: Scatterlist for receive, currently not for client use * @rx_sg: Scatterlist for receive, currently not for client use
...@@ -835,6 +838,8 @@ struct spi_transfer { ...@@ -835,6 +838,8 @@ struct spi_transfer {
u32 speed_hz; u32 speed_hz;
u16 word_delay; u16 word_delay;
u32 effective_speed_hz;
struct list_head transfer_list; struct list_head transfer_list;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment