Lines Matching refs:rk817

68 	struct rk808 *rk817;  member
236 static int rk817_codec_ctl_gpio(struct rk817_codec_priv *rk817, in rk817_codec_ctl_gpio() argument
240 rk817->spk_ctl_gpio) { in rk817_codec_ctl_gpio()
241 gpiod_set_value(rk817->spk_ctl_gpio, 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()
258 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_reset() local
269 if (rk817->chip_ver <= 0x4) { in rk817_reset()
363 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_codec_power_up() local
382 if (rk817->chip_ver <= 0x4) { in rk817_codec_power_up()
413 if (rk817->chip_ver <= 0x4) { 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()
535 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_playback_path_config() local
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()
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()
703 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_playback_path_get() local
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()
716 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_playback_path_put() local
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()
731 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_capture_path_config() local
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()
843 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_capture_path_get() local
846 rk817->capture_path); in rk817_capture_path_get()
848 ucontrol->value.integer.value[0] = rk817->capture_path; in rk817_capture_path_get()
857 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_capture_path_put() local
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()
873 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_resume_path_get() local
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()
886 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_resume_path_put() local
888 rk817->resume_path = ucontrol->value.integer.value[0]; in rk817_resume_path_put()
908 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_set_dai_sysclk() local
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()
947 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_hw_params() local
955 if (rk817->chip_ver <= 0x4) { in rk817_hw_params()
999 if (!((substream->stream == SNDRV_PCM_STREAM_CAPTURE) && rk817->pdmdata_out_enable)) { in rk817_hw_params()
1040 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_digital_mute() local
1045 rk817_codec_ctl_gpio(rk817, CODEC_SET_SPK, 0); in rk817_digital_mute()
1046 rk817_codec_ctl_gpio(rk817, CODEC_SET_HP, 0); 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()
1080 rk817_codec_ctl_gpio(rk817, CODEC_SET_SPK, 1); in rk817_digital_mute()
1081 rk817_codec_ctl_gpio(rk817, CODEC_SET_HP, 0); in rk817_digital_mute()
1090 rk817_codec_ctl_gpio(rk817, CODEC_SET_SPK, 0); in rk817_digital_mute()
1091 rk817_codec_ctl_gpio(rk817, CODEC_SET_HP, 1); in rk817_digital_mute()
1098 rk817_codec_ctl_gpio(rk817, CODEC_SET_SPK, 1); in rk817_digital_mute()
1099 rk817_codec_ctl_gpio(rk817, CODEC_SET_HP, 1); in rk817_digital_mute()
1206 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_resume() local
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()
1220 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_probe() local
1226 if (!rk817) { 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()
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()
1256 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component); in rk817_remove() local
1260 if (!rk817) { in rk817_remove()
1267 mutex_destroy(&rk817->clk_lock); in rk817_remove()
1284 struct rk817_codec_priv *rk817) in rk817_codec_parse_dt_property() argument
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()
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()
1315 desc_to_gpio(rk817->spk_ctl_gpio)); in rk817_codec_parse_dt_property()
1319 &rk817->spk_mute_delay); in rk817_codec_parse_dt_property()
1323 rk817->spk_mute_delay = 0; in rk817_codec_parse_dt_property()
1327 &rk817->hp_mute_delay); in rk817_codec_parse_dt_property()
1331 rk817->hp_mute_delay = 0; 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()
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()
1345 &rk817->hp_volume); 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()
1355 &rk817->capture_volume); 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()
1365 rk817->pdmdata_out_enable = in rk817_codec_parse_dt_property()
1368 rk817->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()
1395 struct rk808 *rk817 = dev_get_drvdata(pdev->dev.parent); in rk817_platform_probe() local
1401 if (!rk817) { in rk817_platform_probe()
1421 rk817_codec_data->regmap = devm_regmap_init_i2c(rk817->i2c, in rk817_platform_probe()
1460 struct rk817_codec_priv *rk817 = dev_get_drvdata(&pdev->dev); in rk817_platform_shutdown() local
1464 if (rk817 && rk817->component) in rk817_platform_shutdown()
1465 rk817_codec_power_down(rk817->component, RK817_CODEC_ALL); in rk817_platform_shutdown()