Lines Matching refs:mvc

52 	struct tegra210_mvc *mvc = dev_get_drvdata(dev);  in tegra210_mvc_runtime_suspend()  local
54 regmap_read(mvc->regmap, TEGRA210_MVC_CTRL, &(mvc->ctrl_value)); in tegra210_mvc_runtime_suspend()
56 regcache_cache_only(mvc->regmap, true); in tegra210_mvc_runtime_suspend()
57 regcache_mark_dirty(mvc->regmap); in tegra210_mvc_runtime_suspend()
64 struct tegra210_mvc *mvc = dev_get_drvdata(dev); in tegra210_mvc_runtime_resume() local
66 regcache_cache_only(mvc->regmap, false); in tegra210_mvc_runtime_resume()
67 regcache_sync(mvc->regmap); in tegra210_mvc_runtime_resume()
69 regmap_write(mvc->regmap, TEGRA210_MVC_CTRL, mvc->ctrl_value); in tegra210_mvc_runtime_resume()
70 regmap_update_bits(mvc->regmap, in tegra210_mvc_runtime_resume()
92 static void tegra210_mvc_conv_vol(struct tegra210_mvc *mvc, u8 chan, s32 val) in tegra210_mvc_conv_vol() argument
100 if (mvc->curve_type == CURVE_POLY) { in tegra210_mvc_conv_vol()
103 mvc->volume[chan] = ((val * (1<<8)) / 100) << 16; in tegra210_mvc_conv_vol()
106 mvc->volume[chan] = (val * (1<<8)) / 100; in tegra210_mvc_conv_vol()
113 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_get_ctrl_reg() local
117 regmap_read(mvc->regmap, TEGRA210_MVC_CTRL, &val); in tegra210_mvc_get_ctrl_reg()
178 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_volume_switch_timeout() local
182 err = regmap_read_poll_timeout(mvc->regmap, TEGRA210_MVC_SWITCH, in tegra210_mvc_volume_switch_timeout()
198 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_update_mute() local
219 regmap_update_bits_check(mvc->regmap, TEGRA210_MVC_CTRL, in tegra210_mvc_update_mute()
225 regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, in tegra210_mvc_update_mute()
229 regmap_update_bits(mvc->regmap, TEGRA210_MVC_SWITCH, in tegra210_mvc_update_mute()
264 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_get_vol() local
266 s32 val = mvc->volume[chan]; in tegra210_mvc_get_vol()
268 if (mvc->curve_type == CURVE_POLY) { in tegra210_mvc_get_vol()
293 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_update_vol() local
295 int old_volume = mvc->volume[chan]; in tegra210_mvc_update_vol()
304 tegra210_mvc_conv_vol(mvc, chan, ucontrol->value.integer.value[0]); in tegra210_mvc_update_vol()
306 if (mvc->volume[chan] == old_volume) { in tegra210_mvc_update_vol()
312 regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, in tegra210_mvc_update_vol()
316 regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, in tegra210_mvc_update_vol()
320 mvc->volume[i] = mvc->volume[chan]; in tegra210_mvc_update_vol()
324 regmap_write(mvc->regmap, in tegra210_mvc_update_vol()
326 mvc->volume[chan]); in tegra210_mvc_update_vol()
328 regmap_write(mvc->regmap, mc->reg, mvc->volume[chan]); in tegra210_mvc_update_vol()
330 regmap_update_bits(mvc->regmap, TEGRA210_MVC_SWITCH, in tegra210_mvc_update_vol()
354 static void tegra210_mvc_reset_vol_settings(struct tegra210_mvc *mvc, in tegra210_mvc_reset_vol_settings() argument
360 if (mvc->curve_type == CURVE_POLY) { in tegra210_mvc_reset_vol_settings()
362 mvc->volume[i] = TEGRA210_MVC_INIT_VOL_DEFAULT_POLY; in tegra210_mvc_reset_vol_settings()
365 mvc->volume[i] = TEGRA210_MVC_INIT_VOL_DEFAULT_LINEAR; in tegra210_mvc_reset_vol_settings()
371 regmap_update_bits(mvc->regmap, TEGRA210_MVC_CTRL, in tegra210_mvc_reset_vol_settings()
373 mvc->curve_type << in tegra210_mvc_reset_vol_settings()
378 regmap_write(mvc->regmap, in tegra210_mvc_reset_vol_settings()
380 mvc->volume[i]); in tegra210_mvc_reset_vol_settings()
381 regmap_write(mvc->regmap, in tegra210_mvc_reset_vol_settings()
383 mvc->volume[i]); in tegra210_mvc_reset_vol_settings()
387 regmap_update_bits(mvc->regmap, TEGRA210_MVC_SWITCH, in tegra210_mvc_reset_vol_settings()
398 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_get_curve_type() local
400 ucontrol->value.enumerated.item[0] = mvc->curve_type; in tegra210_mvc_get_curve_type()
409 struct tegra210_mvc *mvc = snd_soc_component_get_drvdata(cmpnt); in tegra210_mvc_put_curve_type() local
412 regmap_read(mvc->regmap, TEGRA210_MVC_ENABLE, &value); in tegra210_mvc_put_curve_type()
419 if (mvc->curve_type == ucontrol->value.enumerated.item[0]) in tegra210_mvc_put_curve_type()
422 mvc->curve_type = ucontrol->value.enumerated.item[0]; in tegra210_mvc_put_curve_type()
424 tegra210_mvc_reset_vol_settings(mvc, cmpnt->dev); in tegra210_mvc_put_curve_type()
429 static int tegra210_mvc_set_audio_cif(struct tegra210_mvc *mvc, in tegra210_mvc_set_audio_cif() argument
456 tegra_set_cif(mvc->regmap, reg, &cif_conf); in tegra210_mvc_set_audio_cif()
466 struct tegra210_mvc *mvc = snd_soc_dai_get_drvdata(dai); in tegra210_mvc_hw_params() local
475 regmap_write(mvc->regmap, TEGRA210_MVC_SOFT_RESET, 1); in tegra210_mvc_hw_params()
477 err = regmap_read_poll_timeout(mvc->regmap, TEGRA210_MVC_SOFT_RESET, in tegra210_mvc_hw_params()
485 err = tegra210_mvc_set_audio_cif(mvc, params, TEGRA210_MVC_RX_CIF_CTRL); in tegra210_mvc_hw_params()
492 err = tegra210_mvc_set_audio_cif(mvc, params, TEGRA210_MVC_TX_CIF_CTRL); in tegra210_mvc_hw_params()
498 tegra210_mvc_write_ram(mvc->regmap); in tegra210_mvc_hw_params()
501 regmap_write(mvc->regmap, TEGRA210_MVC_POLY_N1, gain_params.poly_n1); in tegra210_mvc_hw_params()
502 regmap_write(mvc->regmap, TEGRA210_MVC_POLY_N2, gain_params.poly_n2); in tegra210_mvc_hw_params()
503 regmap_write(mvc->regmap, TEGRA210_MVC_DURATION, gain_params.duration); in tegra210_mvc_hw_params()
506 regmap_write(mvc->regmap, TEGRA210_MVC_DURATION_INV, in tegra210_mvc_hw_params()
709 struct tegra210_mvc *mvc; in tegra210_mvc_platform_probe() local
713 mvc = devm_kzalloc(dev, sizeof(*mvc), GFP_KERNEL); in tegra210_mvc_platform_probe()
714 if (!mvc) in tegra210_mvc_platform_probe()
717 dev_set_drvdata(dev, mvc); in tegra210_mvc_platform_probe()
719 mvc->curve_type = CURVE_LINEAR; in tegra210_mvc_platform_probe()
720 mvc->ctrl_value = TEGRA210_MVC_CTRL_DEFAULT; in tegra210_mvc_platform_probe()
726 mvc->regmap = devm_regmap_init_mmio(dev, regs, in tegra210_mvc_platform_probe()
728 if (IS_ERR(mvc->regmap)) { in tegra210_mvc_platform_probe()
730 return PTR_ERR(mvc->regmap); in tegra210_mvc_platform_probe()
733 regcache_cache_only(mvc->regmap, true); in tegra210_mvc_platform_probe()
745 tegra210_mvc_reset_vol_settings(mvc, &pdev->dev); in tegra210_mvc_platform_probe()