10 Sep, 2020

1 commit

  • Add a slave-level property and program the SCP_INT1_MASK as desired by
    the codec driver. Since there is no DisCo property this has to be an
    implementation-specific firmware property or hard-coded in the driver.

    The only functionality change is that implementation-defined
    interrupts are no longer set for amplifiers - those interrupts are
    typically for jack detection or acoustic event detection/hotwording.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Tested-by: Srinivas Kandagatla
    Reviewed-by: Kai Vehmanen
    Reviewed-by: Guennadi Liakhovetski
    Acked-by: Mark Brown
    Link: https://lore.kernel.org/r/20200908134521.6781-2-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     

09 Sep, 2020

2 commits

  • Fix slimbus case being broken thanks to a typo.

    Fixes: 5bd773242f75 ("soundwire: qcom: avoid dependency on CONFIG_SLIMBUS")
    Signed-off-by: Jonathan Marek
    Reviewed-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200908140818.28373-1-jonathan@marek.ca
    Signed-off-by: Vinod Koul

    Jonathan Marek
     
  • In system suspend stress cases, the SOF CI reports timeouts. The root
    cause is that an alert is generated while the system suspends. The
    interrupt handling generates transactions on the bus that will never
    be handled because the interrupts are disabled in parallel.

    As a result, the transaction never completes and times out on resume.
    This error doesn't seem too problematic since it happens in a work
    queue, and the system recovers without issues.

    Nevertheless, this race condition should not happen. When doing a
    system suspend, or when disabling interrupts, we should make sure the
    current transaction can complete, and prevent new work from being
    queued.

    BugLink: https://github.com/thesofproject/linux/issues/2344
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Rander Wang
    Signed-off-by: Bard Liao
    Acked-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20200817222340.18042-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     

07 Sep, 2020

4 commits


04 Sep, 2020

11 commits

  • Now that the stream is handled at the dai-link level (in the machine
    driver), we can remove the stream handling at the dai level. We still
    need these callbacks to perform dai-level resource handling
    (i.e. addition/removal of a master).

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903204739.31206-5-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • Now that the stream trigger is handled at the dai-link level, there is
    no need for a dai-level trigger any longer.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903204739.31206-4-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • snd_soc_dai_get_sdw_stream() can only return the pointer to stream or
    an ERR_PTR value, NULL is not a possible value.

    Fixes: 09553140c8d7b ('soundwire: intel: implement get_sdw_stream() operations')
    Reported-by: Bard Liao
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Rander Wang
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903204739.31206-3-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • snd_soc_dai_get_sdw_stream() can only return -ENOTSUPP or the stream,
    NULL is not a possible value.

    Fixes: 4550569bd779f ('soundwire: stream: add helper to startup/shutdown streams')
    Reported-by: Bard Liao
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Rander Wang
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903204739.31206-2-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • use FIELD_{GET|PREP} in intel_init driver to get/set field values
    instead of open coding masks and shift operations.

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-9-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use FIELD_{GET|PREP} in intel driver to get/set field values instead of
    open coding masks and shift operations.

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-8-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use FIELD_{GET|PREP} in cadence driver to get/set field values instead
    of open coding masks and shift operations.

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-7-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use FIELD_{GET|PREP} in qcom driver to get/set field values instead of
    open coding masks and shift operations.
    Also, remove now unused register shift defines

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-6-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use FIELD_{GET|PREP} in stream code to get/set field values instead of
    open coding masks and shift operations.

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-5-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use SDW_DISCO_LINK_ID() in slave code to extract field values instead of
    open coding masks and shift operations to extract link_id

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-4-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • use FIELD_GET() in bus code to extract field values instead of open
    coding masks and shift operations.

    Signed-off-by: Vinod Koul
    Tested-by: Bard Liao
    Link: https://lore.kernel.org/r/20200903114504.1202143-3-vkoul@kernel.org
    Signed-off-by: Vinod Koul

    Vinod Koul
     

03 Sep, 2020

