• Rander Wang's avatar
    soundwire: stream: don't program ports when a stream that has not been prepared · bfaa3549
    Rander Wang authored
    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/1637Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Signed-off-by: default avatarRander Wang <rander.wang@intel.com>
    Link: https://lore.kernel.org/r/20200114235227.14502-6-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    bfaa3549
stream.c 43.5 KB