Change GPIO MUX globally - best practice

Dear beagleboard community
On my Beaglebone Black I want to disable the output of 24Mhz clock at the CLKOUT1 pin. We do not use the HDMI feature (it is used for the tda988x) and it interferes with our EMC compliance.
In order to do this I ended up with something like the following in arch/arm/boot/dts/am335x-boneblack.dts in a 4.4.14-bone11 Kernel tree (yes, old and ancient but applies to already delivered modules):

&am33xx_pinmux {
	nxp_hdmi_bonelt_pins: nxp_hdmi_bonelt_pins {
		pinctrl-single,pins = <
/*			0x1b0 0x03   */   /* xdma_event_intr0, OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */
			0x1b0 0x00
			0x9b0 0x00 
			AM33XX_IOPAD(0x9b0, PIN_INPUT | MUX_MODE7)

So the initial 0x1b0 0x03 disabled, the other statements added by me changing to other function.
Quite redundant yet, 0x0b9 is wrong, but I suppose 0x1b0 0x00 does the trick. When I load the tdy988x module, the CLKOUT1 pin goes silent.

The question is, what is the best practice to do this in an actual (well, 5.10.x) kernel globally?
I investigate the dts tree further but all stuff done there applies to modules and drivers when active.
Is there a way to do something like this globally, like MUX GPIO this way ever on boot, regardeless what’s loaded enabled or disabled?
Regards
Konsti

HI @Konstantin one quick hack…

Do you use the hdmi for anything? If not, just force it to use the BeagleBone Green device-tree, which is a clone of the BeagleBone Black with no built-in HDMI…

Regards,

I do not use HDMI at all.
The Problem is, the MUXing is done at powerup via hardware at boot up via SYSBOOT settings soldered onto the Board. I need to not only not use HDMI but also I must change the muxing from this setting actively on my own.

SYSBOOT pins don’t affect the HDMI… The eeprom+device-tree does…

Regards,

SYSBOOT[5] is pulled up to VDD_3V3A which enables CLKOUT1.
CLKOUT1 is routed to JTAG footprint and SN74AUC1G74 which output is connected to HDMI framer TDA19988.

So even if HDMI is not used the MUXing of CLKOUT1 must be changed to disable it.

Finally I came up with this:

diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi b/arch/arm/boot/dts/am335x-bone-common.dtsi
index 5b773d3e287e..aef75f0e7fde 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -120,7 +120,8 @@
 
 	clkout2_pin: pinmux_clkout2_pin {
 		pinctrl-single,pins = <
-			AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_OUTPUT_PULLDOWN, MUX_MODE3)	/* xdma_event_intr1.clkout2 */
+			AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR0, PIN_INPUT_PULLUP, MUX_MODE7)
+			AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1, PIN_INPUT_PULLDOWN, MUX_MODE7)
 		>;
 	};
 

Nice @Konstantin i’ll roll that into an overlay!

ugh, forgot about the ‘jtag’ clock…

Regards,