* 7: "Enable:192K",
*/
asrc_id = <0>;
- auto_asrc = <0>;
+ auto_asrc = <3>;
status = "okay";
};
asrca: resample@0 {
compatible = "amlogic, tl1-resample-a";
- clocks = <&clkc CLKID_MPLL3
- &clkaudio CLKID_AUDIO_MCLK_F
+ clocks = <&clkc CLKID_MPLL0
+ &clkaudio CLKID_AUDIO_MCLK_A
&clkaudio CLKID_AUDIO_RESAMPLE_A>;
clock-names = "resample_pll", "resample_src", "resample_clk";
/*same with toddr_src
*/
resample_module = <3>;
- status = "disabled";
+ status = "okay";
};
asrcb: resample@1 {
* 7: "Enable:192K",
*/
asrc_id = <0>;
- auto_asrc = <0>;
+ auto_asrc = <3>;
status = "okay";
};
asrca: resample@0 {
compatible = "amlogic, tl1-resample-a";
- clocks = <&clkc CLKID_MPLL3
- &clkaudio CLKID_AUDIO_MCLK_F
+ clocks = <&clkc CLKID_MPLL0
+ &clkaudio CLKID_AUDIO_MCLK_A
&clkaudio CLKID_AUDIO_RESAMPLE_A>;
clock-names = "resample_pll", "resample_src", "resample_clk";
/*same with toddr_src
*/
resample_module = <3>;
- status = "disabled";
+ status = "okay";
};
asrcb: resample@1 {
* 7: "Enable:192K",
*/
asrc_id = <0>;
- auto_asrc = <0>;
+ auto_asrc = <3>;
status = "okay";
};
asrca: resample@0 {
compatible = "amlogic, tl1-resample-a";
- clocks = <&clkc CLKID_MPLL3
- &clkaudio CLKID_AUDIO_MCLK_F
+ clocks = <&clkc CLKID_MPLL0
+ &clkaudio CLKID_AUDIO_MCLK_A
&clkaudio CLKID_AUDIO_RESAMPLE_A>;
clock-names = "resample_pll", "resample_src", "resample_clk";
/*same with toddr_src
*/
resample_module = <3>;
- status = "disabled";
+ status = "okay";
};
asrcb: resample@1 {
* 7: "Enable:192K",
*/
asrc_id = <0>;
- auto_asrc = <0>;
+ auto_asrc = <3>;
status = "okay";
};
asrca: resample@0 {
compatible = "amlogic, tl1-resample-a";
- clocks = <&clkc CLKID_MPLL3
- &clkaudio CLKID_AUDIO_MCLK_F
+ clocks = <&clkc CLKID_MPLL0
+ &clkaudio CLKID_AUDIO_MCLK_A
&clkaudio CLKID_AUDIO_RESAMPLE_A>;
clock-names = "resample_pll", "resample_src", "resample_clk";
/*same with toddr_src
*/
resample_module = <3>;
- status = "disabled";
+ status = "okay";
};
asrcb: resample@1 {
}
}
- pr_err("invalid toddr src\n");
-
return -1;
}
}
}
- pr_err("invalid toddr src\n");
-
return NULL;
}
unsigned int reg_base = to->reg_base;
unsigned int reg;
- 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);
}
unsigned int reg_base = to->reg_base;
unsigned int reg;
- 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);
if (asrc_src_sel == 0)
aml_audiobus_update_bits(actrl, reg, 1 << 27, enable << 27);
}
}
- pr_info("Resample %d in running, module:%d, toddr:%d, asrc_src_sel:%d\n",
- p_attach_resample->id,
- p_attach_resample->attach_module,
+ pr_info("toddr %d selects data to %s resample_%c for module:%s\n",
to->fifo_id,
- to->asrc_src_sel);
+ enable ? "enable" : "disable",
+ (p_attach_resample->id == 0) ? 'a' : 'b',
+ toddr_src_get_str(p_attach_resample->attach_module)
+ );
if (enable) {
int bitwidth = to->bitdepth;
}
}
- pr_err("invalid frdd_src\n");
return -1;
}
}
}
- pr_err("invalid frddr src\n");
-
return NULL;
}
* more details.
*
*/
+#define DEBUG
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
/* enable clock */
if (p_resample->enable) {
- ret = clk_prepare_enable(p_resample->clk);
- if (ret) {
- pr_err("Can't enable resample_clk clock: %d\n",
- ret);
- return -EINVAL;
- }
-
- ret = clk_prepare_enable(p_resample->sclk);
- if (ret) {
- pr_err("Can't enable resample_src clock: %d\n",
- ret);
- return -EINVAL;
- }
if (p_resample->out_rate) {
#ifdef __PTM_RESAMPLE_CLK__
return -EINVAL;
}
+ ret = clk_prepare_enable(p_resample->sclk);
+ if (ret) {
+ pr_err("Can't enable resample_src clock: %d\n",
+ ret);
+ return -EINVAL;
+ }
+
+ ret = clk_prepare_enable(p_resample->clk);
+ if (ret) {
+ pr_err("Can't enable resample_clk clock: %d\n",
+ ret);
+ return -EINVAL;
+ }
+
pr_info("%s, resample_pll:%lu, sclk:%lu, clk:%lu\n",
__func__,
clk_get_rate(p_resample->pll),
struct audioresample *p_resample = snd_kcontrol_chip(kcontrol);
if (!p_resample) {
- pr_info("audio resample is not init\n");
+ pr_debug("audio resample is not init\n");
return 0;
}
p_resample->asrc_rate_idx = index;
- pr_info("%s %s\n",
+ pr_info("%s resample_%c %s\n",
__func__,
+ (id == 0) ? 'a' : 'b',
auge_resample_texts[index]);
if (audio_resample_set(p_resample, (bool)index, resample_rate))
int index = ucontrol->value.enumerated.item[0];
if (!p_resample) {
- pr_info("audio resample is not init\n");
+ pr_debug("audio resample is not init\n");
return 0;
}
struct audioresample *p_resample = snd_kcontrol_chip(kcontrol);
if (!p_resample) {
- pr_info("audio resample is not init\n");
+ pr_debug("audio resample is not init\n");
return 0;
}
struct audioresample *p_resample = snd_kcontrol_chip(kcontrol);
if (!p_resample) {
- pr_info("audio resample is not init\n");
+ pr_debug("audio resample is not init\n");
return 0;
}
.probe = resample_platform_probe,
};
module_platform_driver(resample_platform_driver);
-
else
pr_err("unsupport input sample rate:%d\n", input_sr);
- pr_info("resample id:%d, clk_rate = %u, input_sr = %d, Avg_cnt_init = %u\n",
- id,
+ pr_info("resample id:%c, clk_rate = %u, input_sr = %d, Avg_cnt_init = %u\n",
+ (id == 0) ? 'a' : 'b',
clk_rate,
input_sr,
Avg_cnt_init);
/* for debug */
/*#define __SPDIFIN_INSERT_CHNUM__*/
+/*#define __SPDIFIN_AUDIO_TYPE_HW__*/
+
struct spdif_chipinfo {
unsigned int id;
pr_info("Event: EXTCON_SPDIFIN_SAMPLERATE, new sample rate:%s\n",
spdifin_samplerate[mode + 1]);
+#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample enable, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id,
p_spdif->auto_asrc);
-
+#endif
extcon_set_state(p_spdif->edev,
EXTCON_SPDIFIN_SAMPLERATE, 1);
}
EXTCON_SPDIFIN_AUDIOTYPE, 1);
#ifdef __PTM_SPDIF_CLK__
+#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample disable, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id, 0);
#endif
+#endif
}
if (intrpt_status & 0x10)
pr_info("Pd changed\n");
extcon_set_state(p_spdif->edev,
EXTCON_SPDIFIN_AUDIOTYPE, 0);
+#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample to 48k, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
+#endif
}
if (intrpt_status & 0x40)
pr_info("valid changed\n");
pr_err("Can't enable pcm clk_spdifin clock: %d\n", ret);
goto err;
}
+
+#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample to 48k in default, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id, p_spdif->auto_asrc);
+#endif
}
return 0;
clk_disable_unprepare(p_spdif->sysclk);
clk_disable_unprepare(p_spdif->gate_spdifout);
} else {
+#ifdef __SPDIFIN_AUDIO_TYPE_HW__
/* resample disabled, by hw */
if (!spdifin_check_audiotype_by_sw(p_spdif))
resample_set(p_spdif->asrc_id, 0);
-
+#endif
clk_disable_unprepare(p_spdif->clk_spdifin);
clk_disable_unprepare(p_spdif->fixed_clk);
clk_disable_unprepare(p_spdif->gate_spdifin);