All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Seungwhan Youn <sw.youn@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, alsa-devel@alsa-project.org,
	ben-linux@fluff.org, kgene.kim@samsung.com, lrg@slimlogic.co.uk,
	jassi.brar@samsung.com
Subject: Re: [PATCH 9/10] ASoC: SAMSUNG: Add S/PDIF CPU driver
Date: Mon, 4 Oct 2010 15:02:08 -0700	[thread overview]
Message-ID: <20101004220207.GA3545@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1286194397-19904-1-git-send-email-sw.youn@samsung.com>

On Mon, Oct 04, 2010 at 09:13:17PM +0900, Seungwhan Youn wrote:

> +static int spdif_set_sysclk(struct snd_soc_dai *cpu_dai,
> +				int clk_id, unsigned int freq, int dir)
> +{

If you save the clock rate here...

> +	case SND_SOC_SPDIF_MAIN_AUDIO_CLK:
> +		switch (div) {
> +		case 256:
> +			con |= CON_MCLKDIV_256FS;
> +			break;
> +		case 384:
> +			con |= CON_MCLKDIV_384FS;
> +			break;
> +		case 512:
> +			con |= CON_MCLKDIV_512FS;
> +			break;

...then you can calculate this dynamically at runtime in hw_params which
makes life easier for users.

> +/**
> + * struct samsung_spdif_info - Samsung S/PDIF Controller information
> + * @lock: Spin lock for S/PDIF.
> + * @dev: The parent device passed to use from the probe.
> + * @regs: The pointer to the device register block.
> + * @pclk: The peri-clock pointer for spdif master operation.
> + * @sclk: The source clock pointer for making sync signals.
> + * @save_clkcon: Backup clkcon reg. in suspend.
> + * @save_con: Backup con reg. in suspend.
> + * @save_cstas: Backup cstas reg. in suspend.
> + * @dma_playback: DMA information for playback channel.
> + */
> +struct samsung_spdif_info {
> +	spinlock_t	lock;

No need to have this in the headers.

> +/* Registers */
> +#define CLKCON				0x00
> +#define CON				0x04
> +#define BSTAS				0x08

These should all be namespaced or in the driver file to avoid collisoons
with other things - even if only used in this driver things like CON are
risky for collisions with normal kernel headers the driver needs.

WARNING: multiple messages have this Message-ID (diff)
From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/10] ASoC: SAMSUNG: Add S/PDIF CPU driver
Date: Mon, 4 Oct 2010 15:02:08 -0700	[thread overview]
Message-ID: <20101004220207.GA3545@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1286194397-19904-1-git-send-email-sw.youn@samsung.com>

On Mon, Oct 04, 2010 at 09:13:17PM +0900, Seungwhan Youn wrote:

> +static int spdif_set_sysclk(struct snd_soc_dai *cpu_dai,
> +				int clk_id, unsigned int freq, int dir)
> +{

If you save the clock rate here...

> +	case SND_SOC_SPDIF_MAIN_AUDIO_CLK:
> +		switch (div) {
> +		case 256:
> +			con |= CON_MCLKDIV_256FS;
> +			break;
> +		case 384:
> +			con |= CON_MCLKDIV_384FS;
> +			break;
> +		case 512:
> +			con |= CON_MCLKDIV_512FS;
> +			break;

...then you can calculate this dynamically at runtime in hw_params which
makes life easier for users.

> +/**
> + * struct samsung_spdif_info - Samsung S/PDIF Controller information
> + * @lock: Spin lock for S/PDIF.
> + * @dev: The parent device passed to use from the probe.
> + * @regs: The pointer to the device register block.
> + * @pclk: The peri-clock pointer for spdif master operation.
> + * @sclk: The source clock pointer for making sync signals.
> + * @save_clkcon: Backup clkcon reg. in suspend.
> + * @save_con: Backup con reg. in suspend.
> + * @save_cstas: Backup cstas reg. in suspend.
> + * @dma_playback: DMA information for playback channel.
> + */
> +struct samsung_spdif_info {
> +	spinlock_t	lock;

No need to have this in the headers.

> +/* Registers */
> +#define CLKCON				0x00
> +#define CON				0x04
> +#define BSTAS				0x08

These should all be namespaced or in the driver file to avoid collisoons
with other things - even if only used in this driver things like CON are
risky for collisions with normal kernel headers the driver needs.

  reply	other threads:[~2010-10-04 22:02 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 11:25 [PATCH 0/10] Add S/PDIF common driver for Samsung SoCs Seungwhan Youn
2010-10-04 11:25 ` Seungwhan Youn
2010-10-04 11:31 ` [PATCH 1/10] ARM: S5PC100: Add S/PDIF platform device Seungwhan Youn
2010-10-04 11:31   ` Seungwhan Youn
2010-10-04 18:23   ` Mark Brown
2010-10-04 18:23     ` Mark Brown
2010-10-08  9:54   ` Kukjin Kim
2010-10-08  9:54     ` Kukjin Kim
2010-10-04 11:39 ` [PATCH 2/10] ARM: S5PC100: Modify SCLK_AUDIO{0,1,2} clock as sysclks Seungwhan Youn
2010-10-04 11:39   ` Seungwhan Youn
2010-10-04 18:28   ` Mark Brown
2010-10-04 18:28     ` Mark Brown
2010-10-08  9:57   ` Kukjin Kim
2010-10-08  9:57     ` Kukjin Kim
2010-10-04 11:42 ` [PATCH 3/10] ARM: S5PC100: Add SCLK_SPDIF clock Seungwhan Youn
2010-10-04 11:42   ` Seungwhan Youn
2010-10-04 18:30   ` Mark Brown
2010-10-04 18:30     ` Mark Brown
2010-10-05  0:29     ` [alsa-devel] " Jassi Brar
2010-10-05  0:29       ` Jassi Brar
2010-10-08 10:11   ` Kukjin Kim
2010-10-08 10:11     ` Kukjin Kim
2010-10-08 10:45     ` Seungwhan Youn
2010-10-08 10:45       ` Seungwhan Youn
2010-10-08 10:51       ` Kukjin Kim
2010-10-08 10:51         ` Kukjin Kim
2010-10-04 11:46 ` [PATCH 4/10] ARM: S5PV210: Add S/PDIF platform device Seungwhan Youn
2010-10-04 11:46   ` Seungwhan Youn
2010-10-04 18:38   ` Mark Brown
2010-10-04 18:38     ` Mark Brown
2010-10-08 10:14   ` Kukjin Kim
2010-10-08 10:14     ` Kukjin Kim
2010-10-04 11:52 ` [PATCH 5/10] ARM: S5PV210: Add SCLK_SPDIF clock Seungwhan Youn
2010-10-04 11:52   ` Seungwhan Youn
2010-10-04 18:39   ` Mark Brown
2010-10-04 18:39     ` Mark Brown
2010-10-05  0:30     ` [alsa-devel] " Jassi Brar
2010-10-05  0:30       ` Jassi Brar
2010-10-08 10:16   ` Kukjin Kim
2010-10-08 10:16     ` Kukjin Kim
2010-10-08 10:51     ` Seungwhan Youn
2010-10-08 10:51       ` Seungwhan Youn
2010-10-04 11:57 ` [PATCH 6/10] ARM: S5PV210: Add audio clocks as sysclk Seungwhan Youn
2010-10-04 11:57   ` Seungwhan Youn
2010-10-04 18:42   ` Mark Brown
2010-10-04 18:42     ` Mark Brown
2010-10-08 10:18   ` Kukjin Kim
2010-10-08 10:18     ` Kukjin Kim
2010-10-04 12:05 ` [PATCH 7/10] ARM: S5PV210: Fix wrong EPLL rate getting on setup clocks Seungwhan Youn
2010-10-04 12:05   ` Seungwhan Youn
2010-10-08 10:37   ` Kukjin Kim
2010-10-08 10:37     ` Kukjin Kim
2010-10-08 10:55     ` Seungwhan Youn
2010-10-08 10:55       ` Seungwhan Youn
2010-10-04 12:07 ` [PATCH 8/10] ARM: S5PV210: Add EPLL clock operations Seungwhan Youn
2010-10-04 12:07   ` Seungwhan Youn
2010-10-08 10:29   ` Kukjin Kim
2010-10-08 10:29     ` Kukjin Kim
2010-10-08 10:53     ` Seungwhan Youn
2010-10-08 10:53       ` Seungwhan Youn
2010-10-04 12:13 ` [PATCH 9/10] ASoC: SAMSUNG: Add S/PDIF CPU driver Seungwhan Youn
2010-10-04 12:13   ` Seungwhan Youn
2010-10-04 22:02   ` Mark Brown [this message]
2010-10-04 22:02     ` Mark Brown
2010-10-05  2:08     ` Seungwhan Youn
2010-10-05  2:08       ` Seungwhan Youn
2010-10-04 12:16 ` [PATCH 10/10] ASoC: SAMSUNG: Add Machine driver for S/PDIF PCM audio Seungwhan Youn
2010-10-04 12:16   ` Seungwhan Youn
2010-10-04 22:42   ` Mark Brown
2010-10-04 22:42     ` Mark Brown
2010-10-05  1:10     ` Jassi Brar
2010-10-05  1:10       ` [alsa-devel] " Jassi Brar
2010-10-05  2:19       ` Jassi Brar
2010-10-05  2:19         ` Jassi Brar
2010-10-05  4:43         ` Mark Brown
2010-10-05  4:43           ` Mark Brown
2010-10-05  5:39           ` Jassi Brar
2010-10-05  5:39             ` Jassi Brar
2010-10-05  5:59             ` Mark Brown
2010-10-05  5:59               ` Mark Brown
2010-10-05  7:09               ` Jassi Brar
2010-10-05  7:09                 ` [alsa-devel] " Jassi Brar
2010-10-05  7:39                 ` Seungwhan Youn
2010-10-05  7:39                   ` [alsa-devel] " Seungwhan Youn
2010-10-06  6:34                   ` Kukjin Kim
2010-10-06  6:34                     ` Kukjin Kim
2010-10-07  1:33                     ` Seungwhan Youn
2010-10-07  1:33                       ` Seungwhan Youn
2010-10-08  9:07                       ` Seungwhan Youn
2010-10-08  9:07                         ` Seungwhan Youn
2010-10-08  9:48                         ` Kukjin Kim
2010-10-08  9:48                           ` Kukjin Kim
2010-10-09  1:52                         ` Jassi Brar
2010-10-09  1:52                           ` [alsa-devel] " Jassi Brar
2010-10-11 10:47                           ` Mark Brown
2010-10-11 10:47                             ` Mark Brown
2010-10-12  1:27                             ` Jassi Brar
2010-10-12  1:27                               ` Jassi Brar
2010-10-12  3:25                               ` Seungwhan Youn
2010-10-12  3:25                                 ` Seungwhan Youn
2010-10-05 16:54                 ` Mark Brown
2010-10-05 16:54                   ` [alsa-devel] " Mark Brown
2010-10-04 13:35 ` [alsa-devel] [PATCH 0/10] Add S/PDIF common driver for Samsung SoCs Jassi Brar
2010-10-04 13:35   ` Jassi Brar

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=20101004220207.GA3545@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=ben-linux@fluff.org \
    --cc=jassi.brar@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=sw.youn@samsung.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.