Message ID | 20190525162323.20216-4-peron.clem@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Allwinner H6 SPDIF support | expand |
On Sat, May 25, 2019 at 06:23:19PM +0200, Clément Péron wrote: > Allwinner H6 has a different bit to flush the TX FIFO. > > Add a quirks to prepare introduction of H6 SoC. > > Signed-off-by: Clément Péron <peron.clem@gmail.com> > --- > sound/soc/sunxi/sun4i-spdif.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c > index b6c66a62e915..8317bbee0712 100644 > --- a/sound/soc/sunxi/sun4i-spdif.c > +++ b/sound/soc/sunxi/sun4i-spdif.c > @@ -166,10 +166,12 @@ > * > * @reg_dac_tx_data: TX FIFO offset for DMA config. > * @has_reset: SoC needs reset deasserted. > + * @reg_fctl_ftx: TX FIFO flush bitmask. It's a bit weird to use the same prefix for a register offset (reg_dac_tx_data) and a value (reg_fctl_ftx). Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi Maxime, On Sun, 26 May 2019 at 20:24, Maxime Ripard <maxime.ripard@bootlin.com> wrote: > > On Sat, May 25, 2019 at 06:23:19PM +0200, Clément Péron wrote: > > Allwinner H6 has a different bit to flush the TX FIFO. > > > > Add a quirks to prepare introduction of H6 SoC. > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com> > > --- > > sound/soc/sunxi/sun4i-spdif.c | 11 ++++++++++- > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c > > index b6c66a62e915..8317bbee0712 100644 > > --- a/sound/soc/sunxi/sun4i-spdif.c > > +++ b/sound/soc/sunxi/sun4i-spdif.c > > @@ -166,10 +166,12 @@ > > * > > * @reg_dac_tx_data: TX FIFO offset for DMA config. > > * @has_reset: SoC needs reset deasserted. > > + * @reg_fctl_ftx: TX FIFO flush bitmask. > > It's a bit weird to use the same prefix for a register offset > (reg_dac_tx_data) and a value (reg_fctl_ftx). I just look at sun4i-codec and they use a regmap, But I think it's a bit overkill no? What do you think about val_fctl_ftx ? Thanks for your review, Clément > > Maxime > > -- > Maxime Ripard, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com
On Sun, May 26, 2019 at 09:00:30PM +0200, Clément Péron wrote: > Hi Maxime, > > On Sun, 26 May 2019 at 20:24, Maxime Ripard <maxime.ripard@bootlin.com> wrote: > > > > On Sat, May 25, 2019 at 06:23:19PM +0200, Clément Péron wrote: > > > Allwinner H6 has a different bit to flush the TX FIFO. > > > > > > Add a quirks to prepare introduction of H6 SoC. > > > > > > Signed-off-by: Clément Péron <peron.clem@gmail.com> > > > --- > > > sound/soc/sunxi/sun4i-spdif.c | 11 ++++++++++- > > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > > > diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c > > > index b6c66a62e915..8317bbee0712 100644 > > > --- a/sound/soc/sunxi/sun4i-spdif.c > > > +++ b/sound/soc/sunxi/sun4i-spdif.c > > > @@ -166,10 +166,12 @@ > > > * > > > * @reg_dac_tx_data: TX FIFO offset for DMA config. > > > * @has_reset: SoC needs reset deasserted. > > > + * @reg_fctl_ftx: TX FIFO flush bitmask. > > > > It's a bit weird to use the same prefix for a register offset > > (reg_dac_tx_data) and a value (reg_fctl_ftx). > > I just look at sun4i-codec and they use a regmap, But I think it's a > bit overkill no? For a single value, yeah > What do you think about val_fctl_ftx ? Looks good, thanks! Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c index b6c66a62e915..8317bbee0712 100644 --- a/sound/soc/sunxi/sun4i-spdif.c +++ b/sound/soc/sunxi/sun4i-spdif.c @@ -166,10 +166,12 @@ * * @reg_dac_tx_data: TX FIFO offset for DMA config. * @has_reset: SoC needs reset deasserted. + * @reg_fctl_ftx: TX FIFO flush bitmask. */ struct sun4i_spdif_quirks { unsigned int reg_dac_txdata; bool has_reset; + unsigned int reg_fctl_ftx; }; struct sun4i_spdif_dev { @@ -180,16 +182,19 @@ struct sun4i_spdif_dev { struct snd_soc_dai_driver cpu_dai_drv; struct regmap *regmap; struct snd_dmaengine_dai_dma_data dma_params_tx; + const struct sun4i_spdif_quirks *quirks; }; static void sun4i_spdif_configure(struct sun4i_spdif_dev *host) { + const struct sun4i_spdif_quirks *quirks = host->quirks; + /* soft reset SPDIF */ regmap_write(host->regmap, SUN4I_SPDIF_CTL, SUN4I_SPDIF_CTL_RESET); /* flush TX FIFO */ regmap_update_bits(host->regmap, SUN4I_SPDIF_FCTL, - SUN4I_SPDIF_FCTL_FTX, SUN4I_SPDIF_FCTL_FTX); + quirks->reg_fctl_ftx, quirks->reg_fctl_ftx); /* clear TX counter */ regmap_write(host->regmap, SUN4I_SPDIF_TXCNT, 0); @@ -418,15 +423,18 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = { static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = { .reg_dac_txdata = SUN4I_SPDIF_TXFIFO, + .reg_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, }; static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = { .reg_dac_txdata = SUN4I_SPDIF_TXFIFO, + .reg_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, .has_reset = true, }; static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = { .reg_dac_txdata = SUN8I_SPDIF_TXFIFO, + .reg_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, .has_reset = true, }; @@ -507,6 +515,7 @@ static int sun4i_spdif_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to determine the quirks to use\n"); return -ENODEV; } + host->quirks = quirks; host->regmap = devm_regmap_init_mmio(&pdev->dev, base, &sun4i_spdif_regmap_config);
Allwinner H6 has a different bit to flush the TX FIFO. Add a quirks to prepare introduction of H6 SoC. Signed-off-by: Clément Péron <peron.clem@gmail.com> --- sound/soc/sunxi/sun4i-spdif.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)