All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Bo Shen <voice.shen@atmel.com>
Cc: broonie@kernel.org, alsa-devel@alsa-project.org,
	Takashi Iwai <tiwai@suse.de>,
	linux-kernel@vger.kernel.org, nicolas.ferre@atmel.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org, plagnioj@jcrosoft.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [alsa-devel] [PATCH v2 1/3] ASoC: atmel_ssc_dai: make option to choose clock
Date: Mon, 27 Jan 2014 08:06:23 +0100	[thread overview]
Message-ID: <52E6056F.2050008@metafoo.de> (raw)
In-Reply-To: <1390805726-1841-2-git-send-email-voice.shen@atmel.com>

On 01/27/2014 07:55 AM, Bo Shen wrote:
> When SSC works in slave mode, according to the hardware design, the
> clock can get from TK pin, also can get from RK pin. So, add one
> parameter to choose where the clock from.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
> Changes in v2: None
> 
>  sound/soc/atmel/atmel_ssc_dai.c | 16 ++++++++++++----
>  sound/soc/atmel/atmel_ssc_dai.h |  1 +
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index 8697ced..03eb0be 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -340,6 +340,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	struct snd_soc_dai *dai)
>  {
>  	int id = dai->id;
> +	struct snd_soc_card *card = dai->card;
>  	struct atmel_ssc_info *ssc_p = &ssc_info[id];
>  	struct atmel_pcm_dma_params *dma_params;
>  	int dir, channels, bits;
> @@ -347,6 +348,9 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	int start_event;
>  	int ret;
>  
> +	ssc_p->clk_from_rk_pin =
> +		((struct atmel_ssc_info *)(card->drvdata))->clk_from_rk_pin;

This is a layering violation. The DAI driver is not supposed to make any
assumptions what drvdata is attached to the card. Use the set_sysclk API to
set the source clock.

- Lars

WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Bo Shen <voice.shen@atmel.com>
Cc: broonie@kernel.org, alsa-devel@alsa-project.org,
	Takashi Iwai <tiwai@suse.de>,
	linux-kernel@vger.kernel.org, nicolas.ferre@atmel.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-sound@vger.kernel.org, plagnioj@jcrosoft.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [alsa-devel] [PATCH v2 1/3] ASoC: atmel_ssc_dai: make option to choose clock
Date: Mon, 27 Jan 2014 07:06:23 +0000	[thread overview]
Message-ID: <52E6056F.2050008@metafoo.de> (raw)
In-Reply-To: <1390805726-1841-2-git-send-email-voice.shen@atmel.com>

On 01/27/2014 07:55 AM, Bo Shen wrote:
> When SSC works in slave mode, according to the hardware design, the
> clock can get from TK pin, also can get from RK pin. So, add one
> parameter to choose where the clock from.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
> Changes in v2: None
> 
>  sound/soc/atmel/atmel_ssc_dai.c | 16 ++++++++++++----
>  sound/soc/atmel/atmel_ssc_dai.h |  1 +
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index 8697ced..03eb0be 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -340,6 +340,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	struct snd_soc_dai *dai)
>  {
>  	int id = dai->id;
> +	struct snd_soc_card *card = dai->card;
>  	struct atmel_ssc_info *ssc_p = &ssc_info[id];
>  	struct atmel_pcm_dma_params *dma_params;
>  	int dir, channels, bits;
> @@ -347,6 +348,9 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	int start_event;
>  	int ret;
>  
> +	ssc_p->clk_from_rk_pin > +		((struct atmel_ssc_info *)(card->drvdata))->clk_from_rk_pin;

This is a layering violation. The DAI driver is not supposed to make any
assumptions what drvdata is attached to the card. Use the set_sysclk API to
set the source clock.

- Lars

WARNING: multiple messages have this Message-ID (diff)
From: lars@metafoo.de (Lars-Peter Clausen)
To: linux-arm-kernel@lists.infradead.org
Subject: [alsa-devel] [PATCH v2 1/3] ASoC: atmel_ssc_dai: make option to choose clock
Date: Mon, 27 Jan 2014 08:06:23 +0100	[thread overview]
Message-ID: <52E6056F.2050008@metafoo.de> (raw)
In-Reply-To: <1390805726-1841-2-git-send-email-voice.shen@atmel.com>

On 01/27/2014 07:55 AM, Bo Shen wrote:
> When SSC works in slave mode, according to the hardware design, the
> clock can get from TK pin, also can get from RK pin. So, add one
> parameter to choose where the clock from.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
> Changes in v2: None
> 
>  sound/soc/atmel/atmel_ssc_dai.c | 16 ++++++++++++----
>  sound/soc/atmel/atmel_ssc_dai.h |  1 +
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
> index 8697ced..03eb0be 100644
> --- a/sound/soc/atmel/atmel_ssc_dai.c
> +++ b/sound/soc/atmel/atmel_ssc_dai.c
> @@ -340,6 +340,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	struct snd_soc_dai *dai)
>  {
>  	int id = dai->id;
> +	struct snd_soc_card *card = dai->card;
>  	struct atmel_ssc_info *ssc_p = &ssc_info[id];
>  	struct atmel_pcm_dma_params *dma_params;
>  	int dir, channels, bits;
> @@ -347,6 +348,9 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
>  	int start_event;
>  	int ret;
>  
> +	ssc_p->clk_from_rk_pin =
> +		((struct atmel_ssc_info *)(card->drvdata))->clk_from_rk_pin;

This is a layering violation. The DAI driver is not supposed to make any
assumptions what drvdata is attached to the card. Use the set_sysclk API to
set the source clock.

- Lars

  reply	other threads:[~2014-01-27  7:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  6:55 [PATCH v2 0/3] ASoC: atmel_ssc_dai: add option to choose clock Bo Shen
2014-01-27  6:55 ` Bo Shen
2014-01-27  6:55 ` Bo Shen
2014-01-27  6:55 ` [PATCH v2 1/3] ASoC: atmel_ssc_dai: make " Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  7:06   ` Lars-Peter Clausen [this message]
2014-01-27  7:06     ` [alsa-devel] " Lars-Peter Clausen
2014-01-27  7:06     ` Lars-Peter Clausen
2014-01-27  6:55 ` [PATCH v2 2/3] ASoC: atmel_wm8904: make it available " Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55 ` [PATCH v2 3/3] Binding: atmel-wm8904: add option " Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27  6:55   ` Bo Shen
2014-01-27 19:31   ` Mark Brown
2014-01-27 19:31     ` Mark Brown
2014-01-27 19:31     ` 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=52E6056F.2050008@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=plagnioj@jcrosoft.com \
    --cc=tiwai@suse.de \
    --cc=voice.shen@atmel.com \
    /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.