From: "Noralf Trønnes" <noralf@tronnes.org>
To: Stefan Wahren <stefan.wahren@i2se.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mark Brown <broonie@kernel.org>,
Henri Chain <henri.chain@eleves.ec-nantes.fr>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection
Date: Tue, 25 Aug 2015 00:00:37 +0200 [thread overview]
Message-ID: <55DB9405.1080806@tronnes.org> (raw)
In-Reply-To: <1440441228-27113-3-git-send-email-stefan.wahren@i2se.com>
Den 24.08.2015 20:33, skrev Stefan Wahren:
> Since bits_per_word isn't usually checked during SPI setup the 9-bit
> support must be checked manually.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
> drivers/staging/fbtft/fbtft-core.c | 7 +++++++
> drivers/staging/fbtft/flexfb.c | 7 +++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index 3638554..bd71487 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -1438,6 +1438,13 @@ int fbtft_probe_common(struct fbtft_display *display,
> if (par->spi && display->buswidth == 9) {
> par->spi->bits_per_word = 9;
> ret = spi_setup(par->spi);
> + if (!ret) {
> + struct spi_master *ma = par->spi->master;
> +
> + if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
> + ret = -EINVAL;
> + }
> +
> if (ret) {
There's no point in calling spi_setup() when it doesn't check bits_per_word.
Apparently this changed with the commit:
spi: convert drivers to use bits_per_word_mask.
This has not been detected earlier, because FBTFT was previously mostly
used on the Raspberry Pi which had a downstream SPI driver that did this
check.
How about this:
- par->spi->bits_per_word = 9;
- ret = par->spi->master->setup(par->spi);
+ if (par->spi->master->bits_per_word_mask &
SPI_BPW_MASK(9)) {
+ par->spi->bits_per_word = 9;
- if (ret) {
+ } else {
dev_warn(&par->spi->dev,
"9-bit SPI not available, emulating
using 8-bit.\n");
- par->spi->bits_per_word = 8;
- ret = par->spi->master->setup(par->spi);
- if (ret)
- goto out_release;
/* allocate buffer with room for dc bits */
par->extra = devm_kzalloc(par->info->device,
next prev parent reply other threads:[~2015-08-24 22:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 18:33 [PATCH RFC 0/2] staging: fbtft: fix 9-bit SPI support Stefan Wahren
2015-08-24 18:33 ` [PATCH RFC 1/2] staging: fbtft: replace master->setup() with spi_setup() Stefan Wahren
2015-08-24 18:33 ` [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection Stefan Wahren
2015-08-24 22:00 ` Noralf Trønnes [this message]
2015-08-25 17:34 ` Stefan Wahren
2015-08-25 18:21 ` Noralf Trønnes
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=55DB9405.1080806@tronnes.org \
--to=noralf@tronnes.org \
--cc=broonie@kernel.org \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=henri.chain@eleves.ec-nantes.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=stefan.wahren@i2se.com \
--cc=thomas.petazzoni@free-electrons.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: 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