Re: [PATCH 1/3] ASoC: Add support for Loongson I2S controller

From: Yingkun Meng
Date: Sun Jun 11 2023 - 21:45:20 EST



On 2023/6/5 21:17, Mark Brown wrote:
On Mon, Jun 05, 2023 at 08:09:32PM +0800, YingKun Meng wrote:

+ regmap_read_poll_timeout_atomic(i2s->regmap,
+ LS_I2S_CTRL, val,
+ !(val & I2S_CTRL_MCLK_READY),
+ 10, 2000);
The driver is waiting for status bits to change in the regmap but...


Break condition reversed. Fixed in new version.


+ pr_err("buf len not multiply of period len\n");
Use dev_ functions to log things please.


OK.

+static const struct regmap_config loongson_i2s_regmap_config = {
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .max_register = 0x110,
+ .cache_type = REGCACHE_FLAT,
+};
...there are no volatile registers in the regmap so we will never read
from the hardware. I don't understand how this can work?


The I2S controller has two private DMA controllers to transfer the audio
data.
Its register set is divided into two parts: I2S control registers and
DMA control registers.

1) The I2S control registers are used to config I2S parameters, accessed
by regmap API. So we don't need to read back.

2) The DMA control registers are used to maintain the status of audio
data transmission.
These registers isn't maintained by regmap. They are accessed using
readx()/writex() APIs.

+ i2s->reg_base = pci_iomap(pdev, BAR_NUM, 0);
+ if (!i2s->reg_base) {
+ dev_err(&pdev->dev, "pci_iomap_error\n");
+ ret = -EIO;
+ goto err_release;
+ }
pcim_iomap()?


OK.

+ dev_set_name(&pdev->dev, "%s", loongson_i2s_dai.name);
Don't log static information like this, it just adds noise and makes the
boot slower.


Removed in new version. Its original purpose is to set a fixed value for
platform component name, and match this value in machine driver.

+ pci_disable_device(pdev);
pcim_enable_device() too.


OK.