From: Lars-Peter Clausen <lars@metafoo.de>
To: Mike Frysinger <vapier@gentoo.org>
Cc: uclinux-dist-devel@blackfin.uclinux.org,
alsa-devel@alsa-project.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
device-drivers-devel@blackfin.uclinux.org,
Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836
Date: Fri, 06 May 2011 14:28:32 +0200 [thread overview]
Message-ID: <4DC3E970.2030207@metafoo.de> (raw)
In-Reply-To: <BANLkTi=u+_LBkv2=DAwhZ53FEoRaYcHErA@mail.gmail.com>
On 05/06/2011 12:56 AM, Mike Frysinger wrote:
> On Thu, May 5, 2011 at 13:52, Lars-Peter Clausen wrote:
>> Currently there is a special case for the ad1836 in the ASoC generic spi write
>> functions, which swaps the upper and the lower byte for 4/12 transfers.
>> This was done, because the 4/12 spi write function was added for the ad1836
>> for which all of the users are configured to use use 16-bit transfers.
>> In order to be able to get rid of this special casing switch all users of
>> ad1836 to 8-bit transfers.
>
> 16bit spi transfers are inherently less overhead than 8bit transfers.
> so if the codec supports it, we should use it rather than drop 16bit
> support everywhere because 8bit is simpler. am i missing something
> obvious ?
> -mike
At some point the codec driver used u16 for the type of the data to be
transferred, so 16bit transfers where fine then.
But at some point the driver was updated to use the snd_soc_cache
infrastructure, which uses a u8[2] array for the data to be transferred.
The snd_soc_cache infrastructure has several helper functions for writing spi
on a spi bus. The one used by the ad1836 was specifically added for the ad1836
and is special compared to the other spi helper functions in the regard that it
swaps the upper and the lower byte of the to be transferred data.
While this works on blackfin which is litte-endian this scheme will obviously
fail on big-endian machines. Also this might not work for other codecs which
want to reuse the same helper function.
And furthermore it disallows more generalization of the spi write functions in
snd_soc_cache, which is done in the follow-up patches.
If we wanted to use 16-bit spi transfers we would have to add something generic
to the do_spi_write function, which swaps the upper and the lower byte of each
short to be transferred if the host is little-endian.
- Lars
next prev parent reply other threads:[~2011-05-06 12:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-05 17:52 [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 2/4] ASoC: Do not swap upper and lower byte in snd_soc_4_12_spi_write Lars-Peter Clausen
2011-05-05 17:52 ` [PATCH 3/4] ASoC: Get rid of snd_soc_*_*_spi_write wrapper functions Lars-Peter Clausen
2011-05-12 12:25 ` Barry Song
2011-05-05 17:52 ` [PATCH 4/4] ASoC: Use spi_write in do_spi_write Lars-Peter Clausen
2011-05-05 22:56 ` [uclinux-dist-devel] [PATCH 1/4] Blackfin: Use 8bit spi transfers for the ad1836 Mike Frysinger
2011-05-06 12:28 ` Lars-Peter Clausen [this message]
2011-05-06 12:48 ` Mark Brown
2011-05-06 13:12 ` [Device-drivers-devel] " Mike Frysinger
2011-05-06 13:19 ` Lars-Peter Clausen
2011-05-06 13:26 ` Mark Brown
2011-05-06 13:31 ` Lars-Peter Clausen
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=4DC3E970.2030207@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=lrg@slimlogic.co.uk \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
--cc=vapier@gentoo.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;
as well as URLs for NNTP newsgroup(s).