Message ID | 20200508074753.10362-1-giraffesnn123@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ASoC: rsnd: add interrupt support for SSI BUSIF buffer | expand |
Hi Yongbo Thank you for the patch > SSI BUSIF buffer is possible to overflow or underflow, especially in a > hypervisor environment. If there is no interrupt support, it will eventually > lead to errors in pcm data. > This patch adds overflow and underflow interrupt support for SSI BUSIF buffer. > > Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > Reported-by: Chen Li <licheng0822@thundersoft.com> > Signed-off-by: Yongbo Zhang <giraffesnn123@gmail.com> > Tested-by: Chen Li <licheng0822@thundersoft.com> > --- (snip) > @@ -635,6 +713,19 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, > if (enable) > val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; > > + if (is_tdm || is_tdm_split) { > + switch (id) { > + case 0: > + case 1: > + case 2: > + case 3: > + case 4: > + case 9: > + val |= 0xff00; > + break; > + } > + } This is small things, but we like to have - val |= 0xff00; + val |= 0x0000ff00; Except above Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Thank you for your help !! Best regards --- Kuninori Morimoto
Hi Yongbo, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [also build test WARNING on v5.7-rc4 next-20200508] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Yongbo-Zhang/ASoC-rsnd-add-interrupt-support-for-SSI-BUSIF-buffer/20200509-035713 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next :::::: branch date: 6 hours ago :::::: commit date: 6 hours ago If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@intel.com> cppcheck warnings: (new ones prefixed by >>) >> sound/soc/sh/rcar/ssi.c:531:1: warning: Unmatched '{'. Configuration: ''. [syntaxError] { ^ >> sound/soc/sh/rcar/ssi.c:531:1: warning: Unmatched '{'. Configuration: 'DEBUG'. [syntaxError] { ^ # https://github.com/0day-ci/linux/commit/391d452251464b78f72ba3a1fd9b6091b3d4a942 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 391d452251464b78f72ba3a1fd9b6091b3d4a942 vim +531 sound/soc/sh/rcar/ssi.c ae5c322303fff5 Kuninori Morimoto 2013-07-21 527 ae5c322303fff5 Kuninori Morimoto 2013-07-21 528 static int rsnd_ssi_quit(struct rsnd_mod *mod, 2c0fac19de2cd7 Kuninori Morimoto 2015-06-15 529 struct rsnd_dai_stream *io, 690602fcd85385 Kuninori Morimoto 2015-01-15 530 struct rsnd_priv *priv) ae5c322303fff5 Kuninori Morimoto 2013-07-21 @531 { ae5c322303fff5 Kuninori Morimoto 2013-07-21 532 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); ae5c322303fff5 Kuninori Morimoto 2013-07-21 533 struct device *dev = rsnd_priv_to_dev(priv); 391d452251464b Yongbo Zhang 2020-05-08 534 int is_tdm, is_tdm_split; 391d452251464b Yongbo Zhang 2020-05-08 535 int id = rsnd_mod_id(mod); 391d452251464b Yongbo Zhang 2020-05-08 536 int i; 391d452251464b Yongbo Zhang 2020-05-08 537 u32 sys_int_enable = 0; 391d452251464b Yongbo Zhang 2020-05-08 538 391d452251464b Yongbo Zhang 2020-05-08 539 is_tdm = rsnd_runtime_is_tdm(io); 391d452251464b Yongbo Zhang 2020-05-08 540 is_tdm_split = rsnd_runtime_is_tdm_split(io); ae5c322303fff5 Kuninori Morimoto 2013-07-21 541 fd9adcfdc1434f Kuninori Morimoto 2016-02-18 542 if (!rsnd_ssi_is_run_mods(mod, io)) fd9adcfdc1434f Kuninori Morimoto 2016-02-18 543 return 0; fd9adcfdc1434f Kuninori Morimoto 2016-02-18 544 e5d9cfc6f5fe56 Andrzej Hajda 2015-12-24 545 if (!ssi->usrcnt) { c0ea089dbad47a Kuninori Morimoto 2018-10-30 546 dev_err(dev, "%s usrcnt error\n", rsnd_mod_name(mod)); e5d9cfc6f5fe56 Andrzej Hajda 2015-12-24 547 return -EIO; e5d9cfc6f5fe56 Andrzej Hajda 2015-12-24 548 } e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 549 26d34b11af6a34 Kuninori Morimoto 2016-02-18 550 rsnd_ssi_master_clk_stop(mod, io); e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 551 e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 552 rsnd_mod_power_off(mod); e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 553 e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 554 ssi->usrcnt--; e7d850dd10f4e6 Kuninori Morimoto 2015-10-26 555 203cdf51f28820 Kuninori Morimoto 2018-06-12 556 if (!ssi->usrcnt) { 203cdf51f28820 Kuninori Morimoto 2018-06-12 557 ssi->cr_own = 0; 203cdf51f28820 Kuninori Morimoto 2018-06-12 558 ssi->cr_mode = 0; 203cdf51f28820 Kuninori Morimoto 2018-06-12 559 ssi->wsr = 0; 203cdf51f28820 Kuninori Morimoto 2018-06-12 560 } 203cdf51f28820 Kuninori Morimoto 2018-06-12 561 391d452251464b Yongbo Zhang 2020-05-08 562 /* disable busif buffer over/under run interrupt. */ 391d452251464b Yongbo Zhang 2020-05-08 563 if (is_tdm || is_tdm_split) { 391d452251464b Yongbo Zhang 2020-05-08 564 switch (id) { 391d452251464b Yongbo Zhang 2020-05-08 565 case 0: 391d452251464b Yongbo Zhang 2020-05-08 566 case 1: 391d452251464b Yongbo Zhang 2020-05-08 567 case 2: 391d452251464b Yongbo Zhang 2020-05-08 568 case 3: 391d452251464b Yongbo Zhang 2020-05-08 569 case 4: 391d452251464b Yongbo Zhang 2020-05-08 570 for (i = 0; i < 4; i++) { 391d452251464b Yongbo Zhang 2020-05-08 571 sys_int_enable = rsnd_mod_read(mod, 391d452251464b Yongbo Zhang 2020-05-08 572 SSI_SYS_INT_ENABLE(i * 2)); 391d452251464b Yongbo Zhang 2020-05-08 573 sys_int_enable &= ~(0xf << (id * 4)); 391d452251464b Yongbo Zhang 2020-05-08 574 rsnd_mod_write(mod, 391d452251464b Yongbo Zhang 2020-05-08 575 SSI_SYS_INT_ENABLE(i * 2), 391d452251464b Yongbo Zhang 2020-05-08 576 sys_int_enable); 391d452251464b Yongbo Zhang 2020-05-08 577 } 391d452251464b Yongbo Zhang 2020-05-08 578 391d452251464b Yongbo Zhang 2020-05-08 579 break; 391d452251464b Yongbo Zhang 2020-05-08 580 case 9: 391d452251464b Yongbo Zhang 2020-05-08 581 for (i = 0; i < 4; i++) { 391d452251464b Yongbo Zhang 2020-05-08 582 sys_int_enable = rsnd_mod_read(mod, 391d452251464b Yongbo Zhang 2020-05-08 583 SSI_SYS_INT_ENABLE((i * 2) + 1)); 391d452251464b Yongbo Zhang 2020-05-08 584 sys_int_enable &= ~(0xf << 4); 391d452251464b Yongbo Zhang 2020-05-08 585 rsnd_mod_write(mod, 391d452251464b Yongbo Zhang 2020-05-08 586 SSI_SYS_INT_ENABLE((i * 2) + 1), 391d452251464b Yongbo Zhang 2020-05-08 587 sys_int_enable); 391d452251464b Yongbo Zhang 2020-05-08 588 } 391d452251464b Yongbo Zhang 2020-05-08 589 391d452251464b Yongbo Zhang 2020-05-08 590 break; 391d452251464b Yongbo Zhang 2020-05-08 591 } 391d452251464b Yongbo Zhang 2020-05-08 592 ae5c322303fff5 Kuninori Morimoto 2013-07-21 593 return 0; ae5c322303fff5 Kuninori Morimoto 2013-07-21 594 } ae5c322303fff5 Kuninori Morimoto 2013-07-21 595 :::::: The code at line 531 was first introduced by commit :::::: ae5c322303fff50b93d60e34c6563f1264a5941b ASoC: add Renesas R-Car SSI feature :::::: TO: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> :::::: CC: Mark Brown <broonie@linaro.org> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c index af19010b9d88..8bd49c8a9517 100644 --- a/sound/soc/sh/rcar/gen.c +++ b/sound/soc/sh/rcar/gen.c @@ -224,6 +224,14 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv) RSND_GEN_S_REG(SSI_SYS_STATUS5, 0x884), RSND_GEN_S_REG(SSI_SYS_STATUS6, 0x888), RSND_GEN_S_REG(SSI_SYS_STATUS7, 0x88c), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE4, 0x890), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE5, 0x894), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE6, 0x898), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE7, 0x89c), RSND_GEN_S_REG(HDMI0_SEL, 0x9e0), RSND_GEN_S_REG(HDMI1_SEL, 0x9e4), diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index ea6cbaa9743e..d47608ff5fac 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -189,6 +189,14 @@ enum rsnd_reg { SSI_SYS_STATUS5, SSI_SYS_STATUS6, SSI_SYS_STATUS7, + SSI_SYS_INT_ENABLE0, + SSI_SYS_INT_ENABLE1, + SSI_SYS_INT_ENABLE2, + SSI_SYS_INT_ENABLE3, + SSI_SYS_INT_ENABLE4, + SSI_SYS_INT_ENABLE5, + SSI_SYS_INT_ENABLE6, + SSI_SYS_INT_ENABLE7, HDMI0_SEL, HDMI1_SEL, SSI9_BUSIF0_MODE, @@ -237,6 +245,7 @@ enum rsnd_reg { #define SSI9_BUSIF_ADINR(i) (SSI9_BUSIF0_ADINR + (i)) #define SSI9_BUSIF_DALIGN(i) (SSI9_BUSIF0_DALIGN + (i)) #define SSI_SYS_STATUS(i) (SSI_SYS_STATUS0 + (i)) +#define SSI_SYS_INT_ENABLE(i) (SSI_SYS_INT_ENABLE0 + (i)) struct rsnd_priv; diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 4a7d3413917f..178f50a91b3e 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -372,6 +372,9 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, u32 wsr = ssi->wsr; int width; int is_tdm, is_tdm_split; + int id = rsnd_mod_id(mod); + int i; + u32 sys_int_enable = 0; is_tdm = rsnd_runtime_is_tdm(io); is_tdm_split = rsnd_runtime_is_tdm_split(io); @@ -447,6 +450,38 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, cr_mode = DIEN; /* PIO : enable Data interrupt */ } + /* enable busif buffer over/under run interrupt. */ + if (is_tdm || is_tdm_split) { + switch (id) { + case 0: + case 1: + case 2: + case 3: + case 4: + for (i = 0; i < 4; i++) { + sys_int_enable = rsnd_mod_read(mod, + SSI_SYS_INT_ENABLE(i * 2)); + sys_int_enable |= 0xf << (id * 4); + rsnd_mod_write(mod, + SSI_SYS_INT_ENABLE(i * 2), + sys_int_enable); + } + + break; + case 9: + for (i = 0; i < 4; i++) { + sys_int_enable = rsnd_mod_read(mod, + SSI_SYS_INT_ENABLE((i * 2) + 1)); + sys_int_enable |= 0xf << 4; + rsnd_mod_write(mod, + SSI_SYS_INT_ENABLE((i * 2) + 1), + sys_int_enable); + } + + break; + } + } + init_end: ssi->cr_own = cr_own; ssi->cr_mode = cr_mode; @@ -496,6 +531,13 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, { struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct device *dev = rsnd_priv_to_dev(priv); + int is_tdm, is_tdm_split; + int id = rsnd_mod_id(mod); + int i; + u32 sys_int_enable = 0; + + is_tdm = rsnd_runtime_is_tdm(io); + is_tdm_split = rsnd_runtime_is_tdm_split(io); if (!rsnd_ssi_is_run_mods(mod, io)) return 0; @@ -517,6 +559,37 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, ssi->wsr = 0; } + /* disable busif buffer over/under run interrupt. */ + if (is_tdm || is_tdm_split) { + switch (id) { + case 0: + case 1: + case 2: + case 3: + case 4: + for (i = 0; i < 4; i++) { + sys_int_enable = rsnd_mod_read(mod, + SSI_SYS_INT_ENABLE(i * 2)); + sys_int_enable &= ~(0xf << (id * 4)); + rsnd_mod_write(mod, + SSI_SYS_INT_ENABLE(i * 2), + sys_int_enable); + } + + break; + case 9: + for (i = 0; i < 4; i++) { + sys_int_enable = rsnd_mod_read(mod, + SSI_SYS_INT_ENABLE((i * 2) + 1)); + sys_int_enable &= ~(0xf << 4); + rsnd_mod_write(mod, + SSI_SYS_INT_ENABLE((i * 2) + 1), + sys_int_enable); + } + + break; + } + return 0; } @@ -622,6 +695,11 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, int enable) { u32 val = 0; + int is_tdm, is_tdm_split; + int id = rsnd_mod_id(mod); + + is_tdm = rsnd_runtime_is_tdm(io); + is_tdm_split = rsnd_runtime_is_tdm_split(io); if (rsnd_is_gen1(priv)) return 0; @@ -635,6 +713,19 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, if (enable) val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000; + if (is_tdm || is_tdm_split) { + switch (id) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 9: + val |= 0xff00; + break; + } + } + rsnd_mod_write(mod, SSI_INT_ENABLE, val); return 0; @@ -651,6 +742,10 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, u32 status; bool elapsed = false; bool stop = false; + int is_tdm, is_tdm_split; + + is_tdm = rsnd_runtime_is_tdm(io); + is_tdm_split = rsnd_runtime_is_tdm_split(io); spin_lock(&priv->lock); @@ -672,6 +767,53 @@ static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, stop = true; } + status = 0; + + if (is_tdm || is_tdm_split) { + switch (id) { + case 0: + case 1: + case 2: + case 3: + case 4: + for (i = 0; i < 4; i++) { + status = rsnd_mod_read(mod, + SSI_SYS_STATUS(i * 2)); + status &= 0xf << (id * 4); + + if (status) { + rsnd_dbg_irq_status(dev, + "%s err status : 0x%08x\n", + rsnd_mod_name(mod), status); + rsnd_mod_write(mod, + SSI_SYS_STATUS(i * 2), + 0xf << (id * 4)); + stop = true; + break; + } + } + break; + case 9: + for (i = 0; i < 4; i++) { + status = rsnd_mod_write(mod, + SSI_SYS_STATUS((i * 2) + 1)); + status &= 0xf << 4; + + if (status) { + rsnd_dbg_irq_status(dev, + "%s err status : 0x%08x\n", + rsnd_mod_name(mod), status); + rsnd_mod_write(mod, + SSI_SYS_STATUS((i * 2) + 1), + 0xf << 4); + stop = true; + break; + } + } + break; + } + } + rsnd_ssi_status_clear(mod); rsnd_ssi_interrupt_out: spin_unlock(&priv->lock);