From db7b36bbad6753f98173ac0763c3992dbccc2430 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Mon, 26 Jul 2010 09:59:15 +0300 Subject: [PATCH] --- yaml --- r: 206626 b: refs/heads/master c: b93cc9f19bade9e9ddd41958352168dc0d266f48 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/sound/sh_fsi.h | 2 - trunk/sound/soc/codecs/twl4030.c | 2 - trunk/sound/soc/sh/fsi.c | 70 +++++++------------------------- 4 files changed, 16 insertions(+), 60 deletions(-) diff --git a/[refs] b/[refs] index 832ee09652f7..2c3923b4d542 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3bc280708e7b9a84cc6307c1f9acca57e0fafaac +refs/heads/master: b93cc9f19bade9e9ddd41958352168dc0d266f48 diff --git a/trunk/include/sound/sh_fsi.h b/trunk/include/sound/sh_fsi.h index 9d51d6f35893..6ac71863c70f 100644 --- a/trunk/include/sound/sh_fsi.h +++ b/trunk/include/sound/sh_fsi.h @@ -64,8 +64,6 @@ #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/trunk/sound/soc/codecs/twl4030.c b/trunk/sound/soc/codecs/twl4030.c index bd557c2bcb8c..d401c597d38f 100644 --- a/trunk/sound/soc/codecs/twl4030.c +++ b/trunk/sound/soc/codecs/twl4030.c @@ -1432,11 +1432,9 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { TX2 Left/Right: either analog Left/Right or Digimic1 */ SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0, &twl4030_dapm_micpathtx1_control, micpath_event, - SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| SND_SOC_DAPM_POST_REG), SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0, &twl4030_dapm_micpathtx2_control, micpath_event, - SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| SND_SOC_DAPM_POST_REG), /* Analog input mixers for the capture amplifiers */ diff --git a/trunk/sound/soc/sh/fsi.c b/trunk/sound/soc/sh/fsi.c index 58c6bec642de..a1ce6089177c 100644 --- a/trunk/sound/soc/sh/fsi.c +++ b/trunk/sound/soc/sh/fsi.c @@ -30,11 +30,9 @@ #define DIDT 0x0020 #define DODT 0x0024 #define MUTE_ST 0x0028 -#define OUT_SEL 0x0030 -#define REG_END OUT_SEL +#define REG_END MUTE_ST + -#define A_MST_CTLR 0x0180 -#define B_MST_CTLR 0x01A0 #define CPU_INT_ST 0x01F4 #define CPU_IEMSK 0x01F8 #define CPU_IMSK 0x01FC @@ -45,7 +43,7 @@ #define CLK_RST 0x0210 #define SOFT_RST 0x0214 #define FIFO_SZ 0x0218 -#define MREG_START A_MST_CTLR +#define MREG_START CPU_INT_ST #define MREG_END FIFO_SZ /* DO_FMT */ @@ -56,7 +54,6 @@ #define CR_I2S (0x3 << 4) #define CR_TDM (0x4 << 4) #define CR_TDM_D (0x5 << 4) -#define CR_SPDIF 0x00100120 /* DOFF_CTL */ /* DIFF_CTL */ @@ -72,10 +69,6 @@ #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 @@ -120,8 +113,6 @@ struct fsi_priv { int period_len; int buffer_len; int periods; - - u32 mst_ctrl; }; struct fsi_core { @@ -401,29 +392,6 @@ static void fsi_irq_clear_status(struct fsi_priv *fsi) fsi_master_mask_set(master, master->core->int_st, data, 0); } -/************************************************************************ - - - 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); -} - /************************************************************************ @@ -703,7 +671,6 @@ 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; @@ -765,16 +732,6 @@ 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; @@ -846,6 +803,10 @@ 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; @@ -904,6 +865,7 @@ 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; @@ -1086,6 +1048,11 @@ 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"); @@ -1114,21 +1081,14 @@ 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->fsib.mst_ctrl = B_MST_CTLR; + master->core = (struct fsi_core *)id_entry->driver_data; + spin_lock_init(&master->lock); pm_runtime_enable(&pdev->dev); pm_runtime_resume(&pdev->dev);