udio: auge: tl1 acodec mapping to data 1 [1/2]
authorJian Xu <jian.xu@amlogic.com>
Wed, 19 Dec 2018 14:07:07 +0000 (22:07 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 20 Dec 2018 07:26:58 +0000 (23:26 -0800)
PD#SWPL-3277

Problem:
tl1 internal codec volume can by adjusted

Solution:
configure the acodec data layout mapping
to a fixed volume

Verify:
x301

Change-Id: I14d3762b39a0a5291722ef5489026f10fc960120
Signed-off-by: Jian Xu <jian.xu@amlogic.com>
arch/arm/boot/dts/amlogic/tl1_t962x2_t309.dts
arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts
sound/soc/amlogic/auge/ddr_mngr.c
sound/soc/amlogic/auge/spdif.c
sound/soc/amlogic/auge/spdif_hw.c
sound/soc/amlogic/auge/tdm.c
sound/soc/amlogic/common/spdif_info.c
sound/soc/codecs/amlogic/aml_codec_tl1_acodec.c

index 9d4dea9..317aeda 100644 (file)
                reg = <0xff632000 0x1c>;
                tdmout_index = <0>;
                tdmin_index = <0>;
+               dat1_ch_sel = <1>;
        };
 
        aml_dtv_demod {
index b922bda..3494d32 100644 (file)
                reg = <0xff632000 0x1c>;
                tdmout_index = <0>;
                tdmin_index = <0>;
+               dat1_ch_sel = <1>;
        };
 
        aml_dtv_demod {
index d350436..756a4fc 100644 (file)
@@ -14,6 +14,7 @@
  * more details.
  *
  */
+#define DEBUG
 #undef pr_fmt
 #define pr_fmt(fmt) "audio_ddr_mngr: " fmt
 
@@ -213,7 +214,7 @@ static struct toddr *register_toddr_l(struct device *dev,
        to->dev = dev;
        to->actrl = actrl;
        to->in_use = true;
-       pr_info("toddrs[%d] registered by device %s\n", i, dev_name(dev));
+       pr_debug("toddrs[%d] registered by device %s\n", i, dev_name(dev));
        return to;
 }
 
@@ -259,7 +260,7 @@ static int unregister_toddr_l(struct device *dev, void *data)
        to->dev = NULL;
        to->actrl = NULL;
        to->in_use = false;
-       pr_info("toddrs[%d] released by device %s\n", i, dev_name(dev));
+       pr_debug("toddrs[%d] released by device %s\n", i, dev_name(dev));
 
        return 0;
 }
@@ -499,7 +500,7 @@ void aml_toddr_set_resample(struct toddr *to, bool enable)
        unsigned int reg_base = to->reg_base;
        unsigned int reg;
 
-       pr_info("toddr selects data to %s resample\n",
+       pr_debug("toddr selects data to %s resample\n",
                enable ? "enable" : "disable");
        reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL0, reg_base);
        aml_audiobus_update_bits(actrl, reg, 1<<30, enable<<30);
@@ -511,7 +512,7 @@ void aml_toddr_set_resample_ab(struct toddr *to, int asrc_src_sel, bool enable)
        unsigned int reg_base = to->reg_base;
        unsigned int reg;
 
-       pr_info("toddr selects data to %s resample %c\n",
+       pr_debug("toddr selects data to %s resample %c\n",
                enable ? "enable" : "disable",
                (asrc_src_sel == 0) ? 'a' : 'b');
        reg = calc_toddr_address(EE_AUDIO_TODDR_A_CTRL1, reg_base);
@@ -786,7 +787,7 @@ static struct frddr *register_frddr_l(struct device *dev,
        from->dev = dev;
        from->actrl = actrl;
        from->in_use = true;
-       pr_info("frddrs[%d] registered by device %s\n", i, dev_name(dev));
+       pr_debug("frddrs[%d] registered by device %s\n", i, dev_name(dev));
        return from;
 }
 
@@ -826,7 +827,7 @@ static int unregister_frddr_l(struct device *dev, void *data)
        from->dev = NULL;
        from->actrl = NULL;
        from->in_use = false;
-       pr_info("frddrs[%d] released by device %s\n", i, dev_name(dev));
+       pr_debug("frddrs[%d] released by device %s\n", i, dev_name(dev));
        return 0;
 }
 
