int i;
snd_soc_write(codec, RK616_RESET, 0xfc);
-
mdelay(10);
-
snd_soc_write(codec, RK616_RESET, 0x43);
+ mdelay(10);
snd_soc_write(codec, RK616_SINGNAL_ZC_CTL1, 0x3f);
snd_soc_write(codec, RK616_SINGNAL_ZC_CTL2, 0xff);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
+ snd_soc_update_bits(codec, RK616_DAC_CTL,
+ RK616_DACL_INIT_MASK, 0);
snd_soc_update_bits(codec, RK616_DAC_CTL,
RK616_DACL_PWRD | RK616_DACL_CLK_PWRD |
RK616_DACL_INIT_MASK, 0);
switch (event) {
case SND_SOC_DAPM_POST_PMU:
+ snd_soc_update_bits(codec, RK616_DAC_CTL,
+ RK616_DACR_INIT_MASK, 0);
snd_soc_update_bits(codec, RK616_DAC_CTL,
RK616_DACR_PWRD | RK616_DACR_CLK_PWRD |
RK616_DACR_INIT_MASK, 0);
snd_soc_write(codec, power_up_list[i].reg, power_up_list[i].value);
}
- if (rk616_priv->spk_ctl_gpio != 0)
- gpio_set_value(rk616_priv->spk_ctl_gpio, 1);
+ if (rk616_priv->spk_ctl_gpio != INVALID_GPIO)
+ gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_HIGH);
return 0;
}
printk("rk616_codec_power_down\n");
- if (rk616_priv->spk_ctl_gpio != 0)
- gpio_set_value(rk616_priv->spk_ctl_gpio, 0);
+ if (rk616_priv->spk_ctl_gpio != INVALID_GPIO)
+ gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_LOW);
rk616_reset(codec);
}
}
}
-
}
#endif
if (rk616_mfd && rk616_mfd->pdata && rk616_mfd->pdata->spk_ctl_gpio) {
gpio_request(rk616_mfd->pdata->spk_ctl_gpio, NULL);
- gpio_direction_output(rk616_mfd->pdata->spk_ctl_gpio, 0);
+ gpio_direction_output(rk616_mfd->pdata->spk_ctl_gpio, GPIO_LOW);
rk616->spk_ctl_gpio = rk616_mfd->pdata->spk_ctl_gpio;
} else {
printk("rk616_probe : rk616 or pdata or spk_ctl_gpio is NULL!\n");
- rk616->spk_ctl_gpio = 0;
+ rk616->spk_ctl_gpio = INVALID_GPIO;
}
#ifdef RK616_FOR_MID
/* power down chip */
static int rk616_remove(struct snd_soc_codec *codec)
{
- rk616_set_bias_level(codec, SND_SOC_BIAS_OFF);
+ DBG("%s\n", __func__);
+
+#ifdef RK616_FOR_MID
+ cancel_delayed_work_sync(&delayed_work);
+
+ if (rk616_codec_work_type != RK616_CODEC_WORK_NULL) {
+ rk616_codec_work_type = RK616_CODEC_WORK_NULL;
+ rk616_codec_power_down();
+ }
+#else
+ snd_soc_write(codec, RK616_RESET, 0xfc);
+ mdelay(10);
+ snd_soc_write(codec, RK616_RESET, 0x3);
+ mdelay(10);
+#endif
if (rk616_priv)
kfree(rk616_priv);
return 0;
}
+void rk616_platform_shutdown(struct platform_device *pdev)
+{
+#ifdef RK616_FOR_MID
+ DBG("%s\n", __func__);
+
+ cancel_delayed_work_sync(&delayed_work);
+
+ if (rk616_codec_work_type != RK616_CODEC_WORK_NULL) {
+ rk616_codec_work_type = RK616_CODEC_WORK_NULL;
+ rk616_codec_power_down();
+ }
+#else
+ struct snd_soc_codec *codec = rk616_priv->codec;
+
+ if (!rk616_priv || !rk616_priv->codec) {
+ printk("rk616_hw_write : %s %s\n", rk616_priv ? "" : "rk616_priv is NULL",
+ rk616_priv->codec ? "" : "rk616_priv->codec is NULL");
+ return;
+ }
+
+ DBG("%s\n", __func__);
+
+ snd_soc_write(codec, RK616_RESET, 0xfc);
+ mdelay(10);
+ snd_soc_write(codec, RK616_RESET, 0x3);
+ mdelay(10);
+#endif
+}
+
static struct platform_driver rk616_codec_driver = {
.driver = {
.name = "rk616-codec",
},
.probe = rk616_platform_probe,
.remove = __devexit_p(rk616_platform_remove),
+ .shutdown = rk616_platform_shutdown,
};