#
740a6059 |
| 05-Aug-2024 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: re-check Peripheral status with delayed_work
[ Upstream commit f8c35d61ba01afa76846905c67862cdace7f66b0 ]
The SoundWire peripheral enumeration is entirely based on interrupts, m
soundwire: cadence: re-check Peripheral status with delayed_work
[ Upstream commit f8c35d61ba01afa76846905c67862cdace7f66b0 ]
The SoundWire peripheral enumeration is entirely based on interrupts, more specifically sticky bits tracking state changes.
This patch adds a defensive programming check on the actual status reported in PING frames. If for some reason an interrupt was lost or delayed, the delayed work would detect a peripheral change of status after the bus starts.
The 100ms defined for the delay is not completely arbitrary, if a Peripheral didn't join the bus within that delay then probably the hardware link is broken, and conversely if the detection didn't happen because of software issues the 100ms is still acceptable in terms of user experience.
The overhead of the one-shot workqueue is minimal, and the mutual exclusion ensures that the interrupt and delayed work cannot update the status concurrently.
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20240805114921.88007-1-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
#
7eeef1e9 |
| 26-Mar-2024 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: fix invalid PDI offset
[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ]
For some reason, we add an offset to the PDI, presumably to skip the PDI0 and PDI1 which are
soundwire: cadence: fix invalid PDI offset
[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ]
For some reason, we add an offset to the PDI, presumably to skip the PDI0 and PDI1 which are reserved for BPT.
This code is however completely wrong and leads to an out-of-bounds access. We were just lucky so far since we used only a couple of PDIs and remained within the PDI array bounds.
A Fixes: tag is not provided since there are no known platforms where the out-of-bounds would be accessed, and the initial code had problems as well.
A follow-up patch completely removes this useless offset.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20240326090122.1051806-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
show more ...
|
#
94f89950 |
| 17-May-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: revisit parity injection
We want to wait for the CONFIG_UPDATE bit to clear before doing something else.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.co
soundwire: cadence: revisit parity injection
We want to wait for the CONFIG_UPDATE bit to clear before doing something else.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230518024119.164160-4-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
ffc363d9 |
| 17-May-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: intel/cadence: update hardware reset sequence
Combining hardware reset with the multi-link mode leads to a shortened hardware reset pattern observed on the bus.
The updated hardware prog
soundwire: intel/cadence: update hardware reset sequence
Combining hardware reset with the multi-link mode leads to a shortened hardware reset pattern observed on the bus.
The updated hardware programming sequence is to first enable the clock with the sync_arm/sync_go pattern, and only in a second step to issue the hardware reset sequence. Since there is no longer a dependency between sync_arm/sync_go and hw_reset, the behavior of sdw_cdns_exit_reset() is changed to wait for the self-clearing CONFIG_UPDATE to go back to zero,
Link: https://github.com/thesofproject/linux/issues/4170 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230518024119.164160-3-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
83ae1ccb |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: change access to IP_MCP_CMD_BASE
The latest Cadence IP moves MCP_CMD_BASE and MCP_CMD_RESP to the IP_MCP_CMD_BASE and IP_MCP_CMD_RESP registers located in different area and acce
soundwire: cadence: change access to IP_MCP_CMD_BASE
The latest Cadence IP moves MCP_CMD_BASE and MCP_CMD_RESP to the IP_MCP_CMD_BASE and IP_MCP_CMD_RESP registers located in different area and accessed with a fixed offset.
Unlike other patches, the fields are not renamed to avoid a very invasive and low-value set of changes.
For existing solutions, this is an iso-functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-17-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
73a29d3f |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: split access to IP_MCP_CMDCTRL fields
The latest Cadence IP splits the MCP_CMDCTRL fields in two registers: MCP_CMDCTRL and IP_MCP_CMDCTRL. Rename the relevant fields and change
soundwire: cadence: split access to IP_MCP_CMDCTRL fields
The latest Cadence IP splits the MCP_CMDCTRL fields in two registers: MCP_CMDCTRL and IP_MCP_CMDCTRL. Rename the relevant fields and change the access methods used for those fields.
In practice we only use the Parity error insertion in IP_CMD_CTRL.
For existing solutions, this is an iso-functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-16-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
4dc953bc |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: split access to IP_MCP_CONTROL fields
The latest Cadence IP splits the MCP_CONTROL fields in two registers: MCP_CONTROL and IP_MCP_CONTROL. Rename the relevant fields and change
soundwire: cadence: split access to IP_MCP_CONTROL fields
The latest Cadence IP splits the MCP_CONTROL fields in two registers: MCP_CONTROL and IP_MCP_CONTROL. Rename the relevant fields and change the access methods used for those fields.
For existing solutions, this is an iso-functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-15-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
c5753714 |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: split access to IP_MCP_CONFIG fields
The latest Cadence IP splits the MCP_CONFIG fields in two registers: MCP_CONFIG and IP_MCP_CONFIG. Rename the relevant fields and change the
soundwire: cadence: split access to IP_MCP_CONFIG fields
The latest Cadence IP splits the MCP_CONFIG fields in two registers: MCP_CONFIG and IP_MCP_CONFIG. Rename the relevant fields and change the access methods used for those fields.
For existing solutions, this is an iso-functionality change.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-14-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
9402e25d |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: add helpers to access IP_MCP registers
The latest Cadence IP splits some of the existing registers into two, separated by a fixed offset. The bitfields themselves remain at the s
soundwire: cadence: add helpers to access IP_MCP registers
The latest Cadence IP splits some of the existing registers into two, separated by a fixed offset. The bitfields themselves remain at the same position, so we can use new helpers to dynamically add the fixed offset.
For example, the existing MCP_CONFIG is now split in two with MCP_CONFIG and IP_MCP_CONFIG (the naming comes directly from the design document).
This patch adds helpers to access registers with the IP_ prefix. The addition of the 'ip' prefix for helpers, registers and bitfields is intentional to help reviewers spot any mistake.
For existing solutions, the offset is exactly zero so there's no functional change - the MCP_CONFIG and IP_MCP_CONFIG are aliased to the same address.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-13-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
f117e908 |
| 13-Mar-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: remove CDNS_MCP_CONFIG_SSPMOD
This field is not used, and its definition is not aligned with the hardware specification.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossar
soundwire: cadence: remove CDNS_MCP_CONFIG_SSPMOD
This field is not used, and its definition is not aligned with the hardware specification.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230314015410.487311-12-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
66f95de7 |
| 19-Jan-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: further simplify low-level xfer_msg_defer() callback
The message pointer is already stored in the bus->defer structure, not need to pass it as an argument.
Suggested-by: Ranjani
soundwire: cadence: further simplify low-level xfer_msg_defer() callback
The message pointer is already stored in the bus->defer structure, not need to pass it as an argument.
Suggested-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230119073211.85979-5-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
dd0b9619 |
| 19-Jan-2023 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: use directly bus sdw_defer structure
Copying the bus sdw_defer structure into the Cadence internals leads to using stale pointers and kernel oopses on errors. It's just simpler a
soundwire: cadence: use directly bus sdw_defer structure
Copying the bus sdw_defer structure into the Cadence internals leads to using stale pointers and kernel oopses on errors. It's just simpler and safer to use the bus sdw_defer structure directly.
Link: https://github.com/thesofproject/linux/issues/4056 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20230119073211.85979-4-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
3bd3bc2a |
| 23-Jan-2023 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: bus: Remove unused reset_page_addr() callback
A previous patch removed unnecessary zeroing of the page registers after a paged transaction, so now the reset_page_addr callback is unused a
soundwire: bus: Remove unused reset_page_addr() callback
A previous patch removed unnecessary zeroing of the page registers after a paged transaction, so now the reset_page_addr callback is unused and can be removed.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230123164949.245898-3-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
0603a47b |
| 02-Dec-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Drain the RX FIFO after an IO timeout
If wait_for_completion_timeout() times-out in _cdns_xfer_msg() it is possible that something could have been written to the RX FIFO. In this
soundwire: cadence: Drain the RX FIFO after an IO timeout
If wait_for_completion_timeout() times-out in _cdns_xfer_msg() it is possible that something could have been written to the RX FIFO. In this case, we should drain the RX FIFO so that anything in it doesn't carry over and mess up the next transfer.
Obviously, if we got to this state something went wrong, and we don't really know the state of everything. The cleanup in this situation cannot be bullet-proof but we should attempt to avoid breaking future transaction, if only to reduce the amount of error noise when debugging the failure from a kernel log.
Note that this patch only implements the draining for blocking (non-deferred) transfers. The deferred API doesn't have any proper handling of error conditions and would need some re-design before implementing cleanup. That is a task for a separate patch...
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20221202161812.4186897-4-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
827c32d0 |
| 02-Dec-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Remove wasted space in response_buf
The response_buf was declared much larger (128 entries) than the number of responses that could ever be written into it. The Cadence IP is con
soundwire: cadence: Remove wasted space in response_buf
The response_buf was declared much larger (128 entries) than the number of responses that could ever be written into it. The Cadence IP is configurable up to a maximum of 32 entries, and the datasheet says that RX_FIFO_AVAIL can be 2 larger than this. So allow up to 34 responses.
Also add checking in cdns_read_response() to prevent overflowing reponse_buf if RX_FIFO_AVAIL contains an unexpectedly large number.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20221202161812.4186897-3-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
7cbfee2e |
| 02-Dec-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Don't overflow the command FIFOs
The command FIFOs in the Cadence IP can be configured during design up to 32 entries, and the code in cadence_master.c was assuming the full 32-e
soundwire: cadence: Don't overflow the command FIFOs
The command FIFOs in the Cadence IP can be configured during design up to 32 entries, and the code in cadence_master.c was assuming the full 32-entry FIFO. But all current Intel implementations use an 8-entry FIFO.
Up to now the longest message used was 6 entries so this wasn't causing any problem. But future Cirrus Logic codecs have downloadable firmware or tuning blobs. It is more efficient for the codec driver to issue long transfers that can take advantage of any queuing in the Soundwire controller and avoid the overhead of repeatedly writing the page registers.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Fixes: 2f52a5177caa ("soundwire: cdns: Add cadence library") Link: https://lore.kernel.org/r/20221202161812.4186897-2-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
7dddead7 |
| 31-Oct-2022 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: use dai_runtime_array instead of dma_data
Simplify the code with a Cadence-specific dai_runtime_array, indexed with dai->id, instead of abusing dma_data.
Signed-off-by: Pierre-L
soundwire: cadence: use dai_runtime_array instead of dma_data
Simplify the code with a Cadence-specific dai_runtime_array, indexed with dai->id, instead of abusing dma_data.
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/20221101023521.2384586-3-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
e0767e39 |
| 31-Oct-2022 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: cadence: rename sdw_cdns_dai_dma_data as sdw_cdns_dai_runtime
The existing 'struct sdw_cdns_dma_data' has really nothing to do with DMAs. The information is stored in the dai->dma_data, b
soundwire: cadence: rename sdw_cdns_dai_dma_data as sdw_cdns_dai_runtime
The existing 'struct sdw_cdns_dma_data' has really nothing to do with DMAs. The information is stored in the dai->dma_data, but this is really private data that should be stored in a different context.
Beyond the academic elegance discussion, using dma_data is a problem for new Intel hardware where the dma_data structure is already used for true DMA handling performed by other parts of the code.
This patch prepares a transition away from the use of dma_data, for now with a rename-only change.
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/20221101023521.2384586-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
bafb1eac |
| 17-Sep-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Simplify error paths in cdns_xfer_msg()
There's no need to goto an exit label to return from cdns_xfer_msg(). It doesn't do any cleanup, only a return statement.
Replace the got
soundwire: cadence: Simplify error paths in cdns_xfer_msg()
There's no need to goto an exit label to return from cdns_xfer_msg(). It doesn't do any cleanup, only a return statement.
Replace the gotos with returns.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220917154822.690472-2-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
7f6bad4d |
| 17-Sep-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Fix error check in cdns_xfer_msg()
_cdns_xfer_msg() returns an sdw_command_response value, not a negative error code.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com
soundwire: cadence: Fix error check in cdns_xfer_msg()
_cdns_xfer_msg() returns an sdw_command_response value, not a negative error code.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220917154822.690472-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
3ed96fb4 |
| 17-Sep-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Write to correct address for each FIFO chunk
_cdns_xfer_msg() must add the fragment offset to msg->addr to get the base target address of each FIFO chunk. Otherwise every chunk w
soundwire: cadence: Write to correct address for each FIFO chunk
_cdns_xfer_msg() must add the fragment offset to msg->addr to get the base target address of each FIFO chunk. Otherwise every chunk will be written to the first 32 register addresses.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220917123517.229153-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
ba05b39d |
| 16-Sep-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Don't overwrite msg->buf during write commands
The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of
soundwire: cadence: Don't overwrite msg->buf during write commands
The buf passed in struct sdw_msg must only be written for a READ, in that case the RDATA part of the response is the data value of the register.
For a write command there is no RDATA, and buf should be assumed to be const and unmodifable. The original caller should not expect its data buffer to be corrupted by an sdw_nwrite().
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220916103505.1562210-1-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
0c5e99c4 |
| 14-Sep-2022 |
Richard Fitzgerald <rf@opensource.cirrus.com> |
soundwire: cadence: Fix lost ATTACHED interrupts when enumerating
The correct way to handle interrupts is to clear the bits we are about to handle _before_ handling them. Thus if the condition then
soundwire: cadence: Fix lost ATTACHED interrupts when enumerating
The correct way to handle interrupts is to clear the bits we are about to handle _before_ handling them. Thus if the condition then re-asserts during the handling we won't lose it.
This patch changes cdns_update_slave_status_work() to do this.
The previous code cleared the interrupts after handling them. The problem with this is that when handling enumeration of devices the ATTACH statuses can be accidentally cleared and so some or all of the devices never complete their enumeration.
Thus we can have a situation like this: - one or more devices are reverting to ID #0
- accumulated status bits indicate some devices attached and some on ID #0. (Remember: status bits are sticky until they are handled)
- Because of device on #0 sdw_handle_slave_status() programs the device ID and exits without handling the other status, expecting to get an ATTACHED from this reprogrammed device.
- The device immediately starts reporting ATTACHED in PINGs, which will assert its CDNS_MCP_SLAVE_INTSTAT_ATTACHED bit.
- cdns_update_slave_status_work() clears INTSTAT0/1. If the initial status had CDNS_MCP_SLAVE_INTSTAT_ATTACHED bit set it will be cleared.
- The ATTACHED change for the device has now been lost.
- cdns_update_slave_status_work() clears CDNS_MCP_INT_SLAVE_MASK so if the new ATTACHED state had set it, it will be cleared without ever having been handled.
Unless there is some other state change from another device to cause a new interrupt, the ATTACHED state of the reprogrammed device will never cause an interrupt so its enumeration will not be completed.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220914160248.1047627-5-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
fbbc73a2 |
| 14-Sep-2022 |
Simon Trimmer <simont@opensource.cirrus.com> |
soundwire: cadence: fix updating slave status when a bus has multiple peripherals
The cadence IP explicitly reports slave status changes with bits for each possible change. The function cdns_update_
soundwire: cadence: fix updating slave status when a bus has multiple peripherals
The cadence IP explicitly reports slave status changes with bits for each possible change. The function cdns_update_slave_status() attempts to translate this into the current status of each of the slaves.
However when there are multiple peripherals on a bus any slave that did not have a status change when the work function ran would not have it's status updated - the array is initialised to a value that equates to UNATTACHED and this can cause spurious reports that slaves had dropped off the bus.
In the case where a slave has no status change or has multiple status changes the value from the last PING command is used.
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220914160248.1047627-2-rf@opensource.cirrus.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
show more ...
|
#
133547a1 |
| 13-Jul-2022 |
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> |
soundwire: intel/cadence: expose PING status in manager ops
Simple indirection to existing register.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander W
soundwire: intel/cadence: expose PING status in manager ops
Simple indirection to existing register.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Acked-By: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20220714011043.46059-3-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
show more ...
|