All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH RFC] arm64: dts: allwinner: a64: teres-i: Enable audio
@ 2019-02-11 11:12 Torsten Duwe
  2019-02-11 13:36   ` Harald Geyer
  0 siblings, 1 reply; 33+ messages in thread
From: Torsten Duwe @ 2019-02-11 11:12 UTC (permalink / raw)
  To: Harald Geyer
  Cc: Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland,
	devicetree, info, Mark Brown, ibu, linux-arm-kernel


> hpvcc-supply vs. cpvdd-supply:
> On the A64 manual the pin is called CPVDD and the binding documents
> requires a cpvdd-supply property. However in the actual driver and
> devicetrees so far hpvcc-supply is used. This is a very new binding,
> so we have the luxury to decide either way, I think. Any input from
> the devicetree maintainers would be appreciated.

I don't really have a strong opinion here, besides settling this ASAP,
to minimise confusion.

> debug console multiplexing:
> Olimex have a userspace script that controls gpio PL9 during boot,
> to select between HP and serial console. I guess this is not acceptable
> for mainline.

> The best solution I can see is to switch the HP jack from serial console
> to audio once the audio drivers load. With this people can still capture
> the bootlogs but everybody gets audio once the system is up and
> switching back to console output is as simple as unloading the audio
> drivers.

IMO it is really not the audio driver's business to mess with this switch.
You could argue as well that the serial driver should get a flag to claim
the HP jack, which would be similarily unjustified.

My solution is to confine this choice inside U-Boot:
in sun50i-a64-teres-i-u-boot.dtsi I put

/ {
        leds {
                compatible = "gpio-leds";
                /* Not really a LED, but the least intrusive workaround */
                audioconsole {
                        label = "teres-i:audio:console";
                        gpio = <&r_pio 0 9 GPIO_ACTIVE_LOW>; /* PL9 */
                        default-state = "on";
                };
        };
[...]

and place a "gpio set PL9;" somewhere in the bootcmd_* logic. Otherwise there's
a *lot* of chirping on the right ear during boot ;-)
The switch is for early boot debugging, so it's best to have U-Boot enable it
when required, and keep it off by default.

> Testing:
> I don't have a headset with combo connector, so I could only test the
> headphones output, but not the headset mic. If somebody happens to
> have a TERES-I and a suitable headset, testing this would be nice.

The pinout required is the "CTIA" one, *not* OMTP (standards are great...) see
https://source.android.com/devices/accessories/headset/plug-headset-spec#mechanical

I do have a compatible headset, but was neither able to record from the HS mic
nor from the internal mic, so I have to try harder, I guess ;-) I could hear
both mics when choosing the mixer as output source though. Mute and boost
worked for both mics, in alsamixer.  Kernel is 4.20.6, so ca0412a05756cd0b
is missing; which shouldn't make a difference in this respect, right?

	Torsten

^ permalink raw reply	[flat|nested] 33+ messages in thread
* [PATCH RFC] arm64: dts: allwinner: a64: teres-i: Enable audio
@ 2019-02-01 11:37 ` Harald Geyer
  0 siblings, 0 replies; 33+ messages in thread
From: Harald Geyer @ 2019-02-01 11:37 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Rob Herring, Mark Rutland
  Cc: devicetree, info, Mark Brown, Harald Geyer, ibu, linux-arm-kernel

The TERES-I has internal speakers (left, right), internal microphone
and a headset combo jack (headphones + mic).

The headphone lines are multiplexed with the debug console.
The headphone and mic detect lines of the A64 are connected properly,
but AFAIK currently unsupported by the driver.

Signed-off-by: Harald Geyer <harald@ccbib.org>
---
Hi all,

a couple of issues make this patch RFC:

hpvcc-supply vs. cpvdd-supply:
On the A64 manual the pin is called CPVDD and the binding documents
requires a cpvdd-supply property. However in the actual driver and
devicetrees so far hpvcc-supply is used. This is a very new binding,
so we have the luxury to decide either way, I think. Any input from
the devicetree maintainers would be appreciated.

debug console multiplexing:
Olimex have a userspace script that controls gpio PL9 during boot,
to select between HP and serial console. I guess this is not acceptable
for mainline.

The best solution I can see is to switch the HP jack from serial console
to audio once the audio drivers load. With this people can still capture
the bootlogs but everybody gets audio once the system is up and
switching back to console output is as simple as unloading the audio
drivers.

However the current implementation with a pinctrl group doesn't work:
The audio card device correctly claims the pin (ie I can't export the
gpio in sysfs anymore), but the pinctrl driver doesn't set the pin
to output.