@@ -1043,7 +1044,7 @@ void aml_frddr_select_dst_ss(struct frddr *fr,
                                        sel);
                                break;
                        }
-                       pr_info("%s sel:%d, dst_src:%d\n",
+                       pr_debug("%s sel:%d, dst_src:%d\n",
                                __func__, sel, dst);
                        aml_audiobus_update_bits(actrl, reg, s_m, s_v);
        }
index ce37b25..5e79c6f 100644 (file)
@@ -14,7 +14,7 @@
  * more details.
  *
  */
-
+#define  DEBUG
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/platform_device.h>
@@ -236,7 +236,7 @@ static int spdifin_check_audio_type(void)
                }
        }
 
-       pr_debug("%s audio type:%d\n", __func__, audio_type);
+       /*pr_debug("%s audio type:%d\n", __func__, audio_type);*/
 
        return audio_type;
 }
@@ -853,7 +853,7 @@ static struct snd_pcm_ops aml_spdif_ops = {
        .mmap      = aml_spdif_mmap,
 };
 
-#define PREALLOC_BUFFER                (32 * 1024)
+#define PREALLOC_BUFFER                (128 * 1024)
 #define PREALLOC_BUFFER_MAX    (256 * 1024)
 static int aml_spdif_new(struct snd_soc_pcm_runtime *rtd)
 {
@@ -862,7 +862,7 @@ static int aml_spdif_new(struct snd_soc_pcm_runtime *rtd)
 
        p_spdif = (struct aml_spdif *)dev_get_drvdata(dev);
 
-       pr_info("%s spdif_%s, clk continuous:%d\n",
+       pr_debug("%s spdif_%s, clk continuous:%d\n",
                __func__,
                (p_spdif->id == 0) ? "a":"b",
                p_spdif->clk_cont);
@@ -1206,7 +1206,7 @@ static int aml_dai_spdif_hw_params(struct snd_pcm_substream *substream,
 
 static int aml_dai_set_spdif_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
-       pr_info("%s , fmt %#x\n", __func__, fmt);
+       pr_debug("%s , fmt %#x\n", __func__, fmt);
 
        return 0;
 }
@@ -1220,10 +1220,10 @@ static void aml_set_spdifclk(struct aml_spdif *p_spdif)
                int ret;
 
                if (spdif_is_4x_clk()) {
-                       pr_info("set 4x audio clk for 958\n");
+                       pr_debug("set 4x audio clk for 958\n");
                        p_spdif->sysclk_freq *= 4;
                } else {
-                       pr_info("set normal 512 fs /4 fs\n");
+                       pr_debug("set normal 512 fs /4 fs\n");
                }
                mpll_freq = p_spdif->sysclk_freq * mul;
 
@@ -1245,10 +1245,10 @@ static void aml_set_spdifclk(struct aml_spdif *p_spdif)
                        pr_err("Can't enable clk_spdifout clock: %d\n", ret);
                        return;
                }
-               pr_info("\t set spdifout clk:%d, mpll:%d\n",
+               pr_debug("\t set spdifout clk:%d, mpll:%d\n",
                        p_spdif->sysclk_freq,
                        mpll_freq);
-               pr_info("\t get spdifout clk:%lu, mpll:%lu\n",
+               pr_debug("\t get spdifout clk:%lu, mpll:%lu\n",
                        clk_get_rate(p_spdif->clk_spdifout),
                        clk_get_rate(p_spdif->sysclk));
        }
@@ -1396,7 +1396,7 @@ static int aml_spdif_parse_of(struct platform_device *pdev)
                if (ret < 0)
                        p_spdif->auto_asrc = 0;
 
-               pr_info("SPDIF id %d asrc_id:%d auto_asrc:%d\n",
+               pr_debug("SPDIF id %d asrc_id:%d auto_asrc:%d\n",
                        p_spdif->id,
                        p_spdif->asrc_id,
                        p_spdif->auto_asrc);
@@ -1521,7 +1521,7 @@ static int aml_spdif_platform_probe(struct platform_device *pdev)
                dev_warn_once(dev,
                        "check whether to update spdif chipinfo\n");
 
-       pr_info("%s, spdif ID = %u\n", __func__, aml_spdif->id);
+       pr_debug("%s, spdif ID = %u\n", __func__, aml_spdif->id);
 
        /* get audio controller */
        node_prt = of_get_parent(node);
index 51503dd..386b68b 100644 (file)
@@ -14,7 +14,7 @@
  * more details.
  *
  */
-
+#define DEBUG
 #include <sound/soc.h>
 
 #include "iomap.h"
@@ -64,7 +64,7 @@ void aml_spdifin_chnum_en(struct aml_audio_controller *actrl,
        reg = EE_AUDIO_SPDIFIN_CTRL0;
        aml_audiobus_update_bits(actrl, reg, 1 << 26, is_enable << 26);
 
-       pr_info("%s spdifin ctrl0:0x%x\n",
+       pr_debug("%s spdifin ctrl0:0x%x\n",
                __func__,
                aml_audiobus_read(actrl, reg));
 }
@@ -234,7 +234,7 @@ void aml_spdif_fifo_ctrl(
                return;
        }
 
-       pr_info("%s, bit depth:%d, frddr type:%d, toddr:type:%d\n",
+       pr_debug("%s, bit depth:%d, frddr type:%d, toddr:type:%d\n",
                __func__,
                bitwidth,
                frddr_type,
@@ -408,7 +408,7 @@ void spdifout_fifo_ctrl(int spdif_id, int fifo_id, int bitwidth)
        unsigned int frddr_type = spdifout_get_frddr_type(bitwidth);
        unsigned int offset, reg;
 
-       pr_info("spdif_%s fifo ctrl, frddr:%d type:%d, %d bits\n",
+       pr_debug("spdif_%s fifo ctrl, frddr:%d type:%d, %d bits\n",
                (spdif_id == 0) ? "a":"b",
                fifo_id,
                frddr_type,
@@ -454,7 +454,7 @@ void spdifout_enable(int spdif_id, bool is_enable)
 {
        unsigned int offset, reg;
 
-       pr_info("spdif_%s is set to %s\n",
+       pr_debug("spdif_%s is set to %s\n",
                (spdif_id == 0) ? "a":"b",
                is_enable ? "enable":"disable");
 
@@ -594,7 +594,7 @@ void spdif_set_channel_status_info(
 
 void spdifout_play_with_zerodata(unsigned int spdif_id)
 {
-       pr_info("%s, spdif id:%d enable:%d\n",
+       pr_debug("%s, spdif id:%d enable:%d\n",
                __func__,
                spdif_id,
                spdifout_is_enable(spdif_id));
@@ -643,7 +643,7 @@ void spdifout_play_with_zerodata(unsigned int spdif_id)
 
 void spdifout_play_with_zerodata_free(unsigned int spdif_id)
 {
-       pr_info("%s, spdif id:%d\n",
+       pr_debug("%s, spdif id:%d\n",
                __func__,
                spdif_id);
 
index 4d3b36f..2208616 100644 (file)
@@ -14,7 +14,7 @@
  * more details.
  *
  */
-
+#define DEBUG
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/platform_device.h>
@@ -773,7 +773,7 @@ static int aml_dai_set_tdm_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 {
        struct aml_tdm *p_tdm = snd_soc_dai_get_drvdata(cpu_dai);
 
-       pr_info("asoc aml_dai_set_tdm_fmt, %#x, %p, id(%d), clksel(%d)\n",
+       pr_debug("asoc aml_dai_set_tdm_fmt, %#x, %p, id(%d), clksel(%d)\n",
                fmt, p_tdm, p_tdm->id, p_tdm->clk_sel);
        switch (fmt & SND_SOC_DAIFMT_CLOCK_MASK) {
        case SND_SOC_DAIFMT_CONT:
@@ -865,10 +865,10 @@ static int aml_dai_set_bclk_ratio(struct snd_soc_dai *cpu_dai,
 
        if (p_tdm->setting.pcm_mode == SND_SOC_DAIFMT_I2S ||
                p_tdm->setting.pcm_mode == SND_SOC_DAIFMT_LEFT_J) {
-               pr_info("aml_dai_set_bclk_ratio, select I2S mode\n");
+               pr_debug("aml_dai_set_bclk_ratio, select I2S mode\n");
                lrclk_hi = bclk_ratio / 2;
        } else {
-               pr_info("aml_dai_set_bclk_ratio, select TDM mode\n");
+               pr_debug("aml_dai_set_bclk_ratio, select TDM mode\n");
        }
        aml_tdm_set_bclk_ratio(p_tdm->actrl,
                p_tdm->clk_sel, lrclk_hi, bclk_ratio);
@@ -911,15 +911,15 @@ static int aml_dai_set_tdm_slot(struct snd_soc_dai *cpu_dai,
        lanes_oe_in_cnt = pop_count(p_tdm->setting.lane_oe_mask_in);
        lanes_lb_cnt = pop_count(p_tdm->setting.lane_lb_mask_in);
 
-       pr_info("%s(), txmask(%#x), rxmask(%#x)\n",
+       pr_debug("%s(), txmask(%#x), rxmask(%#x)\n",
                __func__, tx_mask, rx_mask);
-       pr_info("\tlanes_out_cnt(%d), lanes_in_cnt(%d)\n",
+       pr_debug("\tlanes_out_cnt(%d), lanes_in_cnt(%d)\n",
                lanes_out_cnt, lanes_in_cnt);
-       pr_info("\tlanes_oe_out_cnt(%d), lanes_oe_in_cnt(%d)\n",
+       pr_debug("\tlanes_oe_out_cnt(%d), lanes_oe_in_cnt(%d)\n",
                lanes_oe_out_cnt, lanes_oe_in_cnt);
-       pr_info("\tlanes_lb_cnt(%d)\n",
+       pr_debug("\tlanes_lb_cnt(%d)\n",
                lanes_lb_cnt);
-       pr_info("\tslots(%d), slot_width(%d)\n",
+       pr_debug("\tslots(%d), slot_width(%d)\n",
                slots, slot_width);
        p_tdm->setting.tx_mask = tx_mask;
        p_tdm->setting.rx_mask = rx_mask;
index c900c5f..85bd5e2 100644 (file)
@@ -14,6 +14,7 @@
  * more details.
  *
  */
+#define DEBUG
 #undef pr_fmt
 #define pr_fmt(fmt) "spdif_info: " fmt
 
@@ -111,7 +112,7 @@ void spdif_get_channel_status_info(
                        chsts->chstat1_r = 0xe00;
                }
        }
-       pr_info("rate: %d, channel status ch0_l:0x%x, ch0_r:0x%x, ch1_l:0x%x, ch1_r:0x%x\n",
+       pr_debug("rate: %d, channel status ch0_l:0x%x, ch0_r:0x%x, ch1_l:0x%x, ch1_r:0x%x\n",
                rate,
                chsts->chstat0_l,
                chsts->chstat0_r,
index 928eca4..174babe 100644 (file)
@@ -788,6 +788,12 @@ static int aml_tl1_acodec_probe(struct platform_device *pdev)
 
        of_property_read_u32(
                        pdev->dev.of_node,
+                       "dat1_ch_sel",
+                       &aml_acodec->dat1_ch_sel);
+       pr_info("aml_tl1_acodec dat1_ch_sel=%d\n",
+               aml_acodec->dat1_ch_sel);
+       of_property_read_u32(
+                       pdev->dev.of_node,
                        "tdmin_index",
                        &aml_acodec->tdmin_index);
        pr_info("aml_tl1_acodec tdmin_index=%d\n",