Hello,

In attachment the patch for PCAP2 codec driver enables the FM DAI input select.
Apply in current development branch from git.
This patch have a small changes from original, I hope that this is correct now. :D

Thanks.

Enable the FM DAI input select and small fixes for checkpatch.pl passing.
Apply in openezx kernel 2.6.28-rc6 ezx/current development branch

Signed-off-by: Fabio Belavenuto <[EMAIL PROTECTED]>

--- sound/soc/codecs/pcap2.c.orig       2008-12-07 23:10:17.000000000 -0200
+++ sound/soc/codecs/pcap2.c    2008-12-07 23:19:38.000000000 -0200
@@ -30,6 +30,7 @@
 #define DAI_AP_ST      0
 #define DAI_AP_MONO    1
 #define DAI_BP         2
+#define DAI_FM         3
 
 #define OUT_LOUDSPEAKER        0
 #define OUT_EARPIECE   1               
@@ -87,7 +88,7 @@ static int pcap2_dai_mode;
 static int pcap2_get_dai(struct snd_kcontrol *kcontrol,
                        struct snd_ctl_elem_value *ucontrol)
 {
-       printk("WM: get_dai %d\n", pcap2_dai_mode);
+       printk(KERN_DEBUG "WM: get_dai %d\n", pcap2_dai_mode);
        ucontrol->value.integer.value[0] = pcap2_dai_mode;
        return 0;
 }
@@ -99,21 +100,28 @@ static int pcap2_set_dai_mode(struct snd
 {
        u32 tmp;
 
-       printk("WM: set_dai_mode %d\n", mode);
+       printk(KERN_DEBUG "WM: set_dai_mode %d\n", mode);
        if (mode == DAI_AP_ST) {
                printk("WM: ep st\n");
                snd_soc_dapm_enable_pin(codec, "ST_DAC");
                snd_soc_dapm_disable_pin(codec, "CDC_DAC");
                snd_soc_dapm_disable_pin(codec, "CDC_ADC");
-       }
-       else {
-               printk("WM: ep mono\n");
+               snd_soc_dapm_disable_pin(codec, "FM");
+       } else if (mode == DAI_FM) {
+               printk(KERN_DEBUG "WM: ep fm st\n");
+               snd_soc_dapm_enable_pin(codec, "ST_DAC");
+               snd_soc_dapm_disable_pin(codec, "CDC_DAC");
+               snd_soc_dapm_disable_pin(codec, "CDC_ADC");
+               snd_soc_dapm_enable_pin(codec, "FM");
+       } else {
+               printk(KERN_DEBUG "WM: ep mono\n");
                snd_soc_dapm_disable_pin(codec, "ST_DAC");
                snd_soc_dapm_enable_pin(codec, "CDC_DAC");
                snd_soc_dapm_enable_pin(codec, "CDC_ADC");
+               snd_soc_dapm_disable_pin(codec, "FM");
        }
        if (mode == DAI_BP) {
-               printk("WM: dai bp\n");
+               printk(KERN_DEBUG "WM: dai bp\n");
 
                tmp = pcap2_codec_read(codec, PCAP2_OUTPUT_AMP);
                tmp &= ~PCAP2_OUTPUT_AMP_ST_DAC_SW;
@@ -128,7 +136,7 @@ static int pcap2_set_dai_mode(struct snd
                pcap2_codec_write(codec, PCAP2_CODEC, tmp);
        }
        else {
-               printk("WM: dai ap\n");
+               printk(KERN_DEBUG "WM: dai ap || fm\n");
 
                tmp = pcap2_codec_read(codec, PCAP2_INPUT_AMP);
                tmp &= ~PCAP2_INPUT_AMP_V2EN2;
@@ -148,14 +156,16 @@ static int pcap2_set_dai(struct snd_kcon
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 
-       printk("WM: set_dai %d\n", ucontrol->value.integer.value[0]);
+       printk(KERN_DEBUG "WM: set_dai %ld\n",
+                       ucontrol->value.integer.value[0]);
 
        if (pcap2_dai_mode == ucontrol->value.integer.value[0])
                return 0;
        
        pcap2_dai_mode = ucontrol->value.integer.value[0];
 
-       if (pcap2_dai_mode > 2) pcap2_dai_mode = 0;
+       if (pcap2_dai_mode > 3)
+               pcap2_dai_mode = 0;
 
        pcap2_set_dai_mode(codec, pcap2_dai_mode);
 
@@ -176,7 +186,8 @@ SOC_ENUM_SINGLE((PCAP2_OUTPUT_AMP|SH), 3
 static const char *pcap2_dai_select[] = {
        "Stereo",
        "Mono",
-       "BP"
+       "BP",
+       "FM"
 };
 
 static const struct soc_enum pcap2_dai_enum[] = {
@@ -213,6 +224,7 @@ static const struct snd_soc_dapm_widget 
        SND_SOC_DAPM_DAC("ST_DAC", "playback", (PCAP2_OUTPUT_AMP|SL), 9, 0),
        SND_SOC_DAPM_DAC("CDC_DAC", "playback", (PCAP2_OUTPUT_AMP|SL), 8, 0),
        SND_SOC_DAPM_ADC("CDC_ADC", "capture", (PCAP2_OUTPUT_AMP|SL), 8, 0),
+       SND_SOC_DAPM_PGA("PGA_IN", (PCAP2_OUTPUT_AMP|SL), 10, 0, NULL, 0),
        SND_SOC_DAPM_PGA("PGA_R", (PCAP2_OUTPUT_AMP|SL), 11, 0, NULL, 0),
        SND_SOC_DAPM_PGA("PGA_L", (PCAP2_OUTPUT_AMP|SL), 12, 0, NULL, 0),
        SND_SOC_DAPM_MUX("Downmixer", SND_SOC_NOPM, 0, 0,
@@ -233,6 +245,7 @@ static const struct snd_soc_dapm_widget 
        SND_SOC_DAPM_PGA("PGA_A5", (PCAP2_INPUT_AMP|SL), 8, 0, NULL, 0),
        SND_SOC_DAPM_INPUT("A3"), /* Headset Mic */
        SND_SOC_DAPM_INPUT("A5"), /* Builtin Mic */
+       SND_SOC_DAPM_INPUT("FM"), /* FM Chip */
 };
 
 static const struct snd_soc_dapm_route audio_map[] = {
@@ -260,6 +273,10 @@ static const struct snd_soc_dapm_route a
        { "PGA_L", NULL, "ST_DAC" },
        { "PGA_R", NULL, "CDC_DAC" },
 
+       { "PGA_R", NULL, "PGA_IN" },
+       { "PGA_L", NULL, "PGA_IN" },
+       { "PGA_IN", NULL, "FM" },
+
        /* input path */
        { "BIAS1", NULL, "A3" },
        { "BIAS2", NULL, "A5" },
@@ -312,7 +329,8 @@ static int pcap2_hw_params(struct snd_pc
        struct snd_soc_codec *codec = codec_dai->codec;
        unsigned int tmp;
 
-       if (pcap2_dai_mode == DAI_BP) /* pcap is set to talk with BP */
+       if (pcap2_dai_mode == DAI_BP ||
+           pcap2_dai_mode == DAI_FM) /* pcap is set to talk with BP or FM */
                return -EINVAL;
 
        if (pcap2_dai_mode == DAI_AP_ST) {

Reply via email to