All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: fsi: SPDIF support
@ 2010-07-28  2:56 Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 1/3] ASoC: fsi: remove unnecessary clock processing Kuninori Morimoto
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2010-07-28  2:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood


Dear Mark, Liam

These are FSI driver patches

Kuninori Morimoto (3):
      ASoC: fsi: remove unnecessary clock processing
      ASoC: fsi: remove device id check
      ASoC: fsi: Add new funtion for SPDIF

These patches are based on Mark's "for-2.6.36" tree.
These are needed for FSI2 device and HDMI support.

Best regards
--
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/3] ASoC: fsi: remove unnecessary clock processing
  2010-07-28  2:56 [PATCH 0/3] ASoC: fsi: SPDIF support Kuninori Morimoto
@ 2010-07-28  2:57 ` Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 2/3] ASoC: fsi: remove device id check Kuninori Morimoto
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2010-07-28  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index a1ce608..24c378c 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -803,10 +803,6 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
 	if (!set_rate)
 		return -EIO;
 
-	/* clock stop */
-	pm_runtime_put_sync(dai->dev);
-	fsi_clk_ctrl(fsi, 0);
-
 	ret = set_rate(fsi_is_port_a(fsi), params_rate(params));
 	if (ret > 0) {
 		u32 data = 0;
@@ -865,7 +861,6 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
 		fsi_clk_ctrl(fsi, 1);
 		ret = 0;
 	}
-	pm_runtime_get_sync(dai->dev);
 
 	return ret;
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] ASoC: fsi: remove device id check
  2010-07-28  2:56 [PATCH 0/3] ASoC: fsi: SPDIF support Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 1/3] ASoC: fsi: remove unnecessary clock processing Kuninori Morimoto
@ 2010-07-28  2:57 ` Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF Kuninori Morimoto
  2010-07-29 17:29 ` [PATCH 0/3] ASoC: fsi: SPDIF support Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2010-07-28  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood

Current FSI driver id is not only 0

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/fsi.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 24c378c..4b09b3d 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1043,11 +1043,6 @@ static int fsi_probe(struct platform_device *pdev)
 	unsigned int irq;
 	int ret;
 
-	if (0 != pdev->id) {
-		dev_err(&pdev->dev, "current fsi support id 0 only now\n");
-		return -ENODEV;
-	}
-
 	id_entry = pdev->id_entry;
 	if (!id_entry) {
 		dev_err(&pdev->dev, "unknown fsi device\n");
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF
  2010-07-28  2:56 [PATCH 0/3] ASoC: fsi: SPDIF support Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 1/3] ASoC: fsi: remove unnecessary clock processing Kuninori Morimoto
  2010-07-28  2:57 ` [PATCH 2/3] ASoC: fsi: remove device id check Kuninori Morimoto
