/*
- * drivers/spi/tsc2301-mixer.c
- *
* ALSA Mixer implementation for TSC2301
*
* Copyright (C) 2006 Nokia Corporation.
#include <sound/core.h>
#include <sound/control.h>
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
-static char *id = NULL;
-MODULE_PARM_DESC(id, "TSC2301 ALSA Mixer Driver");
-#endif
-
/* shadow register indexes */
enum {
/* audio control and volume registers */
struct tsc2301 *tsc;
struct mutex mutex;
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
- struct snd_card *card;
-#endif
-
/* shadow registers holding TSC2301 audio registers. Used to hold
* their states during the sleep and also to reduce communication with
* the chip since get callback functions could get register values
return 0;
}
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
-static int tsc2301_mixer_register_card(struct tsc2301 *tsc)
-{
- struct snd_card *card;
- int err;
-
- /* create new sound card instance */
- card = snd_card_new(-1, id, THIS_MODULE, 0);
- if (card == NULL)
- return -ENOMEM;
-
- tsc->mixer->card = card;
-
- strcpy(card->driver, "TSC2301");
- strcpy(card->shortname, "TSC2301");
- sprintf(card->longname, "TSC2301 ALSA Mixer");
- strcpy(card->mixername, "TSC2301 Mixer");
-
- /* register mixer controls for the sound card */
- if ((err = tsc2301_mixer_register_controls(&tsc->spi->dev, card)) != 0)
- goto err1;
-
- /* register the sound card instance */
- if ((err = snd_card_register(card)) != 0)
- goto err1;
-
- printk(KERN_INFO "TSC2301 ALSA Mixer support initialized\n");
-
- return 0;
-err1:
- snd_card_free(card);
- return err;
-}
-#endif
-
int tsc2301_mixer_init(struct tsc2301 *tsc,
struct tsc2301_platform_data *pdata)
{
tsc2301_flush_shadow_regs(tsc);
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
- err = tsc2301_mixer_register_card(tsc);
- if (err < 0)
- goto err2;
-#endif
-
if (mix->platform_init != NULL) {
err = mix->platform_init(&tsc->spi->dev);
if (err < 0)
- goto err3;
+ goto err2;
}
return 0;
-err3:
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
- snd_card_free(mix->card);
err2:
-#endif
if (mix->mixer_gpios != NULL)
kfree(mix->mixer_gpios);
err1:
{
struct tsc2301_mixer *mixer = tsc->mixer;
-#ifdef TSC2301_MIXER_SELF_REGISTRATION
- snd_card_free(mixer->card);
-#endif
-
if (mixer->platform_cleanup != NULL)
mixer->platform_cleanup(&tsc->spi->dev);