Skip to content

Commit fe08b7d

Browse files
rfvirgilbroonie
authored andcommitted
firmware: cs_dsp: Remove async regmap writes
Change calls to async regmap write functions to use the normal blocking writes so that the cs35l56 driver can use spi_bus_lock() to gain exclusive access to the SPI bus. As this is part of a fix, it makes only the minimal change to swap the functions to the blocking equivalents. There's no need to risk reworking the buffer allocation logic that is now partially redundant. The async writes are a 12-year-old workaround for inefficiency of synchronous writes in the SPI subsystem. The SPI subsystem has since been changed to avoid the overheads, so this workaround should not be necessary. The cs35l56 driver needs to use spi_bus_lock() prevent bus activity while it is soft-resetting the cs35l56. But spi_bus_lock() is incompatible with spi_async() calls, which will fail with -EBUSY. Fixes: 8a731fd ("ASoC: cs35l56: Move utility functions to shared file") Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250225131843.113752-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d31babd commit fe08b7d

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,8 +1609,8 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
16091609
goto out_fw;
16101610
}
16111611

1612-
ret = regmap_raw_write_async(regmap, reg, buf->buf,
1613-
le32_to_cpu(region->len));
1612+
ret = regmap_raw_write(regmap, reg, buf->buf,
1613+
le32_to_cpu(region->len));
16141614
if (ret != 0) {
16151615
cs_dsp_err(dsp,
16161616
"%s.%d: Failed to write %d bytes at %d in %s: %d\n",
@@ -1625,20 +1625,13 @@ static int cs_dsp_load(struct cs_dsp *dsp, const struct firmware *firmware,
16251625
regions++;
16261626
}
16271627

1628-
ret = regmap_async_complete(regmap);
1629-
if (ret != 0) {
1630-
cs_dsp_err(dsp, "Failed to complete async write: %d\n", ret);
1631-
goto out_fw;
1632-
}
1633-
16341628
if (pos > firmware->size)
16351629
cs_dsp_warn(dsp, "%s.%d: %zu bytes at end of file\n",
16361630
file, regions, pos - firmware->size);
16371631

16381632
cs_dsp_debugfs_save_wmfwname(dsp, file);
16391633

16401634
out_fw:
1641-
regmap_async_complete(regmap);
16421635
cs_dsp_buf_free(&buf_list);
16431636

16441637
if (ret == -EOVERFLOW)
@@ -2326,8 +2319,8 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware
23262319
cs_dsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n",
23272320
file, blocks, le32_to_cpu(blk->len),
23282321
reg);
2329-
ret = regmap_raw_write_async(regmap, reg, buf->buf,
2330-
le32_to_cpu(blk->len));
2322+
ret = regmap_raw_write(regmap, reg, buf->buf,
2323+
le32_to_cpu(blk->len));
23312324
if (ret != 0) {
23322325
cs_dsp_err(dsp,
23332326
"%s.%d: Failed to write to %x in %s: %d\n",
@@ -2339,18 +2332,13 @@ static int cs_dsp_load_coeff(struct cs_dsp *dsp, const struct firmware *firmware
23392332
blocks++;
23402333
}
23412334

2342-
ret = regmap_async_complete(regmap);
2343-
if (ret != 0)
2344-
cs_dsp_err(dsp, "Failed to complete async write: %d\n", ret);
2345-
23462335
if (pos > firmware->size)
23472336
cs_dsp_warn(dsp, "%s.%d: %zu bytes at end of file\n",
23482337
file, blocks, pos - firmware->size);
23492338

23502339
cs_dsp_debugfs_save_binname(dsp, file);
23512340

23522341
out_fw:
2353-
regmap_async_complete(regmap);
23542342
cs_dsp_buf_free(&buf_list);
23552343

23562344
if (ret == -EOVERFLOW)
@@ -2561,8 +2549,8 @@ static int cs_dsp_adsp2_enable_core(struct cs_dsp *dsp)
25612549
{
25622550
int ret;
25632551

2564-
ret = regmap_update_bits_async(dsp->regmap, dsp->base + ADSP2_CONTROL,
2565-
ADSP2_SYS_ENA, ADSP2_SYS_ENA);
2552+
ret = regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
2553+
ADSP2_SYS_ENA, ADSP2_SYS_ENA);
25662554
if (ret != 0)
25672555
return ret;
25682556

0 commit comments

Comments
 (0)