@ 2010-07-28  2:57 ` Kuninori Morimoto
  2010-07-28 10:16   ` Liam Girdwood
  2010-07-29 17:29 ` [PATCH 0/3] ASoC: fsi: SPDIF support Mark Brown
  3 siblings, 1 reply; 7+ messages in thread
From: Kuninori Morimoto @ 2010-07-28  2:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/sh_fsi.h |    2 +
 sound/soc/sh/fsi.c     |   60 ++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 6ac7186..9d51d6f 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -64,6 +64,8 @@
 #define SH_FSI_FMT_I2S		3
 #define SH_FSI_FMT_TDM		4
 #define SH_FSI_FMT_TDM_DELAY	5
+#define SH_FSI_FMT_SPDIF	6
+
 
 #define SH_FSI_IFMT_TDM_CH(x) \
 	(SH_FSI_IFMT(TDM)	| SH_FSI_SET_CH_I(x))
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 4b09b3d..0bcdfcc 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -30,9 +30,11 @@
 #define DIDT		0x0020
 #define DODT		0x0024
 #define MUTE_ST		0x0028
-#define REG_END		MUTE_ST
-
+#define OUT_SEL		0x0030
+#define REG_END		OUT_SEL
 
+#define A_MST_CTLR	0x0180
+#define B_MST_CTLR	0x01A0
 #define CPU_INT_ST	0x01F4
 #define CPU_IEMSK	0x01F8
 #define CPU_IMSK	0x01FC
@@ -43,7 +45,7 @@
 #define CLK_RST		0x0210
 #define SOFT_RST	0x0214
 #define FIFO_SZ		0x0218
-#define MREG_START	CPU_INT_ST
+#define MREG_START	A_MST_CTLR
 #define MREG_END	FIFO_SZ
 
 /* DO_FMT */
@@ -54,6 +56,7 @@
 #define CR_I2S		(0x3 << 4)
 #define CR_TDM		(0x4 << 4)
 #define CR_TDM_D	(0x5 << 4)
+#define CR_SPDIF	(0x00100120)
 
 /* DOFF_CTL */
 /* DIFF_CTL */
@@ -69,6 +72,10 @@
 #define ACKMD_MASK	0x00007000
 #define BPFMD_MASK	0x00000700
 
+/* A/B MST_CTLR */
+#define BP	(1 << 4)	/* Fix the signal of Biphase output */
+#define SE	(1 << 0)	/* Fix the master clock */
+
 /* CLK_RST */
 #define B_CLK		0x00000010
 #define A_CLK		0x00000001
@@ -113,6 +120,8 @@ struct fsi_priv {
 	int period_len;
 	int buffer_len;
 	int periods;
+
+	u32 mst_ctrl;
 };
 
 struct fsi_core {
@@ -395,6 +404,29 @@ static void fsi_irq_clear_status(struct fsi_priv *fsi)
 /************************************************************************
 
 
+		SPDIF master clock function
+
+These functions are used later FSI2
+************************************************************************/
+static void fsi_spdif_clk_ctrl(struct fsi_priv *fsi, int enable)
+{
+	struct fsi_master *master = fsi_get_master(fsi);
+	u32 val = BP | SE;
+
+	if (master->core->ver < 2) {
+		pr_err("fsi: register access err (%s)\n", __func__);
+		return;
+	}
+
+	if (enable)
+		fsi_master_mask_set(master, fsi->mst_ctrl, val, val);
+	else
+		fsi_master_mask_set(master, fsi->mst_ctrl, val, 0);
+}
+
+/************************************************************************
+
+
 		ctrl function
 
 
@@ -671,6 +703,7 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
 {
 	struct fsi_priv *fsi = fsi_get_priv(substream);
 	u32 flags = fsi_get_info_flags(fsi);
+	struct fsi_master *master = fsi_get_master(fsi);
 	u32 fmt;
 	u32 reg;
 	u32 data;
@@ -732,6 +765,16 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
 			SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
 		data = CR_TDM_D | (fsi->chan - 1);
 		break;
+	case SH_FSI_FMT_SPDIF:
+		if (master->core->ver < 2) {
+			dev_err(dai->dev, "This FSI can not use SPDIF\n");
+			return -EINVAL;
+		}
+		data = CR_SPDIF;
+		fsi->chan = 2;
+		fsi_spdif_clk_ctrl(fsi, 1);
+		fsi_reg_mask_set(fsi, OUT_SEL, 0x0010, 0x0010);
+		break;
 	default:
 		dev_err(dai->dev, "unknown format.\n");
 		return -EINVAL;
@@ -1071,14 +1114,21 @@ static int fsi_probe(struct platform_device *pdev)
 		goto exit_kfree;
 	}
 
+	/* master setting */
 	master->irq		= irq;
 	master->info		= pdev->dev.platform_data;
+	master->core		= (struct fsi_core *)id_entry->driver_data;
+	spin_lock_init(&master->lock);
+
+	/* FSI A setting */
 	master->fsia.base	= master->base;
 	master->fsia.master	= master;
+	master->fsia.mst_ctrl	= A_MST_CTLR;
+
+	/* FSI B setting */
 	master->fsib.base	= master->base + 0x40;
 	master->fsib.master	= master;
-	master->core		= (struct fsi_core *)id_entry->driver_data;
-	spin_lock_init(&master->lock);
+	master->fsib.mst_ctrl	= B_MST_CTLR;
 
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_resume(&pdev->dev);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF
  2010-07-28  2:57 ` [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF Kuninori Morimoto
@ 2010-07-28 10:16   ` Liam Girdwood
  2010-07-29  7:48     ` [PATCH 3/3 v2] " Kuninori Morimoto
  0 siblings, 1 reply; 7+ messages in thread
From: Liam Girdwood @ 2010-07-28 10:16 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Mark Brown

On Wed, 2010-07-28 at 11:57 +0900, Kuninori Morimoto wrote:
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  include/sound/sh_fsi.h |    2 +
>  sound/soc/sh/fsi.c     |   60 ++++++++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 57 insertions(+), 5 deletions(-)
> 
> diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
> index 6ac7186..9d51d6f 100644
> --- a/include/sound/sh_fsi.h
> +++ b/include/sound/sh_fsi.h
> @@ -64,6 +64,8 @@
>  #define SH_FSI_FMT_I2S		3
>  #define SH_FSI_FMT_TDM		4
>  #define SH_FSI_FMT_TDM_DELAY	5
> +#define SH_FSI_FMT_SPDIF	6
> +
>  
>  #define SH_FSI_IFMT_TDM_CH(x) \
>  	(SH_FSI_IFMT(TDM)	| SH_FSI_SET_CH_I(x))
> diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
> index 4b09b3d..0bcdfcc 100644
> --- a/sound/soc/sh/fsi.c
> +++ b/sound/soc/sh/fsi.c
> @@ -30,9 +30,11 @@
>  #define DIDT		0x0020
>  #define DODT		0x0024
>  #define MUTE_ST		0x0028
> -#define REG_END		MUTE_ST
> -
> +#define OUT_SEL		0x0030
> +#define REG_END		OUT_SEL
>  
> +#define A_MST_CTLR	0x0180
> +#define B_MST_CTLR	0x01A0
>  #define CPU_INT_ST	0x01F4
>  #define CPU_IEMSK	0x01F8
>  #define CPU_IMSK	0x01FC
> @@ -43,7 +45,7 @@
>  #define CLK_RST		0x0210
>  #define SOFT_RST	0x0214
>  #define FIFO_SZ		0x0218
> -#define MREG_START	CPU_INT_ST
> +#define MREG_START	A_MST_CTLR
>  #define MREG_END	FIFO_SZ
>  
>  /* DO_FMT */
> @@ -54,6 +56,7 @@
>  #define CR_I2S		(0x3 << 4)
>  #define CR_TDM		(0x4 << 4)
>  #define CR_TDM_D	(0x5 << 4)
> +#define CR_SPDIF	(0x00100120)

Parenthesis not required here.


All Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/3 v2] ASoC: fsi: Add new funtion for SPDIF
  2010-07-28 10:16   ` Liam Girdwood
@ 2010-07-29  7:48     ` Kuninori Morimoto
  0 siblings, 0 replies; 7+ messages in thread
