static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; struct snd_soc_dapm_context *dapm = &codec->dapm; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); int hs_trim; int ret = 0; /* * Configure McPDM offset cancellation based on the HSOTRIM value from * twl6040. */ hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), TWL6040_HSF_TRIM_RIGHT(hs_trim)); /* Headset jack detection only if it is supported */ if (priv->jack_detection) { ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); } /* * NULL pdata means we booted with DT. In this case the routing is * provided and the card is fully routed, no need to mark pins. */ if (!pdata) return ret; /* Disable not connected paths if not used */ twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator"); twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In"); return ret; }
static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; struct snd_soc_dapm_context *dapm = &codec->dapm; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); int hs_trim; int ret = 0; /* */ twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vinrator"); twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In"); /* */ hs_trim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); omap_mcpdm_configure_dn_offsets(rtd, TWL6040_HSF_TRIM_LEFT(hs_trim), TWL6040_HSF_TRIM_RIGHT(hs_trim)); /* */ if (pdata->jack_detection) { ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); } return ret; }
static int omap_abe_twl6040_dl2_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_platform *platform = rtd->platform; struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); u32 hfotrim, left_offset, right_offset; /* DC offset cancellation computation only if ABE is enabled */ if (pdata->has_abe) { /* DC offset cancellation computation */ hfotrim = twl6040_get_trim_value(codec, TWL6040_TRIM_HFOTRIM); right_offset = TWL6040_HSF_TRIM_RIGHT(hfotrim); left_offset = TWL6040_HSF_TRIM_LEFT(hfotrim); omap_abe_dc_set_hf_offset(platform, left_offset, right_offset); } return 0; }
static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; struct snd_soc_platform *platform = rtd->platform; struct snd_soc_dapm_context *dapm = &codec->dapm; struct snd_soc_dapm_context *card_dapm = &card->dapm; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); struct omap_abe_data *card_data = snd_soc_card_get_drvdata(card); u32 hsotrim, left_offset, right_offset, step_mV; int ret = 0; card_data->twl6040_codec = codec; /* Disable not connected paths if not used */ twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator"); twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In"); /* allow audio paths from the audio modem to run during suspend */ snd_soc_dapm_ignore_suspend(&card->dapm, "Ext Spk"); snd_soc_dapm_ignore_suspend(dapm, "AFML"); snd_soc_dapm_ignore_suspend(dapm, "AFMR"); snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Stereophone"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 0"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 1"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 2"); card_dapm->stream_event = omap_abe_stream_event; /* DC offset cancellation computation only if ABE is enabled */ if (pdata->has_abe) { hsotrim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); right_offset = TWL6040_HSF_TRIM_RIGHT(hsotrim); left_offset = TWL6040_HSF_TRIM_LEFT(hsotrim); step_mV = twl6040_get_hs_step_size(codec); omap_abe_dc_set_hs_offset(platform, left_offset, right_offset, step_mV); } /* Headset jack detection only if it is supported */ if (pdata->jack_detection) { ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); if (machine_is_omap_4430sdp() || machine_is_omap_tabletblaze() || machine_is_omap5_sevm() || machine_is_omap5_panda()) twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); else snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET); } return ret; }
static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct snd_soc_card *card = codec->card; struct snd_soc_platform *platform = rtd->platform; struct snd_soc_dapm_context *dapm = &codec->dapm; struct omap_abe_twl6040_data *pdata = dev_get_platdata(card->dev); struct omap_abe_data *card_data = snd_soc_card_get_drvdata(card); u32 hsotrim, left_offset, right_offset, step_mV; int ret = 0; /* Disable not connected paths if not used */ twl6040_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); twl6040_disconnect_pin(dapm, pdata->has_hf, "Ext Spk"); twl6040_disconnect_pin(dapm, pdata->has_ep, "Earphone Spk"); twl6040_disconnect_pin(dapm, pdata->has_aux, "Line Out"); twl6040_disconnect_pin(dapm, pdata->has_vibra, "Vibrator"); twl6040_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); twl6040_disconnect_pin(dapm, pdata->has_mainmic, "Main Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_submic, "Sub Handset Mic"); twl6040_disconnect_pin(dapm, pdata->has_afm, "Line In"); /* allow audio paths from the audio modem to run during suspend */ snd_soc_dapm_ignore_suspend(&card->dapm, "Ext Spk"); snd_soc_dapm_ignore_suspend(dapm, "AFML"); snd_soc_dapm_ignore_suspend(dapm, "AFMR"); snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Stereophone"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 0"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 1"); snd_soc_dapm_ignore_suspend(&card->dapm, "Digital Mic 2"); /* DC offset cancellation computation only if ABE is enabled */ if (pdata->has_abe) { hsotrim = twl6040_get_trim_value(codec, TWL6040_TRIM_HSOTRIM); right_offset = TWL6040_HSF_TRIM_RIGHT(hsotrim); left_offset = TWL6040_HSF_TRIM_LEFT(hsotrim); step_mV = twl6040_get_hs_step_size(codec); omap_abe_dc_set_hs_offset(platform, left_offset, right_offset, step_mV); } /* Headset jack detection only if it is supported */ ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); if (pdata->jack_detection) twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); else snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET); /* Only configure the TPS6130x on SDP4430 */ if (machine_is_omap_4430sdp()) { card_data->adapter = i2c_get_adapter(1); if (!card_data->adapter) { dev_err(card->dev, "can't get i2c adapter\n"); return -ENODEV; } card_data->tps6130x = i2c_new_device(card_data->adapter, &tps6130x_hwmon_info); if (!card_data->tps6130x) { dev_err(card->dev, "can't add i2c device\n"); i2c_put_adapter(card_data->adapter); return -ENODEV; } omap_abe_tps6130x_configure(card_data); } return ret; }