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:
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <sound/cs8427.h> #include <sound/cs8427.h>
#include <sound/asoundef.h> #include <sound/asoundef.h>
static void snd_cs8427_reset(snd_i2c_device_t *cs8427); static void snd_cs8427_reset(struct snd_i2c_device *cs8427);
MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>"); MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic"); MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic");
...@@ -38,22 +38,22 @@ MODULE_LICENSE("GPL"); ...@@ -38,22 +38,22 @@ MODULE_LICENSE("GPL");
#define CS8427_ADDR (0x20>>1) /* fixed address */ #define CS8427_ADDR (0x20>>1) /* fixed address */
typedef struct { struct cs8427_stream {
snd_pcm_substream_t *substream; struct snd_pcm_substream *substream;
char hw_status[24]; /* hardware status */ char hw_status[24]; /* hardware status */
char def_status[24]; /* default status */ char def_status[24]; /* default status */
char pcm_status[24]; /* PCM private status */ char pcm_status[24]; /* PCM private status */
char hw_udata[32]; char hw_udata[32];
snd_kcontrol_t *pcm_ctl; struct snd_kcontrol *pcm_ctl;
} cs8427_stream_t; };
typedef struct { struct cs8427 {
unsigned char regmap[0x14]; /* map of first 1 + 13 registers */ unsigned char regmap[0x14]; /* map of first 1 + 13 registers */
unsigned int rate; unsigned int rate;
unsigned int reset_timeout; unsigned int reset_timeout;
cs8427_stream_t playback; struct cs8427_stream playback;
cs8427_stream_t capture; struct cs8427_stream capture;
} cs8427_t; };
static unsigned char swapbits(unsigned char val) static unsigned char swapbits(unsigned char val)
{ {
...@@ -67,7 +67,8 @@ static unsigned char swapbits(unsigned char val) ...@@ -67,7 +67,8 @@ static unsigned char swapbits(unsigned char val)
return res; return res;
} }
int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned char val) int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
unsigned char val)
{ {
int err; int err;
unsigned char buf[2]; unsigned char buf[2];
...@@ -81,7 +82,7 @@ int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned c ...@@ -81,7 +82,7 @@ int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned c
return 0; return 0;
} }
static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg) static int snd_cs8427_reg_read(struct snd_i2c_device *device, unsigned char reg)
{ {
int err; int err;
unsigned char buf; unsigned char buf;
...@@ -97,28 +98,29 @@ static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg) ...@@ -97,28 +98,29 @@ static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg)
return buf; return buf;
} }
static int snd_cs8427_select_corudata(snd_i2c_device_t *device, int udata) static int snd_cs8427_select_corudata(struct snd_i2c_device *device, int udata)
{ {
cs8427_t *chip = device->private_data; struct cs8427 *chip = device->private_data;
int err; int err;
udata = udata ? CS8427_BSEL : 0; udata = udata ? CS8427_BSEL : 0;
if (udata != (chip->regmap[CS8427_REG_CSDATABUF] & udata)) { if (udata != (chip->regmap[CS8427_REG_CSDATABUF] & udata)) {
chip->regmap[CS8427_REG_CSDATABUF] &= ~CS8427_BSEL; chip->regmap[CS8427_REG_CSDATABUF] &= ~CS8427_BSEL;
chip->regmap[CS8427_REG_CSDATABUF] |= udata; chip->regmap[CS8427_REG_CSDATABUF] |= udata;
err = snd_cs8427_reg_write(device, CS8427_REG_CSDATABUF, chip->regmap[CS8427_REG_CSDATABUF]); err = snd_cs8427_reg_write(device, CS8427_REG_CSDATABUF,
chip->regmap[CS8427_REG_CSDATABUF]);
if (err < 0) if (err < 0)
return err; return err;
} }
return 0; return 0;
} }
static int snd_cs8427_send_corudata(snd_i2c_device_t *device, static int snd_cs8427_send_corudata(struct snd_i2c_device *device,
int udata, int udata,
unsigned char *ndata, unsigned char *ndata,
int count) int count)
{ {
cs8427_t *chip = device->private_data; struct cs8427 *chip = device->private_data;
char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status; char *hw_data = udata ? chip->playback.hw_udata : chip->playback.hw_status;
char data[32]; char data[32];
int err, idx; int err, idx;
...@@ -133,7 +135,8 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device, ...@@ -133,7 +135,8 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device,
if (memcmp(hw_data, data, count) == 0) { if (memcmp(hw_data, data, count) == 0) {
chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK; chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK;
chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | CS8427_EFTUI; chip->regmap[CS8427_REG_UDATABUF] |= CS8427_UBMZEROS | CS8427_EFTUI;
if ((err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF, chip->regmap[CS8427_REG_UDATABUF])) < 0) if ((err = snd_cs8427_reg_write(device, CS8427_REG_UDATABUF,
chip->regmap[CS8427_REG_UDATABUF])) < 0)
return err; return err;
return 0; return 0;
} }
...@@ -146,15 +149,15 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device, ...@@ -146,15 +149,15 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device,
return 1; return 1;
} }
static void snd_cs8427_free(snd_i2c_device_t *device) static void snd_cs8427_free(struct snd_i2c_device *device)
{ {
kfree(device->private_data); kfree(device->private_data);
} }
int snd_cs8427_create(snd_i2c_bus_t *bus, int snd_cs8427_create(struct snd_i2c_bus *bus,
unsigned char addr, unsigned char addr,
unsigned int reset_timeout, unsigned int reset_timeout,
snd_i2c_device_t **r_cs8427) struct snd_i2c_device **r_cs8427)
{ {
static unsigned char initvals1[] = { static unsigned char initvals1[] = {
CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC,
...@@ -194,11 +197,12 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, ...@@ -194,11 +197,12 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
CS8427_UD | CS8427_EFTUI | CS8427_DETUI, CS8427_UD | CS8427_EFTUI | CS8427_DETUI,
}; };
int err; int err;
cs8427_t *chip; struct cs8427 *chip;
snd_i2c_device_t *device; struct snd_i2c_device *device;
unsigned char buf[24]; unsigned char buf[24];
if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7),
&device)) < 0)
return err; return err;
chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
if (chip == NULL) { if (chip == NULL) {
...@@ -208,9 +212,13 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, ...@@ -208,9 +212,13 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
device->private_free = snd_cs8427_free; device->private_free = snd_cs8427_free;
snd_i2c_lock(bus); snd_i2c_lock(bus);
if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) { if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) !=
CS8427_VER8427A) {
snd_i2c_unlock(bus); snd_i2c_unlock(bus);
snd_printk(KERN_ERR "unable to find CS8427 signature (expected 0x%x, read 0x%x), initialization is not completed\n", CS8427_VER8427A, err); snd_printk(KERN_ERR "unable to find CS8427 signature "
"(expected 0x%x, read 0x%x),\n",
CS8427_VER8427A, err);
snd_printk(KERN_ERR " initialization is not completed\n");
return -EFAULT; return -EFAULT;
} }
/* turn off run bit while making changes to configuration */ /* turn off run bit while making changes to configuration */
...@@ -279,9 +287,9 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, ...@@ -279,9 +287,9 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
* put back AES3INPUT. This workaround is described in latest * put back AES3INPUT. This workaround is described in latest
* CS8427 datasheet, otherwise TXDSERIAL will not work. * CS8427 datasheet, otherwise TXDSERIAL will not work.
*/ */
static void snd_cs8427_reset(snd_i2c_device_t *cs8427) static void snd_cs8427_reset(struct snd_i2c_device *cs8427)
{ {
cs8427_t *chip; struct cs8427 *chip;
unsigned long end_time; unsigned long end_time;
int data; int data;
...@@ -289,10 +297,12 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427) ...@@ -289,10 +297,12 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
chip = cs8427->private_data; chip = cs8427->private_data;
snd_i2c_lock(cs8427->bus); snd_i2c_lock(cs8427->bus);
chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK); chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~(CS8427_RUN | CS8427_RXDMASK);
snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
chip->regmap[CS8427_REG_CLOCKSOURCE]);
udelay(200); udelay(200);
chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RUN | CS8427_RXDILRCK; chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RUN | CS8427_RXDILRCK;
snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
chip->regmap[CS8427_REG_CLOCKSOURCE]);
udelay(200); udelay(200);
snd_i2c_unlock(cs8427->bus); snd_i2c_unlock(cs8427->bus);
end_time = jiffies + chip->reset_timeout; end_time = jiffies + chip->reset_timeout;
...@@ -307,12 +317,13 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427) ...@@ -307,12 +317,13 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427)
snd_i2c_lock(cs8427->bus); snd_i2c_lock(cs8427->bus);
chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK;
chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RXDAES3INPUT; chip->regmap[CS8427_REG_CLOCKSOURCE] |= CS8427_RXDAES3INPUT;
snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE, chip->regmap[CS8427_REG_CLOCKSOURCE]); snd_cs8427_reg_write(cs8427, CS8427_REG_CLOCKSOURCE,
chip->regmap[CS8427_REG_CLOCKSOURCE]);
snd_i2c_unlock(cs8427->bus); snd_i2c_unlock(cs8427->bus);
} }
static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol, static int snd_cs8427_in_status_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -321,10 +332,10 @@ static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol, ...@@ -321,10 +332,10 @@ static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol, static int snd_cs8427_in_status_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
int data; int data;
snd_i2c_lock(device->bus); snd_i2c_lock(device->bus);
...@@ -336,18 +347,18 @@ static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol, ...@@ -336,18 +347,18 @@ static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_cs8427_qsubcode_info(snd_kcontrol_t *kcontrol, static int snd_cs8427_qsubcode_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = 10; uinfo->count = 10;
return 0; return 0;
} }
static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
unsigned char reg = CS8427_REG_QSUBCODE; unsigned char reg = CS8427_REG_QSUBCODE;
int err; int err;
...@@ -366,18 +377,18 @@ static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, ...@@ -366,18 +377,18 @@ static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_cs8427_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_cs8427_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol, static int snd_cs8427_spdif_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
cs8427_t *chip = device->private_data; struct cs8427 *chip = device->private_data;
snd_i2c_lock(device->bus); snd_i2c_lock(device->bus);
memcpy(ucontrol->value.iec958.status, chip->playback.def_status, 24); memcpy(ucontrol->value.iec958.status, chip->playback.def_status, 24);
...@@ -385,13 +396,15 @@ static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol, ...@@ -385,13 +396,15 @@ static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol, static int snd_cs8427_spdif_put(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol);
cs8427_t *chip = device->private_data; struct cs8427 *chip = device->private_data;
unsigned char *status = kcontrol->private_value ? chip->playback.pcm_status : chip->playback.def_status; unsigned char *status = kcontrol->private_value ?
snd_pcm_runtime_t *runtime = chip->playback.substream ? chip->playback.substream->runtime : NULL; chip->playback.pcm_status : chip->playback.def_status;
struct snd_pcm_runtime *runtime = chip->playback.substream ?
chip->playback.substream->runtime : NULL;
int err, change; int err, change;
snd_i2c_lock(device->bus); snd_i2c_lock(device->bus);
...@@ -406,21 +419,22 @@ static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol, ...@@ -406,21 +419,22 @@ static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol,
return change; return change;
} }
static int snd_cs8427_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_cs8427_spdif_mask_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_cs8427_spdif_mask_get(snd_kcontrol_t * kcontrol, static int snd_cs8427_spdif_mask_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
memset(ucontrol->value.iec958.status, 0xff, 24); memset(ucontrol->value.iec958.status, 0xff, 24);
return 0; return 0;
} }
static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = { static struct snd_kcontrol_new snd_cs8427_iec958_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.info = snd_cs8427_in_status_info, .info = snd_cs8427_in_status_info,
...@@ -469,12 +483,12 @@ static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = { ...@@ -469,12 +483,12 @@ static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = {
.get = snd_cs8427_qsubcode_get .get = snd_cs8427_qsubcode_get
}}; }};
int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
snd_pcm_substream_t *play_substream, struct snd_pcm_substream *play_substream,
snd_pcm_substream_t *cap_substream) struct snd_pcm_substream *cap_substream)
{ {
cs8427_t *chip = cs8427->private_data; struct cs8427 *chip = cs8427->private_data;
snd_kcontrol_t *kctl; struct snd_kcontrol *kctl;
unsigned int idx; unsigned int idx;
int err; int err;
...@@ -498,9 +512,9 @@ int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, ...@@ -498,9 +512,9 @@ int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427,
return 0; return 0;
} }
int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active) int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active)
{ {
cs8427_t *chip; struct cs8427 *chip;
snd_assert(cs8427, return -ENXIO); snd_assert(cs8427, return -ENXIO);
chip = cs8427->private_data; chip = cs8427->private_data;
...@@ -512,9 +526,9 @@ int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active) ...@@ -512,9 +526,9 @@ int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active)
return 0; return 0;
} }
int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate) int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate)
{ {
cs8427_t *chip; struct cs8427 *chip;
char *status; char *status;
int err, reset; int err, reset;
......
...@@ -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);
......
...@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); ...@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
static void ak4114_stats(void *); static void ak4114_stats(void *);
static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val) static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val)
{ {
ak4114->write(ak4114->private_data, reg, val); ak4114->write(ak4114->private_data, reg, val);
if (reg <= AK4114_REG_INT1_MASK) if (reg <= AK4114_REG_INT1_MASK)
...@@ -46,13 +46,13 @@ static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val) ...@@ -46,13 +46,13 @@ static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val)
ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val; ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val;
} }
static inline unsigned char reg_read(ak4114_t *ak4114, unsigned char reg) static inline unsigned char reg_read(struct ak4114 *ak4114, unsigned char reg)
{ {
return ak4114->read(ak4114->private_data, reg); return ak4114->read(ak4114->private_data, reg);
} }
#if 0 #if 0
static void reg_dump(ak4114_t *ak4114) static void reg_dump(struct ak4114 *ak4114)
{ {
int i; int i;
...@@ -62,7 +62,7 @@ static void reg_dump(ak4114_t *ak4114) ...@@ -62,7 +62,7 @@ static void reg_dump(ak4114_t *ak4114)
} }
#endif #endif
static void snd_ak4114_free(ak4114_t *chip) static void snd_ak4114_free(struct ak4114 *chip)
{ {
chip->init = 1; /* don't schedule new work */ chip->init = 1; /* don't schedule new work */
mb(); mb();
...@@ -73,22 +73,22 @@ static void snd_ak4114_free(ak4114_t *chip) ...@@ -73,22 +73,22 @@ static void snd_ak4114_free(ak4114_t *chip)
kfree(chip); kfree(chip);
} }
static int snd_ak4114_dev_free(snd_device_t *device) static int snd_ak4114_dev_free(struct snd_device *device)
{ {
ak4114_t *chip = device->device_data; struct ak4114 *chip = device->device_data;
snd_ak4114_free(chip); snd_ak4114_free(chip);
return 0; return 0;
} }
int snd_ak4114_create(snd_card_t *card, int snd_ak4114_create(struct snd_card *card,
ak4114_read_t *read, ak4114_write_t *write, ak4114_read_t *read, ak4114_write_t *write,
unsigned char pgm[7], unsigned char txcsb[5], unsigned char pgm[7], unsigned char txcsb[5],
void *private_data, ak4114_t **r_ak4114) void *private_data, struct ak4114 **r_ak4114)
{ {
ak4114_t *chip; struct ak4114 *chip;
int err = 0; int err = 0;
unsigned char reg; unsigned char reg;
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = snd_ak4114_dev_free, .dev_free = snd_ak4114_dev_free,
}; };
...@@ -129,7 +129,7 @@ int snd_ak4114_create(snd_card_t *card, ...@@ -129,7 +129,7 @@ int snd_ak4114_create(snd_card_t *card,
return err < 0 ? err : -EIO; return err < 0 ? err : -EIO;
} }
void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask, unsigned char val) void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val)
{ {
if (reg <= AK4114_REG_INT1_MASK) if (reg <= AK4114_REG_INT1_MASK)
reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val);
...@@ -137,7 +137,7 @@ void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask, ...@@ -137,7 +137,7 @@ void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask,
reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val); reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val);
} }
void snd_ak4114_reinit(ak4114_t *chip) void snd_ak4114_reinit(struct ak4114 *chip)
{ {
unsigned char old = chip->regmap[AK4114_REG_PWRDN], reg; unsigned char old = chip->regmap[AK4114_REG_PWRDN], reg;
...@@ -176,8 +176,8 @@ static unsigned int external_rate(unsigned char rcs1) ...@@ -176,8 +176,8 @@ static unsigned int external_rate(unsigned char rcs1)
} }
} }
static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol, static int snd_ak4114_in_error_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -186,10 +186,10 @@ static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol, ...@@ -186,10 +186,10 @@ static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol, static int snd_ak4114_in_error_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
long *ptr; long *ptr;
spin_lock_irq(&chip->lock); spin_lock_irq(&chip->lock);
...@@ -200,8 +200,8 @@ static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol, ...@@ -200,8 +200,8 @@ static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol, static int snd_ak4114_in_bit_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
...@@ -210,10 +210,10 @@ static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol, ...@@ -210,10 +210,10 @@ static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol, static int snd_ak4114_in_bit_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned char reg = kcontrol->private_value & 0xff; unsigned char reg = kcontrol->private_value & 0xff;
unsigned char bit = (kcontrol->private_value >> 8) & 0xff; unsigned char bit = (kcontrol->private_value >> 8) & 0xff;
unsigned char inv = (kcontrol->private_value >> 31) & 1; unsigned char inv = (kcontrol->private_value >> 31) & 1;
...@@ -222,8 +222,8 @@ static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol, ...@@ -222,8 +222,8 @@ static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol, static int snd_ak4114_rate_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -232,26 +232,26 @@ static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol, ...@@ -232,26 +232,26 @@ static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4114_rate_get(snd_kcontrol_t *kcontrol, static int snd_ak4114_rate_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4114_REG_RCS1)); ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4114_REG_RCS1));
return 0; return 0;
} }
static int snd_ak4114_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4114_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++) for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++)
...@@ -259,10 +259,10 @@ static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol, ...@@ -259,10 +259,10 @@ static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_playback_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++) for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
...@@ -270,10 +270,10 @@ static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol, ...@@ -270,10 +270,10 @@ static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_playback_put(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++) for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
...@@ -281,21 +281,21 @@ static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol, ...@@ -281,21 +281,21 @@ static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4114_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4114_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_ak4114_spdif_mask_get(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_mask_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE); memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE);
return 0; return 0;
} }
static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4114_spdif_pinfo(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->value.integer.min = 0; uinfo->value.integer.min = 0;
...@@ -304,10 +304,10 @@ static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -304,10 +304,10 @@ static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_pget(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned short tmp; unsigned short tmp;
ucontrol->value.integer.value[0] = 0xf8f2; ucontrol->value.integer.value[0] = 0xf8f2;
...@@ -319,17 +319,17 @@ static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol, ...@@ -319,17 +319,17 @@ static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4114_spdif_qinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4114_spdif_qinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = AK4114_REG_QSUB_SIZE; uinfo->count = AK4114_REG_QSUB_SIZE;
return 0; return 0;
} }
static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol, static int snd_ak4114_spdif_qget(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4114_t *chip = snd_kcontrol_chip(kcontrol); struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4114_REG_QSUB_SIZE; i++) for (i = 0; i < AK4114_REG_QSUB_SIZE; i++)
...@@ -338,14 +338,14 @@ static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol, ...@@ -338,14 +338,14 @@ static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol,
} }
/* Don't forget to change AK4114_CONTROLS define!!! */ /* Don't forget to change AK4114_CONTROLS define!!! */
static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "IEC958 Parity Errors", .name = "IEC958 Parity Errors",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4114_in_error_info, .info = snd_ak4114_in_error_info,
.get = snd_ak4114_in_error_get, .get = snd_ak4114_in_error_get,
.private_value = offsetof(ak4114_t, parity_errors), .private_value = offsetof(struct ak4114, parity_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -353,7 +353,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { ...@@ -353,7 +353,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4114_in_error_info, .info = snd_ak4114_in_error_info,
.get = snd_ak4114_in_error_get, .get = snd_ak4114_in_error_get,
.private_value = offsetof(ak4114_t, v_bit_errors), .private_value = offsetof(struct ak4114, v_bit_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -361,7 +361,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { ...@@ -361,7 +361,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4114_in_error_info, .info = snd_ak4114_in_error_info,
.get = snd_ak4114_in_error_get, .get = snd_ak4114_in_error_get,
.private_value = offsetof(ak4114_t, ccrc_errors), .private_value = offsetof(struct ak4114, ccrc_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -369,7 +369,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { ...@@ -369,7 +369,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4114_in_error_info, .info = snd_ak4114_in_error_info,
.get = snd_ak4114_in_error_get, .get = snd_ak4114_in_error_get,
.private_value = offsetof(ak4114_t, qcrc_errors), .private_value = offsetof(struct ak4114, qcrc_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -447,11 +447,11 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { ...@@ -447,11 +447,11 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
} }
}; };
int snd_ak4114_build(ak4114_t *ak4114, int snd_ak4114_build(struct ak4114 *ak4114,
snd_pcm_substream_t *ply_substream, struct snd_pcm_substream *ply_substream,
snd_pcm_substream_t *cap_substream) struct snd_pcm_substream *cap_substream)
{ {
snd_kcontrol_t *kctl; struct snd_kcontrol *kctl;
unsigned int idx; unsigned int idx;
int err; int err;
...@@ -482,7 +482,7 @@ int snd_ak4114_build(ak4114_t *ak4114, ...@@ -482,7 +482,7 @@ int snd_ak4114_build(ak4114_t *ak4114,
return 0; return 0;
} }
int snd_ak4114_external_rate(ak4114_t *ak4114) int snd_ak4114_external_rate(struct ak4114 *ak4114)
{ {
unsigned char rcs1; unsigned char rcs1;
...@@ -490,9 +490,9 @@ int snd_ak4114_external_rate(ak4114_t *ak4114) ...@@ -490,9 +490,9 @@ int snd_ak4114_external_rate(ak4114_t *ak4114)
return external_rate(rcs1); return external_rate(rcs1);
} }
int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
{ {
snd_pcm_runtime_t *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL; struct snd_pcm_runtime *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
unsigned long _flags; unsigned long _flags;
int res = 0; int res = 0;
unsigned char rcs0, rcs1; unsigned char rcs0, rcs1;
...@@ -563,7 +563,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) ...@@ -563,7 +563,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
static void ak4114_stats(void *data) static void ak4114_stats(void *data)
{ {
ak4114_t *chip = (ak4114_t *)data; struct ak4114 *chip = (struct ak4114 *)data;
if (chip->init) if (chip->init)
return; return;
......
...@@ -37,20 +37,20 @@ MODULE_LICENSE("GPL"); ...@@ -37,20 +37,20 @@ MODULE_LICENSE("GPL");
static void snd_ak4117_timer(unsigned long data); static void snd_ak4117_timer(unsigned long data);
static void reg_write(ak4117_t *ak4117, unsigned char reg, unsigned char val) static void reg_write(struct ak4117 *ak4117, unsigned char reg, unsigned char val)
{ {
ak4117->write(ak4117->private_data, reg, val); ak4117->write(ak4117->private_data, reg, val);
if (reg < sizeof(ak4117->regmap)) if (reg < sizeof(ak4117->regmap))
ak4117->regmap[reg] = val; ak4117->regmap[reg] = val;
} }
static inline unsigned char reg_read(ak4117_t *ak4117, unsigned char reg) static inline unsigned char reg_read(struct ak4117 *ak4117, unsigned char reg)
{ {
return ak4117->read(ak4117->private_data, reg); return ak4117->read(ak4117->private_data, reg);
} }
#if 0 #if 0
static void reg_dump(ak4117_t *ak4117) static void reg_dump(struct ak4117 *ak4117)
{ {
int i; int i;
...@@ -60,26 +60,26 @@ static void reg_dump(ak4117_t *ak4117) ...@@ -60,26 +60,26 @@ static void reg_dump(ak4117_t *ak4117)
} }
#endif #endif
static void snd_ak4117_free(ak4117_t *chip) static void snd_ak4117_free(struct ak4117 *chip)
{ {
del_timer(&chip->timer); del_timer(&chip->timer);
kfree(chip); kfree(chip);
} }
static int snd_ak4117_dev_free(snd_device_t *device) static int snd_ak4117_dev_free(struct snd_device *device)
{ {
ak4117_t *chip = device->device_data; struct ak4117 *chip = device->device_data;
snd_ak4117_free(chip); snd_ak4117_free(chip);
return 0; return 0;
} }
int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write,
unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117) unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117)
{ {
ak4117_t *chip; struct ak4117 *chip;
int err = 0; int err = 0;
unsigned char reg; unsigned char reg;
static snd_device_ops_t ops = { static struct snd_device_ops ops = {
.dev_free = snd_ak4117_dev_free, .dev_free = snd_ak4117_dev_free,
}; };
...@@ -115,14 +115,14 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri ...@@ -115,14 +115,14 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri
return err < 0 ? err : -EIO; return err < 0 ? err : -EIO;
} }
void snd_ak4117_reg_write(ak4117_t *chip, unsigned char reg, unsigned char mask, unsigned char val) void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val)
{ {
if (reg >= 5) if (reg >= 5)
return; return;
reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val);
} }
void snd_ak4117_reinit(ak4117_t *chip) void snd_ak4117_reinit(struct ak4117 *chip)
{ {
unsigned char old = chip->regmap[AK4117_REG_PWRDN], reg; unsigned char old = chip->regmap[AK4117_REG_PWRDN], reg;
...@@ -157,8 +157,8 @@ static unsigned int external_rate(unsigned char rcs1) ...@@ -157,8 +157,8 @@ static unsigned int external_rate(unsigned char rcs1)
} }
} }
static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol, static int snd_ak4117_in_error_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -167,10 +167,10 @@ static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol, ...@@ -167,10 +167,10 @@ static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol, static int snd_ak4117_in_error_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
long *ptr; long *ptr;
spin_lock_irq(&chip->lock); spin_lock_irq(&chip->lock);
...@@ -181,8 +181,8 @@ static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol, ...@@ -181,8 +181,8 @@ static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol, static int snd_ak4117_in_bit_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1; uinfo->count = 1;
...@@ -191,10 +191,10 @@ static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol, ...@@ -191,10 +191,10 @@ static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol, static int snd_ak4117_in_bit_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
unsigned char reg = kcontrol->private_value & 0xff; unsigned char reg = kcontrol->private_value & 0xff;
unsigned char bit = (kcontrol->private_value >> 8) & 0xff; unsigned char bit = (kcontrol->private_value >> 8) & 0xff;
unsigned char inv = (kcontrol->private_value >> 31) & 1; unsigned char inv = (kcontrol->private_value >> 31) & 1;
...@@ -203,8 +203,8 @@ static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol, ...@@ -203,8 +203,8 @@ static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol, static int snd_ak4117_rx_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -213,19 +213,19 @@ static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol, ...@@ -213,19 +213,19 @@ static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_rx_get(snd_kcontrol_t *kcontrol, static int snd_ak4117_rx_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = (chip->regmap[AK4117_REG_IO] & AK4117_IPS) ? 1 : 0; ucontrol->value.integer.value[0] = (chip->regmap[AK4117_REG_IO] & AK4117_IPS) ? 1 : 0;
return 0; return 0;
} }
static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol, static int snd_ak4117_rx_put(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
int change; int change;
u8 old_val; u8 old_val;
...@@ -238,8 +238,8 @@ static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol, ...@@ -238,8 +238,8 @@ static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol,
return change; return change;
} }
static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol, static int snd_ak4117_rate_info(struct snd_kcontrol *kcontrol,
snd_ctl_elem_info_t *uinfo) 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;
...@@ -248,26 +248,26 @@ static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol, ...@@ -248,26 +248,26 @@ static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol,
return 0; return 0;
} }
static int snd_ak4117_rate_get(snd_kcontrol_t *kcontrol, static int snd_ak4117_rate_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4117_REG_RCS1)); ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4117_REG_RCS1));
return 0; return 0;
} }
static int snd_ak4117_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4117_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol, static int snd_ak4117_spdif_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4117_REG_RXCSB_SIZE; i++) for (i = 0; i < AK4117_REG_RXCSB_SIZE; i++)
...@@ -275,21 +275,21 @@ static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol, ...@@ -275,21 +275,21 @@ static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4117_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4117_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
uinfo->count = 1; uinfo->count = 1;
return 0; return 0;
} }
static int snd_ak4117_spdif_mask_get(snd_kcontrol_t * kcontrol, static int snd_ak4117_spdif_mask_get(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
memset(ucontrol->value.iec958.status, 0xff, AK4117_REG_RXCSB_SIZE); memset(ucontrol->value.iec958.status, 0xff, AK4117_REG_RXCSB_SIZE);
return 0; return 0;
} }
static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4117_spdif_pinfo(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->value.integer.min = 0; uinfo->value.integer.min = 0;
...@@ -298,10 +298,10 @@ static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -298,10 +298,10 @@ static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol, static int snd_ak4117_spdif_pget(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
unsigned short tmp; unsigned short tmp;
ucontrol->value.integer.value[0] = 0xf8f2; ucontrol->value.integer.value[0] = 0xf8f2;
...@@ -313,17 +313,17 @@ static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol, ...@@ -313,17 +313,17 @@ static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol,
return 0; return 0;
} }
static int snd_ak4117_spdif_qinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ak4117_spdif_qinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{ {
uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
uinfo->count = AK4117_REG_QSUB_SIZE; uinfo->count = AK4117_REG_QSUB_SIZE;
return 0; return 0;
} }
static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol, static int snd_ak4117_spdif_qget(struct snd_kcontrol *kcontrol,
snd_ctl_elem_value_t * ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
ak4117_t *chip = snd_kcontrol_chip(kcontrol); struct ak4117 *chip = snd_kcontrol_chip(kcontrol);
unsigned i; unsigned i;
for (i = 0; i < AK4117_REG_QSUB_SIZE; i++) for (i = 0; i < AK4117_REG_QSUB_SIZE; i++)
...@@ -332,14 +332,14 @@ static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol, ...@@ -332,14 +332,14 @@ static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol,
} }
/* Don't forget to change AK4117_CONTROLS define!!! */ /* Don't forget to change AK4117_CONTROLS define!!! */
static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { static struct snd_kcontrol_new snd_ak4117_iec958_controls[] = {
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
.name = "IEC958 Parity Errors", .name = "IEC958 Parity Errors",
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4117_in_error_info, .info = snd_ak4117_in_error_info,
.get = snd_ak4117_in_error_get, .get = snd_ak4117_in_error_get,
.private_value = offsetof(ak4117_t, parity_errors), .private_value = offsetof(struct ak4117, parity_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -347,7 +347,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { ...@@ -347,7 +347,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4117_in_error_info, .info = snd_ak4117_in_error_info,
.get = snd_ak4117_in_error_get, .get = snd_ak4117_in_error_get,
.private_value = offsetof(ak4117_t, v_bit_errors), .private_value = offsetof(struct ak4117, v_bit_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -355,7 +355,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { ...@@ -355,7 +355,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4117_in_error_info, .info = snd_ak4117_in_error_info,
.get = snd_ak4117_in_error_get, .get = snd_ak4117_in_error_get,
.private_value = offsetof(ak4117_t, ccrc_errors), .private_value = offsetof(struct ak4117, ccrc_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -363,7 +363,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { ...@@ -363,7 +363,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
.info = snd_ak4117_in_error_info, .info = snd_ak4117_in_error_info,
.get = snd_ak4117_in_error_get, .get = snd_ak4117_in_error_get,
.private_value = offsetof(ak4117_t, qcrc_errors), .private_value = offsetof(struct ak4117, qcrc_errors),
}, },
{ {
.iface = SNDRV_CTL_ELEM_IFACE_PCM, .iface = SNDRV_CTL_ELEM_IFACE_PCM,
...@@ -434,9 +434,9 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { ...@@ -434,9 +434,9 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = {
} }
}; };
int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream) int snd_ak4117_build(struct ak4117 *ak4117, struct snd_pcm_substream *cap_substream)
{ {
snd_kcontrol_t *kctl; struct snd_kcontrol *kctl;
unsigned int idx; unsigned int idx;
int err; int err;
...@@ -456,7 +456,7 @@ int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream) ...@@ -456,7 +456,7 @@ int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream)
return 0; return 0;
} }
int snd_ak4117_external_rate(ak4117_t *ak4117) int snd_ak4117_external_rate(struct ak4117 *ak4117)
{ {
unsigned char rcs1; unsigned char rcs1;
...@@ -464,9 +464,9 @@ int snd_ak4117_external_rate(ak4117_t *ak4117) ...@@ -464,9 +464,9 @@ int snd_ak4117_external_rate(ak4117_t *ak4117)
return external_rate(rcs1); return external_rate(rcs1);
} }
int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags) int snd_ak4117_check_rate_and_errors(struct ak4117 *ak4117, unsigned int flags)
{ {
snd_pcm_runtime_t *runtime = ak4117->substream ? ak4117->substream->runtime : NULL; struct snd_pcm_runtime *runtime = ak4117->substream ? ak4117->substream->runtime : NULL;
unsigned long _flags; unsigned long _flags;
int res = 0; int res = 0;
unsigned char rcs0, rcs1, rcs2; unsigned char rcs0, rcs1, rcs2;
...@@ -542,7 +542,7 @@ int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags) ...@@ -542,7 +542,7 @@ int snd_ak4117_check_rate_and_errors(ak4117_t *ak4117, unsigned int flags)
static void snd_ak4117_timer(unsigned long data) static void snd_ak4117_timer(unsigned long data)
{ {
ak4117_t *chip = (ak4117_t *)data; struct ak4117 *chip = (struct ak4117 *)data;
if (chip->init) if (chip->init)
return; return;
......
...@@ -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