audio: auge: pdm supports 64k sample rate
authorXing Wang <xing.wang@amlogic.com>
Sat, 24 Feb 2018 04:57:49 +0000 (12:57 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Mon, 5 Mar 2018 07:34:36 +0000 (15:34 +0800)
PD#156734: audio: auge: pdm supports 64k sample rate

Change-Id: Ia938906fc0aef51d66b947b376b62c21fb2c8c76
Signed-off-by: Xing Wang <xing.wang@amlogic.com>
sound/soc/amlogic/auge/pdm.c
sound/soc/amlogic/auge/pdm.h
sound/soc/amlogic/auge/pdm_hw.c
sound/soc/codecs/amlogic/pdm_dummy.c

index fb01c92..e784e6b 100644 (file)
@@ -51,7 +51,7 @@ static struct snd_pcm_hardware aml_pdm_hardware = {
                                        SNDRV_PCM_FMTBIT_S32,
 
        .rate_min                       =       8000,
-       .rate_max                       =       48000,
+       .rate_max                       =       64000,
 
        .channels_min           =       PDM_CHANNELS_MIN,
        .channels_max           =       PDM_CHANNELS_MAX,
@@ -139,7 +139,7 @@ static int pdm_hcic_shift_gain_set_enum(
 int pdm_dclk;
 
 static const char *const pdm_dclk_texts[] = {
-       "PDM Dclk 3.072m, support 8k/16k/32k/48k",
+       "PDM Dclk 3.072m, support 8k/16k/32k/48k/64k",
        "PDM Dclk 1.024m, support 8k/16k",
        "PDM Dclk   768k, support 8k/16k",
 };
@@ -652,7 +652,9 @@ static int aml_pdm_dai_prepare(
                                return -EINVAL;
                        }
                } else {
-                       if (runtime->rate == 48000)
+                       if (runtime->rate == 64000)
+                               osr = 48;
+                       else if (runtime->rate == 48000)
                                osr = 64;
                        else if (runtime->rate == 32000)
                                osr = 96;
index ab34611..115efa6 100644 (file)
@@ -29,7 +29,8 @@
 #define PDM_CHANNELS_MIN               1
 #define PDM_CHANNELS_MAX               (8 + 8) /* 8ch pdm in, 8 ch tdmin_lb */
 
-#define PDM_RATES                      (SNDRV_PCM_RATE_48000 |\
+#define PDM_RATES                      (SNDRV_PCM_RATE_64000 |\
+                                               SNDRV_PCM_RATE_48000 |\
                                                SNDRV_PCM_RATE_32000 |\
                                                SNDRV_PCM_RATE_16000 |\
                                                SNDRV_PCM_RATE_8000)
index fb0f94d..5177aee 100644 (file)
@@ -147,22 +147,22 @@ static void aml_pdm_filters_config(int osr,
        case 32:
                hcic_dn_rate = 0x4;
                hcic_gain        = 0x80;
-               hcic_shift       = 0xa;
+               hcic_shift       = 0xe;
                break;
        case 40:
                hcic_dn_rate = 0x5;
-               hcic_gain        = 0x54;
-               hcic_shift       = 0xb;
+               hcic_gain        = 0x6b;
+               hcic_shift       = 0x10;
                break;
        case 48:
                hcic_dn_rate = 0x6;
-               hcic_gain        = 0x43;
-               hcic_shift       = 0xc;
+               hcic_gain        = 0x78;
+               hcic_shift       = 0x12;
                break;
        case 56:
                hcic_dn_rate = 0x7;
-               hcic_gain        = 0x7d;
-               hcic_shift       = 0xe;
+               hcic_gain        = 0x51;
+               hcic_shift       = 0x13;
                break;
        case 64:
                hcic_dn_rate = 0x0008;
@@ -358,7 +358,8 @@ void aml_pdm_filter_ctrl(int osr, int mode)
        case 48:
        case 56:
        default:
-               pr_info("default mode 1, osr 64, 48k\n");
+               pr_info("osr :%d , lpf2 uses default parameters with osr64\n",
+                       osr);
                lpf2_coeff = lpf2_osr64;
                break;
        }
index 0200d1c..79fca33 100644 (file)
@@ -20,7 +20,8 @@
 #include <linux/of.h>
 #include <sound/soc.h>
 
-#define DUMMY_RATES                    (SNDRV_PCM_RATE_48000 |\
+#define DUMMY_RATES                    (SNDRV_PCM_RATE_64000 |\
+                                               SNDRV_PCM_RATE_48000 |\
                                                SNDRV_PCM_RATE_32000 |\
                                                SNDRV_PCM_RATE_16000 |\
                                                SNDRV_PCM_RATE_8000)