Commit 97f02e05 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[ALSA] Remove xxx_t typedefs: I2C drivers

Remove xxx_t typedefs from the i2c drivers.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a42dd420
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#endif #endif
SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bits) SND_CS8403_DECL void SND_CS8403_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
{ {
if (bits & 0x01) { /* consumer */ if (bits & 0x01) { /* consumer */
if (!(bits & 0x02)) if (!(bits & 0x02))
...@@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit ...@@ -79,7 +79,7 @@ SND_CS8403_DECL void SND_CS8403_DECODE(snd_aes_iec958_t *diga, unsigned char bit
} }
} }
SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(struct snd_aes_iec958 *diga)
{ {
unsigned char bits; unsigned char bits;
...@@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) ...@@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga)
#endif #endif
SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bits) SND_CS8404_DECL void SND_CS8404_DECODE(struct snd_aes_iec958 *diga, unsigned char bits)
{ {
if (bits & 0x10) { /* consumer */ if (bits & 0x10) { /* consumer */
if (!(bits & 0x20)) if (!(bits & 0x20))
...@@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit ...@@ -205,7 +205,7 @@ SND_CS8404_DECL void SND_CS8404_DECODE(snd_aes_iec958_t *diga, unsigned char bit
} }
} }
SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(snd_aes_iec958_t *diga) SND_CS8404_DECL unsigned char SND_CS8404_ENCODE(struct snd_aes_iec958 *diga)
{ {
unsigned char bits; unsigned char bits;
......
...@@ -186,11 +186,16 @@ ...@@ -186,11 +186,16 @@
#define CS8427_VERSHIFT 0 #define CS8427_VERSHIFT 0
#define CS8427_VER8427A 0x71 #define CS8427_VER8427A 0x71
int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, struct snd_pcm_substream;
unsigned int reset_timeout, snd_i2c_device_t **r_cs8427);
int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val); int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); unsigned char val);
int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
struct snd_pcm_substream *playback_substream,
struct snd_pcm_substream *capture_substream);
int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active);
int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate);
#endif /* __SOUND_CS8427_H */ #endif /* __SOUND_CS8427_H */
...@@ -21,82 +21,84 @@ ...@@ -21,82 +21,84 @@
* *
*/ */
typedef struct _snd_i2c_device snd_i2c_device_t;
typedef struct _snd_i2c_bus snd_i2c_bus_t;
#define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ #define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */
struct _snd_i2c_device { struct snd_i2c_device {
struct list_head list; struct list_head list;
snd_i2c_bus_t *bus; /* I2C bus */ struct snd_i2c_bus *bus; /* I2C bus */
char name[32]; /* some useful device name */ char name[32]; /* some useful device name */
unsigned short flags; /* device flags */ unsigned short flags; /* device flags */
unsigned short addr; /* device address (might be 10-bit) */ unsigned short addr; /* device address (might be 10-bit) */
unsigned long private_value; unsigned long private_value;
void *private_data; void *private_data;
void (*private_free)(snd_i2c_device_t *device); void (*private_free)(struct snd_i2c_device *device);
};
#define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list)
struct snd_i2c_bit_ops {
void (*start)(struct snd_i2c_bus *bus); /* transfer start */
void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */
void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */
void (*setlines)(struct snd_i2c_bus *bus, int clock, int data);
int (*getclock)(struct snd_i2c_bus *bus);
int (*getdata)(struct snd_i2c_bus *bus, int ack);
}; };
#define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) struct snd_i2c_ops {
int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
typedef struct _snd_i2c_bit_ops { int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count);
void (*start)(snd_i2c_bus_t *bus); /* transfer start */ int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr);
void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ };
void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */
void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); struct snd_i2c_bus {
int (*getclock)(snd_i2c_bus_t *bus); struct snd_card *card; /* card which I2C belongs to */
int (*getdata)(snd_i2c_bus_t *bus, int ack);
} snd_i2c_bit_ops_t;
typedef struct _snd_i2c_ops {
int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count);
int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr);
} snd_i2c_ops_t;
struct _snd_i2c_bus {
snd_card_t *card; /* card which I2C belongs to */
char name[32]; /* some useful label */ char name[32]; /* some useful label */
struct semaphore lock_mutex; struct semaphore lock_mutex;
snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */
struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */
struct list_head devices; /* attached devices to this bus */ struct list_head devices; /* attached devices to this bus */
union { union {
snd_i2c_bit_ops_t *bit; struct snd_i2c_bit_ops *bit;
void *ops; void *ops;
} hw_ops; /* lowlevel operations */ } hw_ops; /* lowlevel operations */
snd_i2c_ops_t *ops; /* midlevel operations */ struct snd_i2c_ops *ops; /* midlevel operations */
unsigned long private_value; unsigned long private_value;
void *private_data; void *private_data;
void (*private_free)(snd_i2c_bus_t *bus); void (*private_free)(struct snd_i2c_bus *bus);
}; };
#define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) #define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses)
int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); int snd_i2c_bus_create(struct snd_card *card, const char *name,
int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c);
int snd_i2c_device_free(snd_i2c_device_t *device); int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
unsigned char addr, struct snd_i2c_device **rdevice);
int snd_i2c_device_free(struct snd_i2c_device *device);
static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { static inline void snd_i2c_lock(struct snd_i2c_bus *bus)
{
if (bus->master) if (bus->master)
down(&bus->master->lock_mutex); down(&bus->master->lock_mutex);
else else
down(&bus->lock_mutex); down(&bus->lock_mutex);
} }
static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) {
static inline void snd_i2c_unlock(struct snd_i2c_bus *bus)
{
if (bus->master) if (bus->master)
up(&bus->master->lock_mutex); up(&bus->master->lock_mutex);
else else
up(&bus->lock_mutex); up(&bus->lock_mutex);
} }
int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count);
int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr);
#endif /* __SOUND_I2C_H */ #endif /* __SOUND_I2C_H */
...@@ -24,15 +24,15 @@ ...@@ -24,15 +24,15 @@
#include <linux/videodev.h> #include <linux/videodev.h>
typedef struct snd_tea575x tea575x_t; struct snd_tea575x;
struct snd_tea575x_ops { struct snd_tea575x_ops {
void (*write)(tea575x_t *tea, unsigned int val); void (*write)(struct snd_tea575x *tea, unsigned int val);
unsigned int (*read)(tea575x_t *tea); unsigned int (*read)(struct snd_tea575x *tea);
}; };
struct snd_tea575x { struct snd_tea575x {
snd_card_t *card; struct snd_card *card;
struct video_device vd; /* video device */ struct video_device vd; /* video device */
struct file_operations fops; struct file_operations fops;
int dev_nr; /* requested device number + 1 */ int dev_nr; /* requested device number + 1 */
...@@ -45,7 +45,7 @@ struct snd_tea575x { ...@@ -45,7 +45,7 @@ struct snd_tea575x {
void *private_data; void *private_data;
}; };
void snd_tea575x_init(tea575x_t *tea); void snd_tea575x_init(struct snd_tea575x *tea);
void snd_tea575x_exit(tea575x_t *tea); void snd_tea575x_exit(struct snd_tea575x *tea);
#endif /* __SOUND_TEA575X_TUNER_H */ #endif /* __SOUND_TEA575X_TUNER_H */
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
#include "i2c.h" /* generic i2c support */ #include "i2c.h" /* generic i2c support */
int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer); int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer);
int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader); int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus,
int equalizer, int fader);
#endif /* __SOUND_TEA6330T_H */ #endif /* __SOUND_TEA6330T_H */
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* features support * features support
*/ */
/* $Id: uda1341.h,v 1.7 2005/11/17 10:25:22 tiwai Exp $ */ /* $Id: uda1341.h,v 1.8 2005/11/17 14:17:21 tiwai Exp $ */
#define UDA1341_ALSA_NAME "snd-uda1341" #define UDA1341_ALSA_NAME "snd-uda1341"
...@@ -119,7 +119,7 @@ enum write_through { ...@@ -119,7 +119,7 @@ enum write_through {
FLUSH, FLUSH,
}; };
int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt); int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
/* /*
* Local variables: * Local variables:
......
This diff is collapsed.
...@@ -32,20 +32,23 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); ...@@ -32,20 +32,23 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("Generic i2c interface for ALSA"); MODULE_DESCRIPTION("Generic i2c interface for ALSA");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device,
static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); unsigned char *bytes, int count);
static int snd_i2c_bit_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
unsigned char *bytes, int count);
static snd_i2c_ops_t snd_i2c_bit_ops = { static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus,
unsigned short addr);
static struct snd_i2c_ops snd_i2c_bit_ops = {
.sendbytes = snd_i2c_bit_sendbytes, .sendbytes = snd_i2c_bit_sendbytes,
.readbytes = snd_i2c_bit_readbytes, .readbytes = snd_i2c_bit_readbytes,
.probeaddr = snd_i2c_bit_probeaddr, .probeaddr = snd_i2c_bit_probeaddr,
}; };
static int snd_i2c_bus_free(snd_i2c_bus_t *bus) static int snd_i2c_bus_free(struct snd_i2c_bus *bus)
{ {
snd_i2c_bus_t *slave; struct snd_i2c_bus *slave;
snd_i2c_device_t *device; struct snd_i2c_device *device;
snd_assert(bus != NULL, return -EINVAL); snd_assert(bus != NULL, return -EINVAL);
while (!list_empty(&bus->devices)) { while (!list_empty(&bus->devices)) {
...@@ -66,17 +69,18 @@ static int snd_i2c_bus_free(snd_i2c_bus_t *bus) ...@@ -66,17 +69,18 @@ static int snd_i2c_bus_free(snd_i2c_bus_t *bus)
return 0; return 0;
} }
static int snd_i2c_bus_dev_free(snd_device_t *device) static int snd_i2c_bus_dev_free(struct snd_device *device)
{ {
snd_i2c_bus_t *bus = device->device_data; struct snd_i2c_bus *bus = device->device_data;
return snd_i2c_bus_free(bus); return snd_i2c_bus_free(bus);
} }
int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c) int snd_i2c_bus_create(struct snd_card *card, const char *name,
struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c)
{ {
snd_i2c_bus_t *bus; struct snd_i2c_bus *bus;
int err; int err;
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = snd_i2c_bus_dev_free, .dev_free = snd_i2c_bus_dev_free,
}; };
...@@ -102,9 +106,10 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master ...@@ -102,9 +106,10 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
return 0; return 0;
} }
int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice) int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
unsigned char addr, struct snd_i2c_device **rdevice)
{ {
snd_i2c_device_t *device; struct snd_i2c_device *device;
*rdevice = NULL; *rdevice = NULL;
snd_assert(bus != NULL, return -EINVAL); snd_assert(bus != NULL, return -EINVAL);
...@@ -119,7 +124,7 @@ int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char ad ...@@ -119,7 +124,7 @@ int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char ad
return 0; return 0;
} }
int snd_i2c_device_free(snd_i2c_device_t *device) int snd_i2c_device_free(struct snd_i2c_device *device)
{ {
if (device->bus) if (device->bus)
list_del(&device->list); list_del(&device->list);
...@@ -129,18 +134,18 @@ int snd_i2c_device_free(snd_i2c_device_t *device) ...@@ -129,18 +134,18 @@ int snd_i2c_device_free(snd_i2c_device_t *device)
return 0; return 0;
} }
int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
{ {
return device->bus->ops->sendbytes(device, bytes, count); return device->bus->ops->sendbytes(device, bytes, count);
} }
int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count)
{ {
return device->bus->ops->readbytes(device, bytes, count); return device->bus->ops->readbytes(device, bytes, count);
} }
int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
{ {
return bus->ops->probeaddr(bus, addr); return bus->ops->probeaddr(bus, addr);
} }
...@@ -149,31 +154,31 @@ int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) ...@@ -149,31 +154,31 @@ int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr)
* bit-operations * bit-operations
*/ */
static inline void snd_i2c_bit_hw_start(snd_i2c_bus_t *bus) static inline void snd_i2c_bit_hw_start(struct snd_i2c_bus *bus)
{ {
if (bus->hw_ops.bit->start) if (bus->hw_ops.bit->start)
bus->hw_ops.bit->start(bus); bus->hw_ops.bit->start(bus);
} }
static inline void snd_i2c_bit_hw_stop(snd_i2c_bus_t *bus) static inline void snd_i2c_bit_hw_stop(struct snd_i2c_bus *bus)
{ {
if (bus->hw_ops.bit->stop) if (bus->hw_ops.bit->stop)
bus->hw_ops.bit->stop(bus); bus->hw_ops.bit->stop(bus);
} }
static void snd_i2c_bit_direction(snd_i2c_bus_t *bus, int clock, int data) static void snd_i2c_bit_direction(struct snd_i2c_bus *bus, int clock, int data)
{ {
if (bus->hw_ops.bit->direction) if (bus->hw_ops.bit->direction)
bus->hw_ops.bit->direction(bus, clock, data); bus->hw_ops.bit->direction(bus, clock, data);
} }
static void snd_i2c_bit_set(snd_i2c_bus_t *bus, int clock, int data) static void snd_i2c_bit_set(struct snd_i2c_bus *bus, int clock, int data)
{ {
bus->hw_ops.bit->setlines(bus, clock, data); bus->hw_ops.bit->setlines(bus, clock, data);
} }
#if 0 #if 0
static int snd_i2c_bit_clock(snd_i2c_bus_t *bus) static int snd_i2c_bit_clock(struct snd_i2c_bus *bus)
{ {
if (bus->hw_ops.bit->getclock) if (bus->hw_ops.bit->getclock)
return bus->hw_ops.bit->getclock(bus); return bus->hw_ops.bit->getclock(bus);
...@@ -181,12 +186,12 @@ static int snd_i2c_bit_clock(snd_i2c_bus_t *bus) ...@@ -181,12 +186,12 @@ static int snd_i2c_bit_clock(snd_i2c_bus_t *bus)
} }
#endif #endif
static int snd_i2c_bit_data(snd_i2c_bus_t *bus, int ack) static int snd_i2c_bit_data(struct snd_i2c_bus *bus, int ack)
{ {
return bus->hw_ops.bit->getdata(bus, ack); return bus->hw_ops.bit->getdata(bus, ack);
} }
static void snd_i2c_bit_start(snd_i2c_bus_t *bus) static void snd_i2c_bit_start(struct snd_i2c_bus *bus)
{ {
snd_i2c_bit_hw_start(bus); snd_i2c_bit_hw_start(bus);
snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */
...@@ -195,7 +200,7 @@ static void snd_i2c_bit_start(snd_i2c_bus_t *bus) ...@@ -195,7 +200,7 @@ static void snd_i2c_bit_start(snd_i2c_bus_t *bus)
snd_i2c_bit_set(bus, 0, 0); snd_i2c_bit_set(bus, 0, 0);
} }
static void snd_i2c_bit_stop(snd_i2c_bus_t *bus) static void snd_i2c_bit_stop(struct snd_i2c_bus *bus)
{ {
snd_i2c_bit_set(bus, 0, 0); snd_i2c_bit_set(bus, 0, 0);
snd_i2c_bit_set(bus, 1, 0); snd_i2c_bit_set(bus, 1, 0);
...@@ -203,14 +208,14 @@ static void snd_i2c_bit_stop(snd_i2c_bus_t *bus) ...@@ -203,14 +208,14 @@ static void snd_i2c_bit_stop(snd_i2c_bus_t *bus)
snd_i2c_bit_hw_stop(bus); snd_i2c_bit_hw_stop(bus);
} }
static void snd_i2c_bit_send(snd_i2c_bus_t *bus, int data) static void snd_i2c_bit_send(struct snd_i2c_bus *bus, int data)
{ {
snd_i2c_bit_set(bus, 0, data); snd_i2c_bit_set(bus, 0, data);
snd_i2c_bit_set(bus, 1, data); snd_i2c_bit_set(bus, 1, data);
snd_i2c_bit_set(bus, 0, data); snd_i2c_bit_set(bus, 0, data);
} }
static int snd_i2c_bit_ack(snd_i2c_bus_t *bus) static int snd_i2c_bit_ack(struct snd_i2c_bus *bus)
{ {
int ack; int ack;
...@@ -223,7 +228,7 @@ static int snd_i2c_bit_ack(snd_i2c_bus_t *bus) ...@@ -223,7 +228,7 @@ static int snd_i2c_bit_ack(snd_i2c_bus_t *bus)
return ack ? -EIO : 0; return ack ? -EIO : 0;
} }
static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data) static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data)
{ {
int i, err; int i, err;
...@@ -234,7 +239,7 @@ static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data) ...@@ -234,7 +239,7 @@ static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data)
return 0; return 0;
} }
static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last) static int snd_i2c_bit_readbyte(struct snd_i2c_bus *bus, int last)
{ {
int i; int i;
unsigned char data = 0; unsigned char data = 0;
...@@ -252,9 +257,10 @@ static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last) ...@@ -252,9 +257,10 @@ static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last)
return data; return data;
} }
static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device,
unsigned char *bytes, int count)
{ {
snd_i2c_bus_t *bus = device->bus; struct snd_i2c_bus *bus = device->bus;
int err, res = 0; int err, res = 0;
if (device->flags & SND_I2C_DEVICE_ADDRTEN) if (device->flags & SND_I2C_DEVICE_ADDRTEN)
...@@ -275,9 +281,10 @@ static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, ...@@ -275,9 +281,10 @@ static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes,
return res; return res;
} }
static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count) static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
unsigned char *bytes, int count)
{ {
snd_i2c_bus_t *bus = device->bus; struct snd_i2c_bus *bus = device->bus;
int err, res = 0; int err, res = 0;
if (device->flags & SND_I2C_DEVICE_ADDRTEN) if (device->flags & SND_I2C_DEVICE_ADDRTEN)
...@@ -299,7 +306,7 @@ static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, ...@@ -299,7 +306,7 @@ static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes,
return res; return res;
} }
static int snd_i2c_bit_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
{ {
int err; int err;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* 2002-05-12 Tomas Kasparek another code cleanup * 2002-05-12 Tomas Kasparek another code cleanup
*/ */
/* $Id: uda1341.c,v 1.17 2005/11/17 10:25:22 tiwai Exp $ */ /* $Id: uda1341.c,v 1.18 2005/11/17 14:17:21 tiwai Exp $ */
#include <sound/driver.h> #include <sound/driver.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -140,15 +140,13 @@ static const char ** uda1341_enum_names[] = { ...@@ -140,15 +140,13 @@ static const char ** uda1341_enum_names[] = {
typedef int uda1341_cfg[CMD_LAST]; typedef int uda1341_cfg[CMD_LAST];
typedef struct uda1341 uda1341_t;
struct uda1341 { struct uda1341 {
int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val); int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val);
int (*read) (struct l3_client *uda1341, unsigned short reg); int (*read) (struct l3_client *uda1341, unsigned short reg);
unsigned char regs[uda1341_reg_last]; unsigned char regs[uda1341_reg_last];
int active; int active;
spinlock_t reg_lock; spinlock_t reg_lock;
snd_card_t *card; struct snd_card *card;
uda1341_cfg cfg; uda1341_cfg cfg;
#ifdef CONFIG_PM #ifdef CONFIG_PM
unsigned char suspend_regs[uda1341_reg_last]; unsigned char suspend_regs[uda1341_reg_last];
...@@ -429,8 +427,8 @@ static const char *peak_value[] = { ...@@ -429,8 +427,8 @@ static const char *peak_value[] = {
"-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB", "-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
}; };
static void snd_uda1341_proc_read(snd_info_entry_t *entry, static void snd_uda1341_proc_read(struct snd_info_entry *entry,
snd_info_buffer_t * buffer) struct snd_info_buffer *buffer)
{ {
struct l3_client *clnt = entry->private_data; struct l3_client *clnt = entry->private_data;
struct uda1341 *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
...@@ -494,8 +492,8 @@ static void snd_uda1341_proc_read(snd_info_entry_t *entry, ...@@ -494,8 +492,8 @@ static void snd_uda1341_proc_read(snd_info_entry_t *entry,
snd_iprintf(buffer, "Input Amp. Gain ch 2: %s dB\n", ig_small_value[uda->cfg[CMD_IG]]); snd_iprintf(buffer, "Input Amp. Gain ch 2: %s dB\n", ig_small_value[uda->cfg[CMD_IG]]);
} }
static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, static void snd_uda1341_proc_regs_read(struct snd_info_entry *entry,
snd_info_buffer_t * buffer) struct snd_info_buffer *buffer)
{ {
struct l3_client *clnt = entry->private_data; struct l3_client *clnt = entry->private_data;
struct uda1341 *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
...@@ -514,9 +512,9 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, ...@@ -514,9 +512,9 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry,
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client *clnt) static void __devinit snd_uda1341_proc_init(struct snd_card *card, struct l3_client *clnt)
{ {
snd_info_entry_t *entry; struct snd_info_entry *entry;
if (! snd_card_proc_new(card, "uda1341", &entry)) if (! snd_card_proc_new(card, "uda1341", &entry))
snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_read); snd_info_set_text_ops(entry, clnt, 1024, snd_uda1341_proc_read);
...@@ -536,7 +534,8 @@ static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client * ...@@ -536,7 +534,8 @@ static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client *
.private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \
} }
static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_uda1341_info_single(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
int mask = (kcontrol->private_value >> 12) & 63; int mask = (kcontrol->private_value >> 12) & 63;
...@@ -547,10 +546,11 @@ static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -547,10 +546,11 @@ static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_uda1341_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_get_single(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
int mask = (kcontrol->private_value >> 12) & 63; int mask = (kcontrol->private_value >> 12) & 63;
int invert = (kcontrol->private_value >> 18) & 1; int invert = (kcontrol->private_value >> 18) & 1;
...@@ -562,10 +562,11 @@ static int snd_uda1341_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ ...@@ -562,10 +562,11 @@ static int snd_uda1341_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
return 0; return 0;
} }
static int snd_uda1341_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_put_single(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
int reg = (kcontrol->private_value >> 5) & 15; int reg = (kcontrol->private_value >> 5) & 15;
int shift = (kcontrol->private_value >> 9) & 7; int shift = (kcontrol->private_value >> 9) & 7;
...@@ -591,7 +592,8 @@ static int snd_uda1341_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_ ...@@ -591,7 +592,8 @@ static int snd_uda1341_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
.private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \ .private_value = where | (reg << 5) | (shift << 9) | (mask << 12) | (invert << 18) \
} }
static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_uda1341_info_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
const char **texts; const char **texts;
...@@ -612,20 +614,22 @@ static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * ...@@ -612,20 +614,22 @@ static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
return 0; return 0;
} }
static int snd_uda1341_get_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_get_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
ucontrol->value.enumerated.item[0] = uda->cfg[where]; ucontrol->value.enumerated.item[0] = uda->cfg[where];
return 0; return 0;
} }
static int snd_uda1341_put_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_put_enum(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
int reg = (kcontrol->private_value >> 5) & 15; int reg = (kcontrol->private_value >> 5) & 15;
int shift = (kcontrol->private_value >> 9) & 7; int shift = (kcontrol->private_value >> 9) & 7;
...@@ -648,7 +652,8 @@ static int snd_uda1341_put_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t ...@@ -648,7 +652,8 @@ static int snd_uda1341_put_enum(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
} }
static int snd_uda1341_info_2regs(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_uda1341_info_2regs(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
int mask_1 = (kcontrol->private_value >> 19) & 63; int mask_1 = (kcontrol->private_value >> 19) & 63;
int mask_2 = (kcontrol->private_value >> 25) & 63; int mask_2 = (kcontrol->private_value >> 25) & 63;
...@@ -662,10 +667,11 @@ static int snd_uda1341_info_2regs(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -662,10 +667,11 @@ static int snd_uda1341_info_2regs(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_uda1341_get_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_get_2regs(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
int mask_1 = (kcontrol->private_value >> 19) & 63; int mask_1 = (kcontrol->private_value >> 19) & 63;
int mask_2 = (kcontrol->private_value >> 25) & 63; int mask_2 = (kcontrol->private_value >> 25) & 63;
...@@ -680,10 +686,11 @@ static int snd_uda1341_get_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t ...@@ -680,10 +686,11 @@ static int snd_uda1341_get_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
return 0; return 0;
} }
static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_uda1341_put_2regs(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct l3_client *clnt = snd_kcontrol_chip(kcontrol); struct l3_client *clnt = snd_kcontrol_chip(kcontrol);
uda1341_t *uda = clnt->driver_data; struct uda1341 *uda = clnt->driver_data;
int where = kcontrol->private_value & 31; int where = kcontrol->private_value & 31;
int reg_1 = (kcontrol->private_value >> 5) & 15; int reg_1 = (kcontrol->private_value >> 5) & 15;
int reg_2 = (kcontrol->private_value >> 9) & 15; int reg_2 = (kcontrol->private_value >> 9) & 15;
...@@ -716,7 +723,7 @@ static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t ...@@ -716,7 +723,7 @@ static int snd_uda1341_put_2regs(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
/* }}} */ /* }}} */
static snd_kcontrol_new_t snd_uda1341_controls[] = { static struct snd_kcontrol_new snd_uda1341_controls[] = {
UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1), UDA1341_SINGLE("Master Playback Switch", CMD_MUTE, data0_2, 2, 1, 1),
UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1), UDA1341_SINGLE("Master Playback Volume", CMD_VOLUME, data0_0, 0, 63, 1),
...@@ -748,20 +755,20 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = { ...@@ -748,20 +755,20 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = {
static void uda1341_free(struct l3_client *clnt) static void uda1341_free(struct l3_client *clnt)
{ {
l3_detach_client(clnt); // calls kfree for driver_data (uda1341_t) l3_detach_client(clnt); // calls kfree for driver_data (struct uda1341)
kfree(clnt); kfree(clnt);
} }
static int uda1341_dev_free(snd_device_t *device) static int uda1341_dev_free(struct snd_device *device)
{ {
struct l3_client *clnt = device->device_data; struct l3_client *clnt = device->device_data;
uda1341_free(clnt); uda1341_free(clnt);
return 0; return 0;
} }
int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clntp) int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clntp)
{ {
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = uda1341_dev_free, .dev_free = uda1341_dev_free,
}; };
struct l3_client *clnt; struct l3_client *clnt;
...@@ -792,7 +799,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clntp ...@@ -792,7 +799,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clntp
*clntp = clnt; *clntp = clnt;
strcpy(card->mixername, "UDA1341TS Mixer"); strcpy(card->mixername, "UDA1341TS Mixer");
((uda1341_t *)uda1341->driver_data)->card = card; ((struct uda1341 *)clnt->driver_data)->card = card;
snd_uda1341_proc_init(card, clnt); snd_uda1341_proc_init(card, clnt);
......
This diff is collapsed.
This diff is collapsed.
...@@ -34,7 +34,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Takashi Iwai <tiwai@suse.de>"); ...@@ -34,7 +34,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>, Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("Routines for control of AK452x / AK43xx AD/DA converters"); MODULE_DESCRIPTION("Routines for control of AK452x / AK43xx AD/DA converters");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char val) void snd_akm4xxx_write(struct snd_akm4xxx *ak, int chip, unsigned char reg, unsigned char val)
{ {
ak->ops.lock(ak, chip); ak->ops.lock(ak, chip);
ak->ops.write(ak, chip, reg, val); ak->ops.write(ak, chip, reg, val);
...@@ -58,7 +58,7 @@ void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char ...@@ -58,7 +58,7 @@ void snd_akm4xxx_write(akm4xxx_t *ak, int chip, unsigned char reg, unsigned char
* *
* assert the reset operation and restores the register values to the chips. * assert the reset operation and restores the register values to the chips.
*/ */
void snd_akm4xxx_reset(akm4xxx_t *ak, int state) void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state)
{ {
unsigned int chip; unsigned int chip;
unsigned char reg; unsigned char reg;
...@@ -109,7 +109,7 @@ void snd_akm4xxx_reset(akm4xxx_t *ak, int state) ...@@ -109,7 +109,7 @@ void snd_akm4xxx_reset(akm4xxx_t *ak, int state)
/* /*
* initialize all the ak4xxx chips * initialize all the ak4xxx chips
*/ */
void snd_akm4xxx_init(akm4xxx_t *ak) void snd_akm4xxx_init(struct snd_akm4xxx *ak)
{ {
static unsigned char inits_ak4524[] = { static unsigned char inits_ak4524[] = {
0x00, 0x07, /* 0: all power up */ 0x00, 0x07, /* 0: all power up */
...@@ -247,7 +247,8 @@ void snd_akm4xxx_init(akm4xxx_t *ak) ...@@ -247,7 +247,8 @@ void snd_akm4xxx_init(akm4xxx_t *ak)
#define AK_COMPOSE(chip,addr,shift,mask) (((chip) << 8) | (addr) | ((shift) << 16) | ((mask) << 24)) #define AK_COMPOSE(chip,addr,shift,mask) (((chip) << 8) | (addr) | ((shift) << 16) | ((mask) << 24))
#define AK_INVERT (1<<23) #define AK_INVERT (1<<23)
static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_akm4xxx_volume_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
unsigned int mask = AK_GET_MASK(kcontrol->private_value); unsigned int mask = AK_GET_MASK(kcontrol->private_value);
...@@ -258,9 +259,10 @@ static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -258,9 +259,10 @@ static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_akm4xxx_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_volume_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
int invert = AK_GET_INVERT(kcontrol->private_value); int invert = AK_GET_INVERT(kcontrol->private_value);
...@@ -271,9 +273,10 @@ static int snd_akm4xxx_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t ...@@ -271,9 +273,10 @@ static int snd_akm4xxx_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
return 0; return 0;
} }
static int snd_akm4xxx_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_volume_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
int invert = AK_GET_INVERT(kcontrol->private_value); int invert = AK_GET_INVERT(kcontrol->private_value);
...@@ -289,7 +292,8 @@ static int snd_akm4xxx_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t ...@@ -289,7 +292,8 @@ static int snd_akm4xxx_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
return change; return change;
} }
static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_akm4xxx_ipga_gain_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -298,18 +302,20 @@ static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf ...@@ -298,18 +302,20 @@ static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
return 0; return 0;
} }
static int snd_akm4xxx_ipga_gain_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_ipga_gain_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
ucontrol->value.integer.value[0] = snd_akm4xxx_get_ipga(ak, chip, addr) & 0x7f; ucontrol->value.integer.value[0] = snd_akm4xxx_get_ipga(ak, chip, addr) & 0x7f;
return 0; return 0;
} }
static int snd_akm4xxx_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_ipga_gain_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80; unsigned char nval = (ucontrol->value.integer.value[0] % 37) | 0x80;
...@@ -319,7 +325,8 @@ static int snd_akm4xxx_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu ...@@ -319,7 +325,8 @@ static int snd_akm4xxx_ipga_gain_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_valu
return change; return change;
} }
static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) static int snd_akm4xxx_deemphasis_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
static char *texts[4] = { static char *texts[4] = {
"44.1kHz", "Off", "48kHz", "32kHz", "44.1kHz", "Off", "48kHz", "32kHz",
...@@ -333,9 +340,10 @@ static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in ...@@ -333,9 +340,10 @@ static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in
return 0; return 0;
} }
static int snd_akm4xxx_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_deemphasis_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
int shift = AK_GET_SHIFT(kcontrol->private_value); int shift = AK_GET_SHIFT(kcontrol->private_value);
...@@ -343,9 +351,10 @@ static int snd_akm4xxx_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_va ...@@ -343,9 +351,10 @@ static int snd_akm4xxx_deemphasis_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_va
return 0; return 0;
} }
static int snd_akm4xxx_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) static int snd_akm4xxx_deemphasis_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
akm4xxx_t *ak = snd_kcontrol_chip(kcontrol); struct snd_akm4xxx *ak = snd_kcontrol_chip(kcontrol);
int chip = AK_GET_CHIP(kcontrol->private_value); int chip = AK_GET_CHIP(kcontrol->private_value);
int addr = AK_GET_ADDR(kcontrol->private_value); int addr = AK_GET_ADDR(kcontrol->private_value);
int shift = AK_GET_SHIFT(kcontrol->private_value); int shift = AK_GET_SHIFT(kcontrol->private_value);
...@@ -363,10 +372,10 @@ static int snd_akm4xxx_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val ...@@ -363,10 +372,10 @@ static int snd_akm4xxx_deemphasis_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
* build AK4xxx controls * build AK4xxx controls
*/ */
int snd_akm4xxx_build_controls(akm4xxx_t *ak) int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak)
{ {
unsigned int idx, num_emphs; unsigned int idx, num_emphs;
snd_kcontrol_t *ctl; struct snd_kcontrol *ctl;
int err; int err;
ctl = kmalloc(sizeof(*ctl), GFP_KERNEL); ctl = kmalloc(sizeof(*ctl), GFP_KERNEL);
......
...@@ -58,7 +58,7 @@ MODULE_LICENSE("GPL"); ...@@ -58,7 +58,7 @@ MODULE_LICENSE("GPL");
* lowlevel part * lowlevel part
*/ */
static void snd_tea575x_set_freq(tea575x_t *tea) static void snd_tea575x_set_freq(struct snd_tea575x *tea)
{ {
unsigned long freq; unsigned long freq;
...@@ -89,7 +89,7 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file, ...@@ -89,7 +89,7 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long data) unsigned int cmd, unsigned long data)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
tea575x_t *tea = video_get_drvdata(dev); struct snd_tea575x *tea = video_get_drvdata(dev);
void __user *arg = (void __user *)data; void __user *arg = (void __user *)data;
switch(cmd) { switch(cmd) {
...@@ -175,7 +175,7 @@ static void snd_tea575x_release(struct video_device *vfd) ...@@ -175,7 +175,7 @@ static void snd_tea575x_release(struct video_device *vfd)
/* /*
* initialize all the tea575x chips * initialize all the tea575x chips
*/ */
void snd_tea575x_init(tea575x_t *tea) void snd_tea575x_init(struct snd_tea575x *tea)
{ {
unsigned int val; unsigned int val;
...@@ -209,7 +209,7 @@ void snd_tea575x_init(tea575x_t *tea) ...@@ -209,7 +209,7 @@ void snd_tea575x_init(tea575x_t *tea)
snd_tea575x_set_freq(tea); snd_tea575x_set_freq(tea);
} }
void snd_tea575x_exit(tea575x_t *tea) void snd_tea575x_exit(struct snd_tea575x *tea)
{ {
if (tea->vd_registered) { if (tea->vd_registered) {
video_unregister_device(&tea->vd); video_unregister_device(&tea->vd);
......
...@@ -44,18 +44,20 @@ MODULE_LICENSE("GPL"); ...@@ -44,18 +44,20 @@ MODULE_LICENSE("GPL");
#define TEA6330T_GMU 0x80 /* mute control, general mute */ #define TEA6330T_GMU 0x80 /* mute control, general mute */
#define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */ #define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */
typedef struct {
snd_i2c_device_t *device; struct tea6330t {
snd_i2c_bus_t *bus; struct snd_i2c_device *device;
struct snd_i2c_bus *bus;
int equalizer; int equalizer;
int fader; int fader;
unsigned char regs[8]; unsigned char regs[8];
unsigned char mleft, mright; unsigned char mleft, mright;
unsigned char bass, treble; unsigned char bass, treble;
unsigned char max_bass, max_treble; unsigned char max_bass, max_treble;
} tea6330t_t; };
int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer) int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer)
{ {
int res; int res;
...@@ -66,7 +68,7 @@ int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer) ...@@ -66,7 +68,7 @@ int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer)
} }
#if 0 #if 0
static void snd_tea6330t_set(tea6330t_t *tea, static void snd_tea6330t_set(struct tea6330t *tea,
unsigned char addr, unsigned char value) unsigned char addr, unsigned char value)
{ {
#if 0 #if 0
...@@ -81,7 +83,8 @@ static void snd_tea6330t_set(tea6330t_t *tea, ...@@ -81,7 +83,8 @@ static void snd_tea6330t_set(tea6330t_t *tea,
.info = snd_tea6330t_info_master_volume, \ .info = snd_tea6330t_info_master_volume, \
.get = snd_tea6330t_get_master_volume, .put = snd_tea6330t_put_master_volume } .get = snd_tea6330t_get_master_volume, .put = snd_tea6330t_put_master_volume }
static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_tea6330t_info_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2; uinfo->count = 2;
...@@ -90,9 +93,10 @@ static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele ...@@ -90,9 +93,10 @@ static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele
return 0; return 0;
} }
static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_get_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
snd_i2c_lock(tea->bus); snd_i2c_lock(tea->bus);
ucontrol->value.integer.value[0] = tea->mleft - 0x14; ucontrol->value.integer.value[0] = tea->mleft - 0x14;
...@@ -101,9 +105,10 @@ static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele ...@@ -101,9 +105,10 @@ static int snd_tea6330t_get_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
return 0; return 0;
} }
static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, count, err; int change, count, err;
unsigned char bytes[3]; unsigned char bytes[3];
unsigned char val1, val2; unsigned char val1, val2;
...@@ -137,7 +142,8 @@ static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele ...@@ -137,7 +142,8 @@ static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele
.info = snd_tea6330t_info_master_switch, \ .info = snd_tea6330t_info_master_switch, \
.get = snd_tea6330t_get_master_switch, .put = snd_tea6330t_put_master_switch } .get = snd_tea6330t_get_master_switch, .put = snd_tea6330t_put_master_switch }
static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_tea6330t_info_master_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 2; uinfo->count = 2;
...@@ -146,9 +152,10 @@ static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_ele ...@@ -146,9 +152,10 @@ static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_ele
return 0; return 0;
} }
static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_get_master_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
snd_i2c_lock(tea->bus); snd_i2c_lock(tea->bus);
ucontrol->value.integer.value[0] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] == 0 ? 0 : 1; ucontrol->value.integer.value[0] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] == 0 ? 0 : 1;
...@@ -157,9 +164,10 @@ static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele ...@@ -157,9 +164,10 @@ static int snd_tea6330t_get_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
return 0; return 0;
} }
static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_put_master_switch(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, err; int change, err;
unsigned char bytes[3]; unsigned char bytes[3];
unsigned char oval1, oval2, val1, val2; unsigned char oval1, oval2, val1, val2;
...@@ -186,9 +194,10 @@ static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele ...@@ -186,9 +194,10 @@ static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele
.info = snd_tea6330t_info_bass, \ .info = snd_tea6330t_info_bass, \
.get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass } .get = snd_tea6330t_get_bass, .put = snd_tea6330t_put_bass }
static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_tea6330t_info_bass(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -197,17 +206,19 @@ static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -197,17 +206,19 @@ static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_tea6330t_get_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_get_bass(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = tea->bass; ucontrol->value.integer.value[0] = tea->bass;
return 0; return 0;
} }
static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_put_bass(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, err; int change, err;
unsigned char bytes[2]; unsigned char bytes[2];
unsigned char val1; unsigned char val1;
...@@ -230,9 +241,10 @@ static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t ...@@ -230,9 +241,10 @@ static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
.info = snd_tea6330t_info_treble, \ .info = snd_tea6330t_info_treble, \
.get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble } .get = snd_tea6330t_get_treble, .put = snd_tea6330t_put_treble }
static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_tea6330t_info_treble(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1; uinfo->count = 1;
...@@ -241,17 +253,19 @@ static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_ ...@@ -241,17 +253,19 @@ static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_
return 0; return 0;
} }
static int snd_tea6330t_get_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_get_treble(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = tea->treble; ucontrol->value.integer.value[0] = tea->treble;
return 0; return 0;
} }
static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_tea6330t_put_treble(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
tea6330t_t *tea = snd_kcontrol_chip(kcontrol); struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, err; int change, err;
unsigned char bytes[2]; unsigned char bytes[2];
unsigned char val1; unsigned char val1;
...@@ -269,25 +283,25 @@ static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value ...@@ -269,25 +283,25 @@ static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
return change; return change;
} }
static snd_kcontrol_new_t snd_tea6330t_controls[] = { static struct snd_kcontrol_new snd_tea6330t_controls[] = {
TEA6330T_MASTER_SWITCH("Master Playback Switch", 0), TEA6330T_MASTER_SWITCH("Master Playback Switch", 0),
TEA6330T_MASTER_VOLUME("Master Playback Volume", 0), TEA6330T_MASTER_VOLUME("Master Playback Volume", 0),
TEA6330T_BASS("Tone Control - Bass", 0), TEA6330T_BASS("Tone Control - Bass", 0),
TEA6330T_TREBLE("Tone Control - Treble", 0) TEA6330T_TREBLE("Tone Control - Treble", 0)
}; };
static void snd_tea6330_free(snd_i2c_device_t *device) static void snd_tea6330_free(struct snd_i2c_device *device)
{ {
kfree(device->private_data); kfree(device->private_data);
} }
int snd_tea6330t_update_mixer(snd_card_t * card, int snd_tea6330t_update_mixer(struct snd_card *card,
snd_i2c_bus_t *bus, struct snd_i2c_bus *bus,
int equalizer, int fader) int equalizer, int fader)
{ {
snd_i2c_device_t *device; struct snd_i2c_device *device;
tea6330t_t *tea; struct tea6330t *tea;
snd_kcontrol_new_t *knew; struct snd_kcontrol_new *knew;
unsigned int idx; unsigned int idx;
int err = -ENOMEM; int err = -ENOMEM;
u8 default_treble, default_bass; u8 default_treble, default_bass;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment