Lines Matching +full:gain +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0
11 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
13 #include "s3c24xx-i2s.h"
23 * speaker_gain_get - read the speaker gain setting.
24 * @kcontrol: The control for the speaker gain.
27 * Read the value for the AMP gain control.
32 ucontrol->value.integer.value[0] = spk_gain; in speaker_gain_get()
37 * speaker_gain_set - set the value of the speaker amp gain
42 gpio_set_value_cansleep(pdata->amp_gain[0], value & 1); in speaker_gain_set()
43 gpio_set_value_cansleep(pdata->amp_gain[1], value >> 1); in speaker_gain_set()
47 * speaker_gain_put - set the speaker gain setting.
48 * @kcontrol: The control for the speaker gain.
51 * Set the value of the speaker gain from the specified
54 * Note, if the speaker amp is muted, then we do not set a gain value
55 * as at-least one of the ICs that is fitted will try and power up even
61 int value = ucontrol->value.integer.value[0]; in speaker_gain_put()
72 SOC_SINGLE_EXT("Speaker Gain", 0, 0, 3, 0,
77 * spk_unmute_state - set the unmute state of the speaker
78 * @to: zero to unmute, non-zero to ununmute.
85 gpio_set_value(pdata->amp_gpio, to); in spk_unmute_state()
87 /* if we're umuting, also re-set the gain */ in spk_unmute_state()
88 if (to && pdata->amp_gain[0] > 0) in spk_unmute_state()
93 * speaker_unmute_get - read the speaker unmute setting.
94 * @kcontrol: The control for the speaker gain.
97 * Read the value for the AMP gain control.
102 ucontrol->value.integer.value[0] = spk_unmute; in speaker_unmute_get()
107 * speaker_unmute_put - set the speaker unmute setting.
108 * @kcontrol: The control for the speaker gain.
111 * Set the value of the speaker gain from the specified
117 spk_unmute_state(ucontrol->value.integer.value[0]); in speaker_unmute_put()
132 struct snd_soc_card *card = rtd->card; in simtec_audio_init()
134 if (pdata->amp_gpio > 0) { in simtec_audio_init()
141 if (pdata->amp_gain[0] > 0) { in simtec_audio_init()
152 * simtec_hw_params - update hardware parameters
174 if (pdata->use_mpllin) { in simtec_hw_params()
185 if (pdata->output_cdclk) { in simtec_hw_params()
189 cdclk_scale--; in simtec_hw_params()
208 if (pd->startup) in simtec_call_startup()
209 pd->startup(); in simtec_call_startup()
219 * attach_gpio_amp - get and configure the necessary gpios
231 /* attach gpio amp gain (if any) */ in attach_gpio_amp()
232 if (pdata->amp_gain[0] > 0) { in attach_gpio_amp()
233 ret = gpio_request(pd->amp_gain[0], "gpio-amp-gain0"); in attach_gpio_amp()
239 ret = gpio_request(pd->amp_gain[1], "gpio-amp-gain1"); in attach_gpio_amp()
242 gpio_free(pdata->amp_gain[0]); in attach_gpio_amp()
246 gpio_direction_output(pd->amp_gain[0], 0); in attach_gpio_amp()
247 gpio_direction_output(pd->amp_gain[1], 0); in attach_gpio_amp()
251 if (pdata->amp_gpio > 0) { in attach_gpio_amp()
252 ret = gpio_request(pd->amp_gpio, "gpio-amp"); in attach_gpio_amp()
255 pd->amp_gpio, ret); in attach_gpio_amp()
266 if (pd->amp_gain[0] > 0) { in attach_gpio_amp()
267 gpio_free(pd->amp_gain[0]); in attach_gpio_amp()
268 gpio_free(pd->amp_gain[1]); in attach_gpio_amp()
276 if (pd->amp_gain[0] > 0) { in detach_gpio_amp()
277 gpio_free(pd->amp_gain[0]); in detach_gpio_amp()
278 gpio_free(pd->amp_gain[1]); in detach_gpio_amp()
281 if (pd->amp_gpio > 0) in detach_gpio_amp()
282 gpio_free(pd->amp_gpio); in detach_gpio_amp()
304 card->dai_link->ops = &simtec_snd_ops; in simtec_audio_core_probe()
305 card->dai_link->dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | in simtec_audio_core_probe()
308 pdata = pdev->dev.platform_data; in simtec_audio_core_probe()
310 dev_err(&pdev->dev, "no platform data supplied\n"); in simtec_audio_core_probe()
311 return -EINVAL; in simtec_audio_core_probe()
316 xtal_clk = clk_get(&pdev->dev, "xtal"); in simtec_audio_core_probe()
318 dev_err(&pdev->dev, "could not get clkout0\n"); in simtec_audio_core_probe()
319 return -EINVAL; in simtec_audio_core_probe()
322 dev_info(&pdev->dev, "xtal rate is %ld\n", clk_get_rate(xtal_clk)); in simtec_audio_core_probe()
324 ret = attach_gpio_amp(&pdev->dev, pdata); in simtec_audio_core_probe()
328 snd_dev = platform_device_alloc("soc-audio", -1); in simtec_audio_core_probe()
330 dev_err(&pdev->dev, "failed to alloc soc-audio device\n"); in simtec_audio_core_probe()
331 ret = -ENOMEM; in simtec_audio_core_probe()
339 dev_err(&pdev->dev, "failed to add soc-audio dev\n"); in simtec_audio_core_probe()