Could we leave the actual implementation of this report function to the machine driver? Since the things being done in detection function are common (even if other status are wanted to be updated), then probably machine driver could define a specific function ("action") for doing extra tasks, it can be called from generic gpio detect function. Could it be a valid approach?
That sounds like adding a callback for power updates on the jack itself to me (which isn't a bad idea), rather than changing the report function of the jack detection method. The need for machine-specific extra actions probably isn't specific to jacks that are detected via GPIOs.
In that situation, power updates should come only when the jack reporting bits are either all active (jack enabled) or none (jack disabled), is that correct?
If so, then machine drivers can create callbacks receiving the soc_codec the jack belongs to and the current state of the jack. All the power updates (dapm_enable_pin/damp_disable_pin) will happen in the callback in machine driver but the dapm sync will happen in soc jack framework (i.e. when reporting current status of the jack).
-Misa