Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

soundwire: cadence: add soft-reset on startup

Follow the recommended programming flows.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20241003094830.119673-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Vinod Koul
6124a406 cbcb7edd

+32
+25
drivers/soundwire/cadence_master.c
··· 1378 1378 } 1379 1379 1380 1380 /** 1381 + * sdw_cdns_soft_reset() - Cadence soft-reset 1382 + * @cdns: Cadence instance 1383 + */ 1384 + int sdw_cdns_soft_reset(struct sdw_cdns *cdns) 1385 + { 1386 + int ret; 1387 + 1388 + cdns_updatel(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_SOFT_RST, 1389 + CDNS_MCP_CONTROL_SOFT_RST); 1390 + 1391 + ret = cdns_config_update(cdns); 1392 + if (ret < 0) { 1393 + dev_err(cdns->dev, "%s: config update failed\n", __func__); 1394 + return ret; 1395 + } 1396 + 1397 + ret = cdns_set_wait(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_SOFT_RST, 0); 1398 + if (ret < 0) 1399 + dev_err(cdns->dev, "%s: Soft Reset timed out\n", __func__); 1400 + 1401 + return ret; 1402 + } 1403 + EXPORT_SYMBOL(sdw_cdns_soft_reset); 1404 + 1405 + /** 1381 1406 * sdw_cdns_init() - Cadence initialization 1382 1407 * @cdns: Cadence instance 1383 1408 */
+1
drivers/soundwire/cadence_master.h
··· 168 168 irqreturn_t sdw_cdns_irq(int irq, void *dev_id); 169 169 irqreturn_t sdw_cdns_thread(int irq, void *dev_id); 170 170 171 + int sdw_cdns_soft_reset(struct sdw_cdns *cdns); 171 172 int sdw_cdns_init(struct sdw_cdns *cdns); 172 173 int sdw_cdns_pdi_init(struct sdw_cdns *cdns, 173 174 struct sdw_cdns_stream_config config);
+6
drivers/soundwire/intel_bus_common.c
··· 16 16 struct sdw_bus *bus = &cdns->bus; 17 17 int ret; 18 18 19 + ret = sdw_cdns_soft_reset(cdns); 20 + if (ret < 0) { 21 + dev_err(dev, "%s: unable to soft-reset Cadence IP: %d\n", __func__, ret); 22 + return ret; 23 + } 24 + 19 25 /* 20 26 * follow recommended programming flows to avoid timeouts when 21 27 * gsync is enabled