From: songjun.wu@atmel•com (Wu, Songjun)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] ASoC: atmel_ssc_dai: distinguish the different SSC
Date: Tue, 16 Feb 2016 10:54:21 +0800 [thread overview]
Message-ID: <56C28F5D.5010000@atmel.com> (raw)
In-Reply-To: <56966852.8050205@atmel.com>
Any comments on this patch?
On 1/13/2016 23:08, Nicolas Ferre wrote:
> Le 13/01/2016 07:35, Songjun Wu a ?crit :
>> Cpu_dai id always equals 0, can't distinguish the
>> different SSC. Use platform_device id to record
>> and distinguish the different SSC.
>>
>> Signed-off-by: Songjun Wu <songjun.wu@atmel•com>
>
> It seems okay:
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel•com>
>
>> ---
>>
>> drivers/misc/atmel-ssc.c | 1 +
>> sound/soc/atmel/atmel_ssc_dai.c | 27 ++++++++++++++++++---------
>> 2 files changed, 19 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c
>> index e11a0bd..0516ecd 100644
>> --- a/drivers/misc/atmel-ssc.c
>> +++ b/drivers/misc/atmel-ssc.c
>> @@ -34,6 +34,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
>> if (ssc->pdev->dev.of_node) {
>> if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc")
>> == ssc_num) {
>> + ssc->pdev->id = ssc_num;
>> ssc_valid = 1;
>> break;
>> }
>> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
>> index ba8def5..2768970 100644
>> --- a/sound/soc/atmel/atmel_ssc_dai.c
>> +++ b/sound/soc/atmel/atmel_ssc_dai.c
>> @@ -285,7 +285,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params,
>> static int atmel_ssc_startup(struct snd_pcm_substream *substream,
>> struct snd_soc_dai *dai)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
>> + struct platform_device *pdev = to_platform_device(dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>> struct atmel_pcm_dma_params *dma_params;
>> int dir, dir_mask;
>> int ret;
>> @@ -346,7 +347,8 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
>> static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
>> struct snd_soc_dai *dai)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
>> + struct platform_device *pdev = to_platform_device(dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>> struct atmel_pcm_dma_params *dma_params;
>> int dir, dir_mask;
>>
>> @@ -392,7 +394,8 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
>> static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>> unsigned int fmt)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id];
>> + struct platform_device *pdev = to_platform_device(cpu_dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>>
>> ssc_p->daifmt = fmt;
>> return 0;
>> @@ -404,7 +407,8 @@ static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>> static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
>> int div_id, int div)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id];
>> + struct platform_device *pdev = to_platform_device(cpu_dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>>
>> switch (div_id) {
>> case ATMEL_SSC_CMR_DIV:
>> @@ -445,7 +449,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>> struct snd_pcm_hw_params *params,
>> struct snd_soc_dai *dai)
>> {
>> - int id = dai->id;
>> + struct platform_device *pdev = to_platform_device(dai->dev);
>> + int id = pdev->id;
>> struct atmel_ssc_info *ssc_p = &ssc_info[id];
>> struct ssc_device *ssc = ssc_p->ssc;
>> struct atmel_pcm_dma_params *dma_params;
>> @@ -772,7 +777,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>> static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
>> struct snd_soc_dai *dai)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
>> + struct platform_device *pdev = to_platform_device(dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>> struct atmel_pcm_dma_params *dma_params;
>> int dir;
>>
>> @@ -795,7 +801,8 @@ static int atmel_ssc_prepare(struct snd_pcm_substream *substream,
>> static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
>> int cmd, struct snd_soc_dai *dai)
>> {
>> - struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
>> + struct platform_device *pdev = to_platform_device(dai->dev);
>> + struct atmel_ssc_info *ssc_p = &ssc_info[pdev->id];
>> struct atmel_pcm_dma_params *dma_params;
>> int dir;
>>
>> @@ -824,11 +831,12 @@ static int atmel_ssc_trigger(struct snd_pcm_substream *substream,
>> static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai)
>> {
>> struct atmel_ssc_info *ssc_p;
>> + struct platform_device *pdev = to_platform_device(cpu_dai->dev);
>>
>> if (!cpu_dai->active)
>> return 0;
>>
>> - ssc_p = &ssc_info[cpu_dai->id];
>> + ssc_p = &ssc_info[pdev->id];
>>
>> /* Save the status register before disabling transmit and receive */
>> ssc_p->ssc_state.ssc_sr = ssc_readl(ssc_p->ssc->regs, SR);
>> @@ -852,12 +860,13 @@ static int atmel_ssc_suspend(struct snd_soc_dai *cpu_dai)
>> static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
>> {
>> struct atmel_ssc_info *ssc_p;
>> + struct platform_device *pdev = to_platform_device(cpu_dai->dev);
>> u32 cr;
>>
>> if (!cpu_dai->active)
>> return 0;
>>
>> - ssc_p = &ssc_info[cpu_dai->id];
>> + ssc_p = &ssc_info[pdev->id];
>>
>> /* restore SSC register settings */
>> ssc_writel(ssc_p->ssc->regs, TFMR, ssc_p->ssc_state.ssc_tfmr);
>>
>
>
next prev parent reply other threads:[~2016-02-16 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-13 6:35 [PATCH] ASoC: atmel_ssc_dai: distinguish the different SSC Songjun Wu
2016-01-13 15:08 ` Nicolas Ferre
2016-02-16 2:54 ` Wu, Songjun [this message]
2016-02-17 16:22 ` 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=56C28F5D.5010000@atmel.com \
--to=songjun.wu@atmel$(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