From: Kuninori Morimoto @ 2010-07-29  7:48 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: Linux-ALSA, Mark Brown

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

o remove parenthesis from CR_SPDIF

 include/sound/sh_fsi.h |    2 +
 sound/soc/sh/fsi.c     |   60 ++++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 6ac7186..9d51d6f 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -64,6 +64,8 @@
 #define SH_FSI_FMT_I2S		3
 #define SH_FSI_FMT_TDM		4
 #define SH_FSI_FMT_TDM_DELAY	5
+#define SH_FSI_FMT_SPDIF	6
+
 
 #define SH_FSI_IFMT_TDM_CH(x) \
 	(SH_FSI_IFMT(TDM)	| SH_FSI_SET_CH_I(x))
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 4b09b3d..58c6bec 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -30,9 +30,11 @@
 #define DIDT		0x0020
 #define DODT		0x0024
 #define MUTE_ST		0x0028
-#define REG_END		MUTE_ST
-
+#define OUT_SEL		0x0030
+#define REG_END		OUT_SEL
 
+#define A_MST_CTLR	0x0180
+#define B_MST_CTLR	0x01A0
 #define CPU_INT_ST	0x01F4
 #define CPU_IEMSK	0x01F8
 #define CPU_IMSK	0x01FC
@@ -43,7 +45,7 @@
 #define CLK_RST		0x0210
 #define SOFT_RST	0x0214
 #define FIFO_SZ		0x0218
-#define MREG_START	CPU_INT_ST
+#define MREG_START	A_MST_CTLR
 #define MREG_END	FIFO_SZ
 
 /* DO_FMT */
@@ -54,6 +56,7 @@
 #define CR_I2S		(0x3 << 4)
 #define CR_TDM		(0x4 << 4)
 #define CR_TDM_D	(0x5 << 4)
+#define CR_SPDIF	0x00100120
 
 /* DOFF_CTL */
 /* DIFF_CTL */
@@ -69,6 +72,10 @@
 #define ACKMD_MASK	0x00007000
 #define BPFMD_MASK	0x00000700
 
+/* A/B MST_CTLR */
+#define BP	(1 << 4)	/* Fix the signal of Biphase output */
+#define SE	(1 << 0)	/* Fix the master clock */
+
 /* CLK_RST */
 #define B_CLK		0x00000010
 #define A_CLK		0x00000001
