[alsa-devel] [RFC] ucb1400 touchscreen, irq auto probing and ac97 with its private field

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Apr 24 20:56:58 CEST 2008


On Thu, Apr 24, 2008 at 06:09:52PM +0200, Takashi Iwai wrote:

> The problem with void * is that you don't know what it really is.
> Yes, it's exactly the purpose - to be generic.  But, this means that
> the true shape of the tossed data from the ac97 controller driver to
> the platform driver is anonymous, too.

Indeed, but unfortunately if you try to cater for everything that might
need to pass data through you rapidly get a balloning stucture - it's
the same use case as the device_data in struct device (in fact, now that
I think about it it may be best to just do the same thing as the
platform bus does and define accessor macros for getting at this from a
struct snd_ac97).

> > Note that this will also need changes in all the relevant AC97 drivers
> > to support getting the private data from platform/machine definition
> > code to the relevant driver using whatever methods are appropriate for
> > the platform.

> What kind of data are needed be passed?

In the case of the WM97xx driver it currently takes a structure
containing seven function pointers, an interrupt number and a boolean
for managing integration of the touchscreen interface an auxiliary ADCs
with the rest of the system.  It's really not terribly generic and
there's probably more things that could be added if there were use
cases:

/* Machine specific and accelerated touch operations */
struct wm97xx_mach_ops {

        /* accelerated touch readback - coords are transmited on AC97 link */
        int acc_enabled;
        void (*acc_pen_up) (struct wm97xx *);
        int (*acc_pen_down) (struct wm97xx *);
        int (*acc_startup) (struct wm97xx *);
        void (*acc_shutdown) (struct wm97xx *);

        /* interrupt mask control - required for accelerated operation */
        void (*irq_enable) (struct wm97xx *, int enable);

        /* GPIO pin used for accelerated operation */
        int irq_gpio;

        /* pre and post sample - can be used to minimise any analog noise */
        void (*pre_sample) (int);  /* function to run before sampling */
        void (*post_sample) (int);  /* function to run after sampling */
};



More information about the Alsa-devel mailing list