mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 05:32:00 +00:00
soundwire updates for 5.12-rc1
Updates forv5.12-rc1 are: - New no_pm IO routines and the usage in Intel drivers - Intel driver & Cadence lib updates -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+vs47OPLdNbVcHzyfBQHDyUjg0cFAmAgI5EACgkQfBQHDyUj g0dpnA/7BBzyCEZDQijj4P3BHif3Ypcorv0YzXmR/soXqDoqb3wx6pAcylf95m71 kBfNpBM4T5CjF+sUzOX00UEKLnfSG9xGWuxuth0EOIbjB3Zp4l2bxwC5st4PBjZt ZhEaZpapYQ4WqNd08p6PztxTp1CwvYFHfsDfZW7L/Zeu02cmcRiofgZBCfcaqafz f1gJj2zCbrMK0KX//J1ZAjwkcNBXeFz4wkpkh9Fth9ltfza5yZeBg64kx9RutFIb mkTFnBhi0d52BsQV0cnr2m73YFCcDb8cHlGmYcvwH2qEV5R0BAYBHY3RKKad8fDw rzGR6esut0CvI3zMvWkRd1/soCC+lqN4njHrc8BFhU9HmFPXpcY5dpJbh73wUAPa pdZ9S2SIVDSprIIuDUnoxVz9lGqZwlpAjZaXo1JhnsgUgskt7vqb4rbugaH1YMaj 8FPOzVLchtXqlbR5CtZ9E/t+pYi3xvhwMCifLimVtmyZMcl/TFtTMT7OavEkwzAZ L/G9yvi+Gv2HeQ/UTTxvPr2IsfD66O0tKBAWjGcZPF8G3igYExHNifum/6a6cWZk Qebfyc5dxN1ch1KY2dpO/PzXFM7LZ5AwqlLMhgACTlO/tpMsq77hWcpwgw+Iw+jV olH8e20m53+aHFt0fb8fh/BKUX2zr3GOFXcNZ+1peXPl4hqoKsk= =ZNSl -----END PGP SIGNATURE----- Merge tag 'soundwire-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire into char-misc-next Vinod writes: soundwire updates for 5.12-rc1 Updates forv5.12-rc1 are: - New no_pm IO routines and the usage in Intel drivers - Intel driver & Cadence lib updates * tag 'soundwire-5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire: soundwire: bus: clarify dev_err/dbg device references soundwire: bus: fix confusion on device used by pm_runtime soundwire: export sdw_write/read_no_pm functions soundwire: bus: use no_pm IO routines for all interrupt handling soundwire: bus: use sdw_write_no_pm when setting the bus scale registers soundwire: bus: use sdw_update_no_pm when initializing a device soundwire: Revert "soundwire: debugfs: use controller id instead of link_id" soundwire: return earlier if no slave is attached soundwire: bus: add better dev_dbg to track complete() calls soundwire: cadence: adjust verbosity in response handling soundwire: cadence: fix ACK/NAK handling soundwire: bus: add more details to track failed transfers soundwire: cadence: add status in dev_dbg 'State change' log soundwire: use consistent format for Slave devID logs soundwire: intel: don't return error when clock stop failed soundwire: debugfs: use controller id instead of link_id MAINTAINERS: soundwire: Add soundwire tree soundwire: sysfs: Constify static struct attribute_group soundwire: cadence: reduce timeout on transactions soundwire: intel: Use kzalloc for allocating only one thing
This commit is contained in:
commit
f3be861362
@ -16667,6 +16667,7 @@ R: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
|
||||
R: Sanyog Kale <sanyog.r.kale@intel.com>
|
||||
L: alsa-devel@alsa-project.org (moderated for non-subscribers)
|
||||
S: Supported
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire.git
|
||||
F: Documentation/driver-api/soundwire/
|
||||
F: drivers/soundwire/
|
||||
F: include/linux/soundwire/
|
||||
|
@ -267,8 +267,10 @@ static int sdw_transfer_unlocked(struct sdw_bus *bus, struct sdw_msg *msg)
|
||||
|
||||
ret = do_transfer(bus, msg);
|
||||
if (ret != 0 && ret != -ENODATA)
|
||||
dev_err(bus->dev, "trf on Slave %d failed:%d\n",
|
||||
msg->dev_num, ret);
|
||||
dev_err(bus->dev, "trf on Slave %d failed:%d %s addr %x count %d\n",
|
||||
msg->dev_num, ret,
|
||||
(msg->flags & SDW_MSG_FLAG_WRITE) ? "write" : "read",
|
||||
msg->addr, msg->len);
|
||||
|
||||
if (msg->page)
|
||||
sdw_reset_page(bus, msg->dev_num);
|
||||
@ -405,10 +407,11 @@ sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
|
||||
return sdw_transfer(slave->bus, &msg);
|
||||
}
|
||||
|
||||
static int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
|
||||
int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
|
||||
{
|
||||
return sdw_nwrite_no_pm(slave, addr, 1, &value);
|
||||
}
|
||||
EXPORT_SYMBOL(sdw_write_no_pm);
|
||||
|
||||
static int
|
||||
sdw_bread_no_pm(struct sdw_bus *bus, u16 dev_num, u32 addr)
|
||||
@ -476,8 +479,7 @@ int sdw_bwrite_no_pm_unlocked(struct sdw_bus *bus, u16 dev_num, u32 addr, u8 val
|
||||
}
|
||||
EXPORT_SYMBOL(sdw_bwrite_no_pm_unlocked);
|
||||
|
||||
static int
|
||||
sdw_read_no_pm(struct sdw_slave *slave, u32 addr)
|
||||
int sdw_read_no_pm(struct sdw_slave *slave, u32 addr)
|
||||
{
|
||||
u8 buf;
|
||||
int ret;
|
||||
@ -488,6 +490,19 @@ sdw_read_no_pm(struct sdw_slave *slave, u32 addr)
|
||||
else
|
||||
return buf;
|
||||
}
|
||||
EXPORT_SYMBOL(sdw_read_no_pm);
|
||||
|
||||
static int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
tmp = sdw_read_no_pm(slave, addr);
|
||||
if (tmp < 0)
|
||||
return tmp;
|
||||
|
||||
tmp = (tmp & ~mask) | val;
|
||||
return sdw_write_no_pm(slave, addr, tmp);
|
||||
}
|
||||
|
||||
/**
|
||||
* sdw_nread() - Read "n" contiguous SDW Slave registers
|
||||
@ -500,16 +515,16 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(slave->bus->dev);
|
||||
ret = pm_runtime_get_sync(&slave->dev);
|
||||
if (ret < 0 && ret != -EACCES) {
|
||||
pm_runtime_put_noidle(slave->bus->dev);
|
||||
pm_runtime_put_noidle(&slave->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sdw_nread_no_pm(slave, addr, count, val);
|
||||
|
||||
pm_runtime_mark_last_busy(slave->bus->dev);
|
||||
pm_runtime_put(slave->bus->dev);
|
||||
pm_runtime_mark_last_busy(&slave->dev);
|
||||
pm_runtime_put(&slave->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -526,16 +541,16 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = pm_runtime_get_sync(slave->bus->dev);
|
||||
ret = pm_runtime_get_sync(&slave->dev);
|
||||
if (ret < 0 && ret != -EACCES) {
|
||||
pm_runtime_put_noidle(slave->bus->dev);
|
||||
pm_runtime_put_noidle(&slave->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = sdw_nwrite_no_pm(slave, addr, count, val);
|
||||
|
||||
pm_runtime_mark_last_busy(slave->bus->dev);
|
||||
pm_runtime_put(slave->bus->dev);
|
||||
pm_runtime_mark_last_busy(&slave->dev);
|
||||
pm_runtime_put(&slave->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -623,6 +638,7 @@ err:
|
||||
|
||||
static int sdw_assign_device_num(struct sdw_slave *slave)
|
||||
{
|
||||
struct sdw_bus *bus = slave->bus;
|
||||
int ret, dev_num;
|
||||
bool new_device = false;
|
||||
|
||||
@ -633,7 +649,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
|
||||
dev_num = sdw_get_device_num(slave);
|
||||
mutex_unlock(&slave->bus->bus_lock);
|
||||
if (dev_num < 0) {
|
||||
dev_err(slave->bus->dev, "Get dev_num failed: %d\n",
|
||||
dev_err(bus->dev, "Get dev_num failed: %d\n",
|
||||
dev_num);
|
||||
return dev_num;
|
||||
}
|
||||
@ -646,7 +662,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
|
||||
}
|
||||
|
||||
if (!new_device)
|
||||
dev_dbg(slave->bus->dev,
|
||||
dev_dbg(bus->dev,
|
||||
"Slave already registered, reusing dev_num:%d\n",
|
||||
slave->dev_num);
|
||||
|
||||
@ -656,7 +672,7 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
|
||||
|
||||
ret = sdw_write_no_pm(slave, SDW_SCP_DEVNUMBER, dev_num);
|
||||
if (ret < 0) {
|
||||
dev_err(&slave->dev, "Program device_num %d failed: %d\n",
|
||||
dev_err(bus->dev, "Program device_num %d failed: %d\n",
|
||||
dev_num, ret);
|
||||
return ret;
|
||||
}
|
||||
@ -679,9 +695,8 @@ void sdw_extract_slave_id(struct sdw_bus *bus,
|
||||
id->class_id = SDW_CLASS_ID(addr);
|
||||
|
||||
dev_dbg(bus->dev,
|
||||
"SDW Slave class_id %x, part_id %x, mfg_id %x, unique_id %x, version %x\n",
|
||||
id->class_id, id->part_id, id->mfg_id,
|
||||
id->unique_id, id->sdw_version);
|
||||
"SDW Slave class_id 0x%02x, mfg_id 0x%04x, part_id 0x%04x, unique_id 0x%x, version 0x%x\n",
|
||||
id->class_id, id->mfg_id, id->part_id, id->unique_id, id->sdw_version);
|
||||
}
|
||||
|
||||
static int sdw_program_device_num(struct sdw_bus *bus)
|
||||
@ -735,7 +750,7 @@ static int sdw_program_device_num(struct sdw_bus *bus)
|
||||
*/
|
||||
ret = sdw_assign_device_num(slave);
|
||||
if (ret) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(bus->dev,
|
||||
"Assign dev_num failed:%d\n",
|
||||
ret);
|
||||
return ret;
|
||||
@ -775,15 +790,17 @@ static int sdw_program_device_num(struct sdw_bus *bus)
|
||||
static void sdw_modify_slave_status(struct sdw_slave *slave,
|
||||
enum sdw_slave_status status)
|
||||
{
|
||||
mutex_lock(&slave->bus->bus_lock);
|
||||
struct sdw_bus *bus = slave->bus;
|
||||
|
||||
dev_vdbg(&slave->dev,
|
||||
mutex_lock(&bus->bus_lock);
|
||||
|
||||
dev_vdbg(bus->dev,
|
||||
"%s: changing status slave %d status %d new status %d\n",
|
||||
__func__, slave->dev_num, slave->status, status);
|
||||
|
||||
if (status == SDW_SLAVE_UNATTACHED) {
|
||||
dev_dbg(&slave->dev,
|
||||
"%s: initializing completion for Slave %d\n",
|
||||
"%s: initializing enumeration and init completion for Slave %d\n",
|
||||
__func__, slave->dev_num);
|
||||
|
||||
init_completion(&slave->enumeration_complete);
|
||||
@ -792,13 +809,13 @@ static void sdw_modify_slave_status(struct sdw_slave *slave,
|
||||
} else if ((status == SDW_SLAVE_ATTACHED) &&
|
||||
(slave->status == SDW_SLAVE_UNATTACHED)) {
|
||||
dev_dbg(&slave->dev,
|
||||
"%s: signaling completion for Slave %d\n",
|
||||
"%s: signaling enumeration completion for Slave %d\n",
|
||||
__func__, slave->dev_num);
|
||||
|
||||
complete(&slave->enumeration_complete);
|
||||
}
|
||||
slave->status = status;
|
||||
mutex_unlock(&slave->bus->bus_lock);
|
||||
mutex_unlock(&bus->bus_lock);
|
||||
}
|
||||
|
||||
static enum sdw_clk_stop_mode sdw_get_clk_stop_mode(struct sdw_slave *slave)
|
||||
@ -950,17 +967,17 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus)
|
||||
simple_clk_stop = false;
|
||||
}
|
||||
|
||||
if (is_slave && !simple_clk_stop) {
|
||||
/* Skip remaining clock stop preparation if no Slave is attached */
|
||||
if (!is_slave)
|
||||
return ret;
|
||||
|
||||
if (!simple_clk_stop) {
|
||||
ret = sdw_bus_wait_for_clk_prep_deprep(bus,
|
||||
SDW_BROADCAST_DEV_NUM);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Don't need to inform slaves if there is no slave attached */
|
||||
if (!is_slave)
|
||||
return ret;
|
||||
|
||||
/* Inform slaves that prep is done */
|
||||
list_for_each_entry(slave, &bus->slaves, node) {
|
||||
if (!slave->dev_num)
|
||||
@ -1074,16 +1091,13 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus)
|
||||
"clk stop deprep failed:%d", ret);
|
||||
}
|
||||
|
||||
if (is_slave && !simple_clk_stop)
|
||||
sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM);
|
||||
|
||||
/*
|
||||
* Don't need to call slave callback function if there is no slave
|
||||
* attached
|
||||
*/
|
||||
/* Skip remaining clock stop de-preparation if no Slave is attached */
|
||||
if (!is_slave)
|
||||
return 0;
|
||||
|
||||
if (!simple_clk_stop)
|
||||
sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM);
|
||||
|
||||
list_for_each_entry(slave, &bus->slaves, node) {
|
||||
if (!slave->dev_num)
|
||||
continue;
|
||||
@ -1127,7 +1141,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave,
|
||||
|
||||
ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val);
|
||||
if (ret < 0)
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DPN_INTMASK write failed:%d\n", val);
|
||||
|
||||
return ret;
|
||||
@ -1210,7 +1224,7 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
|
||||
}
|
||||
scale_index++;
|
||||
|
||||
ret = sdw_write(slave, SDW_SCP_BUS_CLOCK_BASE, base);
|
||||
ret = sdw_write_no_pm(slave, SDW_SCP_BUS_CLOCK_BASE, base);
|
||||
if (ret < 0) {
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_BUS_CLOCK_BASE write failed:%d\n", ret);
|
||||
@ -1218,13 +1232,13 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
|
||||
}
|
||||
|
||||
/* initialize scale for both banks */
|
||||
ret = sdw_write(slave, SDW_SCP_BUSCLOCK_SCALE_B0, scale_index);
|
||||
ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B0, scale_index);
|
||||
if (ret < 0) {
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_BUSCLOCK_SCALE_B0 write failed:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = sdw_write(slave, SDW_SCP_BUSCLOCK_SCALE_B1, scale_index);
|
||||
ret = sdw_write_no_pm(slave, SDW_SCP_BUSCLOCK_SCALE_B1, scale_index);
|
||||
if (ret < 0)
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_BUSCLOCK_SCALE_B1 write failed:%d\n", ret);
|
||||
@ -1256,9 +1270,9 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
|
||||
val = slave->prop.scp_int1_mask;
|
||||
|
||||
/* Enable SCP interrupts */
|
||||
ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val);
|
||||
ret = sdw_update_no_pm(slave, SDW_SCP_INTMASK1, val, val);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INTMASK1 write failed:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@ -1271,9 +1285,9 @@ static int sdw_initialize_slave(struct sdw_slave *slave)
|
||||
val = prop->dp0_prop->imp_def_interrupts;
|
||||
val |= SDW_DP0_INT_PORT_READY | SDW_DP0_INT_BRA_FAILURE;
|
||||
|
||||
ret = sdw_update(slave, SDW_DP0_INTMASK, val, val);
|
||||
ret = sdw_update_no_pm(slave, SDW_DP0_INTMASK, val, val);
|
||||
if (ret < 0)
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INTMASK read failed:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
@ -1283,9 +1297,9 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status)
|
||||
u8 clear, impl_int_mask;
|
||||
int status, status2, ret, count = 0;
|
||||
|
||||
status = sdw_read(slave, SDW_DP0_INT);
|
||||
status = sdw_read_no_pm(slave, SDW_DP0_INT);
|
||||
if (status < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INT read failed:%d\n", status);
|
||||
return status;
|
||||
}
|
||||
@ -1322,17 +1336,17 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status)
|
||||
}
|
||||
|
||||
/* clear the interrupts but don't touch reserved and SDCA_CASCADE fields */
|
||||
ret = sdw_write(slave, SDW_DP0_INT, clear);
|
||||
ret = sdw_write_no_pm(slave, SDW_DP0_INT, clear);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INT write failed:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read DP0 interrupt again */
|
||||
status2 = sdw_read(slave, SDW_DP0_INT);
|
||||
status2 = sdw_read_no_pm(slave, SDW_DP0_INT);
|
||||
if (status2 < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INT read failed:%d\n", status2);
|
||||
return status2;
|
||||
}
|
||||
@ -1345,7 +1359,7 @@ static int sdw_handle_dp0_interrupt(struct sdw_slave *slave, u8 *slave_status)
|
||||
} while ((status & SDW_DP0_INTERRUPTS) && (count < SDW_READ_INTR_CLEAR_RETRY));
|
||||
|
||||
if (count == SDW_READ_INTR_CLEAR_RETRY)
|
||||
dev_warn(slave->bus->dev, "Reached MAX_RETRY on DP0 read\n");
|
||||
dev_warn(&slave->dev, "Reached MAX_RETRY on DP0 read\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1361,9 +1375,9 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
|
||||
return sdw_handle_dp0_interrupt(slave, slave_status);
|
||||
|
||||
addr = SDW_DPN_INT(port);
|
||||
status = sdw_read(slave, addr);
|
||||
status = sdw_read_no_pm(slave, addr);
|
||||
if (status < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DPN_INT read failed:%d\n", status);
|
||||
|
||||
return status;
|
||||
@ -1395,17 +1409,17 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
|
||||
}
|
||||
|
||||
/* clear the interrupt but don't touch reserved fields */
|
||||
ret = sdw_write(slave, addr, clear);
|
||||
ret = sdw_write_no_pm(slave, addr, clear);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DPN_INT write failed:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read DPN interrupt again */
|
||||
status2 = sdw_read(slave, addr);
|
||||
status2 = sdw_read_no_pm(slave, addr);
|
||||
if (status2 < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DPN_INT read failed:%d\n", status2);
|
||||
return status2;
|
||||
}
|
||||
@ -1418,7 +1432,7 @@ static int sdw_handle_port_interrupt(struct sdw_slave *slave,
|
||||
} while ((status & SDW_DPN_INTERRUPTS) && (count < SDW_READ_INTR_CLEAR_RETRY));
|
||||
|
||||
if (count == SDW_READ_INTR_CLEAR_RETRY)
|
||||
dev_warn(slave->bus->dev, "Reached MAX_RETRY on port read");
|
||||
dev_warn(&slave->dev, "Reached MAX_RETRY on port read");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1440,30 +1454,30 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
|
||||
ret = pm_runtime_get_sync(&slave->dev);
|
||||
if (ret < 0 && ret != -EACCES) {
|
||||
dev_err(&slave->dev, "Failed to resume device: %d\n", ret);
|
||||
pm_runtime_put_noidle(slave->bus->dev);
|
||||
pm_runtime_put_noidle(&slave->dev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read Intstat 1, Intstat 2 and Intstat 3 registers */
|
||||
ret = sdw_read(slave, SDW_SCP_INT1);
|
||||
ret = sdw_read_no_pm(slave, SDW_SCP_INT1);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INT1 read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
buf = ret;
|
||||
|
||||
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, buf2);
|
||||
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, buf2);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INT2/3 read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
|
||||
if (slave->prop.is_sdca) {
|
||||
ret = sdw_read(slave, SDW_DP0_INT);
|
||||
ret = sdw_read_no_pm(slave, SDW_DP0_INT);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INT read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
@ -1558,9 +1572,9 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
|
||||
}
|
||||
|
||||
/* Ack interrupt */
|
||||
ret = sdw_write(slave, SDW_SCP_INT1, clear);
|
||||
ret = sdw_write_no_pm(slave, SDW_SCP_INT1, clear);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INT1 write failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
@ -1572,25 +1586,25 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
|
||||
* Read status again to ensure no new interrupts arrived
|
||||
* while servicing interrupts.
|
||||
*/
|
||||
ret = sdw_read(slave, SDW_SCP_INT1);
|
||||
ret = sdw_read_no_pm(slave, SDW_SCP_INT1);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INT1 read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
_buf = ret;
|
||||
|
||||
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, _buf2);
|
||||
ret = sdw_nread_no_pm(slave, SDW_SCP_INTSTAT2, 2, _buf2);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_SCP_INT2/3 read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
|
||||
if (slave->prop.is_sdca) {
|
||||
ret = sdw_read(slave, SDW_DP0_INT);
|
||||
ret = sdw_read_no_pm(slave, SDW_DP0_INT);
|
||||
if (ret < 0) {
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"SDW_DP0_INT read failed:%d\n", ret);
|
||||
goto io_err;
|
||||
}
|
||||
@ -1616,7 +1630,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
|
||||
} while (stat != 0 && count < SDW_READ_INTR_CLEAR_RETRY);
|
||||
|
||||
if (count == SDW_READ_INTR_CLEAR_RETRY)
|
||||
dev_warn(slave->bus->dev, "Reached MAX_RETRY on alert read\n");
|
||||
dev_warn(&slave->dev, "Reached MAX_RETRY on alert read\n");
|
||||
|
||||
io_err:
|
||||
pm_runtime_mark_last_busy(&slave->dev);
|
||||
@ -1722,7 +1736,7 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
|
||||
case SDW_SLAVE_ALERT:
|
||||
ret = sdw_handle_slave_alerts(slave);
|
||||
if (ret)
|
||||
dev_err(bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"Slave %d alert handling failed: %d\n",
|
||||
i, ret);
|
||||
break;
|
||||
@ -1741,24 +1755,29 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
|
||||
|
||||
ret = sdw_initialize_slave(slave);
|
||||
if (ret)
|
||||
dev_err(bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"Slave %d initialization failed: %d\n",
|
||||
i, ret);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(bus->dev, "Invalid slave %d status:%d\n",
|
||||
dev_err(&slave->dev, "Invalid slave %d status:%d\n",
|
||||
i, status[i]);
|
||||
break;
|
||||
}
|
||||
|
||||
ret = sdw_update_slave_status(slave, status[i]);
|
||||
if (ret)
|
||||
dev_err(slave->bus->dev,
|
||||
dev_err(&slave->dev,
|
||||
"Update Slave status failed:%d\n", ret);
|
||||
if (attached_initializing)
|
||||
if (attached_initializing) {
|
||||
dev_dbg(&slave->dev,
|
||||
"%s: signaling initialization completion for Slave %d\n",
|
||||
__func__, slave->dev_num);
|
||||
|
||||
complete(&slave->initialization_complete);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -188,7 +188,7 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
|
||||
#define CDNS_PDI_CONFIG_PORT GENMASK(4, 0)
|
||||
|
||||
/* Driver defaults */
|
||||
#define CDNS_TX_TIMEOUT 2000
|
||||
#define CDNS_TX_TIMEOUT 500
|
||||
|
||||
#define CDNS_SCP_RX_FIFOLEVEL 0x2
|
||||
|
||||
@ -483,11 +483,11 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns,
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!(cdns->response_buf[i] & CDNS_MCP_RESP_ACK)) {
|
||||
no_ack = 1;
|
||||
dev_dbg_ratelimited(cdns->dev, "Msg Ack not received\n");
|
||||
if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) {
|
||||
nack = 1;
|
||||
dev_err_ratelimited(cdns->dev, "Msg NACK received\n");
|
||||
}
|
||||
dev_vdbg(cdns->dev, "Msg Ack not received, cmd %d\n", i);
|
||||
}
|
||||
if (cdns->response_buf[i] & CDNS_MCP_RESP_NACK) {
|
||||
nack = 1;
|
||||
dev_err_ratelimited(cdns->dev, "Msg NACK received, cmd %d\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -734,21 +734,18 @@ static void cdns_read_response(struct sdw_cdns *cdns)
|
||||
}
|
||||
|
||||
static int cdns_update_slave_status(struct sdw_cdns *cdns,
|
||||
u32 slave0, u32 slave1)
|
||||
u64 slave_intstat)
|
||||
{
|
||||
enum sdw_slave_status status[SDW_MAX_DEVICES + 1];
|
||||
bool is_slave = false;
|
||||
u64 slave;
|
||||
u32 mask;
|
||||
int i, set_status;
|
||||
|
||||
/* combine the two status */
|
||||
slave = ((u64)slave1 << 32) | slave0;
|
||||
memset(status, 0, sizeof(status));
|
||||
|
||||
for (i = 0; i <= SDW_MAX_DEVICES; i++) {
|
||||
mask = (slave >> (i * CDNS_MCP_SLAVE_STATUS_NUM)) &
|
||||
CDNS_MCP_SLAVE_STATUS_BITS;
|
||||
mask = (slave_intstat >> (i * CDNS_MCP_SLAVE_STATUS_NUM)) &
|
||||
CDNS_MCP_SLAVE_STATUS_BITS;
|
||||
if (!mask)
|
||||
continue;
|
||||
|
||||
@ -918,13 +915,17 @@ static void cdns_update_slave_status_work(struct work_struct *work)
|
||||
struct sdw_cdns *cdns =
|
||||
container_of(work, struct sdw_cdns, work);
|
||||
u32 slave0, slave1;
|
||||
|
||||
dev_dbg_ratelimited(cdns->dev, "Slave status change\n");
|
||||
u64 slave_intstat;
|
||||
|
||||
slave0 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT0);
|
||||
slave1 = cdns_readl(cdns, CDNS_MCP_SLAVE_INTSTAT1);
|
||||
|
||||
cdns_update_slave_status(cdns, slave0, slave1);
|
||||
/* combine the two status */
|
||||
slave_intstat = ((u64)slave1 << 32) | slave0;
|
||||
|
||||
dev_dbg_ratelimited(cdns->dev, "Slave status change: 0x%llx\n", slave_intstat);
|
||||
|
||||
cdns_update_slave_status(cdns, slave_intstat);
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT0, slave0);
|
||||
cdns_writel(cdns, CDNS_MCP_SLAVE_INTSTAT1, slave1);
|
||||
|
||||
|
@ -967,7 +967,7 @@ static int intel_hw_params(struct snd_pcm_substream *substream,
|
||||
}
|
||||
|
||||
/* Port configuration */
|
||||
pconfig = kcalloc(1, sizeof(*pconfig), GFP_KERNEL);
|
||||
pconfig = kzalloc(sizeof(*pconfig), GFP_KERNEL);
|
||||
if (!pconfig) {
|
||||
ret = -ENOMEM;
|
||||
goto error;
|
||||
@ -1673,10 +1673,12 @@ static int __maybe_unused intel_suspend_runtime(struct device *dev)
|
||||
|
||||
} else if (clock_stop_quirks & SDW_INTEL_CLK_STOP_BUS_RESET ||
|
||||
!clock_stop_quirks) {
|
||||
bool wake_enable = true;
|
||||
|
||||
ret = sdw_cdns_clock_stop(cdns, true);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "cannot enable clock stop on suspend\n");
|
||||
return ret;
|
||||
wake_enable = false;
|
||||
}
|
||||
|
||||
ret = sdw_cdns_enable_interrupt(cdns, false);
|
||||
@ -1691,7 +1693,7 @@ static int __maybe_unused intel_suspend_runtime(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
intel_shim_wake(sdw, true);
|
||||
intel_shim_wake(sdw, wake_enable);
|
||||
} else {
|
||||
dev_err(dev, "%s clock_stop_quirks %x unsupported\n",
|
||||
__func__, clock_stop_quirks);
|
||||
|
@ -163,15 +163,13 @@ int sdw_acpi_find_slaves(struct sdw_bus *bus)
|
||||
|
||||
if (id.unique_id != id2.unique_id) {
|
||||
dev_dbg(bus->dev,
|
||||
"Valid unique IDs %x %x for Slave mfg %x part %d\n",
|
||||
id.unique_id, id2.unique_id,
|
||||
id.mfg_id, id.part_id);
|
||||
"Valid unique IDs 0x%x 0x%x for Slave mfg_id 0x%04x, part_id 0x%04x\n",
|
||||
id.unique_id, id2.unique_id, id.mfg_id, id.part_id);
|
||||
ignore_unique_id = false;
|
||||
} else {
|
||||
dev_err(bus->dev,
|
||||
"Invalid unique IDs %x %x for Slave mfg %x part %d\n",
|
||||
id.unique_id, id2.unique_id,
|
||||
id.mfg_id, id.part_id);
|
||||
"Invalid unique IDs 0x%x 0x%x for Slave mfg_id 0x%04x, part_id 0x%04x\n",
|
||||
id.unique_id, id2.unique_id, id.mfg_id, id.part_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static struct attribute *slave_dev_attrs[] = {
|
||||
* we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory
|
||||
* for device-level properties
|
||||
*/
|
||||
static struct attribute_group sdw_slave_dev_attr_group = {
|
||||
static const struct attribute_group sdw_slave_dev_attr_group = {
|
||||
.attrs = slave_dev_attrs,
|
||||
.name = "dev-properties",
|
||||
};
|
||||
|
@ -1005,6 +1005,8 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus);
|
||||
|
||||
int sdw_read(struct sdw_slave *slave, u32 addr);
|
||||
int sdw_write(struct sdw_slave *slave, u32 addr, u8 value);
|
||||
int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value);
|
||||
int sdw_read_no_pm(struct sdw_slave *slave, u32 addr);
|
||||
int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val);
|
||||
int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user