From: Lars-Peter Clausen <lars@metafoo.de>
To: rajeev <rajeev-dlh.kumar@st.com>
Cc: "tiwai@suse.de" <tiwai@suse.de>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"broonie@opensource.wolfsonmicro.com"
<broonie@opensource.wolfsonmicro.com>,
"lrg@slimlogic.co.uk" <lrg@slimlogic.co.uk>
Subject: Re: [PATCH V4 1/5] sound: asoc: Adding support for STA529 Audio Codec
Date: Mon, 06 Jun 2011 09:35:52 +0200 [thread overview]
Message-ID: <4DEC8358.9000705@metafoo.de> (raw)
In-Reply-To: <4DEC7CFB.60405@st.com>
On 06/06/2011 09:08 AM, rajeev wrote:
> Hi Lars-Peter Clausen
> Please find my answer inline below.
>
> On 6/6/2011 11:53 AM, Lars-Peter Clausen wrote:
>> On 06/06/2011 07:57 AM, Rajeev Kumar wrote:
>>> This patch adds the support for STA529 audio codec.
>>> Details of the audio codec can be seen here:
>>> http://www.st.com/internet/imag_video/product/159187.jsp
>>>
>>> Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
>>> ---
>>> sound/soc/codecs/Kconfig | 5 +
>>> sound/soc/codecs/Makefile | 2 +
>>> sound/soc/codecs/sta529.c | 374 +++++++++++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 381 insertions(+), 0 deletions(-)
>>> create mode 100644 sound/soc/codecs/sta529.c
>>>
>>> [...]
>>> +
>>> +static const struct snd_kcontrol_new sta529_new_snd_controls[] = {
>>> + SOC_ENUM("PWM Select", pwm_src_enum),
>>> + SOC_ENUM("MODE Select", mode_src_enum),
>>
>> The mode should be configured by the dai_drivers set_fmt callback, and not by a
>> control.
>>
> I think giving a interface to the user is better option rather than doing it in set_fmt callback.
Why? Both the codec_dai and the cpu_dai have to agree on who is the master and
who is the slave. So letting the user select the codec mode instead of defining
it in the board driver doesn't make sense, since the setup will stop working if
the cpu dai isn't configured to match the codec dais mode.
Furthermore you don't want to switch the mode while playback is active and
generally you won't even change it at all, once it has been setup.
> [...[
>>> +
>>> +static int sta529_mute(struct snd_soc_dai *dai, int mute)
>>> +{
>>> + struct snd_soc_codec *codec = dai->codec;
>>> +
>>> + u8 mute_reg = snd_soc_read(codec, STA529_FFXCFG0) & ~CODEC_MUTE_VAL;
>>> +
>>> + if (mute)
>>> + mute_reg |= CODEC_MUTE_VAL;
>>> +
>>> + snd_soc_update_bits(codec, STA529_FFXCFG0, 0x80, 00);
>> I guess, it should be mute_reg instead of 00
>>
> No, This is value, register is STA529_FFXCFG0
You are always clearing the mute bit, regardless of whether mute is enabled or
disabled.
snd_soc_update_bits(codec, STA529_FFXCFG0, 0x80, mute_reg); is probably what
you want to do.
>[...]
>>> +static struct snd_soc_dai_ops sta529_dai_ops = {
>> Can be const
> It can not be. Please check snd_soc_dai_ops structure in include/sound/soc-dai.h
Yes, it can. Maybe you are using an outdated ASoC version. Check line 206 of
include/sound/soc-dai.h in Mark's for-next branch.
> [...]
>>> +
>>> + snd_soc_add_controls(codec, sta529_snd_controls,
>>> + ARRAY_SIZE(sta529_snd_controls));
>>> +
>>> + snd_soc_add_controls(codec, sta529_new_snd_controls,
>>> + ARRAY_SIZE(sta529_new_snd_controls));
>> You should use table based controls setup. i.e assign the control table to the
>> 'controls' field of your codec_driver.
>>
> You can do it in either way.
Yes, you can, but you should use the codec_driver fields unless you have good
reasoning not to.
>>> [...]
>>
>> Your driver doesn't use any DAPM. You should at least define input and output
>> pins and their routing, but I would expect that there is more that can be done,
>> like dynamicly powering unused sections of the codec down, like the DAC or ADC.
>> .
>>
> Right now since my driver has not support for DAPM, so definitions for input and output pins
> are not there.Once I will implement DAPM feature in future I will send separate patch for that.
>
Currently there is a bug in the ASoC core, which will cause codec drivers
without DAPM to be not powered down, even though if they are not used.
Given that it will maybe take 5 minutes or so to add basic DAPM (Input/Output
pins and ADC/DAC) it would be a good idea to add it to the inital version of
the driver.
- Lars
next prev parent reply other threads:[~2011-06-06 7:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-06 5:57 [PATCH V4 0/5] Adding ASoC drivers for SPEAr13XX platform Rajeev Kumar
2011-06-06 5:57 ` [PATCH V4 1/5] sound: asoc: Adding support for STA529 Audio Codec Rajeev Kumar
2011-06-06 5:57 ` [PATCH V4 2/5] sound: asoc: Adding support for SPEAr13XX ASoC platform driver Rajeev Kumar
2011-06-06 5:57 ` [PATCH V4 3/5] sound: asoc: Adding support for SPEAr13XX ASoC machine driver Rajeev Kumar
2011-06-06 5:57 ` [PATCH V4 4/5] sound: asoc: Adding Kconfig and Makefile to support SPEAr13XX ASoC driver Rajeev Kumar
2011-06-06 5:57 ` [PATCH V4 5/5] sound: asoc: Adding support for SPEAr13XX in soc Rajeev Kumar
2011-06-07 14:17 ` [PATCH V4 4/5] sound: asoc: Adding Kconfig and Makefile to support SPEAr13XX ASoC driver Mark Brown
2011-06-07 14:16 ` [PATCH V4 3/5] sound: asoc: Adding support for SPEAr13XX ASoC machine driver Mark Brown
2011-06-07 14:12 ` [PATCH V4 2/5] sound: asoc: Adding support for SPEAr13XX ASoC platform driver Mark Brown
2011-06-08 9:05 ` Liam Girdwood
2011-06-06 6:23 ` [PATCH V4 1/5] sound: asoc: Adding support for STA529 Audio Codec Lars-Peter Clausen
2011-06-06 7:08 ` rajeev
2011-06-06 7:35 ` Lars-Peter Clausen [this message]
2011-06-06 10:19 ` rajeev
2011-06-07 7:06 ` Lars-Peter Clausen
2011-06-06 11:55 ` Mark Brown
2011-06-07 6:08 ` rajeev
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=4DEC8358.9000705@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=lrg@slimlogic.co.uk \
--cc=rajeev-dlh.kumar@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).