Lines Matching +full:comp +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2015-2017, The Linux Foundation.
692 struct regmap *rm = wsa881x->regmap; in wsa881x_init()
695 regmap_register_patch(wsa881x->regmap, wsa881x_rev_2_0, in wsa881x_init()
734 static int wsa881x_component_probe(struct snd_soc_component *comp) in wsa881x_component_probe() argument
736 struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(comp); in wsa881x_component_probe()
738 snd_soc_component_init_regmap(comp, wsa881x->regmap); in wsa881x_component_probe()
746 struct snd_soc_component *comp = snd_soc_kcontrol_component(kc); in wsa881x_put_pa_gain() local
748 (struct soc_mixer_control *)kc->private_value; in wsa881x_put_pa_gain()
749 int max = mc->max; in wsa881x_put_pa_gain()
750 unsigned int mask = (1 << fls(max)) - 1; in wsa881x_put_pa_gain()
753 ret = pm_runtime_resume_and_get(comp->dev); in wsa881x_put_pa_gain()
754 if (ret < 0 && ret != -EACCES) in wsa881x_put_pa_gain()
757 max_gain = (max - ucontrol->value.integer.value[0]) & mask; in wsa881x_put_pa_gain()
772 for (val = min_gain; max_gain <= val; val--) { in wsa881x_put_pa_gain()
773 ret = snd_soc_component_update_bits(comp, in wsa881x_put_pa_gain()
778 dev_err(comp->dev, "Failed to change PA gain"); in wsa881x_put_pa_gain()
783 pm_runtime_mark_last_busy(comp->dev); in wsa881x_put_pa_gain()
784 pm_runtime_put_autosuspend(comp->dev); in wsa881x_put_pa_gain()
792 struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); in wsa881x_get_port() local
793 struct wsa881x_priv *data = snd_soc_component_get_drvdata(comp); in wsa881x_get_port()
795 (struct soc_mixer_control *)kcontrol->private_value; in wsa881x_get_port()
796 int portidx = mixer->reg; in wsa881x_get_port()
798 ucontrol->value.integer.value[0] = data->port_enable[portidx]; in wsa881x_get_port()
804 static int wsa881x_boost_ctrl(struct snd_soc_component *comp, bool enable) in wsa881x_boost_ctrl() argument
807 snd_soc_component_update_bits(comp, WSA881X_BOOST_EN_CTL, in wsa881x_boost_ctrl()
811 snd_soc_component_update_bits(comp, WSA881X_BOOST_EN_CTL, in wsa881x_boost_ctrl()
814 * 1.5ms sleep is needed after boost enable/disable as per in wsa881x_boost_ctrl()
824 struct snd_soc_component *comp = snd_soc_kcontrol_component(kcontrol); in wsa881x_set_port() local
825 struct wsa881x_priv *data = snd_soc_component_get_drvdata(comp); in wsa881x_set_port()
827 (struct soc_mixer_control *)kcontrol->private_value; in wsa881x_set_port()
828 int portidx = mixer->reg; in wsa881x_set_port()
830 if (ucontrol->value.integer.value[0]) { in wsa881x_set_port()
831 if (data->port_enable[portidx]) in wsa881x_set_port()
834 data->port_enable[portidx] = true; in wsa881x_set_port()
836 if (!data->port_enable[portidx]) in wsa881x_set_port()
839 data->port_enable[portidx] = false; in wsa881x_set_port()
843 wsa881x_boost_ctrl(comp, data->port_enable[portidx]); in wsa881x_set_port()
868 SOC_SINGLE_EXT("COMP Switch", WSA881X_PORT_COMP, 0, 1, 0,
885 static int wsa881x_visense_txfe_ctrl(struct snd_soc_component *comp, in wsa881x_visense_txfe_ctrl() argument
888 struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(comp); in wsa881x_visense_txfe_ctrl()
891 regmap_multi_reg_write(wsa881x->regmap, wsa881x_vi_txfe_en_2_0, in wsa881x_visense_txfe_ctrl()
894 snd_soc_component_update_bits(comp, in wsa881x_visense_txfe_ctrl()
898 * 200us sleep is needed after visense txfe disable as per in wsa881x_visense_txfe_ctrl()
902 snd_soc_component_update_bits(comp, WSA881X_SPKR_PROT_FE_GAIN, in wsa881x_visense_txfe_ctrl()
908 static int wsa881x_visense_adc_ctrl(struct snd_soc_component *comp, in wsa881x_visense_adc_ctrl() argument
911 snd_soc_component_update_bits(comp, WSA881X_ADC_EN_MODU_V, BIT(7), in wsa881x_visense_adc_ctrl()
913 snd_soc_component_update_bits(comp, WSA881X_ADC_EN_MODU_I, BIT(7), in wsa881x_visense_adc_ctrl()
921 struct snd_soc_component *comp = snd_soc_dapm_to_component(w->dapm); in wsa881x_spkr_pa_event() local
922 struct wsa881x_priv *wsa881x = snd_soc_component_get_drvdata(comp); in wsa881x_spkr_pa_event()
926 snd_soc_component_update_bits(comp, WSA881X_SPKR_OCP_CTL, in wsa881x_spkr_pa_event()
929 regmap_multi_reg_write(wsa881x->regmap, wsa881x_pre_pmu_pa_2_0, in wsa881x_spkr_pa_event()
932 snd_soc_component_update_bits(comp, WSA881X_SPKR_DRV_GAIN, in wsa881x_spkr_pa_event()
937 if (wsa881x->port_prepared[WSA881X_PORT_VISENSE]) { in wsa881x_spkr_pa_event()
938 wsa881x_visense_txfe_ctrl(comp, true); in wsa881x_spkr_pa_event()
939 snd_soc_component_update_bits(comp, in wsa881x_spkr_pa_event()
942 wsa881x_visense_adc_ctrl(comp, true); in wsa881x_spkr_pa_event()
947 if (wsa881x->port_prepared[WSA881X_PORT_VISENSE]) { in wsa881x_spkr_pa_event()
948 wsa881x_visense_adc_ctrl(comp, false); in wsa881x_spkr_pa_event()
949 wsa881x_visense_txfe_ctrl(comp, false); in wsa881x_spkr_pa_event()
952 snd_soc_component_update_bits(comp, WSA881X_SPKR_OCP_CTL, in wsa881x_spkr_pa_event()
983 struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev); in wsa881x_hw_params()
986 wsa881x->active_ports = 0; in wsa881x_hw_params()
988 if (!wsa881x->port_enable[i]) in wsa881x_hw_params()
991 wsa881x->port_config[wsa881x->active_ports] = in wsa881x_hw_params()
993 wsa881x->active_ports++; in wsa881x_hw_params()
996 return sdw_stream_add_slave(wsa881x->slave, &wsa881x->sconfig, in wsa881x_hw_params()
997 wsa881x->port_config, wsa881x->active_ports, in wsa881x_hw_params()
998 wsa881x->sruntime); in wsa881x_hw_params()
1004 struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev); in wsa881x_hw_free()
1006 sdw_stream_remove_slave(wsa881x->slave, wsa881x->sruntime); in wsa881x_hw_free()
1014 struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev); in wsa881x_set_sdw_stream()
1016 wsa881x->sruntime = stream; in wsa881x_set_sdw_stream()
1023 struct wsa881x_priv *wsa881x = dev_get_drvdata(dai->dev); in wsa881x_digital_mute()
1026 regmap_update_bits(wsa881x->regmap, WSA881X_SPKR_DRV_EN, 0x80, in wsa881x_digital_mute()
1029 regmap_update_bits(wsa881x->regmap, WSA881X_SPKR_DRV_EN, 0x80, in wsa881x_digital_mute()
1074 struct wsa881x_priv *wsa881x = dev_get_drvdata(&slave->dev); in wsa881x_update_status()
1076 if (status == SDW_SLAVE_ATTACHED && slave->dev_num > 0) in wsa881x_update_status()
1086 struct wsa881x_priv *wsa881x = dev_get_drvdata(&slave->dev); in wsa881x_port_prep()
1089 wsa881x->port_prepared[prepare_ch->num - 1] = true; in wsa881x_port_prep()
1091 wsa881x->port_prepared[prepare_ch->num - 1] = false; in wsa881x_port_prep()
1099 sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), in wsa881x_bus_config()
1115 struct device *dev = &pdev->dev; in wsa881x_probe()
1119 return -ENOMEM; in wsa881x_probe()
1121 wsa881x->sd_n = devm_gpiod_get_optional(dev, "powerdown", in wsa881x_probe()
1123 if (IS_ERR(wsa881x->sd_n)) in wsa881x_probe()
1124 return dev_err_probe(dev, PTR_ERR(wsa881x->sd_n), in wsa881x_probe()
1128 * Backwards compatibility work-around. in wsa881x_probe()
1143 wsa881x->sd_n_val = gpiod_is_active_low(wsa881x->sd_n); in wsa881x_probe()
1144 if (!wsa881x->sd_n_val) in wsa881x_probe()
1148 wsa881x->slave = pdev; in wsa881x_probe()
1149 wsa881x->dev = dev; in wsa881x_probe()
1150 wsa881x->sconfig.ch_count = 1; in wsa881x_probe()
1151 wsa881x->sconfig.bps = 1; in wsa881x_probe()
1152 wsa881x->sconfig.frame_rate = 48000; in wsa881x_probe()
1153 wsa881x->sconfig.direction = SDW_DATA_DIR_RX; in wsa881x_probe()
1154 wsa881x->sconfig.type = SDW_STREAM_PDM; in wsa881x_probe()
1155 pdev->prop.sink_ports = GENMASK(WSA881X_MAX_SWR_PORTS - 1, 0); in wsa881x_probe()
1156 pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop; in wsa881x_probe()
1157 pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; in wsa881x_probe()
1158 pdev->prop.clk_stop_mode1 = true; in wsa881x_probe()
1159 gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val); in wsa881x_probe()
1161 wsa881x->regmap = devm_regmap_init_sdw(pdev, &wsa881x_regmap_config); in wsa881x_probe()
1162 if (IS_ERR(wsa881x->regmap)) in wsa881x_probe()
1163 return dev_err_probe(dev, PTR_ERR(wsa881x->regmap), "regmap_init failed\n"); in wsa881x_probe()
1182 gpiod_direction_output(wsa881x->sd_n, wsa881x->sd_n_val); in wsa881x_runtime_suspend()
1197 gpiod_direction_output(wsa881x->sd_n, !wsa881x->sd_n_val); in wsa881x_runtime_resume()
1199 time = wait_for_completion_timeout(&slave->initialization_complete, in wsa881x_runtime_resume()
1203 gpiod_direction_output(wsa881x->sd_n, wsa881x->sd_n_val); in wsa881x_runtime_resume()
1204 return -ETIMEDOUT; in wsa881x_runtime_resume()
1229 .name = "wsa881x-codec",