Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a1bf58a authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown
Browse files

ASoC: rsnd: add workaround for SRC sync convert + DVC



We couldn't use SRC sync convert mode together with DVC,
but we can use workaround for it.
This patch adds workaround and can use SRC sync convert + DVC

Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarKeita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a48e3f97
Loading
Loading
Loading
Loading
+32 −11
Original line number Original line Diff line number Diff line
@@ -616,6 +616,14 @@ static void rsnd_src_irq_ctrol_gen2(struct rsnd_mod *mod, int enable)
		int_val = 0;
		int_val = 0;
	}
	}


	/*
	 * WORKAROUND
	 *
	 * ignore over flow error when rsnd_enable_sync_convert()
	 */
	if (rsnd_enable_sync_convert(src))
		sys_int_val = sys_int_val & 0xffff;

	rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
	rsnd_mod_write(mod, SRC_INT_ENABLE0, int_val);
	rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
	rsnd_mod_bset(mod, SCU_SYS_INT_EN0, sys_int_mask, sys_int_val);
	rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
	rsnd_mod_bset(mod, SCU_SYS_INT_EN1, sys_int_mask, sys_int_val);
@@ -631,11 +639,22 @@ static void rsnd_src_error_clear_gen2(struct rsnd_mod *mod)


static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
{
{
	u32 val = OUF_SRC(rsnd_mod_id(mod));
	struct rsnd_src *src = rsnd_mod_to_src(mod);
	u32 val0, val1;
	bool ret = false;
	bool ret = false;


	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val) ||
	val0 = val1 = OUF_SRC(rsnd_mod_id(mod));
	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val)) {

	/*
	 * WORKAROUND
	 *
	 * ignore over flow error when rsnd_enable_sync_convert()
	 */
	if (rsnd_enable_sync_convert(src))
		val0 = val0 & 0xffff;

	if ((rsnd_mod_read(mod, SCU_SYS_STATUS0) & val0) ||
	    (rsnd_mod_read(mod, SCU_SYS_STATUS1) & val1)) {
		struct rsnd_src *src = rsnd_mod_to_src(mod);
		struct rsnd_src *src = rsnd_mod_to_src(mod);


		src->err++;
		src->err++;
@@ -651,7 +670,16 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod)
static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
static int _rsnd_src_start_gen2(struct rsnd_mod *mod,
				struct rsnd_dai_stream *io)
				struct rsnd_dai_stream *io)
{
{
	u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11;
	struct rsnd_src *src = rsnd_mod_to_src(mod);
	u32 val;

	/*
	 * WORKAROUND
	 *
	 * Enable SRC output if you want to use sync convert together with DVC
	 */
	val = (rsnd_io_to_mod_dvc(io) && !rsnd_enable_sync_convert(src)) ?
		0x01 : 0x11;


	rsnd_mod_write(mod, SRC_CTRL, val);
	rsnd_mod_write(mod, SRC_CTRL, val);


@@ -920,13 +948,6 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
	if (!rsnd_rdai_is_clk_master(rdai))
	if (!rsnd_rdai_is_clk_master(rdai))
		return 0;
		return 0;


	/*
	 * We can't use SRC sync convert
	 * if it has DVC
	 */
	if (rsnd_io_to_mod_dvc(io))
		return 0;

	/*
	/*
	 * enable sync convert
	 * enable sync convert
	 */
	 */