Lines Matching refs:codec
79 struct snd_soc_codec *codec; member
109 static unsigned int twl6040_read(struct snd_soc_codec *codec, unsigned int reg) in twl6040_read() argument
111 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_read()
112 struct twl6040 *twl6040 = codec->control_data; in twl6040_read()
134 static bool twl6040_can_write_to_chip(struct snd_soc_codec *codec, in twl6040_can_write_to_chip() argument
137 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_can_write_to_chip()
153 static inline void twl6040_update_dl12_cache(struct snd_soc_codec *codec, in twl6040_update_dl12_cache() argument
156 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_update_dl12_cache()
171 static int twl6040_write(struct snd_soc_codec *codec, in twl6040_write() argument
174 struct twl6040 *twl6040 = codec->control_data; in twl6040_write()
179 twl6040_update_dl12_cache(codec, reg, value); in twl6040_write()
180 if (twl6040_can_write_to_chip(codec, reg)) in twl6040_write()
186 static void twl6040_init_chip(struct snd_soc_codec *codec) in twl6040_init_chip() argument
188 twl6040_read(codec, TWL6040_REG_TRIM1); in twl6040_init_chip()
189 twl6040_read(codec, TWL6040_REG_TRIM2); in twl6040_init_chip()
190 twl6040_read(codec, TWL6040_REG_TRIM3); in twl6040_init_chip()
191 twl6040_read(codec, TWL6040_REG_HSOTRIM); in twl6040_init_chip()
192 twl6040_read(codec, TWL6040_REG_HFOTRIM); in twl6040_init_chip()
196 twl6040_write(codec, TWL6040_REG_MICLCTL, 0x18); in twl6040_init_chip()
197 twl6040_write(codec, TWL6040_REG_MICRCTL, 0x18); in twl6040_init_chip()
204 twl6040_write(codec, TWL6040_REG_HSGAIN, 0xff); in twl6040_init_chip()
205 twl6040_write(codec, TWL6040_REG_EARCTL, 0x1e); in twl6040_init_chip()
206 twl6040_write(codec, TWL6040_REG_HFLGAIN, 0x1d); in twl6040_init_chip()
207 twl6040_write(codec, TWL6040_REG_HFRGAIN, 0x1d); in twl6040_init_chip()
208 twl6040_write(codec, TWL6040_REG_LINEGAIN, 0); in twl6040_init_chip()
212 static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) in headset_power_mode() argument
217 hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); in headset_power_mode()
218 hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); in headset_power_mode()
228 twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); in headset_power_mode()
229 twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); in headset_power_mode()
237 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in twl6040_hs_dac_event() local
245 hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); in twl6040_hs_dac_event()
246 hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); in twl6040_hs_dac_event()
254 twl6040_write(codec, TWL6040_REG_HSLCTL, hslctl); in twl6040_hs_dac_event()
255 twl6040_write(codec, TWL6040_REG_HSRCTL, hsrctl); in twl6040_hs_dac_event()
264 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in twl6040_ep_drv_event() local
265 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_ep_drv_event()
271 ret = headset_power_mode(codec, 1); in twl6040_ep_drv_event()
274 ret = headset_power_mode(codec, priv->hs_power_mode); in twl6040_ep_drv_event()
282 static void twl6040_hs_jack_report(struct snd_soc_codec *codec, in twl6040_hs_jack_report() argument
285 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_hs_jack_report()
291 status = twl6040_read(codec, TWL6040_REG_STATUS); in twl6040_hs_jack_report()
300 void twl6040_hs_jack_detect(struct snd_soc_codec *codec, in twl6040_hs_jack_detect() argument
303 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_hs_jack_detect()
309 twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); in twl6040_hs_jack_detect()
317 struct snd_soc_codec *codec = priv->codec; in twl6040_accessory_work() local
320 twl6040_hs_jack_report(codec, hs_jack->jack, hs_jack->report); in twl6040_accessory_work()
326 struct snd_soc_codec *codec = data; in twl6040_audio_handler() local
327 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_audio_handler()
338 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); in twl6040_soc_dapm_put_vibra_enum() local
343 val = twl6040_read(codec, e->reg); in twl6040_soc_dapm_put_vibra_enum()
487 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in twl6040_headset_power_get_enum() local
488 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_headset_power_get_enum()
498 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in twl6040_headset_power_put_enum() local
499 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_headset_power_put_enum()
504 ret = headset_power_mode(codec, high_perf); in twl6040_headset_power_put_enum()
515 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in twl6040_pll_get_enum() local
516 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_pll_get_enum()
526 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in twl6040_pll_put_enum() local
527 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_pll_put_enum()
534 int twl6040_get_dl1_gain(struct snd_soc_codec *codec) in twl6040_get_dl1_gain() argument
536 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in twl6040_get_dl1_gain()
544 u8 val = snd_soc_read(codec, TWL6040_REG_HSLCTL); in twl6040_get_dl1_gain()
556 int twl6040_get_clk_id(struct snd_soc_codec *codec) in twl6040_get_clk_id() argument
558 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_get_clk_id()
564 int twl6040_get_trim_value(struct snd_soc_codec *codec, enum twl6040_trim trim) in twl6040_get_trim_value() argument
569 return twl6040_read(codec, TWL6040_REG_TRIM1 + trim); in twl6040_get_trim_value()
573 int twl6040_get_hs_step_size(struct snd_soc_codec *codec) in twl6040_get_hs_step_size() argument
575 struct twl6040 *twl6040 = codec->control_data; in twl6040_get_hs_step_size()
822 static int twl6040_set_bias_level(struct snd_soc_codec *codec, in twl6040_set_bias_level() argument
825 struct twl6040 *twl6040 = codec->control_data; in twl6040_set_bias_level()
826 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_set_bias_level()
845 twl6040_write(codec, TWL6040_REG_GPOCTL, 0x02); in twl6040_set_bias_level()
862 struct snd_soc_codec *codec = dai->codec; in twl6040_startup() local
863 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_startup()
876 struct snd_soc_codec *codec = dai->codec; in twl6040_hw_params() local
877 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_hw_params()
888 dev_err(codec->dev, "HPPLL does not support rate %d\n", in twl6040_hw_params()
902 dev_err(codec->dev, "unsupported rate %d\n", rate); in twl6040_hw_params()
912 struct snd_soc_codec *codec = dai->codec; in twl6040_prepare() local
913 struct twl6040 *twl6040 = codec->control_data; in twl6040_prepare()
914 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_prepare()
918 dev_err(codec->dev, in twl6040_prepare()
925 dev_err(codec->dev, "Can not set PLL (%d)\n", ret); in twl6040_prepare()
935 struct snd_soc_codec *codec = codec_dai->codec; in twl6040_set_dai_sysclk() local
936 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_set_dai_sysclk()
945 dev_err(codec->dev, "unknown clk_id %d\n", clk_id); in twl6040_set_dai_sysclk()
952 static void twl6040_mute_path(struct snd_soc_codec *codec, enum twl6040_dai_id id, in twl6040_mute_path() argument
955 struct twl6040 *twl6040 = codec->control_data; in twl6040_mute_path()
956 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_mute_path()
962 hslctl = twl6040_read(codec, TWL6040_REG_HSLCTL); in twl6040_mute_path()
963 hsrctl = twl6040_read(codec, TWL6040_REG_HSRCTL); in twl6040_mute_path()
964 earctl = twl6040_read(codec, TWL6040_REG_EARCTL); in twl6040_mute_path()
980 hflctl = twl6040_read(codec, TWL6040_REG_HFLCTL); in twl6040_mute_path()
981 hfrctl = twl6040_read(codec, TWL6040_REG_HFRCTL); in twl6040_mute_path()
1004 twl6040_mute_path(dai->codec, TWL6040_DAI_DL1, mute); in twl6040_digital_mute()
1005 twl6040_mute_path(dai->codec, TWL6040_DAI_DL2, mute); in twl6040_digital_mute()
1009 twl6040_mute_path(dai->codec, dai->id, mute); in twl6040_digital_mute()
1096 static int twl6040_probe(struct snd_soc_codec *codec) in twl6040_probe() argument
1099 struct twl6040 *twl6040 = dev_get_drvdata(codec->dev->parent); in twl6040_probe()
1100 struct platform_device *pdev = container_of(codec->dev, in twl6040_probe()
1104 priv = devm_kzalloc(codec->dev, sizeof(*priv), GFP_KERNEL); in twl6040_probe()
1108 snd_soc_codec_set_drvdata(codec, priv); in twl6040_probe()
1110 priv->codec = codec; in twl6040_probe()
1111 codec->control_data = twl6040; in twl6040_probe()
1115 dev_err(codec->dev, "invalid irq\n"); in twl6040_probe()
1126 "twl6040_irq_plug", codec); in twl6040_probe()
1128 dev_err(codec->dev, "PLUG IRQ request failed: %d\n", ret); in twl6040_probe()
1132 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); in twl6040_probe()
1133 twl6040_init_chip(codec); in twl6040_probe()
1138 static int twl6040_remove(struct snd_soc_codec *codec) in twl6040_remove() argument
1140 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); in twl6040_remove()
1142 free_irq(priv->plug_irq, codec); in twl6040_remove()