Lines Matching refs:bd

47 static int bd28623_power_on(struct bd28623_priv *bd)  in bd28623_power_on()  argument
51 ret = regulator_bulk_enable(ARRAY_SIZE(bd->supplies), bd->supplies); in bd28623_power_on()
53 dev_err(bd->dev, "Failed to enable supplies: %d\n", ret); in bd28623_power_on()
57 gpiod_set_value_cansleep(bd->reset_gpio, 0); in bd28623_power_on()
63 static void bd28623_power_off(struct bd28623_priv *bd) in bd28623_power_off() argument
65 gpiod_set_value_cansleep(bd->reset_gpio, 1); in bd28623_power_off()
67 regulator_bulk_disable(ARRAY_SIZE(bd->supplies), bd->supplies); in bd28623_power_off()
75 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_get_switch_spk() local
77 ucontrol->value.integer.value[0] = bd->switch_spk; in bd28623_get_switch_spk()
87 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_set_switch_spk() local
89 if (bd->switch_spk == ucontrol->value.integer.value[0]) in bd28623_set_switch_spk()
92 bd->switch_spk = ucontrol->value.integer.value[0]; in bd28623_set_switch_spk()
94 gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); in bd28623_set_switch_spk()
106 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_codec_probe() local
109 bd->switch_spk = 1; in bd28623_codec_probe()
111 ret = bd28623_power_on(bd); in bd28623_codec_probe()
115 gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); in bd28623_codec_probe()
122 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_codec_remove() local
124 bd28623_power_off(bd); in bd28623_codec_remove()
129 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_codec_suspend() local
131 bd28623_power_off(bd); in bd28623_codec_suspend()
138 struct bd28623_priv *bd = snd_soc_component_get_drvdata(component); in bd28623_codec_resume() local
141 ret = bd28623_power_on(bd); in bd28623_codec_resume()
145 gpiod_set_value_cansleep(bd->mute_gpio, bd->switch_spk ? 0 : 1); in bd28623_codec_resume()
184 struct bd28623_priv *bd; in bd28623_probe() local
188 bd = devm_kzalloc(&pdev->dev, sizeof(struct bd28623_priv), GFP_KERNEL); in bd28623_probe()
189 if (!bd) in bd28623_probe()
192 for (i = 0; i < ARRAY_SIZE(bd->supplies); i++) in bd28623_probe()
193 bd->supplies[i].supply = bd28623_supply_names[i]; in bd28623_probe()
195 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(bd->supplies), in bd28623_probe()
196 bd->supplies); in bd28623_probe()
202 bd->reset_gpio = devm_gpiod_get_optional(dev, "reset", in bd28623_probe()
204 if (IS_ERR(bd->reset_gpio)) { in bd28623_probe()
206 PTR_ERR(bd->reset_gpio)); in bd28623_probe()
207 return PTR_ERR(bd->reset_gpio); in bd28623_probe()
210 bd->mute_gpio = devm_gpiod_get_optional(dev, "mute", in bd28623_probe()
212 if (IS_ERR(bd->mute_gpio)) { in bd28623_probe()
214 PTR_ERR(bd->mute_gpio)); in bd28623_probe()
215 return PTR_ERR(bd->mute_gpio); in bd28623_probe()
218 platform_set_drvdata(pdev, bd); in bd28623_probe()
219 bd->dev = dev; in bd28623_probe()