On 09/21/2012 04:16 PM, Peter Ujfalusi wrote:
I would be more inclined to do this on card init time, doing it at registration seems wrong as systems typically have interfaces that aren't used and share pins with other functions. By the time we are setting up a card we've got a good idea we actually want to use the IP but at probe time that's not the case.
Make sense. My first candidate to do this is the soc_probe_link_dais() function and to call snd_soc_configure_dai_pins() for both the cpu_dai and codec_dai.
If we are going to do the pinctrl mux configuration in core we should also consider the machine driver as well. But they tend to request the needed GPIOs in their probe before registering the card. Same can be true for codec drivers where they might need the mux configured before they request the GPIOs they need.
It might be better to leave this to the drivers?
It also seems bad that we're ignoring errors, does the pinctl API not stub itself out well enough.
pinctrl_get_select() returns with a pointer to struct pinctrl. If the platform does not have CONFIG_PINCTRL enabled it will return with NULL. If no pinctrl has been specified for the device it will return with error (-ENODEV). Neither of these cases should be considered as error. We do print out with dev_info() to notify the developer, but having pinctrl mux should not be mandatory.