Unverified Commit 7b0cd83c authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: sun50i-codec-analog: Internal bias support

Merge series from Samuel Holland <samuel@sholland.org>:

This series adds support for enabling the codec's internal microphone
bias, which is needed on at least some versions of the PinePhone.

Changes in v2:
 - Move register update from component probe to device probe

Arnaud Ferraris (2):
  ASoC: dt-bindings: sun50i-codec: Add binding for internal bias
  ASoC: sun50i-codec-analog: Add support for internal bias

Samuel Holland (1):
  arm64: dts: allwinner: pinephone: Enable internal HMIC bias

 .../bindings/sound/allwinner,sun50i-a64-codec-analog.yaml | 5 +++++
 .../arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.0.dts | 4 ++++
 .../arm64/boot/dts/allwinner/sun50i-a64-pinephone-1.1.dts | 4 ++++
 sound/soc/sunxi/sun50i-codec-analog.c                     | 8 ++++++++
 4 files changed, 21 insertions(+)

--
2.35.1
parents ccb0bbe3 25ae1a04
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -21,6 +21,11 @@ properties:
    description:
      Regulator for the headphone amplifier

  allwinner,internal-bias-resistor:
    description:
      Enable the internal 2.2K bias resistor between HBIAS and MICDET pins
    type: boolean

required:
  - compatible
  - reg
+8 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@
#define SUN50I_ADDA_HS_MBIAS_CTRL_MMICBIASEN	7

#define SUN50I_ADDA_JACK_MIC_CTRL	0x1d
#define SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN	6
#define SUN50I_ADDA_JACK_MIC_CTRL_HMICBIASEN	5

/* mixer controls */
@@ -507,6 +508,7 @@ static int sun50i_codec_analog_probe(struct platform_device *pdev)
{
	struct regmap *regmap;
	void __iomem *base;
	bool enable;

	base = devm_platform_ioremap_resource(pdev, 0);
	if (IS_ERR(base)) {
@@ -520,6 +522,12 @@ static int sun50i_codec_analog_probe(struct platform_device *pdev)
		return PTR_ERR(regmap);
	}

	enable = device_property_read_bool(&pdev->dev,
					   "allwinner,internal-bias-resistor");
	regmap_update_bits(regmap, SUN50I_ADDA_JACK_MIC_CTRL,
			   BIT(SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN),
			   enable << SUN50I_ADDA_JACK_MIC_CTRL_INNERRESEN);

	return devm_snd_soc_register_component(&pdev->dev,
					       &sun50i_codec_analog_cmpnt_drv,
					       NULL, 0);