https://github.com/torvalds/linux

sort by:
Revision Author Date Message Commit Date
921ce33 Merge remote-tracking branch 'sof/integration/soundwire-debug-fixes' into integration/soundwire-latest Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:17:56 UTC
c3176eb Merge remote-tracking branch 'sof/integration/soundwire-machine-drivers' into integration/soundwire-latest Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:17:55 UTC
bd69d37 Merge remote-tracking branch 'sof/integration/realtek-sdw-codecs' into integration/soundwire-latest Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:17:55 UTC
a9a7496 Merge remote-tracking branch 'sof/integration/soundwire-sof' into integration/soundwire-latest Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:17:55 UTC
43d7961 Merge remote-tracking branch 'sof/integration/soundwire-intel' into integration/soundwire-latest Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:17:55 UTC
b4ad345 soundwire: stream: add traces to debug "transport params" error Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:27 UTC
d39d994 soundwire: intel: refine function for wakeen event processing if a slave has been attached to a bus, the slave->dev_num_sticky should be non-zero, so we can check this value to skip the ghost devices defined in ACPI table but not populated in hardware. Signed-off-by: Rander Wang <rander.wang@intel.com> 09 January 2020, 18:16:27 UTC
abab764 soundwire: cadence_master: add traces for clock_restart Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:27 UTC
35a8c89 soundwire: bus: add traces for Slave state changes Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:27 UTC
efa39ed soundwire: cadence_master: add traces for Slave state change Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:26 UTC
9df08ee soundwire: bus: add traces for slave alerts Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:26 UTC
568ece7 soundwire: cadence_master: debug error on Olympic device in clock_stop Somehow the master-2 fails to stop the clock [ 24.007288] intel-sdw sdw-master-2: intel_suspend_runtime start [ 24.007297] intel-sdw sdw-master-2: sdw_cdns_clock_stop: start [ 24.007303] intel-sdw sdw-master-2: sdw_cdns_clock_stop: slave attached 0 [ 24.007498] intel-sdw sdw-master-2: Msg ignored for Slave 15 [ 24.007501] intel-sdw sdw-master-2: ClockStopNow Broadcast message failed -61 [ 24.007505] intel-sdw sdw-master-2: bus clock stop failed -61 [ 24.007508] intel-sdw sdw-master-2: cannot enable clock stop on suspend there are not slaves attached, so the command ignored should be accepted what's not clear is what the CMD_ACCEPT (1) is already the default? Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:26 UTC
51b1a9a soundwire: bus: fix io error when processing alert event There are two types of io error when processing alert event. The first one is: master receives a alert event for jack event and invokes implement_def function in slave to check jack status. At this time codec is just suspended, so io registers can't be accessed. Another one is: when waken up from clock stop state and bus needs a complete re-enumeration for synchronization issue , slave register can't be accessed. This patch wakes up codec and wait for initialization complete when processing slave alert event, so that io registers can be accessed. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:26 UTC
1850fd9 soundwire: cadence_master: fix a io timeout issue in S3 test After system resumes from S3, io timeout occurs when setting one unused master on Comet Lake platform. In this case, the master is reset to default state, and FIFOLEVEL is reset to default value, but msg_count used for tracing FIFOLEVEL is still with old value, so FIFOLEVEL will not be set if a new msg FIFO usage is equal to the old msg_count. This patch updates msg_count to default value of FIFOLEVEL when resetting master. Tested on Comet Lake platform. Signed-off-by: Rander Wang <rander.wang@intel.com> 09 January 2020, 18:16:26 UTC
3b4acb2 soundwire: cadence_master: remove useless variable incrementation Fix cppcheck warning: drivers/soundwire/cadence_master.c:992:9: style: Variable 'offset' is assigned a value that is never used. [unreadVariable] offset += stream->num_out; ^ Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:26 UTC
9c9c739 Soundwire: generic_bandwidth_allocation: don't free params if it is null We will free params when we goto out in sdw_compute_port_params(). But we can't free params if it is not allocated successfully. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 09 January 2020, 18:16:26 UTC
bef1b20 ALSA: HDA: intel-dsp-config: add DMI info for Dell laptop Another Dell laptop uses SOF with CML platform Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 09 January 2020, 18:16:25 UTC
b47b719 [HACK] soundwire: add dynamic DEBUG in makefile Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
a56cf39 add traces for bus Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
40118b0 add more traces to bus code Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
76f305d soundwire: cadence_master: log register write info useful for debug, but can be verbose so only enable if strictly needed. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
9a5d380 soundwire: intel: fix factor of two in MCLK handling Somehow Intel folks were confused, the property is 2x what the mclk frequency actually is, as checked with the actual bus frequency. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
0f8a45a soundwire: intel: modify DMAT field for ALH The current value for this field is too low and results in some samples getting dropped and playback being faster than normal. Increase the value to a safer value. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
98eaa6a soundwire: bus: fix device number leak on errors If the programming of the dev_number fails due to an IO error, a new device_number will be assigned, resulting in a leak. Make sure we only assign a device_number once per Slave device. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
86180b8 soundwire: dynamic_allocation: set grp_ctrl_valid false Some Realtek codecs don't support grp_ctrl_valid. Set it to false to prevent DPN_BlockCtrl2 reg write failed. Signed-off-by: Bard Liao <bardliao@gmail.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
1468155 soundwire: Add generic bandwidth allocation algorithm This algorithm computes bus parameters like clock frequency, frame shape and port transport parameters based on active stream(s) running on the bus. Developers can also implement their own .compute_params() callback for specific resource management algorithm, and set if before calling sdw_add_bus_master() Credits: this patch is based on an earlier internal contribution by Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah. All hard-coded values were removed from the initial contribution to use BIOS information instead. FIXME: remove checkpatch report WARNING: Reusing the krealloc arg is almost always a bug + group->rates = krealloc(group->rates, Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
edd7d44 soundwire: cadence_master: handle multiple status reports per Slave When a Slave reports multiple status in the sticky bits, find the latest configuration from the mirror of the PING frame status and update the status directly. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:16:25 UTC
c7d1f2c ALSA: HDA: intel-dsp-config: add DMI info for Dell laptop The laptop doesn't use DMIC, but use SOF. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 09 January 2020, 18:16:25 UTC
aa85a69 ASoC: SOF: select machine driver with sdw adr. Matching machine driver with _ADR information allow us to select different machine driver with the same link_mask. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:12:13 UTC
14fe59b Soundwire: intel_init: add sdw adr info to sdw_intel_ctx So we can match machine driver with sdw _ADR information. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:08:25 UTC
40faefd soundwire: intel: add delay between hardware states in transition There are a few intermediate states in the transition of control between master and glue hw. According to spec, a tiny delay should be inserted to make sure each intermediate state is achieved. After many tests, we found 10 ~ 15us was feasible. Tested on Comet Lake. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:08:18 UTC
cb00432 soundwire: cadence_master: clear interrupt status before enabling interrupt make sure all interrupts status are cleared before enabling interrupt so that there is no unexpected interrupt triggered. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 09 January 2020, 18:07:56 UTC
a3a9047 ASoC: Intel: add SoundWire _ADR for machine matching Now, we can add SoundWire _ADR to struct snd_soc_acpi_mach{} to match the machine in more specific ways, e.g. to account for the fact that some CML devices have stereo or mono speaker amplifiers. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 09 January 2020, 15:56:49 UTC
487e4b1 soundwire: intel: add traces to track clock restart mode Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:32 UTC
a823e38 soundwire: intel: don't program Sync registers in clock stop mode This leads to a "Failed to set sync period" error log, but the values don't need to be reprogrammed. FIXME: is this the right fix? Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:32 UTC
8a144cb soundwire: cadence: disable exit_clock_stop when doing a bus_reset This function is broken due to race conditions and bad ideas... When a bus reset occurs, the clock stop is no longer prepared. FIXME: the clock stop mode1 needs to wait for the device to re-enumerate. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:32 UTC
a660bbe soundwire: cadence_master: filter out bad interrupts If somehow we read the interrupt status while the IP is not powered the result is probably undefined or 0xffffffff. We do know that some of the bits are reserved and read as zero, so use as a filter to discard invalid configurations. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:32 UTC
a348a09 soundwire: intel: refine runtime pm for SDW_INTEL_CLK_STOP_BUS_RESET When all the links are suspended, the HDaudio controller may suspend and the power rails to the SoundWire IP may be disabled, requiring a complete re-initialization/enumeration on resume. However, if one or more Masters remained active, the HDaudio controller will remain active and the power rails will remain enabled. As a result, during the link resume step we can check if the context was preserved by verifying if the clock was stopped, and avoid doing a complete bus reset and re-enumeration. Signed-off-by: Rander Wang <rander.wang@intel.com> 08 January 2020, 17:27:31 UTC
28f7dc8 soundwire: test is_slave before list_for_each_entry(slave, &bus->slaves, node) We don't need to test each slave's status if we already know there is no slave attached. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 08 January 2020, 17:27:31 UTC
79f6806 Soundwire: set is_slave only if the slave is attached We don't need to do anything for the slave if it is unattached. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 08 January 2020, 17:27:31 UTC
689655c Soundwire: bus: return in the while loop rather than break and return So we don't need extra if condition outside the while loop. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 08 January 2020, 17:27:31 UTC
b01de1d soundwire: cadence_master: enter clock stop if there are no Slaves present If there aren't any Slaves present (ATTACHED or ALERT status), we can safely infore CMD_IGNORED/-ENODATA error codes. The Cadence IP is configured to handle such cases as success. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
d47836a soundwire: intel_init: add support for clock_stop quirks Just pass the information provided by the parent (SOF driver) Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
bbe5d7d soundwire: cadence_master: log more useful information during timeouts Add the type of command, device number, register offset and length to reverse engineer what caused the issue. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
369b75b soundwire: cadence_master: fix usage of CMD_ACCEPT cdns_updatel() applies its parameter assuming it's already shifted by the correct amount. Using '1' instead of BIT(1) is incorrect, fix. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
7bee702 soundwire: bus: treat CMD_IGNORED as success on ClockStop If there are no Slaves in ATTACHED or ALERT mode, the CMD_IGNORED/-ENODATA error code is perfectly legit. Filter this case to report errors and let the caller deal with the CMD_IGNORED case. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
dc1f6df soundwire: intel: Fix a io timeout issue if SDW_INTEL_CLK_STOP_BUS_RESET is set If two masters are working and one of them become suspended and activated again, this master will be failed to resumed in SDW_INTEL_CLK_STOP_BUS_RESET mode. The reason is: on intel platform, there are four masters in the same power domain. If one master is active, all other masters are always powered on. Each master will be set to clock stop when it is inactive. And in resume function each master will be initialized because it asummes it is powered off. But if the master is not powered off, it should be in clock stop state, and the normal initialization will be failed in this state. Now check clock status and don't initialize master if it is in clock stop mode. Signed-off-by: Rander Wang <rander.wang@intel.com> 08 January 2020, 17:27:31 UTC
d9606e1 soundwire: cadence_master: add interface to check clock status If master is in clock stop state, driver can't modify registers in master except the registers for clock stop setting. Signed-off-by: Rander Wang <rander.wang@intel.com> 08 January 2020, 17:27:31 UTC
64c319a soundwire: intel: support clock_stop mode without quirks In this mode, on restart the bus restarts immediately, the Slaves remain synchronized and all context is kept intact. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:31 UTC
8974dab soundwire: intel_init: handle power rail dependencies for clock stop mode When none of the clock stop quirks is specified, the Master IP will assume the context is preserved and will not reset the Bus and restart enumeration. Due to power rail dependencies, the HDaudio controller needs to remain powered and prevented from executing its pm_runtime suspend routine. This choice of course has a power impact, and this mode should only be selected when latency requirements are critical or the parent device can enter D0ix modes. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
29b877c soundwire: intel: add wake interrupt support When system is suspended in clock stop mode on intel platforms, both master and slave are in clock stop mode and soundwire bus is taken over by a glue hardware. The bus message for jack event is processed by this glue hardware, which will trigger an interrupt to resume audio pci device. Then audio pci driver will resume soundwire master and slave, transfer bus ownership to master, finally slave will report jack event to master and codec driver is triggered to check jack status. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
44c2d11 soundwire: intel: add interface to process wake events Add driver interface to process external wake events processed by the PCI subsystem. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
78db255 soundwire: intel: add CLK_STOP_NOT_ALLOWED support In case the clock needs to keep running, we need to prevent the Master from entering pm_runtime suspend. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
3a5bc97 soundwire: intel: add CLK_STOP_BUS_RESET support Move existing pm_runtime suspend under the CLK_STOP_TEARDOWN case. In this mode the Master IP will lose all context but in-band wakes are supported. On pm_runtime resume a complete re-enumeration will be performed after a bus reset. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
b23943f soundwire: cadence_master: add clock_stop/restart routines Add support for clock stop and restart, with two configuration parameters: 1) when entering the ClockStop mode, Slave-initiated wakes can be prevented. 2) When exiting the ClockStop mode, the caller can request a Bus Reset (either if all Slaves were configured in ClockStopMode1 or the Master IP lost context and enumeration is required) Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
c46a5d6 soundwire: cadence_master: simplifiy cdns_init() There is no need for the clock_stop_exit argument with the latest implementation Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
58ff3a7 soundwire: bus: add clock stop helpers SoundWire supports two clock stop modes. Add support to handle the clock stop modes and add pm_runtime calls in the bus. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
6f73ad9 soundwire: intel: add CLK_STOP_TEARDOWN for pm_runtime suspend Now that we have options, add support for TEARDOWN mode (same functionality as existing code) All other modes will be added in follow-up patches. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
118918c soundwire: intel: add mutex to prevent concurrent access to SHIM registers Some of the SHIM registers exposed fields that are link specific, and in addition some of the power-related registers (SPA/CPA) take time to be updated. Uncontrolled access leads to timeouts or errors. Add a mutex at the controller level, shared by all links, so that all accesses to such registers are serialized, and follow a pattern of read-modify-write. GitHub issue: https://github.com/thesofproject/linux/issues/1555 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
bc3b762 soundwire: cadence_master: remove config update for interrupt setting Config only needs to be updated when setting MCP_Config, MCP_Control and MCP_CmdCtrl to make these register setting effective. When updating config in master, master will communicate with slave to update status. Communication will be failed when masters and slaves are in clock stop state, and this unnecessary config update makes interrupt setting failed. Tested on Comet Lake with soundwire enabled Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:30 UTC
473e81e pm: add more traces Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
56e0426 [HACK] add traces to debug aplay suspend/resume issue Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> 08 January 2020, 17:27:29 UTC
a5e86e1 soundwire: intel: pm_runtime idle scheduling Add quirk and pm_runtime idle scheduling to let the Master suspend if no Slaves become attached. This can happen when a link is not marked as disabled and has devices exposed in the DSDT, if the power is controlled by sideband means or the link includes a pluggable connector. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
5227c4d soundwire: intel: reinitialize IP+DSP in .prepare(), but only when resuming The .prepare() callback is invoked for normal streaming, underflows or during the system resume transition. In the latter case, the context for the ALH PDIs is lost, and the DSP is not initialized properly either, but the bus parameters don't need to be recomputed. Conversely, when doing a regular .prepare() during an underflow, the ALH/SHIM registers shall not be changed as the hardware cannot be reprogrammed after the DMA started (hardware spec requirement). This patch adds storage of PDI and hw_params in the DAI dma context, and the difference between the types of .prepare() usages is handled via a simple boolean, updated when suspending, and tested for in the .prepare() case. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
a5a0e4d soundwire: bus: disable pm_runtime in sdw_slave_delete Before removing the slave device, disable pm_runtime to prevent any race condition with the resume being executed after the bus and slave devices are removed. Since this pm_runtime_disable() is handled in common routines, implementations of Slave drivers do not need to call it in their .remove() routine. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
e5a7eb0 soundwire: intel: disable pm_runtime when removing a master Prevent race conditions between remove and resume by disabling pm_runtime. Note that this only takes care of pm_runtime at the Master level, the same precautions are needed when removing a Slave device. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
6edda30 soundwire: bus: fix race condition by tracking UNATTACHED transition In previous patches, we added enumeration_ and initialization_complete fields to avoid race conditions. When streaming restarts, the Master first resumes, then requests all Slaves to renumerate/reinitialized, and then the Slave devices resume. Intel validation exposed a corner case where the Slave device may transition to D3 when streaming stops, but streaming restarts before the Master transitions to D3. In that case, the Slave status was not cleared as UNATTACHED, and the wait_for_completion will time out. The proposed solution is that when the Master clears the Slave(s) status, the reason for the Slave(s) becoming unattached is memorized. When the slave resumes, it can check if a Master-initiated re-enumeration and initialization takes place and skip the wait_for_completion() if there is no reason to wait. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
53e3e05 soundwire: bus: fix race condition with initialization_complete signaling Waiting for the enumeration to be complete may not be enough for a Slave driver, there is a possible race condition between resume operations and initializations handled in an interrupt thread, which can results in settings not being fully restored after system or pm_runtime resume. This patch builds on the changes added for enumeration_complete, init_completion() is called when the Slave device becomes UNATTACHED, as done with enumeration_complete. The difference with the enumeration_complete case is that complete() is signaled after the Slave device is fully initialized after the .update_status() callback is called. A Slave device driver can decide to wait on either of the two complete() cases, depending on its initialization code and requirements. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
70263db soundwire: bus: fix race condition with enumeration_complete signaling This patch adds the signaling needed for Slave drivers to wait until the enumeration completes so that race conditions when issuing read/write commands are avoided. The calls for wait_for_completion() will be added in codec drivers in follow-up patches. The order between init_completion() and complete() is deterministic, the Slave is marked as UNATTACHED either during a Master-initiated HardReset, or when the hardware detects the Slave no longer reports as ATTACHED. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
56e6000 soundwire: bus: check first if Slaves become UNATTACHED Before checking for the presence of Device0, we first need to clean-up the internal state of Slaves that are no longer attached. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
afd2851 soundwire: intel: call helper to reset Slave states on resume This helps make sure they are all UNATTACHED and reset the state machines. At the moment we perform a bus reset both for resume and pm_resume, this will be modified when clock-stop mode is supported Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:29 UTC
cd30960 soundwire: bus: add helper to reset Slave status to UNATTACHED When resuming, we need to re-enumerate and restart from UNATTACHED. This will help implement a more robust state machine avoiding race conditions on resume. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
658ebae soundwire: intel: fix race condition on system resume Previous patches took care of the case where the master device is pm_runtime 'suspended' when a system suspend occurs. In the case where the master device was not suspended, e.g. if suspend occurred while streaming audio, Intel validation noticed a race condition the enumeration started by the system resume may race with pm_runtime suspend. This can be simply fixed by updating the status before exiting system resume. GitHub issue: https://github.com/thesofproject/linux/issues/1482 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
8eb64ac soundwire: intel: reset pm_runtime status during system resume The system resume does the entire bus re-initialization and brings it to full-power. If the device was pm_runtime suspended, there is no need to run the pm_runtime resume sequence after the system runtime. Follow the documentation from runtime_pm.rst, and conditionally disable, set_active and re-enable the device on system resume. Note that pm_runtime_suspended() is used instead of pm_runtime_status_suspended() so that we can deal with the case where pm_runtime is disabled. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
4222f1e soundwire: intel: add pm_runtime support Add basic hooks in DAI .startup and .shutdown callbacks. The SoundWire IP should be powered between those two calls. The power dependencies between SoundWire and DSP are handled with the parent/child relationship, before the SoundWire master device becomes active the parent device will become active and power-up the shared rails. For now the strategy is to rely on complete enumeration when the device becomes active, so the code is a copy/paste of the sequence for system suspend/resume. In future patches, the strategy will optionally be to rely on clock stop if the enumeration time is prohibitive or when the devices connected to a link can signal a wake. A module parameter is added to make integration of new Slave devices easier, to e.g. keep the device active or prevent clock-stop. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
34a19e8 soundwire: intel: Add basic power management support Implement suspend/resume capabilities (not runtime_pm for now) The resume part is essentially a full-blown re-enumeration. When S0ix is supported, we will select clock stop mode when the ACPI target state is S0, and tear down the link for S3. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
1d7de96 soundwire: intel: add helpers for link power down and shim wake These routines are required for power management Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
131273e soundwire: bus: write Slave Device Number without runtime_pm While handling the Device0, we can safely use sdw_write_no_pm. This move will also helps us track that all other usages of sdw_write() happen when the Slave is already enumerated. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
cbbae86 soundwire: bus: add PM/no-PM versions of read/write functions Add support for pm_runtime with the appropriate error checks for sdw_write/read functions, e.g. when pm_runtime is not supported. Also expose internal functions without pm_runtime support, which are required to perform any sort of suspend/resume operation, as well as any enumeration tasks. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
663e4b3 soundwire: bus: fix race condition with probe_complete signaling The driver probe takes care of basic initialization and is invoked when a Slave becomes attached, after a match between the Slave DevID registers and ACPI/DT entries. The update_status callback is invoked when a Slave state changes, e.g. when it is assigned a non-zero Device Number and it reports with an ATTACHED/ALERT state. The state change detection is usually hardware-based and based on the SoundWire frame rate (e.g. double-digit microseconds) while the probe is a pure software operation, which may involve a kernel module load. In corner cases, it's possible that the state changes before the probe completes. This patch suggests the use of wait_for_completion to avoid races on startup, so that the update_status callback does not rely on invalid pointers/data structures. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
96ccc29 soundwire: intel/cadence: merge Soundwire interrupt handlers/threads The existing code uses one pair of interrupt handler/thread per link but at the hardware level the interrupt is shared. This works fine for legacy PCI interrupts, but leads to timeouts in MSI (Message-Signaled Interrupt) mode, likely due to edges being lost. This patch unifies interrupt handling for all links. The dedicated handler is removed since we use a common one for all shared interrupt sources, and the thread function takes care of dealing with interrupt sources. This partition follows the model used for the SOF IPC on HDaudio platforms, where similar timeout issues were noticed and doing all the interrupt handling/clearing in the thread improved reliability/stability. Validation results with 4 links active in parallel show a night-and-day improvement with no timeouts noticed even during stress tests. Latency and quality of service are not affected by the change - mostly because events on a SoundWire link are throttled by the bus frame rate (typically 8..48kHz). Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
98905b8 soundwire: intel: use EXPORT_SYMBOL_NS The soundwire-intel module exports an 'intel_sdw_driver' structure, which is declared with a namespace explicitly imported by the soundwire-intel-init module. The use of namespaces might be deemed overkill here, but it did help enforce a proper code partitioning for follow-up patches on clock-stop support. Suggested-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
29be0fb soundwire: intel_init: use EXPORT_SYMBOL_NS Make sure all symbols in this soundwire-intel-init module are exported with a namespace. The MODULE_IMPORT_NS will be used in Intel/SOF HDaudio modules to be posted in a separate series. Namespaces are only introduced for the Intel parts of the SoundWire code at this time, in future patches we should also add namespaces for Cadence parts and the SoundWire core. Suggested-by: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:28 UTC
a923434 soundwire: intel_init: add implementation of sdw_intel_enable_irq() This function is required to enable all interrupts across all links. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
0a91336 soundwire: intel: free all resources on hw_free() Make sure all calls to the SoundWire stream API are done and involve callback Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
807e97b soundwire: intel: add sdw_stream_setup helper for .startup callback The sdw stream is allocated and stored in dai to share the sdw runtime information. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
f8c96ca soundwire: intel: add trigger support in sdw dai driver The existing code does not expose a trigger callback, which is very much required for streaming. The SoundWire stream is enabled and disabled in trigger function. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
afac897 soundwire: intel: add prepare support in sdw dai driver The existing code does not expose a prepare operation, which is very much needed to deal with underflow and resume operations. Signed-off-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
6692e49 soundwire: register master device driver While we don't have a matching function, setting an device driver is still necessary for ASoC to register DAI components as well as power management. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
73e79a2 soundwire: intel: remove platform devices and use 'Master Devices' instead Use sdw_master_device and driver instead of platform devices To quote GregKH: "Don't mess with a platform device unless you really have no other possible choice. And even then, don't do it and try to do something else. Platform devices are really abused, don't perpetuate it " In addition, rather than a plain-vanilla init/exit, this patch provides 3 steps in the initialization (ACPI scan, probe, startup) which makes it easier to verify hardware support for SoundWire, allocate required resources as early as possible, and conversely help make the startup() callback lighter-weight with only hardware register setup. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
7c7a818 soundwire: add initial definitions for sdw_master_device Since we want an explicit support for the SoundWire Master device, add the definitions, following the Greybus example of a 'Host Device'. A parent (such as the Intel audio controller) would use sdw_md_add() to create the device, passing a driver as a parameter. The sdw_md_release() would be called when put_device() is invoked by the parent. We use the shortcut 'md' for 'master device' to avoid very long function names. The 'Master Device' driver exposes interfaces for probe/startup/shutdown/remove and a placeholder for autonomous clock stop support (when the bus control is handed over to a lower-power solution, typically in D0ix modes). Module namespace support is added in a separate patch. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
23bd428 soundwire: slave: move uevent handling to slave device level Currently the .uevent callback is set at the bus level. This is not necessary, we only really need to deal with uevents for the Slave device, so move the uevent handling at that level. Suggested-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
193a78b soundwire: add support for sdw_slave_type In the existing SoundWire code, the bus does not have any explicit representation for Master Devices - only SoundWire Slaves are exposed. In SoundWire, the Master Device provides the clock, synchronization information and command/control channels. When multiple links are supported, a Controller may expose more than one Master Device; they are typically embedded inside a larger audio cluster (be it in an SOC/chipset or an external audio codec), and we need to describe it using the Linux device and driver model. This will allow for configuration functions to account for external dependencies such as power rails, clock sources or wake-up mechanisms. This transition will also allow for better sysfs support without the reference count issues mentioned in the initial reviews. In this patch, we first convert the existing code to use an explicit sdw_slave_type and add error checks if this type is not set. In follow-up patches we can add support for the sdw_master_type. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
4c50a13 soundwire: intel: rename res field as link_res There are too many fields called 'res' so add prefix to make it easier to track what the structures are. Pure rename, no functionality change Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
a3ea616 soundwire: bus_type: rename sdw_drv_ to sdw_slave_drv Before we add master driver support, make sure there is no ambiguity and no occurrences of sdw_drv_ functions. No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:27 UTC
9f3ca44 soundwire: rename drv_to_sdw_slave_driver macro Align with previous renames and shorten macro No functionality change Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:26 UTC
eb68092 soundwire: rename dev_to_sdw_dev macro Since we want to introduce master devices, rename macro so that we have consistency between slave and master device access. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:26 UTC
a8bf47a soundwire: renames to prepare support for master drivers/devices Add clearer references to sdw_slave_driver for internal macros No change for sdw_driver and module_sdw_driver to avoid compatibility issues with existing codec devices No functionality change. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:26 UTC
0d9e044 soundwire: stream: don't program ports when a stream that has not been prepared In the Intel QA multi-pipelines test case, there are two pipelines for playback and capture on the same bus. The test fails with an error when setting port params: [ 599.224812] rt711 sdw:0:25d:711:0: invalid dpn_prop direction 1 port_num 0 [ 599.224815] sdw_program_slave_port_params failed -22 [ 599.224819] intel-sdw sdw-master-0: Program transport params failed: -22 [ 599.224822] intel-sdw sdw-master-0: Program params failed: -22 [ 599.224828] sdw_enable_stream: SDW0 Pin2-Playback: done This problem is root-caused to the programming of the capture stream ports while it is not yet prepared, the calling sequence is: (1) hw_params for playback. The playback stream provide the port information to Bus. (2) stream_prepare for playback, Transport and port parameters are computed for playback. (3) hw_params for capture. The capture stream provide the port information to Bus, but it has not been prepared so is not accounted for in the bandwidth allocation. (4) stream_enable for playback. Program transport and port parameters for all masters and slaves. Since the transport and port parameters are not computed for capture stream, sdw_program_slave_port_params will generate a error when setting port params for capture. in step (4), we should only program the ports for the stream that have been prepared. A stream that is only in CONFIGURED state should be ignored, its ports will be programmed when it becomes PREPARED. Tested on Comet Lake. GitHub issue: https://github.com/thesofproject/linux/issues/1637 Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 08 January 2020, 17:27:26 UTC
039d73b soundwire: stream: fix support for multiple Slaves on the same link The existing code will unconditionally return after dealing with the first Slave on a link. This return should only happen when there is an error case. Tested on Comet Lake platform. Signed-off-by: Rander Wang <rander.wang@intel.com> 08 January 2020, 17:27:26 UTC
back to top