From: s.nawrocki@samsung•com (Sylwester Nawrocki)
To: linux-arm-kernel@lists•infradead.org
Subject: [alsa-devel] [PATCH V2 1/2] ASoC: samsung: Add machine driver for Odroid X2/U3
Date: Thu, 26 Jun 2014 10:47:59 +0200 [thread overview]
Message-ID: <53ABDE3F.2070203@samsung.com> (raw)
In-Reply-To: <53AA42A3.7030004@gmail.com>
On 25/06/14 05:31, Tushar Behera wrote:
> On 06/18/2014 09:52 PM, Sylwester Nawrocki wrote:
>> This patch adds the sound subsystem driver for Odroid-X2 and
>> Odroid-U3 boards. The codec works in I2S master mode; there are
>> 2 separate audio routing paths defined as there are differences
>> in the signal routing between the X2 and U3 boards, i.e. U3 uses
>> single jack for headphones and microphone.
>>
>> Signed-off-by: Chen Zhen <zhen1.chen@samsung•com>
>> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung•com>
>> ---
>> sound/soc/samsung/Kconfig | 8 ++
>> sound/soc/samsung/Makefile | 2 +
>> sound/soc/samsung/odroidx2_max98090.c | 191 +++++++++++++++++++++++++++++++++
>> 3 files changed, 201 insertions(+)
>> create mode 100644 sound/soc/samsung/odroidx2_max98090.c
>>
>
> [ ... ]
>
>> +static int odroidx2_hw_params(struct snd_pcm_substream *substream,
>> + struct snd_pcm_hw_params *params)
>> +{
>> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
>> + struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
>> + struct snd_soc_dai *codec_dai = rtd->codec_dai;
>> + int ret;
>> +
>> + ret = snd_soc_dai_set_sysclk(codec_dai, 0, MAX98090_MCLK,
>> + SND_SOC_CLOCK_IN);
>> + if (ret < 0) {
>> + dev_err(codec_dai->dev,
>> + "Unable to switch to FLL1: %d\n", ret);
>> + return ret;
>> + }
>> +
>> + /* Set the cpu DAI configuration in order to use CDCLK */
>> + ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_CDCLK,
>> + 0, SND_SOC_CLOCK_OUT);
>> + if (ret < 0)
>> + return ret;
>> +
>
> While upstreaming sound-card driver for Snow board, I had a comment from
> Mark to move this to probe, if possible. That way, the clock operations
> would be done only once and this function and odroidx2_ops can be
> removed altogether.
Thanks for the suggestion, I'll change it for the next iteration.
>> + dev_dbg(codec_dai->dev, "HiFi DAI %s params: channels: %d, rate: %d\n",
>> + snd_pcm_stream_str(substream), params_channels(params),
>> + params_rate(params));
>> +
>> + return 0;
>> +}
>> +
>> +static struct snd_soc_ops odroidx2_ops = {
>> + .hw_params = odroidx2_hw_params,
>> +};
>> +
>
> [ ... ]
>
>> +
>> + ret = snd_soc_register_card(card);
>
> devm_snd_soc_register_card ?
Could be, although snd_soc_unregister_card() wouldn't release references
to the OF nodes, i.e. there would be no related of_node_put() calls.
And for correctness, the of_node_put() calls should be made _after_
a snd_soc_unregister_card() call, and I can't see how it could be possible
if I left only of_node_put() calls in the odroidx2_audio_remove() callback.
>> + if (ret) {
>> + dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret);
>> + goto err_put_cpu_n;
>> + }
>> +
>> + return 0;
>> +
>> +err_put_cpu_n:
>> + of_node_put(odroidx2_dai[0].cpu_of_node);
>> +err_put_cod_n:
>> + of_node_put(odroidx2_dai[0].codec_of_node);
>> + return ret;
>> +}
>> +
>> +static int odroidx2_audio_remove(struct platform_device *pdev)
>> +{
>> + struct snd_soc_card *card = platform_get_drvdata(pdev);
>> +
>> + snd_soc_unregister_card(card);
>
> This can be removed when devm_snd_soc_register_card is used.
--
Regards,
Sylwester
next prev parent reply other threads:[~2014-06-26 8:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 16:22 [PATCH V2 0/2] Sound support for Exynos4412 Odroid X2, U3 board Sylwester Nawrocki
2014-06-18 16:22 ` [PATCH V2 1/2] ASoC: samsung: Add machine driver for Odroid X2/U3 Sylwester Nawrocki
2014-06-25 3:31 ` [alsa-devel] " Tushar Behera
2014-06-26 8:47 ` Sylwester Nawrocki [this message]
2014-06-30 18:46 ` Mark Brown
2014-07-14 11:27 ` Sylwester Nawrocki
2014-07-14 11:31 ` Mark Brown
2014-06-18 16:22 ` [PATCH V2 2/2] doc: dt bindings: Document Odroid X2/U3 audio subsystem bindings Sylwester Nawrocki
2014-06-23 9:40 ` [PATCH V2 0/2] Sound support for Exynos4412 Odroid X2, U3 board Daniel Drake
2014-06-23 16:32 ` Sylwester Nawrocki
2014-06-23 16:53 ` Sylwester Nawrocki
2014-06-24 8:35 ` Daniel Drake
2014-06-24 9:02 ` Marek Szyprowski
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=53ABDE3F.2070203@samsung.com \
--to=s.nawrocki@samsung$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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