From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Moise Gergaud <moise.gergaud@st.com>
Cc: Takashi Iwai <tiwai@suse.de>,
alsa-devel@alsa-project.org, broonie@kernel.org,
arnaud.pouliquen@st.com, lgirdwood@gmail.com
Subject: Re: [PATCH 1/3] ALSA: pcm: add IEC958 channel status update
Date: Tue, 8 Dec 2015 14:47:12 +0000 [thread overview]
Message-ID: <20151208144712.GC8644@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <5666E97E.7020002@st.com>
On Tue, Dec 08, 2015 at 03:30:22PM +0100, Moise Gergaud wrote:
> On 12/07/2015 10:51 AM, Takashi Iwai wrote:
> >On Mon, 07 Dec 2015 09:46:02 +0100,
> >Moise Gergaud wrote:
> >>
> >>On 12/03/2015 01:03 PM, Takashi Iwai wrote:
> >>>On Thu, 03 Dec 2015 12:13:04 +0100,
> >>>Russell King - ARM Linux wrote:
> >>>>
> >>>>On Thu, Dec 03, 2015 at 11:58:14AM +0100, Moise Gergaud wrote:
> >>>>>On 12/02/2015 08:00 PM, Russell King - ARM Linux wrote:
> >>>>>>Again, I'm not happy with this change. The intention here is that we
> >>>>>>validate all arguments before we change anything. This breaks that
> >>>>>>principle.
> >>>>>>
> >>>>>We propose this change for compressed mode (IEC61937/non linear PCM).
> >>>>>In case of compressed mode, iec958 channel status byte 0 bit1 = 1, then we
> >>>>>cannot use snd_pcm_create_iec958_consumer.
> >>>>
> >>>>Why can you not use snd_pcm_create_iec958_consumer() for this case? You
> >>>>are allowed to modify the values you get afterwards in order to handle
> >>>>this case if you so wish to toggle this bit.
> >>>>
> >>>>However, if you are using data mode, you really should be using the AES
> >>>>bytes passed by the application through alsalib and into the kernel via
> >>>>the IEC958 controls. There are three controls specified for this:
> >>>>
> >>>>SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK) - the bits which can be
> >>>>changed for consumer mode.
> >>>>SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK) - the bits which can be
> >>>>changed for professional mode.
> >>>>SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT) - the value of the changable
> >>>>bits.
> >>>>
> >>>>When using this, it is userspace's responsibility to set the sample rate
> >>>>appropriately for the stream.
> >>>>
> >>>>The only case to use snd_pcm_create_iec958_consumer() is to generate the
> >>>>status bytes for PCM audio, where the userspace API doesn't facilitiate
> >>>>generating and/or passing the AES status bytes.
> >>>
> >>>That's true. OTOH, in most drivers, we try to be kind not to be too
> >>>strict for this requirement and adjust the status bits accordingly.
> >>>This comes from the lessons we learned how user-space doesn't care the
> >>>things.
> >>>
> >>>So, if we want to keep that good uncle attitude, this change doesn't
> >>>look so bad to me.
> >>>
> >>shall I deliver a new version of this patch with header correction or
> >>shall I abandon this patch?
> >
> >It's up to you whether you want further convincing Russell :)
> >I'd happily merge this once when we get his ack.
> >
> >
> >thanks,
> >
> >Takashi
> >
>
> I share Takashi's view; unfortunately, we cannot always trust user space.
> And so, for robustness reason, I think drivers shall ensure that channel
> status params are correct. For that purpose, the update helper function
> could be useful.
I don't, and now that you mention about not trusting userspace, I'm
entrenching into that position. I have hardware where userspace must get
it correct: I need to use the IEC958 alsalib plugin, and that relies on
userspace getting it right - the kernel plays no part in generating the
channel status, it's all handled in userspace. I do have kernel-side
channel status generation for 24-bit 4-byte PCM audio though, because
it's easy to merge in the channel status information (basically doing
what the IEC958 alsalib plugin does.) I'd much rather that was moved
out to userspace though.
What you're suggesting creates two separate classes of driver:
* those which always overwrite the channel status information from
userspace, which will make userspace lazy and _more_ buggy.
* those which have to use the channel status information from
userspace.
If the second is a minority, what we end up with are bugs with channel
status information being missed, because programs will work on the
"majority" of drivers which overwrite the userspace specified channel
status.
IMHO, that's really not a sane position.
--
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2015-12-08 14:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 14:22 [PATCH 0/3] ASoC: sti: correction for HBRA support Moise Gergaud
2015-12-02 14:22 ` [PATCH 1/3] ALSA: pcm: add IEC958 channel status update Moise Gergaud
2015-12-02 14:32 ` Takashi Iwai
2015-12-02 19:00 ` Russell King - ARM Linux
2015-12-03 10:58 ` Moise Gergaud
2015-12-03 11:13 ` Russell King - ARM Linux
2015-12-03 12:03 ` Takashi Iwai
2015-12-07 8:46 ` Moise Gergaud
2015-12-07 9:51 ` Takashi Iwai
2015-12-08 14:30 ` Moise Gergaud
2015-12-08 14:47 ` Russell King - ARM Linux [this message]
2015-12-02 19:01 ` Russell King - ARM Linux
2015-12-02 14:22 ` [PATCH 2/3] ASoC: sti: use pcm iec958 channel status helper Moise Gergaud
2015-12-02 14:50 ` Takashi Iwai
2015-12-02 14:22 ` [PATCH 3/3] ASoC: sti: correction for HBRA (High Bit Rate Audio) support Moise Gergaud
2015-12-09 8:27 ` [PATCH 0/3] ASoC: sti: correction for HBRA support Moise Gergaud
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=20151208144712.GC8644@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@st.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=moise.gergaud@st.com \
--cc=tiwai@suse.de \
/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).