I have a requirement to dynamically control the OSC32K_32K_OUT signal that is on GPIO1_IO03 from kernel space. I can set the pad configuration in the device tree or use devmem2 to set the mux mode to ALT3 in IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 to generate the clock but I need to do this dynamically within the kernel when a device requests the 32KHz clock which will occur in an interrupt context.
I'm using the linux-imx 4.9.11 kernel. I'm guessing I have to add a new clock to the clock framework and provide the ability to turn it on and off by either setting the mux_mode of IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 to ALT3 and ALT5 respectively.
Is there something already available for this? if not is it possible to do what I'm suggesting? or is there a better way?