From: Nenghua Cao <nhcao@marvell.com>
To: Nenghua Cao <nhcao@marvell.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] asoc: soc-core: use regmap's parse_val to do endian translation
Date: Wed, 19 Feb 2014 13:28:54 +0800 [thread overview]
Message-ID: <53044116.9020406@marvell.com> (raw)
In-Reply-To: <1392787221-29445-1-git-send-email-nhcao@marvell.com>
Update Liam and Mark's mail.
On 02/19/2014 01:20 PM, Nenghua Cao wrote:
> From: Nenghua Cao <nhcao@marvell.com>
>
> In snd_soc_bytes_put function, it forces cpu to do cpu_to_be translation,
> but for mmio bus which uses REGMAP_ENDIAN_NATIVE, it doesn't need to do
> endian translation. So it is better to use regmap's api which can decide
> if this translation is needed according to bus configuration.
>
> Signed-off-by: Nenghua Cao <nhcao@marvell.com>
> ---
> sound/soc/soc-core.c | 34 +++++++++++++++++++++++++++++-----
> 1 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index fe1df50..fb598cb 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -3234,7 +3234,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
> struct soc_bytes *params = (void *)kcontrol->private_value;
> struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
> int ret, len;
> - unsigned int val;
> + unsigned int val, mask;
> void *data;
>
> if (!codec->using_regmap)
> @@ -3264,12 +3264,36 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
> ((u8 *)data)[0] |= val;
> break;
> case 2:
> - ((u16 *)data)[0] &= cpu_to_be16(~params->mask);
> - ((u16 *)data)[0] |= cpu_to_be16(val);
> + mask = ~params->mask;
> + ret = regmap_parse_val(codec->control_data,
> + &mask, &mask);
> + if (ret != 0)
> + goto out;
> +
> + ((u16 *)data)[0] &= mask;
> +
> + ret = regmap_parse_val(codec->control_data,
> + &val, &val);
> + if (ret != 0)
> + goto out;
> +
> + ((u16 *)data)[0] |= val;
> break;
> case 4:
> - ((u32 *)data)[0] &= cpu_to_be32(~params->mask);
> - ((u32 *)data)[0] |= cpu_to_be32(val);
> + mask = ~params->mask;
> + ret = regmap_parse_val(codec->control_data,
> + &mask, &mask);
> + if (ret != 0)
> + goto out;
> +
> + ((u32 *)data)[0] &= mask;
> +
> + ret = regmap_parse_val(codec->control_data,
> + &val, &val);
> + if (ret != 0)
> + goto out;
> +
> + ((u32 *)data)[0] |= val;
> break;
> default:
> ret = -EINVAL;
>
next prev parent reply other threads:[~2014-02-19 5:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-19 5:20 [PATCH 2/2] asoc: soc-core: use regmap's parse_val to do endian translation Nenghua Cao
2014-02-19 5:28 ` Nenghua Cao [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-02-19 10:44 Nenghua Cao
2014-03-06 9:46 ` 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=53044116.9020406@marvell.com \
--to=nhcao@marvell.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.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 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.