History log of /linux-master/sound/soc/sunxi/sun50i-codec-analog.c
Revision Date Author Comments
# 340d79a1 06-Oct-2023 Rob Herring <robh@kernel.org>

ASoC: Explicitly include correct DT includes

The DT of_device.h and of_platform.h date back to the separate
of_platform_bus_type before it was merged into the regular platform bus.
As part of that merge prepping Arm DT support 13 years ago, they
"temporarily" include each other. They also include platform_device.h
and of.h. As a result, there's a pretty much random mix of those include
files used throughout the tree. In order to detangle these headers and
replace the implicit includes with struct declarations, users need to
explicitly include the correct includes.

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev> # for at91
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-1-13a4f0f7fee6@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 25ae1a04d 20-Jun-2022 Arnaud Ferraris <arnaud.ferraris@collabora.com>

ASoC: sun50i-codec-analog: Add support for internal bias

In order to properly bias headset microphones, there should be a pull-up
resistor between pins HBIAS and MIC2P. This can be an external resistor,
but the codec also provides an internal 2.2K resistor which is enabled
by a register.

This patch enables or disables the internal bias resistor based on a
device tree property.

Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
[Samuel: split binding and implementation; move to device probe]
Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20220621035452.60272-3-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7829e68d 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Enable DAPM for earpiece switch

By including the earpiece mute switch in the DAPM graph, both the
earpiece amplifier and the Mixer/DAC inputs can be powered off when
the earpiece is muted.

While the widget is really just a simple switch, it is represented
as a "mixer with named controls" to avoid including the widget name
in the kcontrol name. Otherwise, it is not possible to give the widget
an accurate, descriptive name without changing the kcontrol name
seen by userspace (which should be stable).

The mute switch is between the source selection and the amplifier,
as per the diagram in the SoC manual.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20200726025334.59931-9-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 95d34762 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Enable DAPM for line out switch

By including the line out mute switch in the DAPM graph, the
Mixer/DAC inputs can be powered off when the line output is muted.

The line outputs have an unusual routing scheme. The left side mute
switch is between the source selection and the amplifier, as usual.
The right side source selection comes *after* its amplifier (and
after the left side amplifier), and its mute switch controls
whichever source is currently selected. This matches the diagram in
the SoC manual.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-8-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# dd8286a3 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Make line out routes stereo

This matches the hardware more accurately, and is necessary for
including the (stereo) line out mute switch in the DAPM graph.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-7-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4b9f39e1 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Enable DAPM for headphone switch

By including the headphone mute switch to the DAPM graph, both the
headphone amplifier and the Mixer/DAC inputs can be powered off when
the headphones are muted.

The mute switch is between the source selection and the amplifier,
as per the diagram in the SoC manual.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-6-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 241a578a 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Make headphone routes stereo

This matches the hardware more accurately, and is necessary for
including the (stereo) headphone mute switch in the DAPM graph.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-5-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# cababecb 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Group and sort mixer routes

Sort the controls in the same order as the bits in the register. Then
group the routes by sink, and sort them in the same order as the
controls. This makes it much easier to verify that all mixer inputs are
accounted for.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-4-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9b7612bb 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Gate the amplifier clock during suspend

The clock must be running for the zero-crossing mute functionality.
However, it must be gated for VDD-SYS to be turned off during system
suspend. Disable it in the suspend callback, after everything has
already been muted, to avoid pops when muting/unmuting outputs.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-3-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# ad5b7f69 25-Jul-2020 Samuel Holland <samuel@sholland.org>

ASoC: sun50i-codec-analog: Fix duplicate use of ADC enable bits

The same enable bits are currently used for both the "Left/Right ADC"
and the "Left/Right ADC Mixer" widgets. This happens to work in practice
because the widgets are always enabled/disabled at the same time, but
each register bit should only be associated with a single widget.

To keep symmetry with the DAC widgets, keep the bits on the ADC widgets,
and remove them from the ADC Mixer widgets.

Fixes: 42371f327df0 ("ASoC: sunxi: Add new driver for Allwinner A64 codec's analog path controls")
Reported-by: Ondrej Jirman <megous@megous.com>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-2-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 54dd39e4 27-Jul-2019 YueHaibing <yuehaibing@huawei.com>

ASoC: sunxi: sun50i-codec-analog: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190727150738.54764-34-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1fe08602 03-Jul-2019 Luca Weiss <luca@z3ntu.xyz>

ASoC: sunxi: sun50i-codec-analog: Add earpiece

This adds the necessary registers and audio routes to play audio using
the Earpiece, that's supported on the A64.

Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20190703184814.27191-1-luca@z3ntu.xyz
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5fd812e6 13-Feb-2019 Chen-Yu Tsai <wens@csie.org>

ASoC: sunxi: sun50i-codec-analog: Rename hpvcc regulator supply to cpvdd

The A64 datasheet lists the supply rail for the headphone amp's charge
pump as "CPVDD". cpvdd-supply is the name of the property for this power
rail specified in the device tree bindings. "HPVCC" was the name used in
the A33 datasheet for the same function.

Rename the supply so it matches the datasheet, bindings, and the subject
from the original commit.

Fixes: ca0412a05756 ("ASoC: sunxi: sun50i-codec-analog: Add support for cpvdd regulator supply")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ca0412a0 22-Nov-2018 Chen-Yu Tsai <wens@csie.org>

ASoC: sunxi: sun50i-codec-analog: Add support for cpvdd regulator supply

On the Allwinner A64 SoCs, the audio codec has a built-in headphone
amplifier. This amplifier has a power supply separate from the rest of
the analog audio circuitry, labeled cpvdd.

This patch adds a DAPM widget for this supply, and ties it to the
headphone amp widget.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 42371f32 17-Oct-2018 Vasily Khoruzhick <anarsoul@gmail.com>

ASoC: sunxi: Add new driver for Allwinner A64 codec's analog path controls

The internal codec on A64 is split into 2 parts. The analog path controls
are routed through an embedded custom register bus accessed through
the PRCM block.

Add an ASoC component driver for it. This should be tied to the codec
audio card as an auxiliary device.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Mark Brown <broonie@kernel.org>