| /* |
| * Exynos9610-RT5665 Audio Machine driver. |
| * |
| * This program is free software; you can redistribute it and/or modify it |
| * under the terms of the GNU General Public License as published by the |
| * Free Software Foundation; either version 2 of the License, or (at your |
| * option) any later version. |
| */ |
| |
| #define CHANGE_DEV_PRINT |
| |
| #include <linux/input-event-codes.h> |
| #include <linux/debugfs.h> |
| #include <linux/module.h> |
| #include <linux/of.h> |
| #include <linux/of_gpio.h> |
| #include <linux/clk.h> |
| #include <linux/io.h> |
| #include <linux/slab.h> |
| #include <linux/gpio.h> |
| #include <linux/wakelock.h> |
| #include <sound/tlv.h> |
| #include <sound/soc.h> |
| #include <sound/pcm.h> |
| #include <sound/pcm_params.h> |
| #include <sound/initval.h> |
| #include <soc/samsung/exynos-pmu.h> |
| #include <sound/samsung/abox.h> |
| #include "../codecs/rt5665.h" |
| #include <sound/jack.h> |
| #include <sound/samsung/sec_audio_debug.h> |
| |
| #include "jack_rt5665_sysfs_cb.h" |
| #if defined(CONFIG_SND_SOC_DBMDX) |
| #include <sound/dbmdx-export.h> |
| #endif |
| #define CODEC_SAMPLE_RATE_48KHZ 48000 |
| #define CODEC_PLL_48KHZ 24576000 |
| #define CODEC_SAMPLE_RATE_192KHZ 192000 |
| #define CODEC_PLL_192KHZ 49152000 |
| |
| #define RT5665_MCLK_FREQ 26000000 |
| #define RT5665_DAI_ID 16 |
| #define RT5665_DAI_OFFSET 13 |
| #define RT5665_CODEC_MAX 22 |
| #define RT5665_AUX_MAX 2 |
| |
| #if defined(CONFIG_SND_SOC_RT5510) |
| #define RT5510_DAI_ID 18 |
| #endif |
| |
| #define CLK_SRC_SCLK 0 |
| #define CLK_SRC_LRCLK 1 |
| #define CLK_SRC_PDM 2 |
| #define CLK_SRC_SELF 3 |
| #define CLK_SRC_MCLK 4 |
| #define CLK_SRC_SWIRE 5 |
| |
| #define CLK_SRC_DAI 0 |
| #define CLK_SRC_CODEC 1 |
| |
| #define RDMA_COUNT 8 |
| #define WDMA_COUNT 5 |
| |
| #define UAIF_START (RDMA_COUNT + WDMA_COUNT) |
| #define UAIF_COUNT 4 |
| #define SIFS_START (RDMA_COUNT + WDMA_COUNT + UAIF_COUNT + 2) |
| #define SIFS_COUNT 3 |
| |
| #define DSIF_COUNT 1 |
| #define SPDY_START (RDMA_COUNT + WDMA_COUNT + UAIF_COUNT + DSIF_COUNT) |
| |
| static struct snd_soc_card exynos9610_audio; |
| static struct snd_soc_codec_conf codec_conf[RT5665_CODEC_MAX]; |
| static struct snd_soc_aux_dev aux_dev[RT5665_AUX_MAX]; |
| static struct clk *xclkout; |
| |
| struct rt5665_drvdata { |
| struct device *dev; |
| struct snd_soc_codec *codec; |
| struct snd_soc_jack rt5665_headset; |
| int aifrate; |
| bool use_external_jd; |
| |
| int abox_vss_state; |
| unsigned int pcm_state; |
| struct wake_lock wake_lock; |
| unsigned int wake_lock_switch; |
| |
| int uaifp_count; |
| int uaifc_count; |
| }; |
| |
| static struct rt5665_drvdata exynos9610_drvdata; |
| #if defined(CONFIG_SND_SOC_TFA9894) |
| extern void exynos9610_set_xclkout0_13(void); |
| #endif |
| |
| static struct snd_soc_pcm_runtime *exynos9610_get_rtd(struct snd_soc_card *card, |
| int id) |
| { |
| struct snd_soc_dai_link *dai_link; |
| struct snd_soc_pcm_runtime *rtd = NULL; |
| |
| for (dai_link = card->dai_link; |
| dai_link - card->dai_link < card->num_links; |
| dai_link++) { |
| if (id == dai_link->id) { |
| rtd = snd_soc_get_pcm_runtime(card, dai_link->name); |
| break; |
| } |
| } |
| |
| if (!rtd) |
| rtd = snd_soc_get_pcm_runtime(card, card->dai_link[id].name); |
| |
| return rtd; |
| } |
| |
| static int exynos9610_rt5665_hw_params(struct snd_pcm_substream *substream, |
| struct snd_pcm_hw_params *params) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_card *card = rtd->card; |
| struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| int ret, codec_pll_in, codec_pll_out; |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct snd_soc_dai_link *dai_link = rtd->dai_link; |
| |
| drvdata->pcm_state |= (1 << dai_link->id); |
| |
| if ((drvdata->uaifp_count == 0) && (drvdata->uaifc_count == 0)) { |
| dev_info(card->dev, "%s: BCLK Enable\n", __func__); |
| snd_soc_dai_set_tristate(rtd->cpu_dai, 0); |
| } |
| |
| if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| && (drvdata->uaifp_count == 0)) { |
| drvdata->uaifp_count++; |
| } else if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
| && (drvdata->uaifc_count == 0)) { |
| drvdata->uaifc_count++; |
| } else { |
| dev_err(card->dev, "%s: cnt check stream %d, uaifp_cnt %d, uaifc_cnt %d\n", |
| __func__, substream->stream, drvdata->uaifp_count, drvdata->uaifc_count); |
| } |
| dev_info(card->dev, "%s: uaifp_cnt %d, uaifc_cnt %d\n", __func__, |
| drvdata->uaifp_count, drvdata->uaifc_count); |
| |
| dev_info(card->dev, "%s: %s-%d %dch, %dHz, %dbit, %dbytes (pcm_state: 0x%07x)\n", |
| __func__, rtd->dai_link->name, substream->stream, |
| params_channels(params), params_rate(params), |
| params_width(params), params_buffer_bytes(params), |
| drvdata->pcm_state); |
| |
| codec_pll_in = params_rate(params) * params_width(params) * 2; |
| |
| codec_pll_out = params_rate(params) * 512; |
| |
| ret = snd_soc_dai_set_pll(codec_dai, 0, RT5665_PLL1_S_BCLK1, codec_pll_in, codec_pll_out); |
| if (ret < 0) { |
| dev_err(card->dev, "codec_dai RT5665_PLL1_S_BCLK1 not set\n"); |
| return ret; |
| } |
| ret = snd_soc_dai_set_sysclk(codec_dai, RT5665_SCLK_S_PLL1, codec_pll_out, SND_SOC_CLOCK_IN); |
| if (ret < 0) { |
| dev_err(card->dev, "codec_dai RT5665_PLL1_S_PLL1 not set\n"); |
| return ret; |
| } |
| |
| return ret; |
| } |
| |
| static int exynos9610_rt5665_hw_free(struct snd_pcm_substream *substream) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_card *card = rtd->card; |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct snd_soc_dai_link *dai_link = rtd->dai_link; |
| |
| drvdata->pcm_state &= (~(1 << dai_link->id)); |
| |
| dev_info(card->dev, "%s: %s-%d (pcm_state: 0x%07x)\n", |
| __func__, rtd->dai_link->name, substream->stream, |
| drvdata->pcm_state); |
| |
| if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| && (drvdata->uaifp_count > 0)) { |
| drvdata->uaifp_count--; |
| } else if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) |
| && (drvdata->uaifc_count > 0)) { |
| drvdata->uaifc_count--; |
| } else { |
| dev_err(card->dev, "%s: cnt check stream %d, uaifp_cnt %d, uaifc_cnt %d\n", |
| __func__, substream->stream, drvdata->uaifp_count, drvdata->uaifc_count); |
| } |
| |
| if ((drvdata->uaifp_count == 0) && (drvdata->uaifc_count == 0)) { |
| dev_info(card->dev, "%s: BCLK Disable\n", __func__); |
| snd_soc_dai_set_tristate(rtd->cpu_dai, 1); |
| } |
| |
| dev_info(card->dev, "%s: uaifp_cnt %d, uaifc_cnt %d\n", __func__, |
| drvdata->uaifp_count, drvdata->uaifc_count); |
| |
| return 0; |
| } |
| |
| static struct snd_soc_ops uaif0_ops = { |
| .hw_params = exynos9610_rt5665_hw_params, |
| .hw_free = exynos9610_rt5665_hw_free, |
| }; |
| |
| static int cs35l41_hw_params(struct snd_pcm_substream *substream, |
| struct snd_pcm_hw_params *params) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_card *card = rtd->card; |
| struct snd_soc_dai **codec_dais = rtd->codec_dais; |
| unsigned int clk; |
| unsigned int num_codecs = rtd->num_codecs; |
| int ret = 0, i; |
| |
| /* using bclk for sysclk */ |
| clk = snd_soc_params_to_bclk(params); |
| for (i = 0; i < num_codecs; i++) { |
| ret = snd_soc_codec_set_sysclk(codec_dais[i]->codec, |
| CLK_SRC_SCLK, 0, clk, |
| SND_SOC_CLOCK_IN); |
| if (ret < 0) |
| dev_err(card->dev, "%s: set codec sysclk failed: %d\n", |
| codec_dais[i]->name, ret); |
| } |
| return ret; |
| } |
| |
| static const struct snd_soc_ops cs35l41_ops = { |
| .hw_params = cs35l41_hw_params, |
| }; |
| |
| static int vogue_dai_ops_hw_params(struct snd_pcm_substream *substream, |
| struct snd_pcm_hw_params *params) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_card *card = rtd->card; |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct snd_soc_dai_link *dai_link = rtd->dai_link; |
| int ret = 0; |
| |
| drvdata->pcm_state |= (1 << dai_link->id); |
| |
| dev_info(card->dev, |
| "%s: %s-%d: 0x%x: hw_params: %dch, %dHz, %dbytes, %dbit (pcm_state: 0x%07x)\n", |
| __func__, rtd->dai_link->name, substream->stream, dai_link->id, |
| params_channels(params), params_rate(params), |
| params_buffer_bytes(params), params_width(params), |
| drvdata->pcm_state); |
| |
| return ret; |
| } |
| |
| static int vogue_dai_ops_hw_free(struct snd_pcm_substream *substream) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_card *card = rtd->card; |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct snd_soc_dai_link *dai_link = rtd->dai_link; |
| int ret = 0; |
| |
| drvdata->pcm_state &= (~(1 << dai_link->id)); |
| |
| dev_info(card->dev, "%s: %s-%d (pcm_state: 0x%07x)\n", |
| __func__, rtd->dai_link->name, substream->stream, |
| drvdata->pcm_state); |
| |
| return ret; |
| } |
| |
| static const struct snd_soc_ops uaif_ops = { |
| .hw_params = vogue_dai_ops_hw_params, |
| .hw_free = vogue_dai_ops_hw_free, |
| }; |
| |
| static const struct snd_soc_ops rdma_ops = { |
| .hw_params = vogue_dai_ops_hw_params, |
| .hw_free = vogue_dai_ops_hw_free, |
| }; |
| |
| static const struct snd_soc_ops wdma_ops = { |
| .hw_params = vogue_dai_ops_hw_params, |
| .hw_free = vogue_dai_ops_hw_free, |
| }; |
| |
| static int dsif_hw_params(struct snd_pcm_substream *substream, |
| struct snd_pcm_hw_params *hw_params) |
| { |
| struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
| int tx_slot[] = {0, 1}; |
| |
| /* bclk ratio 64 for DSD64, 128 for DSD128 */ |
| snd_soc_dai_set_bclk_ratio(cpu_dai, 64); |
| |
| /* channel map 0 1 if left is first, 1 0 if right is first */ |
| snd_soc_dai_set_channel_map(cpu_dai, 2, tx_slot, 0, NULL); |
| return 0; |
| } |
| |
| static const struct snd_soc_ops dsif_ops = { |
| .hw_params = dsif_hw_params, |
| }; |
| |
| static int exynos9610_rt5665_codec_init(struct snd_soc_pcm_runtime *rtd) |
| { |
| int ret; |
| struct rt5665_drvdata *ctx = snd_soc_card_get_drvdata(rtd->card); |
| struct snd_soc_codec *codec = rtd->codec; |
| struct snd_soc_jack *jack; |
| |
| dev_info(codec->dev, "%s\n", __func__); |
| |
| ret = snd_soc_card_jack_new(&exynos9610_audio, "Headset Jack", |
| SND_JACK_HEADSET, &ctx->rt5665_headset, NULL, 0); |
| if (ret) { |
| dev_err(rtd->dev, "Headset Jack creation failed %d\n", ret); |
| return ret; |
| } |
| |
| jack = &ctx->rt5665_headset; |
| snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); |
| snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); |
| snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP); |
| snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); |
| rt5665_set_jack_detect(codec, &ctx->rt5665_headset); |
| |
| return ret; |
| } |
| |
| static int exynos9610_late_probe(struct snd_soc_card *card) |
| { |
| struct snd_soc_dai *aif1_dai; |
| struct snd_soc_codec *codec; |
| struct snd_soc_component *cpu; |
| struct snd_soc_dapm_context *dapm; |
| char name[SZ_32]; |
| const char *prefix; |
| int i; |
| struct rt5665_drvdata *drvdata = snd_soc_card_get_drvdata(card); |
| #if defined(CONFIG_SND_SOC_RT5510) |
| struct snd_soc_codec *spk_amp; |
| struct snd_soc_dai *aif2_dai; |
| #endif |
| |
| dev_info(card->dev, "%s\n", __func__); |
| |
| aif1_dai = exynos9610_get_rtd(card, 0)->cpu_dai; |
| cpu = aif1_dai->component; |
| |
| aif1_dai = exynos9610_get_rtd(card, RT5665_DAI_ID)->codec_dai; |
| codec = aif1_dai->codec; |
| |
| #if defined(CONFIG_SND_SOC_RT5510) |
| aif2_dai = exynos9610_get_rtd(card, RT5510_DAI_ID)->codec_dai; |
| spk_amp = aif2_dai->codec; |
| #endif |
| drvdata->codec = codec; |
| |
| /* close codec device immediately when pcm is closed */ |
| snd_soc_dapm_ignore_suspend(&card->dapm, "VOUTPUT"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "VINPUT1"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "VINPUT2"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "VOUTPUTCALL"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "VINPUTCALL"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "HEADSETMIC"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "MAINMIC"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "SUBMIC"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "RECEIVER"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "HEADPHONE"); |
| snd_soc_dapm_ignore_suspend(&card->dapm, "SPEAKER"); |
| snd_soc_dapm_sync(&card->dapm); |
| |
| snd_soc_dapm_ignore_suspend(snd_soc_codec_get_dapm(codec), "AIF1 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_codec_get_dapm(codec), "AIF1_1 Capture"); |
| snd_soc_dapm_sync(snd_soc_codec_get_dapm(codec)); |
| |
| #if defined(CONFIG_SND_SOC_RT5510) |
| snd_soc_dapm_ignore_suspend(snd_soc_codec_get_dapm(spk_amp), "aif_playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_codec_get_dapm(spk_amp), "aif_capture"); |
| snd_soc_dapm_sync(snd_soc_codec_get_dapm(spk_amp)); |
| #endif |
| |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA0 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA1 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA2 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA3 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA4 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA5 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA6 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX RDMA7 Playback"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX WDMA0 Capture"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX WDMA1 Capture"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX WDMA2 Capture"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX WDMA3 Capture"); |
| snd_soc_dapm_ignore_suspend(snd_soc_component_get_dapm(cpu), "ABOX WDMA4 Capture"); |
| snd_soc_dapm_sync(snd_soc_component_get_dapm(cpu)); |
| |
| for (i = 0; i < UAIF_COUNT; i++) { |
| aif1_dai = exynos9610_get_rtd(card, UAIF_START + i)->cpu_dai; |
| cpu = aif1_dai->component; |
| dapm = snd_soc_component_get_dapm(cpu); |
| prefix = dapm->component->name_prefix; |
| snprintf(name, sizeof(name), "%s UAIF%d Capture", prefix, i); |
| snd_soc_dapm_ignore_suspend(dapm, name); |
| snprintf(name, sizeof(name), "%s UAIF%d Playback", prefix, i); |
| snd_soc_dapm_ignore_suspend(dapm, name); |
| snd_soc_dapm_sync(dapm); |
| } |
| |
| for (i = 0; i < SIFS_COUNT; i++) { |
| aif1_dai = exynos9610_get_rtd(card, SIFS_START + i)->cpu_dai; |
| cpu = aif1_dai->component; |
| dapm = snd_soc_component_get_dapm(cpu); |
| prefix = dapm->component->name_prefix; |
| snprintf(name, sizeof(name), "%s SIFS%d Capture", prefix, i); |
| snd_soc_dapm_ignore_suspend(dapm, name); |
| snprintf(name, sizeof(name), "%s SIFS%d Playback", prefix, i); |
| snd_soc_dapm_ignore_suspend(dapm, name); |
| snd_soc_dapm_sync(dapm); |
| } |
| |
| aif1_dai = exynos9610_get_rtd(card, SPDY_START)->cpu_dai; |
| cpu = aif1_dai->component; |
| dapm = snd_soc_component_get_dapm(cpu); |
| prefix = dapm->component->name_prefix; |
| snprintf(name, sizeof(name), "%s SPDY Capture", prefix); |
| snd_soc_dapm_ignore_suspend(dapm, name); |
| snd_soc_dapm_sync(dapm); |
| |
| wake_lock_init(&drvdata->wake_lock, WAKE_LOCK_SUSPEND, "vogue-sound"); |
| drvdata->wake_lock_switch = 0; |
| |
| #if defined(CONFIG_SND_SOC_DBMDX) |
| dbmdx_remote_add_codec_controls(codec); |
| #endif |
| |
| register_rt5665_jack_cb(codec); |
| |
| register_debug_mixer(card); |
| |
| return 0; |
| } |
| |
| static int vogue_headsetmic(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| struct snd_soc_codec *codec = drvdata->codec; |
| struct rt5665_priv *rt5665 = snd_soc_codec_get_drvdata(codec); |
| |
| dev_info(card->dev, "%s ev: %d, jack_type %d\n", __func__, event, rt5665->jack_type); |
| |
| return 0; |
| } |
| |
| static int vogue_mainmic(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_submic(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_receiver(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_headphone(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| struct snd_soc_codec *codec = drvdata->codec; |
| struct rt5665_priv *rt5665 = snd_soc_codec_get_drvdata(codec); |
| |
| dev_info(card->dev, "%s ev: %d, jack_type %d\n", __func__, event, rt5665->jack_type); |
| |
| return 0; |
| } |
| |
| static int vogue_speaker(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_bt_sco_tx(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_bt_sco_rx(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_fm_radio_in(struct snd_soc_dapm_widget *w, |
| struct snd_kcontrol *kcontrol, int event) |
| { |
| struct snd_soc_card *card = w->dapm->card; |
| |
| dev_info(card->dev, "%s ev: %d\n", __func__, event); |
| |
| return 0; |
| } |
| |
| static int vogue_get_sound_wakelock(struct snd_kcontrol *kcontrol, |
| struct snd_ctl_elem_value *ucontrol) |
| { |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| |
| ucontrol->value.integer.value[0] = drvdata->wake_lock_switch; |
| |
| return 0; |
| } |
| |
| static int vogue_set_sound_wakelock(struct snd_kcontrol *kcontrol, |
| struct snd_ctl_elem_value *ucontrol) |
| { |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| unsigned int val; |
| |
| val = (unsigned int)ucontrol->value.integer.value[0]; |
| drvdata->wake_lock_switch = val; |
| |
| dev_info(drvdata->dev, "%s: %d\n", __func__, drvdata->wake_lock_switch); |
| |
| if (drvdata->wake_lock_switch) |
| wake_lock(&drvdata->wake_lock); |
| else |
| wake_unlock(&drvdata->wake_lock); |
| |
| return 0; |
| } |
| |
| static const char * const abox_vss_state_enum_texts[] = { |
| "NORMAL", |
| "INIT FAIL", |
| "SUSPENDED", |
| "PCM OPEN FAIL", |
| "ABOX STUCK", |
| }; |
| |
| SOC_ENUM_SINGLE_DECL(abox_vss_state_enum, SND_SOC_NOPM, 0, |
| abox_vss_state_enum_texts); |
| |
| int abox_vss_state_get(struct snd_kcontrol *kcontrol, |
| struct snd_ctl_elem_value *ucontrol) |
| { |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| |
| ucontrol->value.enumerated.item[0] = drvdata->abox_vss_state; |
| |
| return 0; |
| } |
| |
| int abox_vss_state_put(struct snd_kcontrol *kcontrol, |
| struct snd_ctl_elem_value *ucontrol) |
| { |
| struct rt5665_drvdata *drvdata = &exynos9610_drvdata; |
| struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; |
| const unsigned int item = ucontrol->value.enumerated.item[0]; |
| |
| if (item >= e->items) { |
| dev_err(drvdata->dev, "%s item %d overflow\n", __func__, item); |
| return -EINVAL; |
| } |
| |
| drvdata->abox_vss_state = item; |
| dev_info(drvdata->dev, "VSS STATE: %s\n", abox_vss_state_enum_texts[item]); |
| |
| return 0; |
| } |
| |
| static const struct snd_kcontrol_new exynos9610_audio_controls[] = { |
| SOC_DAPM_PIN_SWITCH("HEADPHONE"), |
| SOC_DAPM_PIN_SWITCH("SPEAKER"), |
| SOC_DAPM_PIN_SWITCH("RECEIVER"), |
| SOC_DAPM_PIN_SWITCH("MAINMIC"), |
| SOC_DAPM_PIN_SWITCH("SUBMIC"), |
| SOC_DAPM_PIN_SWITCH("HEADSETMIC"), |
| SOC_ENUM_EXT("ABOX VSS State", abox_vss_state_enum, abox_vss_state_get, abox_vss_state_put), |
| SOC_SINGLE_BOOL_EXT("Sound Wakelock", 0, |
| vogue_get_sound_wakelock, vogue_set_sound_wakelock), |
| }; |
| |
| const struct snd_soc_dapm_widget exynos9610_audio_dapm_widgets[] = { |
| SND_SOC_DAPM_OUTPUT("VOUTPUT"), |
| SND_SOC_DAPM_INPUT("VINPUT1"), |
| SND_SOC_DAPM_INPUT("VINPUT2"), |
| SND_SOC_DAPM_OUTPUT("VOUTPUTCALL"), |
| SND_SOC_DAPM_INPUT("VINPUTCALL"), |
| SND_SOC_DAPM_MIC("HEADSETMIC", vogue_headsetmic), |
| SND_SOC_DAPM_MIC("MAINMIC", vogue_mainmic), |
| SND_SOC_DAPM_MIC("SUBMIC", vogue_submic), |
| SND_SOC_DAPM_SPK("RECEIVER", vogue_receiver), |
| SND_SOC_DAPM_HP("HEADPHONE", vogue_headphone), |
| SND_SOC_DAPM_SPK("SPEAKER", vogue_speaker), |
| SND_SOC_DAPM_MIC("BLUETOOTH MIC", vogue_bt_sco_tx), |
| SND_SOC_DAPM_SPK("BLUETOOTH SPK", vogue_bt_sco_rx), |
| SND_SOC_DAPM_MIC("FM IN", vogue_fm_radio_in), |
| }; |
| |
| static struct snd_soc_dai_link exynos9610_dai[] = { |
| { |
| .name = "RDMA0", |
| .stream_name = "RDMA0", |
| .platform_name = "14a51000.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 0, |
| }, |
| { |
| .name = "RDMA1", |
| .stream_name = "RDMA1", |
| .platform_name = "14a51100.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 1, |
| }, |
| { |
| .name = "RDMA2", |
| .stream_name = "RDMA2", |
| .platform_name = "14a51200.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 2, |
| }, |
| { |
| .name = "RDMA3", |
| .stream_name = "RDMA3", |
| .platform_name = "14a51300.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 3, |
| }, |
| { |
| .name = "RDMA4", |
| .stream_name = "RDMA4", |
| .platform_name = "14a51400.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 4, |
| }, |
| { |
| .name = "RDMA5", |
| .stream_name = "RDMA5", |
| .platform_name = "14a51500.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 5, |
| }, |
| { |
| .name = "RDMA6", |
| .stream_name = "RDMA6", |
| .platform_name = "14a51600.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 6, |
| }, |
| { |
| .name = "RDMA7", |
| .stream_name = "RDMA7", |
| .platform_name = "14a51700.abox_rdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &rdma_ops, |
| .dpcm_playback = 1, |
| .id = 7, |
| }, |
| { |
| .name = "WDMA0", |
| .stream_name = "WDMA0", |
| .platform_name = "14a52000.abox_wdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &wdma_ops, |
| .dpcm_capture = 1, |
| .id = 8, |
| }, |
| { |
| .name = "WDMA1", |
| .stream_name = "WDMA1", |
| .platform_name = "14a52100.abox_wdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &wdma_ops, |
| .dpcm_capture = 1, |
| .id = 9, |
| }, |
| { |
| .name = "WDMA2", |
| .stream_name = "WDMA2", |
| .platform_name = "14a52200.abox_wdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &wdma_ops, |
| .dpcm_capture = 1, |
| .id = 10, |
| }, |
| { |
| .name = "WDMA3", |
| .stream_name = "WDMA3", |
| .platform_name = "14a52300.abox_wdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &wdma_ops, |
| .dpcm_capture = 1, |
| .id = 11, |
| }, |
| { |
| .name = "WDMA4", |
| .stream_name = "WDMA4", |
| .platform_name = "14a52400.abox_wdma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .dynamic = 1, |
| .ignore_suspend = 1, |
| .trigger = {SND_SOC_DPCM_TRIGGER_POST_PRE, SND_SOC_DPCM_TRIGGER_PRE_POST}, |
| .ops = &wdma_ops, |
| .dpcm_capture = 1, |
| .id = 12, |
| }, |
| #if IS_ENABLED(SND_SOC_SAMSUNG_DISPLAYPORT) |
| { |
| .name = "DP Audio", |
| .stream_name = "DP Audio", |
| .cpu_dai_name = "audio_cpu_dummy", |
| .platform_name = "dp_dma", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| }, |
| #endif |
| { |
| .name = "UAIF0", |
| .stream_name = "UAIF0", |
| .platform_name = "snd-soc-dummy", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &uaif0_ops, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| .init = exynos9610_rt5665_codec_init, |
| .id = 16, |
| }, |
| { |
| .name = "UAIF1", |
| .stream_name = "UAIF1", |
| .platform_name = "snd-soc-dummy", |
| #if !defined(CONFIG_SND_SOC_TFA9894) |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| #endif |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &uaif_ops, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| .id = 17, |
| }, |
| { |
| .name = "UAIF2", |
| .stream_name = "UAIF2", |
| .platform_name = "snd-soc-dummy", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &uaif_ops, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| .id = 18, |
| }, |
| { |
| .name = "UAIF4", |
| .stream_name = "UAIF4", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &uaif_ops, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| .id = 19, |
| }, |
| { |
| .name = "DSIF", |
| .stream_name = "DSIF", |
| .cpu_dai_name = "DSIF", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &dsif_ops, |
| .dpcm_playback = 1, |
| }, |
| { |
| .name = "SPDY", |
| .stream_name = "SPDY", |
| .cpu_dai_name = "SPDY", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .ops = &uaif_ops, |
| .dpcm_capture = 1, |
| .id = 20, |
| }, |
| { |
| .name = "SIFS0", |
| .stream_name = "SIFS0", |
| .cpu_dai_name = "SIFS0", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| }, |
| { |
| .name = "SIFS1", |
| .stream_name = "SIFS1", |
| .cpu_dai_name = "SIFS1", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| }, |
| { |
| .name = "SIFS2", |
| .stream_name = "SIFS2", |
| .cpu_dai_name = "SIFS2", |
| .platform_name = "snd-soc-dummy", |
| .codec_name = "snd-soc-dummy", |
| .codec_dai_name = "snd-soc-dummy-dai", |
| .no_pcm = 1, |
| .ignore_suspend = 1, |
| .ignore_pmdown_time = 1, |
| .be_hw_params_fixup = abox_hw_params_fixup_helper, |
| .dpcm_playback = 1, |
| .dpcm_capture = 1, |
| }, |
| }; |
| |
| static int read_platform(struct device_node *np, const char * const prop, |
| struct device_node **dai) |
| { |
| int ret = 0; |
| |
| np = of_get_child_by_name(np, prop); |
| if (!np) |
| return -ENOENT; |
| |
| *dai = of_parse_phandle(np, "sound-dai", 0); |
| if (!*dai) { |
| ret = -ENODEV; |
| goto out; |
| } |
| out: |
| of_node_put(np); |
| |
| return ret; |
| } |
| |
| static int read_cpu(struct device_node *np, struct device *dev, |
| struct snd_soc_dai_link *dai_link) |
| { |
| int ret = 0; |
| |
| np = of_get_child_by_name(np, "cpu"); |
| if (!np) |
| return -ENOENT; |
| |
| dai_link->cpu_of_node = of_parse_phandle(np, "sound-dai", 0); |
| if (!dai_link->cpu_of_node) { |
| ret = -ENODEV; |
| goto out; |
| } |
| |
| if (dai_link->cpu_dai_name == NULL) { |
| /* Ignoring the return as we don't register DAIs to the platform */ |
| ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name); |
| if (ret) |
| goto out; |
| } |
| out: |
| of_node_put(np); |
| |
| return ret; |
| } |
| |
| static int read_codec(struct device_node *np, struct device *dev, |
| struct snd_soc_dai_link *dai_link) |
| { |
| np = of_get_child_by_name(np, "codec"); |
| if (!np) |
| return -ENOENT; |
| |
| return snd_soc_of_get_dai_link_codecs(dev, np, dai_link); |
| } |
| |
| static void control_xclkout(bool on) |
| { |
| if (on) { |
| clk_prepare_enable(xclkout); |
| #if defined(CONFIG_SND_SOC_TFA9894) |
| exynos9610_set_xclkout0_13(); |
| #endif |
| } else |
| clk_disable_unprepare(xclkout); |
| } |
| |
| static struct snd_soc_card exynos9610_audio = { |
| .name = "Exynos9610-Audio", |
| .owner = THIS_MODULE, |
| .dai_link = exynos9610_dai, |
| .num_links = ARRAY_SIZE(exynos9610_dai), |
| |
| .late_probe = exynos9610_late_probe, |
| |
| .controls = exynos9610_audio_controls, |
| .num_controls = ARRAY_SIZE(exynos9610_audio_controls), |
| .dapm_widgets = exynos9610_audio_dapm_widgets, |
| .num_dapm_widgets = ARRAY_SIZE(exynos9610_audio_dapm_widgets), |
| |
| .drvdata = (void *)&exynos9610_drvdata, |
| |
| .codec_conf = codec_conf, |
| .num_configs = ARRAY_SIZE(codec_conf), |
| |
| .aux_dev = aux_dev, |
| .num_aux_devs = ARRAY_SIZE(aux_dev), |
| }; |
| |
| static void exynos9610_mic_always_on(struct platform_device *pdev) |
| { |
| struct snd_soc_card *card = platform_get_drvdata(pdev); |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct snd_soc_codec *codec = drvdata->codec; |
| struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); |
| |
| dev_info(&pdev->dev, "%s\n", __func__); |
| |
| if (of_find_property(pdev->dev.of_node, "mic-always-on", NULL) != NULL){ |
| snd_soc_dapm_force_enable_pin(dapm, "MICBIAS2"); |
| snd_soc_dapm_force_enable_pin(dapm, "MICBIAS3"); |
| snd_soc_dapm_sync(dapm); |
| } else { |
| dev_info(&pdev->dev, "Invalid mic_always_on\n"); |
| return; |
| } |
| |
| dev_info(&pdev->dev, "Success to enable mic-always-on\n"); |
| } |
| |
| static int exynos9610_audio_probe(struct platform_device *pdev) |
| { |
| struct snd_soc_card *card = &exynos9610_audio; |
| struct rt5665_drvdata *drvdata = card->drvdata; |
| struct device_node *np = pdev->dev.of_node; |
| struct device_node *dai; |
| int nlink = 0; |
| int i, rc, ret; |
| |
| dev_info(&pdev->dev, "%s\n", __func__); |
| |
| card->dev = &pdev->dev; |
| drvdata->dev = card->dev; |
| snd_soc_card_set_drvdata(card, drvdata); |
| |
| xclkout = devm_clk_get(&pdev->dev, "xclkout"); |
| if (IS_ERR(xclkout)) { |
| dev_err(&pdev->dev, "xclkout get failed\n"); |
| xclkout = NULL; |
| } |
| control_xclkout(true); |
| dev_info(&pdev->dev, "xclkout is enabled\n"); |
| |
| for_each_child_of_node(np, dai) { |
| struct snd_soc_dai_link *link = &exynos9610_dai[nlink]; |
| |
| if (!link->name) |
| link->name = dai->name; |
| if (!link->stream_name) |
| link->stream_name = dai->name; |
| |
| if (!link->cpu_name) { |
| ret = read_cpu(dai, card->dev, link); |
| if (ret) { |
| dev_err(card->dev, "Failed to parse cpu DAI for %s: %d\n", |
| dai->name, ret); |
| return ret; |
| } |
| } |
| |
| if (!link->platform_name) { |
| ret = read_platform(dai, "platform", |
| &link->platform_of_node); |
| if (ret) { |
| link->platform_of_node = link->cpu_of_node; |
| dev_info(card->dev, "Cpu node is used as platform for %s: %d\n", |
| dai->name, ret); |
| } |
| } |
| |
| if (!link->codec_name) { |
| ret = read_codec(dai, card->dev, link); |
| if (ret) { |
| dev_err(card->dev, "Failed to parse codec DAI for %s: %d\n", |
| dai->name, ret); |
| return ret; |
| } |
| |
| if (link->codecs && strstr(link->codecs[0].dai_name, |
| "cs35l41")) |
| link->ops = &cs35l41_ops; |
| |
| } |
| |
| link->dai_fmt = snd_soc_of_parse_daifmt(dai, NULL, NULL, NULL); |
| |
| if (++nlink == card->num_links) |
| break; |
| } |
| |
| if (!nlink) { |
| dev_err(card->dev, "No DAIs specified\n"); |
| return -EINVAL; |
| } |
| |
| if (of_property_read_bool(np, "samsung,routing")) { |
| ret = snd_soc_of_parse_audio_routing(card, "samsung,routing"); |
| if (ret) |
| return ret; |
| } |
| |
| for (i = 0; i < ARRAY_SIZE(codec_conf); i++) { |
| codec_conf[i].of_node = of_parse_phandle(np, "samsung,codec", i); |
| if (IS_ERR_OR_NULL(codec_conf[i].of_node)) { |
| exynos9610_audio.num_configs = i; |
| break; |
| } |
| |
| rc = of_property_read_string_index(np, "samsung,prefix", i, |
| &codec_conf[i].name_prefix); |
| if (rc < 0) |
| codec_conf[i].name_prefix = ""; |
| } |
| |
| for (i = 0; i < ARRAY_SIZE(aux_dev); i++) { |
| aux_dev[i].codec_of_node = of_parse_phandle(np, "samsung,aux", i); |
| if (IS_ERR_OR_NULL(aux_dev[i].codec_of_node)) { |
| exynos9610_audio.num_aux_devs = i; |
| break; |
| } |
| } |
| |
| ret = devm_snd_soc_register_card(card->dev, card); |
| if (ret) { |
| dev_err(card->dev, "%s: snd_soc_register_card() failed:%d\n", __func__, ret); |
| sec_audio_bootlog(3, "%s: snd_soc_register_card() failed:%d\n", __func__, ret); |
| } else { |
| exynos9610_mic_always_on(pdev); |
| dev_info(card->dev, "%s done\n", __func__); |
| sec_audio_bootlog(6, "%s done\n", __func__); |
| } |
| |
| return ret; |
| } |
| |
| static const struct of_device_id exynos9610_audio_of_match[] = { |
| {.compatible = "samsung,exynos9610-audio",}, |
| {}, |
| }; |
| MODULE_DEVICE_TABLE(of, exynos9610_audio_of_match); |
| |
| static struct platform_driver exynos9610_audio_driver = { |
| .driver = { |
| .name = "Exynos9610-audio", |
| .owner = THIS_MODULE, |
| .pm = &snd_soc_pm_ops, |
| .of_match_table = of_match_ptr(exynos9610_audio_of_match), |
| }, |
| |
| .probe = exynos9610_audio_probe, |
| }; |
| |
| module_platform_driver(exynos9610_audio_driver); |
| |
| MODULE_DESCRIPTION("ALSA SoC Exynos9610 Audio Driver"); |
| MODULE_AUTHOR("Shinhyung Kang <s47.kang@samsung.com>"); |
| MODULE_LICENSE("GPL v2"); |
| MODULE_ALIAS("platform:exynos9610-audio"); |