linux-stable/sound/soc/qcom
Stephan Gerhold 4ff028f6c1
ASoC: qcom: lpass-cpu: Make I2S SD lines configurable
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: Stephan Gerhold <stephan@gerhold.net>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200425184657.121991-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-05 13:17:23 +01:00
..
qdsp6 ASoC: qcom: q6sp6: use snd_compress_ops 2020-04-21 19:01:57 +01:00
apq8016_sbc.c ASoC: qcom: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer 2020-03-27 14:44:44 +00:00
apq8096.c ASoC: qcom: common: Silence duplicate parse error messages 2020-04-14 15:45:27 +01:00
common.c ASoC: qcom: common: Include link-name in error messages 2019-09-05 18:15:39 +01:00
common.h ASoC: qcom: remove unused header files from common.h 2018-08-06 12:50:07 +01:00
Kconfig ASoC: qcom: sdm845: handle soundwire stream 2020-03-18 21:25:53 +00:00
lpass-apq8016.c ASoC: qcom: Use the defined variable to simplify code 2020-05-04 16:23:25 +01:00
lpass-cpu.c ASoC: qcom: lpass-cpu: Make I2S SD lines configurable 2020-05-05 13:17:23 +01:00
lpass-ipq806x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
lpass-lpaif-reg.h ASoC: qcom: lpass-cpu: Make I2S SD lines configurable 2020-05-05 13:17:23 +01:00
lpass-platform.c ASoC: qcom: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer 2020-03-27 14:44:44 +00:00
lpass.h ASoC: qcom: lpass-cpu: Make I2S SD lines configurable 2020-05-05 13:17:23 +01:00
Makefile ASoC: qcom: make common.c as proper module 2018-08-06 12:50:04 +01:00
sdm845.c ASoC: qcom: common: Silence duplicate parse error messages 2020-04-14 15:45:27 +01:00
storm.c ASoC: qcom: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer 2020-03-27 14:44:44 +00:00