From: kernel@martin.sperl.org To: Mark Brown <broonie@kernel.org>, Eric Anholt <eric@anholt.net>, Stefan Wahren <stefan.wahren@i2se.com>, linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Martin Sperl <kernel@martin.sperl.org> Subject: [PATCH 2/5] spi: core: allow reporting the effectivly used speed_hz for a transfer Date: Sat, 23 Feb 2019 08:49:49 +0000 [thread overview] Message-ID: <20190223084952.14758-3-kernel@martin.sperl.org> (raw) In-Reply-To: <20190223084952.14758-1-kernel@martin.sperl.org> From: Martin Sperl <kernel@martin.sperl.org> 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> --- 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 90659eb29660..5a4616894d57 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3004,6 +3004,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 f2ce1fb403ef..f503a712423d 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, * the next transfer or completing this @spi_message. * @word_delay: clock cycles to inter word delay after each word size * (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 * @tx_sg: Scatterlist for transmit, currently not for client use * @rx_sg: Scatterlist for receive, currently not for client use @@ -799,6 +802,8 @@ struct spi_transfer { u32 speed_hz; u16 word_delay; + u32 effective_speed_hz; + struct list_head transfer_list; }; -- 2.11.0
WARNING: multiple messages have this Message-ID (diff)
From: kernel@martin.sperl.org To: Mark Brown <broonie@kernel.org>, Eric Anholt <eric@anholt.net>, Stefan Wahren <stefan.wahren@i2se.com>, linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Martin Sperl <kernel@martin.sperl.org> Subject: [PATCH 2/5] spi: core: allow reporting the effectivly used speed_hz for a transfer Date: Sat, 23 Feb 2019 08:49:49 +0000 [thread overview] Message-ID: <20190223084952.14758-3-kernel@martin.sperl.org> (raw) In-Reply-To: <20190223084952.14758-1-kernel@martin.sperl.org> From: Martin Sperl <kernel@martin.sperl.org> 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> --- 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 90659eb29660..5a4616894d57 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3004,6 +3004,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 f2ce1fb403ef..f503a712423d 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, * the next transfer or completing this @spi_message. * @word_delay: clock cycles to inter word delay after each word size * (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 * @tx_sg: Scatterlist for transmit, currently not for client use * @rx_sg: Scatterlist for receive, currently not for client use @@ -799,6 +802,8 @@ struct spi_transfer { u32 speed_hz; u16 word_delay; + u32 effective_speed_hz; + struct list_head transfer_list; }; -- 2.11.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-23 8:49 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-23 8:49 [PATCH 0/5] allow to define cs deassert times in us, ns and SCK-len kernel 2019-02-23 8:49 ` kernel 2019-02-23 8:49 ` kernel [this message] 2019-02-23 8:49 ` [PATCH 2/5] spi: core: allow reporting the effectivly used speed_hz for a transfer kernel 2019-02-23 8:49 ` [PATCH 3/5] spi: core: allow defining time that cs is deasserted as a multiple of SCK kernel 2019-02-23 8:49 ` kernel [not found] ` <20190223124010.y7lsncknnxoblvgz@wunner.de> [not found] ` <20190223124010.y7lsncknnxoblvgz-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> 2019-02-23 13:15 ` kernel-TqfNSX0MhmxHKSADF0wUEw 2019-02-23 13:15 ` kernel [not found] ` <20190224103913.bjw7g6ievr75iawz@wunner.de> [not found] ` <20190224103913.bjw7g6ievr75iawz-JFq808J9C/izQB+pC5nmwQ@public.gmane.org> 2019-02-24 11:03 ` kernel-TqfNSX0MhmxHKSADF0wUEw 2019-02-24 11:03 ` kernel 2019-02-26 11:37 ` Mark Brown 2019-05-07 10:07 ` kernel 2019-05-07 10:07 ` kernel [not found] ` <20190223084952.14758-1-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org> 2019-02-23 8:49 ` [PATCH 1/5] spi: core: allow defining time that cs is deasserted kernel-TqfNSX0MhmxHKSADF0wUEw 2019-02-23 8:49 ` kernel [not found] ` <20190223084952.14758-2-kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org> 2019-05-08 9:34 ` Applied "spi: core: allow defining time that cs is deasserted" to the spi tree Mark Brown 2019-05-08 9:34 ` Mark Brown 2019-02-23 8:49 ` [PATCH 4/5] spi: bcm2835: support effective_speed_hz kernel-TqfNSX0MhmxHKSADF0wUEw 2019-02-23 8:49 ` kernel 2019-05-13 15:14 ` Mark Brown
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=20190223084952.14758-3-kernel@martin.sperl.org \ --to=kernel@martin.sperl.org \ --cc=broonie@kernel.org \ --cc=eric@anholt.net \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-rpi-kernel@lists.infradead.org \ --cc=linux-spi@vger.kernel.org \ --cc=stefan.wahren@i2se.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.