On Tue, Oct 13, 2015 at 09:01:06AM +0800, Shunqian Zheng wrote:Delete the dependency and add to SND_SOC_ALL_CODECS.
+config SND_SOC_INNO_RK3036There doesn't appear to be any build dependency here so can we have an
+ tristate "Inno codec driver for RK3036 SoC"
+ depends on ARCH_ROCKCHIP
+
|| COMPILE_TEST please and also add to SND_SOC_ALL_CODECS.
Removed.
+#define DEBUGPlease remove this for upstream.
Removed.
+static int rk3036_codec_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,Remove empty functions, if they can be empty they can just be omitted.
+ unsigned int fre, int dir)
+{
+ /* Nothing to be done here */
+ return 0;
+}
Make mute as a control.
+static int rk3036_codec_dai_digital_mute(struct snd_soc_dai *dai, int mute)Does the device actually need muting to avoid audio issues? If not it
+{
+ struct snd_soc_codec *codec = dai->codec;
+ unsigned int val = 0;
+
+ dev_dbg(codec->dev, "rk3036_codec dai mute : %d\n", mute);
+ if (mute)
+ val |= INNO_REG_09_HP_OUTR_MUTE_YES |
+ INNO_REG_09_HP_OUTL_MUTE_YES;
+ else
+ val |= INNO_REG_09_HP_OUTR_MUTE_NO |
+ INNO_REG_09_HP_OUTL_MUTE_NO;
looks like this is something that might be better made a user visible
control instead.
Move the part of setting precharge current to set_bias_level()
+static void rk3036_codec_power_off(struct snd_soc_codec *codec)I'd expect to see these be part of the set_bias_level() operation.
+{
+ struct inno_reg_val *reg_val;
+ int i;
+static void rk3036_codec_power_on(struct snd_soc_codec *codec)
+{
+ struct inno_reg_val *reg_val;
+ int i;
Use DAPM to manage the power up path.
+ dev_dbg(codec->dev, "rk3036_codec power on\n");This looks suspicious... why isn't the power up sequence managed via
+ /* set a big current for capacitor discharging. */
+ snd_soc_write(codec, INNO_REG_10, INNO_REG_10_MAX_CUR);
+ mdelay(10);
+ /* start precharge */
+ snd_soc_write(codec, INNO_REG_06, INNO_REG_06_DAC_PRECHARGE);
+ mdelay(100);
+
+ for (i = 0; i < ARRAY_SIZE(inno_codec_open_path); i++) {
+ reg_val = &inno_codec_open_path[i];
+ snd_soc_write(codec, reg_val->reg, reg_val->val);
+ mdelay(5);
+ }
DAPM?
Delete this functions.
+static struct regmap *rk3036_codec_get_regmap(struct device *dev)There's already dev_get_regmap().
+{
+ struct rk3036_codec_priv *priv = dev_get_drvdata(dev);
+
+ dev_dbg(dev, "rk3036_codec get regmap\n");
+ return priv->regmap;
+}
Use the devm_regmap_init_mmio().
+static int codec_reg_read(void *context, unsigned int reg, unsigned int *val)This looks like it's just regmap_mmio, why not just use that?
+{
+ struct rk3036_codec_priv *priv = context;
+ void __iomem *base = priv->base;
+
+ *val = readl(base + reg);
+ return 0;
+}
+static struct regmap_bus codec_regmap_bus = {
+ .reg_read = codec_reg_read,
+ .reg_write = codec_reg_write,
Define some macros for grf select.
+ ret = regmap_write(grf, 0x00140, BIT(16 + 10) | BIT(10));Can we have some defines for this rather than all the magic numbers?
+ if (ret != 0) {
Delete it.
+static void rk3036_codec_platform_shutdown(struct platform_device *pdev)If you use DAPM you shouldn't need to do anything here.
+{
+ /*TODO:*/
+}