@@ -113,6 +120,8 @@ struct fsi_priv {
 	int period_len;
 	int buffer_len;
 	int periods;
+
+	u32 mst_ctrl;
 };
 
 struct fsi_core {
@@ -395,6 +404,29 @@ static void fsi_irq_clear_status(struct fsi_priv *fsi)
 /************************************************************************
 
 
+		SPDIF master clock function
+
+These functions are used later FSI2
+************************************************************************/
+static void fsi_spdif_clk_ctrl(struct fsi_priv *fsi, int enable)
+{
+	struct fsi_master *master = fsi_get_master(fsi);
+	u32 val = BP | SE;
+
+	if (master->core->ver < 2) {
+		pr_err("fsi: register access err (%s)\n", __func__);
+		return;
+	}
+
+	if (enable)
+		fsi_master_mask_set(master, fsi->mst_ctrl, val, val);
+	else
+		fsi_master_mask_set(master, fsi->mst_ctrl, val, 0);
+}
+
+/************************************************************************
+
+
 		ctrl function
 
 
@@ -671,6 +703,7 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
 {
 	struct fsi_priv *fsi = fsi_get_priv(substream);
 	u32 flags = fsi_get_info_flags(fsi);
+	struct fsi_master *master = fsi_get_master(fsi);
 	u32 fmt;
 	u32 reg;
 	u32 data;
@@ -732,6 +765,16 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
 			SH_FSI_GET_CH_O(flags) : SH_FSI_GET_CH_I(flags);
 		data = CR_TDM_D | (fsi->chan - 1);
 		break;
+	case SH_FSI_FMT_SPDIF:
+		if (master->core->ver < 2) {
+			dev_err(dai->dev, "This FSI can not use SPDIF\n");
+			return -EINVAL;
+		}
+		data = CR_SPDIF;
+		fsi->chan = 2;
+		fsi_spdif_clk_ctrl(fsi, 1);
+		fsi_reg_mask_set(fsi, OUT_SEL, 0x0010, 0x0010);
+		break;
 	default:
 		dev_err(dai->dev, "unknown format.\n");
 		return -EINVAL;
@@ -1071,14 +1114,21 @@ static int fsi_probe(struct platform_device *pdev)
 		goto exit_kfree;
 	}
 
+	/* master setting */
 	master->irq		= irq;
 	master->info		= pdev->dev.platform_data;
+	master->core		= (struct fsi_core *)id_entry->driver_data;
+	spin_lock_init(&master->lock);
+
+	/* FSI A setting */
 	master->fsia.base	= master->base;
 	master->fsia.master	= master;
+	master->fsia.mst_ctrl	= A_MST_CTLR;
+
+	/* FSI B setting */
 	master->fsib.base	= master->base + 0x40;
 	master->fsib.master	= master;
-	master->core		= (struct fsi_core *)id_entry->driver_data;
-	spin_lock_init(&master->lock);
+	master->fsib.mst_ctrl	= B_MST_CTLR;
 
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_resume(&pdev->dev);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/3] ASoC: fsi: SPDIF support
  2010-07-28  2:56 [PATCH 0/3] ASoC: fsi: SPDIF support Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2010-07-28  2:57 ` [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF Kuninori Morimoto
@ 2010-07-29 17:29 ` Mark Brown
  3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2010-07-29 17:29 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood

On Wed, Jul 28, 2010 at 11:56:44AM +0900, Kuninori Morimoto wrote:
> 
> Dear Mark, Liam
> 
> These are FSI driver patches
> 
> Kuninori Morimoto (3):
>       ASoC: fsi: remove unnecessary clock processing
>       ASoC: fsi: remove device id check
>       ASoC: fsi: Add new funtion for SPDIF

All applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-29 17:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-28  2:56 [PATCH 0/3] ASoC: fsi: SPDIF support Kuninori Morimoto
2010-07-28  2:57 ` [PATCH 1/3] ASoC: fsi: remove unnecessary clock processing Kuninori Morimoto
2010-07-28  2:57 ` [PATCH 2/3] ASoC: fsi: remove device id check Kuninori Morimoto
2010-07-28  2:57 ` [PATCH 3/3] ASoC: fsi: Add new funtion for SPDIF Kuninori Morimoto
2010-07-28 10:16   ` Liam Girdwood
2010-07-29  7:48     ` [PATCH 3/3 v2] " Kuninori Morimoto
2010-07-29 17:29 ` [PATCH 0/3] ASoC: fsi: SPDIF support Mark Brown

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.