Re: [PATCH RFC] arm64: dts: allwinner: a64: teres-i: Enable audio

Harald Geyer
2019-02-11T19:33:09Z

Maxime Ripard writes:
> On Mon, Feb 11, 2019 at 02:36:53PM +0100, Harald Geyer wrote:
> > > > 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.
> >
> > Not the audio driver's business, but perheps the audio card's DT node.
> > Which is why I came up with the pinctrl idea.
> >
> > I know that the nexus7 is quite well supported, and iirc they were using
> > a similar trick on their UART. Have you looked at how they were doing
> > that?

I didn't know that. Thanks for the info, it was quite interessting reading.
Alas it seems it doesn't help us:
1) I couldn't find proof that audio support is actually in mainline.
2) Their HW works differently: Their debug cable uses external voltage
on the mic pin to drive the switch. (They also have a GPIO, but it's
input to detect the debug adapter in software, not output as in the
case of the teres.)

> We want to model this properly. I guess using a pinctrl driver
> controlled through GPIO (similar to what regulator-gpio is) would be a
> good first step.

I considered this too, but didn't like it:

1) Seems like a bit of overkill.

2) The HW at hand is a rather different kind of multiplexer than
what pinctrl assumes. We don't want two mutually exclusive devices,
(Ie don't make the kernel unbind /dev/console for the sake of audio.)
but we want switch the jack between two devices, that might both be
active at the same time. This looks more like the channel multiplexers
used with many ADCs and such. I guess, I could start a new subsystem
around this. Seems like even more overkill.

Instead I just got the original patch working, by implementing
"output-high" DT property in sunxi-pinctrl. I'll send a patch for
review soon.

Harald

--
If you want to support my work:
see http://friends.ccbib.org/harald/supporting/
or donate via CLAM to xASPBtezLNqj4cUe8MT5nZjthRSEjrRQXN
or via peercoin to P98LRdhit3gZbHDBe7ta5jtXrMJUms4p7w