• Stephan Gerhold's avatar
    ASoC: qcom: lpass-cpu: Make I2S SD lines configurable · 4ff028f6
    Stephan Gerhold authored
    The LPASS hardware allows configuring the MI2S SD lines to use
    when playing/recording audio. However, at the moment the lpass-cpu
    driver has SD0 hard-coded for mono/stereo (or additional fixed
    SD lines for more channels).
    
    For weird reasons there seems to be hardware that uses one of the
    other SD lines for mono/stereo. For example, some Samsung devices
    use an external Speaker amplifier connected to Quaternary MI2S.
    For some reason, the SD line for audio playback was connected to
    SD1 rather than SD0. (I have no idea why...)
    At the moment, the lpass-cpu driver cannot be configured to work
    for the Speaker on these devices.
    
    The q6afe driver already allows configuring the MI2S SD lines
    through the "qcom,sd-lines" device tree property, but this works
    only when routing audio through the ADSP.
    
    This commit adds a very similar configuration for the lpass-cpu driver.
    It is now possible to add additional subnodes to the lpass device in
    the device tree, to configure the SD lines for playback and/or capture.
    E.g. for the Samsung devices mentioned above:
    
    &lpass {
    	dai@3 {
    		reg = <MI2S_QUATERNARY>;
    		qcom,playback-sd-lines = <1>;
    	};
    };
    
    qcom,playback/capture-sd-lines takes a list of SD lines (0-3)
    in the same format as the q6afe driver. (The difference here is that
    q6afe has separate DAIs for playback/capture, while lpass-cpu has one
    for both...)
    
    For backwards compatibility with older device trees, the lpass-cpu driver
    defaults to LPAIF_I2SCTL_MODE_8CH if the subnode for a DAI is missing.
    This is equivalent to the previous behavior: Up to 8 channels can be
    configured, and SD0/QUAT01 will be chosen when setting up a stream
    with fewer channels.
    
    This allows the speaker to work on Samsung MSM8916 devices
    that use an external speaker amplifier.
    Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
    Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
    Link: https://lore.kernel.org/r/20200425184657.121991-2-stephan@gerhold.netSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    4ff028f6
lpass-lpaif-reg.h 6.81 KB