| .. | .. |
|---|
| 286 | 286 | {RK817_CODEC_AREF_RTCFG1, 0x40}, |
|---|
| 287 | 287 | {RK817_CODEC_DDAC_POPD_DACST, 0x02}, |
|---|
| 288 | 288 | /* APLL */ |
|---|
| 289 | | - {RK817_CODEC_APLL_CFG0, 0x04}, |
|---|
| 289 | + /* {RK817_CODEC_APLL_CFG0, 0x04}, */ |
|---|
| 290 | 290 | {RK817_CODEC_APLL_CFG1, 0x58}, |
|---|
| 291 | 291 | {RK817_CODEC_APLL_CFG2, 0x2d}, |
|---|
| 292 | | - {RK817_CODEC_APLL_CFG4, 0xa5}, |
|---|
| 292 | + /* {RK817_CODEC_APLL_CFG4, 0xa5}, */ |
|---|
| 293 | 293 | {RK817_CODEC_APLL_CFG5, 0x00}, |
|---|
| 294 | 294 | |
|---|
| 295 | 295 | {RK817_CODEC_DI2S_RXCMD_TSD, 0x00}, |
|---|
| .. | .. |
|---|
| 324 | 324 | {RK817_CODEC_AREF_RTCFG1, 0x40}, |
|---|
| 325 | 325 | {RK817_CODEC_DADC_SR_ACL0, 0x02}, |
|---|
| 326 | 326 | /* {RK817_CODEC_DTOP_DIGEN_CLKE, 0xff}, */ |
|---|
| 327 | | - {RK817_CODEC_APLL_CFG0, 0x04}, |
|---|
| 327 | + /* {RK817_CODEC_APLL_CFG0, 0x04}, */ |
|---|
| 328 | 328 | {RK817_CODEC_APLL_CFG1, 0x58}, |
|---|
| 329 | 329 | {RK817_CODEC_APLL_CFG2, 0x2d}, |
|---|
| 330 | | - {RK817_CODEC_APLL_CFG4, 0xa5}, |
|---|
| 330 | + /* {RK817_CODEC_APLL_CFG4, 0xa5}, */ |
|---|
| 331 | 331 | {RK817_CODEC_APLL_CFG5, 0x00}, |
|---|
| 332 | 332 | |
|---|
| 333 | 333 | /*{RK817_CODEC_DI2S_RXCMD_TSD, 0x00},*/ |
|---|
| .. | .. |
|---|
| 378 | 378 | playback_power_up_list[i].value); |
|---|
| 379 | 379 | } |
|---|
| 380 | 380 | |
|---|
| 381 | | - /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */ |
|---|
| 381 | + /* configure APLL CFG0/4 */ |
|---|
| 382 | 382 | if (rk817->chip_ver <= 0x4) { |
|---|
| 383 | 383 | DBG("%s (%d): SMIC TudorAG and previous versions\n", |
|---|
| 384 | 384 | __func__, __LINE__); |
|---|
| 385 | 385 | snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c); |
|---|
| 386 | 386 | snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95); |
|---|
| 387 | + } else { |
|---|
| 388 | + DBG("%s: SMIC TudorAG version later\n", __func__); |
|---|
| 389 | + snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04); |
|---|
| 390 | + snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5); |
|---|
| 387 | 391 | } |
|---|
| 388 | 392 | |
|---|
| 389 | 393 | snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, |
|---|
| .. | .. |
|---|
| 405 | 409 | capture_power_up_list[i].value); |
|---|
| 406 | 410 | } |
|---|
| 407 | 411 | |
|---|
| 408 | | - /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */ |
|---|
| 412 | + /* configure APLL CFG0/4 */ |
|---|
| 409 | 413 | if (rk817->chip_ver <= 0x4) { |
|---|
| 410 | 414 | DBG("%s (%d): SMIC TudorAG and previous versions\n", |
|---|
| 411 | 415 | __func__, __LINE__); |
|---|
| 412 | 416 | snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c); |
|---|
| 413 | 417 | snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95); |
|---|
| 418 | + } else { |
|---|
| 419 | + DBG("%s: SMIC TudorAG version later\n", __func__); |
|---|
| 420 | + snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04); |
|---|
| 421 | + snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5); |
|---|
| 414 | 422 | } |
|---|
| 415 | 423 | |
|---|
| 416 | 424 | snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE, |
|---|
| .. | .. |
|---|
| 1026 | 1034 | return 0; |
|---|
| 1027 | 1035 | } |
|---|
| 1028 | 1036 | |
|---|
| 1029 | | -static int rk817_digital_mute(struct snd_soc_dai *dai, int mute) |
|---|
| 1037 | +static int rk817_digital_mute(struct snd_soc_dai *dai, int mute, int stream) |
|---|
| 1030 | 1038 | { |
|---|
| 1031 | 1039 | struct snd_soc_component *component = dai->component; |
|---|
| 1032 | 1040 | struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); |
|---|
| .. | .. |
|---|
| 1140 | 1148 | .hw_params = rk817_hw_params, |
|---|
| 1141 | 1149 | .set_fmt = rk817_set_dai_fmt, |
|---|
| 1142 | 1150 | .set_sysclk = rk817_set_dai_sysclk, |
|---|
| 1143 | | - .digital_mute = rk817_digital_mute, |
|---|
| 1151 | + .mute_stream = rk817_digital_mute, |
|---|
| 1144 | 1152 | .shutdown = rk817_codec_shutdown, |
|---|
| 1153 | + .no_capture_mute = 1, |
|---|
| 1145 | 1154 | }; |
|---|
| 1146 | 1155 | |
|---|
| 1147 | 1156 | static struct snd_soc_dai_driver rk817_dai[] = { |
|---|
| .. | .. |
|---|
| 1224 | 1233 | rk817->playback_path = OFF; |
|---|
| 1225 | 1234 | rk817->capture_path = MIC_OFF; |
|---|
| 1226 | 1235 | |
|---|
| 1227 | | - chip_name = snd_soc_component_read32(component, RK817_PMIC_CHIP_NAME); |
|---|
| 1228 | | - chip_ver = snd_soc_component_read32(component, RK817_PMIC_CHIP_VER); |
|---|
| 1236 | + chip_name = snd_soc_component_read(component, RK817_PMIC_CHIP_NAME); |
|---|
| 1237 | + chip_ver = snd_soc_component_read(component, RK817_PMIC_CHIP_VER); |
|---|
| 1229 | 1238 | rk817->chip_ver = (chip_ver & 0x0f); |
|---|
| 1230 | 1239 | dev_info(component->dev, "%s: chip_name:0x%x, chip_ver:0x%x\n", __func__, chip_name, chip_ver); |
|---|
| 1231 | 1240 | |
|---|
| 1241 | + /* always enable mclk, and will disable mclk in rk817_remove */ |
|---|
| 1232 | 1242 | clk_prepare_enable(rk817->mclk); |
|---|
| 1233 | 1243 | rk817_reset(component); |
|---|
| 1234 | | - clk_disable_unprepare(rk817->mclk); |
|---|
| 1235 | 1244 | mutex_init(&rk817->clk_lock); |
|---|
| 1236 | 1245 | rk817->clk_capture = 0; |
|---|
| 1237 | 1246 | rk817->clk_playback = 0; |
|---|
| .. | .. |
|---|
| 1256 | 1265 | rk817_codec_power_down(component, RK817_CODEC_ALL); |
|---|
| 1257 | 1266 | snd_soc_component_exit_regmap(component); |
|---|
| 1258 | 1267 | mutex_destroy(&rk817->clk_lock); |
|---|
| 1268 | + clk_disable_unprepare(rk817->mclk); |
|---|
| 1259 | 1269 | mdelay(10); |
|---|
| 1260 | 1270 | |
|---|
| 1261 | 1271 | } |
|---|