On Tue, Feb 12, 2019 at 10:42:03AM +0100, Harald Geyer wrote: > Maxime Ripard writes: > > On Mon, Feb 11, 2019 at 08:32:35PM +0100, Harald Geyer wrote: > > > > 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. > > > > I'm not quite sure about how that's different from what pinctrl > > assumes. pinctrl assumes to handle devices that have multiple signals > > as input, and one as output. Isn't that exactly what you have? > > I think the pinctrl way would be to have the audio card device > request the HP jack and the uart node request the HP jack and only > once device could probe successfully. Ie it is about ressource > allocation, not true multiplexing where both devices can use the > ressource at the same time. Am I wrong? By default, it's what happens yes, but you can definitely have more complex behaviour that would support changing dynamically back and forth that muxing. > Or course we don't actually want true multiplexing for audio quality > reasons, but I don't see how we could use pinctrl without doing nasty > things to /dev/console ... You can't have multiplexing, because that device doesn't allow you to: it allows only a single signal out at a given time. If you're using audio, you will not be able to get your logs out of the UART. And /dev/console is always there as far as I'm aware. > > And pinctrl can be used dynamically as well if you need to > > Can you explain or point me to the relevant explanation in the docs? > I don't seem to know about it. pinctrl_select_state is what you would want to call, you would have a good example of that runtime change in drivers/i2c/muxes/i2c-mux-pinctrl.c. > > > 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. > > > > What do you want to do with output-high exactly? > > Exactly what I do in the patch that started this thread. > (I'll resend when wens' cpvdd patch is available for me to rebase onto.) There's a few issues with that approach as well: - We're actively trying to remove the pinctrl nodes for the GPIOs - It's completely static: if one only wants to use the UART all the time, they would have to change the DTB, which might or might not be possible. Note that this could be trickier: why would you prevent the console from working for example if the audio support isn't built in? or as a module that might or might not be loaded? Maxime -- Maxime Ripard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Attachment:
signature.asc
Description: PGP signature