From: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Peter Ujfalusi <peter.ujfalusi-l0cyMroinI0@public.gmane.org>,
GTA04 owners
<gta04-owner-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/3] ASoC: twl4030: don't report EBUSY if no change requested.
Date: Mon, 10 Nov 2014 11:45:18 +1100 [thread overview]
Message-ID: <20141110114518.715dcd4e@notabene.brown> (raw)
In-Reply-To: <20141108092242.GB2722-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2121 bytes --]
On Sat, 8 Nov 2014 09:22:42 +0000 Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> On Sat, Nov 08, 2014 at 11:38:03AM +1100, NeilBrown wrote:
>
> > + int val = ucontrol->value.integer.value[0];
> > +
> > + if (!!(twl4030_read(codec, TWL4030_REG_CODEC_MODE)
> > + & TWL4030_OPTION_1) == !!val)
> > + /* No change */
> > + return 0;
>
> We shouldn't be accepting attempts to set out of range values so there
> should be no need for the !! on val (which confused me when I was
> reading this).
True, the '!!' on val isn't necessary.
I took the opportunity to look around a bit more and discovered there was a
snd_soc_get_enum_double, which I really should use in preference to
twl4030_read.
So here is the new version. Can it be taken out of the email, or should I
resend stand-alone?
Thanks,
NeilBrown
From: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
Date: Wed, 2 Oct 2013 14:45:52 +1000
Subject: [PATCH] ASoC: twl4030: don't report EBUSY if no change requested.
"mode" must not be changed when active.
However if a request is received to set the mode to what it currently
is, that is also rejected when active, which causes confusing
error messages.
So check first and if no change is actually requested, don't report
an error.
Signed-off-by: NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index b6b0cb399599..613b61cee081 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -957,6 +957,16 @@ static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
+ struct snd_ctl_elem_value currentval;
+ int ret;
+
+ ret = snd_soc_get_enum_double(kcontrol, ¤tval);
+ if (ret)
+ return ret;
+ if (ucontrol->value.enumerated.item[0] ==
+ currentval.value.enumerated.item[0])
+ /* No change */
+ return 0;
if (twl4030->configured) {
dev_err(codec->dev,
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next prev parent reply other threads:[~2014-11-10 0:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-08 0:38 [PATCH 0/3] ASoC: twl4030: support routine to external VOICE source NeilBrown
2014-11-08 0:38 ` [PATCH 1/3] ASoC: twl4030: don't report EBUSY if no change requested NeilBrown
[not found] ` <20141108003803.6561.42934.stgit-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-11-08 9:22 ` Mark Brown
[not found] ` <20141108092242.GB2722-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-11-10 0:45 ` NeilBrown [this message]
2014-11-10 7:07 ` [alsa-devel] " Lars-Peter Clausen
[not found] ` <54606446.7030907-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2014-11-10 21:45 ` NeilBrown
[not found] ` <20141111084537.1b4e726c-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-11-10 21:49 ` Lars-Peter Clausen
2014-11-08 0:38 ` [PATCH 2/3] ASoC: twl4030: allow voice port to be connected externally NeilBrown
2014-11-08 9:26 ` Mark Brown
2014-11-09 23:25 ` NeilBrown
2014-11-10 6:46 ` [Gta04-owner] " Dr. H. Nikolaus Schaller
[not found] ` <20141110102551.2678d342-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2014-11-10 12:11 ` Mark Brown
2014-11-08 0:38 ` [PATCH 3/3] ASoC: twl4030: enable routing audio to 'voice' interface NeilBrown
2014-11-08 9:27 ` Mark Brown
2014-11-09 23:54 ` NeilBrown
2014-11-10 10:48 ` 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=20141110114518.715dcd4e@notabene.brown \
--to=neilb-l3a5bk7wagm@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=gta04-owner-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=peter.ujfalusi-l0cyMroinI0@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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).