On Sun, Mar 01, 2009 at 07:54:36PM -0600, Lopez Cruz, Misael wrote:
detection/report. There can be a generic detection/report function for gpio, I was thinking in something like:
Yes, that's more or less much what I was looking for.
Some systems won't be able to use their speaker output while a headphone is connected and so will want to make sure to update both speaker and headphone when the headphone jack status changes.
Having a single/generic report function like shown above (as is) we can't handle that case.
Sure it can - remember that the DAPM updates are done separately to the detection and can be set to invert the status reported for the power. The speaker won't be visible as a jack in a situation like this.
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.