20 Dec
2011
20 Dec
'11
12:45 p.m.
On Tue, Dec 20, 2011 at 11:45:43AM +0900, Tomoya MORINAGA wrote:
+{
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- unsigned int clk = 0;
- int ret = 0;
- int bclkfs;
- int mclkfs;
- int rate = params_rate(hw_params);
The coding style here is really odd, looks like you're mixing declarations and code.
- default:
pr_err("%s: Failed not support format\n", __func__);
return -1;
break;
Return sensible error codes and there's no reason for the break after the return.
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS0, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS1, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS2, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS3, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS4, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_BCLKFS5, bclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS0, mclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS1, mclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS2, mclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS3, mclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS4, mclkfs);
- if (ret < 0)
return ret;
- ret = snd_soc_dai_set_clkdiv(cpu_dai, ML7213IOH_MCLKFS5, mclkfs);
- if (ret < 0)
return ret;
This looks like the CODEC driver ought to be working these things out for itself rather than having every machine using the device know about these dividers.
You're also still missing the drivers for the CPU...