Lines Matching +full:spk +full:- +full:mute

44  * 0db~-95db,0.375db/step,for example:
46 * 0x0a: -3.75dB
47 * 0x7d: -46dB
48 * 0xff: -95dB
54 * 0db~-95db,0.375db/step,for example:
56 * 0x0a: -3.75dB
57 * 0x7d: -46dB
58 * 0xff: -95dB
240 rk817->spk_ctl_gpio) { in rk817_codec_ctl_gpio()
241 gpiod_set_value(rk817->spk_ctl_gpio, level); in rk817_codec_ctl_gpio()
242 DBG("%s set spk clt %d\n", __func__, level); in rk817_codec_ctl_gpio()
243 msleep(rk817->spk_mute_delay); in rk817_codec_ctl_gpio()
247 rk817->hp_ctl_gpio) { in rk817_codec_ctl_gpio()
248 gpiod_set_value(rk817->hp_ctl_gpio, level); in rk817_codec_ctl_gpio()
250 msleep(rk817->hp_mute_delay); in rk817_codec_ctl_gpio()
269 if (rk817->chip_ver <= 0x4) { in rk817_reset()
316 /* SPK */
346 /* 0x29: -18db to 27db */
382 if (rk817->chip_ver <= 0x4) { in rk817_codec_power_up()
398 DBG("%s: %d - Playback DIG CLK OPS\n", __func__, __LINE__); in rk817_codec_power_up()
413 if (rk817->chip_ver <= 0x4) { in rk817_codec_power_up()
429 DBG("%s: %d - Capture DIG CLK OPS\n", __func__, __LINE__); in rk817_codec_power_up()
431 if (rk817->mic_in_differential) in rk817_codec_power_up()
441 if (rk817->pdmdata_out_enable) in rk817_codec_power_up()
448 rk817->capture_volume); in rk817_codec_power_up()
450 rk817->capture_volume); in rk817_codec_power_up()
465 /* mute output for pop noise */ in rk817_codec_power_down()
515 "OFF", "RCV", "SPK", "HP", "HP_NO_MIC", "BT", "SPK_HP", /* 0-6 */
516 "RING_SPK", "RING_HP", "RING_HP_NO_MIC", "RING_SPK_HP"}; /* 7-10 */
537 rk817->playback_path = target_path; in rk817_playback_path_config()
540 __func__, rk817->playback_path, pre_path); in rk817_playback_path_config()
542 mutex_lock(&rk817->clk_lock); in rk817_playback_path_config()
543 if (rk817->playback_path != OFF) { in rk817_playback_path_config()
544 if (rk817->clk_playback == 0) { in rk817_playback_path_config()
545 clk_prepare_enable(rk817->mclk); in rk817_playback_path_config()
546 rk817->clk_playback++; in rk817_playback_path_config()
549 if (rk817->clk_playback > 0) { in rk817_playback_path_config()
550 clk_disable_unprepare(rk817->mclk); in rk817_playback_path_config()
551 rk817->clk_playback--; in rk817_playback_path_config()
554 mutex_unlock(&rk817->clk_lock); in rk817_playback_path_config()
556 switch (rk817->playback_path) { in rk817_playback_path_config()
562 if (rk817->capture_path == 0) in rk817_playback_path_config()
571 if (rk817->out_l2spk_r2hp) { in rk817_playback_path_config()
572 /* for costdown: ldac -> ClassD rdac -> Hp */ in rk817_playback_path_config()
595 } else if (!rk817->use_ext_amplifier) { in rk817_playback_path_config()
628 rk817->spk_volume); in rk817_playback_path_config()
630 rk817->spk_volume); in rk817_playback_path_config()
651 rk817->hp_volume); in rk817_playback_path_config()
653 rk817->hp_volume); in rk817_playback_path_config()
672 if (!rk817->use_ext_amplifier) { in rk817_playback_path_config()
688 rk817->hp_volume); in rk817_playback_path_config()
690 rk817->hp_volume); in rk817_playback_path_config()
693 return -EINVAL; in rk817_playback_path_config()
705 DBG("%s : playback_path %ld\n", __func__, rk817->playback_path); in rk817_playback_path_get()
707 ucontrol->value.integer.value[0] = rk817->playback_path; in rk817_playback_path_get()
718 if (rk817->playback_path == ucontrol->value.integer.value[0]) { in rk817_playback_path_put()
724 return rk817_playback_path_config(component, rk817->playback_path, in rk817_playback_path_put()
725 ucontrol->value.integer.value[0]); in rk817_playback_path_put()
733 rk817->capture_path = target_path; in rk817_capture_path_config()
736 rk817->capture_path, pre_path); in rk817_capture_path_config()
738 mutex_lock(&rk817->clk_lock); in rk817_capture_path_config()
739 if (rk817->capture_path != MIC_OFF) { in rk817_capture_path_config()
740 if (rk817->clk_capture == 0) { in rk817_capture_path_config()
741 clk_prepare_enable(rk817->mclk); in rk817_capture_path_config()
742 rk817->clk_capture++; in rk817_capture_path_config()
745 if (rk817->clk_capture > 0) { in rk817_capture_path_config()
746 clk_disable_unprepare(rk817->mclk); in rk817_capture_path_config()
747 rk817->clk_capture--; in rk817_capture_path_config()
750 mutex_unlock(&rk817->clk_lock); in rk817_capture_path_config()
752 switch (rk817->capture_path) { in rk817_capture_path_config()
756 if (rk817->playback_path == OFF) in rk817_capture_path_config()
764 if (rk817->adc_for_loopback) { in rk817_capture_path_config()
781 if (!rk817->mic_in_differential) { in rk817_capture_path_config()
799 if (rk817->adc_for_loopback) { in rk817_capture_path_config()
816 if (!rk817->mic_in_differential) { in rk817_capture_path_config()
833 return -EINVAL; in rk817_capture_path_config()
846 rk817->capture_path); in rk817_capture_path_get()
848 ucontrol->value.integer.value[0] = rk817->capture_path; in rk817_capture_path_get()
859 if (rk817->capture_path == ucontrol->value.integer.value[0]) { in rk817_capture_path_put()
865 return rk817_capture_path_config(component, rk817->capture_path, in rk817_capture_path_put()
866 ucontrol->value.integer.value[0]); in rk817_capture_path_put()
875 DBG("%s : resume_path %ld\n", __func__, rk817->resume_path); in rk817_resume_path_get()
877 ucontrol->value.integer.value[0] = rk817->resume_path; in rk817_resume_path_get()
888 rk817->resume_path = ucontrol->value.integer.value[0]; in rk817_resume_path_put()
907 struct snd_soc_component *component = codec_dai->component; in rk817_set_dai_sysclk()
910 rk817->stereo_sysclk = freq; in rk817_set_dai_sysclk()
912 DBG("%s : MCLK = %dHz\n", __func__, rk817->stereo_sysclk); in rk817_set_dai_sysclk()
920 struct snd_soc_component *component = codec_dai->component; in rk817_set_dai_fmt()
931 dev_err(component->dev, "%s : set master mask failed!\n", __func__); in rk817_set_dai_fmt()
932 return -EINVAL; in rk817_set_dai_fmt()
946 struct snd_soc_component *component = dai->component; in rk817_hw_params()
955 if (rk817->chip_ver <= 0x4) { in rk817_hw_params()
965 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) in rk817_hw_params()
991 return -EINVAL; in rk817_hw_params()
999 if (!((substream->stream == SNDRV_PCM_STREAM_CAPTURE) && rk817->pdmdata_out_enable)) { in rk817_hw_params()
1031 return -EINVAL; in rk817_hw_params()
1037 static int rk817_digital_mute(struct snd_soc_dai *dai, int mute, int stream) in rk817_digital_mute() argument
1039 struct snd_soc_component *component = dai->component; in rk817_digital_mute()
1042 DBG("%s %d\n", __func__, mute); in rk817_digital_mute()
1044 if (mute) { in rk817_digital_mute()
1064 switch (rk817->playback_path) { in rk817_digital_mute()
1067 if (rk817->out_l2spk_r2hp) { in rk817_digital_mute()
1071 } else if (!rk817->use_ext_amplifier) { in rk817_digital_mute()
1131 struct snd_soc_component *component = dai->component; in rk817_codec_shutdown()
1138 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) { in rk817_codec_shutdown()
1158 .name = "rk817-hifi",
1177 .name = "rk817-voice",
1208 if (rk817->resume_path) { in rk817_resume()
1209 if (rk817->capture_path != MIC_OFF) in rk817_resume()
1210 rk817_capture_path_config(component, OFF, rk817->capture_path); in rk817_resume()
1211 if (rk817->playback_path != OFF) in rk817_resume()
1212 rk817_playback_path_config(component, OFF, rk817->playback_path); in rk817_resume()
1227 dev_err(component->dev, "%s : rk817 priv is NULL!\n", in rk817_probe()
1229 return -EINVAL; in rk817_probe()
1231 snd_soc_component_init_regmap(component, rk817->regmap); in rk817_probe()
1232 rk817->component = component; in rk817_probe()
1233 rk817->playback_path = OFF; in rk817_probe()
1234 rk817->capture_path = MIC_OFF; in rk817_probe()
1238 rk817->chip_ver = (chip_ver & 0x0f); in rk817_probe()
1239 dev_info(component->dev, "%s: chip_name:0x%x, chip_ver:0x%x\n", __func__, chip_name, chip_ver); in rk817_probe()
1241 clk_prepare_enable(rk817->mclk); in rk817_probe()
1243 clk_disable_unprepare(rk817->mclk); in rk817_probe()
1244 mutex_init(&rk817->clk_lock); in rk817_probe()
1245 rk817->clk_capture = 0; in rk817_probe()
1246 rk817->clk_playback = 0; in rk817_probe()
1261 dev_err(component->dev, "%s : rk817 is NULL\n", __func__); in rk817_remove()
1267 mutex_destroy(&rk817->clk_lock); in rk817_remove()
1286 struct device_node *node = dev->parent->of_node; in rk817_codec_parse_dt_property()
1292 dev_err(dev, "%s() dev->parent->of_node is NULL\n", in rk817_codec_parse_dt_property()
1294 return -ENODEV; in rk817_codec_parse_dt_property()
1297 node = of_get_child_by_name(dev->parent->of_node, "codec"); in rk817_codec_parse_dt_property()
1301 return -ENODEV; in rk817_codec_parse_dt_property()
1304 rk817->hp_ctl_gpio = devm_gpiod_get_optional(dev, "hp-ctl", in rk817_codec_parse_dt_property()
1306 if (!IS_ERR_OR_NULL(rk817->hp_ctl_gpio)) { in rk817_codec_parse_dt_property()
1307 DBG("%s : hp-ctl-gpio %d\n", __func__, in rk817_codec_parse_dt_property()
1308 desc_to_gpio(rk817->hp_ctl_gpio)); in rk817_codec_parse_dt_property()
1311 rk817->spk_ctl_gpio = devm_gpiod_get_optional(dev, "spk-ctl", in rk817_codec_parse_dt_property()
1313 if (!IS_ERR_OR_NULL(rk817->spk_ctl_gpio)) { in rk817_codec_parse_dt_property()
1314 DBG("%s : spk-ctl-gpio %d\n", __func__, in rk817_codec_parse_dt_property()
1315 desc_to_gpio(rk817->spk_ctl_gpio)); in rk817_codec_parse_dt_property()
1318 ret = of_property_read_u32(node, "spk-mute-delay-ms", in rk817_codec_parse_dt_property()
1319 &rk817->spk_mute_delay); in rk817_codec_parse_dt_property()
1321 DBG("%s() Can not read property spk-mute-delay-ms\n", in rk817_codec_parse_dt_property()
1323 rk817->spk_mute_delay = 0; in rk817_codec_parse_dt_property()
1326 ret = of_property_read_u32(node, "hp-mute-delay-ms", in rk817_codec_parse_dt_property()
1327 &rk817->hp_mute_delay); in rk817_codec_parse_dt_property()
1329 DBG("%s() Can not read property hp-mute-delay-ms\n", in rk817_codec_parse_dt_property()
1331 rk817->hp_mute_delay = 0; in rk817_codec_parse_dt_property()
1333 DBG("spk mute delay %dms --- hp mute delay %dms\n", in rk817_codec_parse_dt_property()
1334 rk817->spk_mute_delay, rk817->hp_mute_delay); in rk817_codec_parse_dt_property()
1336 ret = of_property_read_u32(node, "spk-volume", &rk817->spk_volume); in rk817_codec_parse_dt_property()
1338 DBG("%s() Can not read property spk-volume\n", __func__); in rk817_codec_parse_dt_property()
1339 rk817->spk_volume = OUT_VOLUME; in rk817_codec_parse_dt_property()
1341 if (rk817->spk_volume < 3) in rk817_codec_parse_dt_property()
1342 rk817->spk_volume = 3; in rk817_codec_parse_dt_property()
1344 ret = of_property_read_u32(node, "hp-volume", in rk817_codec_parse_dt_property()
1345 &rk817->hp_volume); in rk817_codec_parse_dt_property()
1347 DBG("%s() Can not read property hp-volume\n", in rk817_codec_parse_dt_property()
1349 rk817->hp_volume = OUT_VOLUME; in rk817_codec_parse_dt_property()
1351 if (rk817->hp_volume < 3) in rk817_codec_parse_dt_property()
1352 rk817->hp_volume = 3; in rk817_codec_parse_dt_property()
1354 ret = of_property_read_u32(node, "capture-volume", in rk817_codec_parse_dt_property()
1355 &rk817->capture_volume); in rk817_codec_parse_dt_property()
1357 DBG("%s() Can not read property capture-volume\n", in rk817_codec_parse_dt_property()
1359 rk817->capture_volume = CAPTURE_VOLUME; in rk817_codec_parse_dt_property()
1362 rk817->mic_in_differential = in rk817_codec_parse_dt_property()
1363 of_property_read_bool(node, "mic-in-differential"); in rk817_codec_parse_dt_property()
1365 rk817->pdmdata_out_enable = in rk817_codec_parse_dt_property()
1366 of_property_read_bool(node, "pdmdata-out-enable"); in rk817_codec_parse_dt_property()
1368 rk817->use_ext_amplifier = in rk817_codec_parse_dt_property()
1369 of_property_read_bool(node, "use-ext-amplifier"); in rk817_codec_parse_dt_property()
1371 rk817->out_l2spk_r2hp = of_property_read_bool(node, "out-l2spk-r2hp"); in rk817_codec_parse_dt_property()
1373 rk817->adc_for_loopback = in rk817_codec_parse_dt_property()
1374 of_property_read_bool(node, "adc-for-loopback"); in rk817_codec_parse_dt_property()
1380 .name = "rk817-codec",
1395 struct rk808 *rk817 = dev_get_drvdata(pdev->dev.parent); in rk817_platform_probe()
1402 dev_err(&pdev->dev, "%s : rk817 is NULL\n", __func__); in rk817_platform_probe()
1403 return -EINVAL; in rk817_platform_probe()
1406 rk817_codec_data = devm_kzalloc(&pdev->dev, in rk817_platform_probe()
1410 return -ENOMEM; in rk817_platform_probe()
1414 ret = rk817_codec_parse_dt_property(&pdev->dev, rk817_codec_data); in rk817_platform_probe()
1416 dev_err(&pdev->dev, "%s() parse device tree property error %d\n", in rk817_platform_probe()
1421 rk817_codec_data->regmap = devm_regmap_init_i2c(rk817->i2c, in rk817_platform_probe()
1423 if (IS_ERR(rk817_codec_data->regmap)) { in rk817_platform_probe()
1424 ret = PTR_ERR(rk817_codec_data->regmap); in rk817_platform_probe()
1425 dev_err(&pdev->dev, "failed to allocate register map: %d\n", in rk817_platform_probe()
1430 rk817_codec_data->mclk = devm_clk_get(&pdev->dev, "mclk"); in rk817_platform_probe()
1431 if (IS_ERR(rk817_codec_data->mclk)) { in rk817_platform_probe()
1432 dev_err(&pdev->dev, "Unable to get mclk\n"); in rk817_platform_probe()
1433 ret = -ENXIO; in rk817_platform_probe()
1437 ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk817, in rk817_platform_probe()
1440 dev_err(&pdev->dev, "%s() register codec error %d\n", in rk817_platform_probe()
1453 snd_soc_unregister_component(&pdev->dev); in rk817_platform_remove()
1460 struct rk817_codec_priv *rk817 = dev_get_drvdata(&pdev->dev); in rk817_platform_shutdown()
1464 if (rk817 && rk817->component) in rk817_platform_shutdown()
1465 rk817_codec_power_down(rk817->component, RK817_CODEC_ALL); in rk817_platform_shutdown()
1469 { .compatible = "rockchip,rk817-codec" },
1476 .name = "rk817-codec",
1487 MODULE_AUTHOR("binyuan <kevan.lan@rock-chips.com>");