Testing:
I don't have a headset with combo connector, so I could only test the
headphones output, but not the headset mic. If somebody happens to
have a TERES-I and a suitable headset, testing this would be nice.

TIA,
Harald

 .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
index f9eede0a8bd3..d57049fbdaca 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
@@ -70,6 +70,26 @@
 		compatible = "mmc-pwrseq-simple";
 		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
 	};
+
+	speaker_amp: audio-amplifier {
+		compatible = "simple-audio-amplifier";
+		enable-gpios = <&r_pio 0 12 GPIO_ACTIVE_HIGH>; /* PL12 */
+		sound-name-prefix = "Speaker Amp";
+	};
+};
+
+&codec {
+	status = "okay";
+};
+
+&codec_analog {
+	hpvcc-supply = <&reg_eldo1>; /* TODO: Use only one of these */
+	cpvdd-supply = <&reg_eldo1>;
+	status = "okay";
+};
+
+&dai {
+	status = "okay";
 };
 
 &ehci1 {
@@ -131,6 +151,14 @@
 	status = "okay";
 };
 
+&r_pio {
+	r_debug_select_pin: debug-select {
+		pins = "PL9";
+		function = "gpio_out";
+		output-high;
+	};
+};
+
 &r_rsb {
 	status = "okay";
 
@@ -258,6 +286,31 @@
 	vcc-hdmi-supply = <&reg_dldo1>;
 };
 
+&sound {
+	pinctrl-names = "default";
+	pinctrl-0 = <&r_debug_select_pin>;
+	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
+	simple-audio-card,widgets = "Headphone", "Headphone Jack",
+				    "Microphone", "Headset Microphone",
+				    "Microphone", "Internal Microphone",
+				    "Speaker", "Internal Speaker";
+	simple-audio-card,routing =
+			"Left DAC", "AIF1 Slot 0 Left",
+			"Right DAC", "AIF1 Slot 0 Right",
+			"AIF1 Slot 0 Left ADC", "Left ADC",
+			"AIF1 Slot 0 Right ADC", "Right ADC",
+			"Headphone Jack", "HP",
+			"Speaker Amp INL", "LINEOUT",
+			"Speaker Amp INR", "LINEOUT",
+			"Internal Speaker", "Speaker Amp OUTL",
+			"Internal Speaker", "Speaker Amp OUTR",
+			"Internal Microphone", "MBIAS",
+			"MIC1", "Internal Microphone",
+			"Headset Microphone", "HBIAS",
+			"MIC2", "Headset Microphone";
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pb_pins>;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2019-05-02 14:57 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 11:12 [PATCH RFC] arm64: dts: allwinner: a64: teres-i: Enable audio Torsten Duwe
2019-02-11 13:36 ` Harald Geyer
2019-02-11 13:36   ` Harald Geyer
2019-02-11 15:39   ` Maxime Ripard
2019-02-11 15:39     ` Maxime Ripard
2019-02-11 19:32     ` Harald Geyer
2019-02-11 19:32       ` Harald Geyer
2019-02-12  8:38       ` Maxime Ripard
2019-02-12  9:42         ` Harald Geyer
2019-02-12  9:42           ` Harald Geyer
2019-02-12 10:09           ` Maxime Ripard
2019-02-12 19:37             ` Harald Geyer
2019-02-12 19:37               ` Harald Geyer
2019-02-13  9:44               ` Maxime Ripard
2019-02-13 11:43                 ` Harald Geyer
2019-02-13 15:53                   ` Maxime Ripard
2019-02-14  0:12                     ` Harald Geyer
2019-02-15 14:20                       ` Torsten Duwe
2019-02-15 14:20                         ` Torsten Duwe
2019-02-16 20:47                         ` Harald Geyer
2019-02-16 20:47                           ` Harald Geyer
2019-02-17 11:30                           ` Torsten Duwe
2019-02-17 11:30                             ` Torsten Duwe
2019-02-18 10:24                           ` Maxime Ripard
2019-04-30 13:32                             ` Torsten Duwe
2019-04-30 13:32                               ` Torsten Duwe
2019-05-02  7:46                               ` Maxime Ripard
2019-05-02 14:48                                 ` Harald Geyer
2019-05-02 14:48                                   ` Harald Geyer
  -- strict thread matches above, loose matches on Subject: below --
2019-02-01 11:37 Harald Geyer
2019-02-01 11:37 ` Harald Geyer
2019-02-12  8:34 ` Chen-Yu Tsai
2019-02-12  8:34   ` Chen-Yu Tsai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.