10 commits

  • Each link has separate power controls, but experimental results show
    we need to use an all-or-none approach to the link power management.

    This change has marginal power impacts, the DSP needs to be powered
    anyways before SoundWire links can be powered, and even when powered a
    link can be in clock-stopped mode.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-11-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • While the hardware exposes independent bits to power-up each master,
    the recommended sequence is to power all links or none. Idle links can
    still use the clock stop mode while the master is powered.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-10-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • Detect cases where the clock is assumed to be stopped but the IP is
    not in the relevant state. There is no real way to recover here, but
    adding an error log can help detect bad programming sequences or race
    conditions.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-9-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • Use platform-specific information to decide when to use hw_sync, not
    only a number of links > 1.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-8-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • set the flags as required by hardware implementation

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-7-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • Deal with the BUS_RESET case, which is the default. The only change is
    to add support for the exit sequence using the syncArm/syncGo mode for
    the exit reset sequence.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-5-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • The multi-link support is enabled with a hardware gsync signal
    connecting all links. All commands and operations which typically are
    handled on an SSP boundary will be deferred further and enabled across
    all links with the 'syncGo' sequence.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-4-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • with multiple links synchronized in hardware, retrying commands in
    software is not recommended.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-3-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • If we enabled the clock stop mode and suspend, we need to disable the
    shim wake. We do so only if the parent is pm_runtime active due to
    power rail dependencies.

    GitHub issue: https://github.com/thesofproject/linux/issues/1678
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200901150556.19432-2-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • The existing code allocates memory for the total number of ports.
    This only works if the ports are contiguous, but will break if e.g. a
    Devices uses port0, 1, and 14. The port_ready[] array would contain 3
    elements, which would lead to an out-of-bounds access. Conversely in
    other cases, the wrong port index would be used leading to timeouts on
    prepare.

    This can be fixed by allocating for the worst-case of 15
    ports (DP0..DP14). In addition since the number is now fixed, we can
    use an array instead of a dynamic allocation.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Reviewed-by: Rander Wang
    Reviewed-by: Guennadi Liakhovetski
    Link: https://lore.kernel.org/r/20200831134318.11443-4-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     

26 Aug, 2020

1 commit

  • When CONFIG_PM_SLEEP is not defined, GCC throws compilation warnings:

    drivers/soundwire/intel.c:1799:12: warning: ‘intel_resume’ defined but not
    used [-Wunused-function]
    static int intel_resume(struct device *dev)
    ^~~~~~~~~~~~
    drivers/soundwire/intel.c:1683:12: warning: ‘intel_suspend’ defined but not
    used [-Wunused-function]
    static int intel_suspend(struct device *dev)
    ^~~~~~~~~~~~~

    Fix by using __maybe_unused macro.

    Suggested-by: Vinod Koul
    Signed-off-by: Bard Liao
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200824133234.28115-1-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Bard Liao
     

18 Aug, 2020

11 commits

  • 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
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-13-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Rander Wang
     
  • In this mode, on restart the bus restarts immediately, the Slaves
    remain synchronized and all context is kept intact.

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Rander Wang
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-12-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-11-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-10-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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
    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-9-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Rander Wang
     
  • 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
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-8-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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: Pierre-Louis Bossart
    Signed-off-by: Rander Wang
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-7-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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
    Signed-off-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200817152923.3259-6-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Bard Liao
     
  • This helps make sure they are all UNATTACHED and reset the state
    machines.

    At the moment we perform a bus reset both for system resume and
    pm_runtime resume, this will be modified when clock-stop mode is
    supported

    Signed-off-by: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-5-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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 pm_runtime suspend may conflict with the enumeration
    started by the system resume.

    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
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-4-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart
     
  • 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: Pierre-Louis Bossart
    Signed-off-by: Bard Liao
    Link: https://lore.kernel.org/r/20200817152923.3259-3-yung-chuan.liao@linux.intel.com
    Signed-off-by: Vinod Koul

    Pierre-Louis Bossart