From 0948e3c8bb187b3dea38be1e1ffd1797866014f1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 10:25:22 +0100 Subject: [ALSA] Clean up sa11xx-uda1341 driver Modules: SA11xx UDA1341 driver,L3 drivers,UDA1341 Clean up sa11xx-uda1341 driver: - Fix buggy destructor - Remove the global variable - Move array definitions from uda1341.h - Make functions in uda1341.c static Signed-off-by: Takashi Iwai --- sound/i2c/l3/uda1341.c | 170 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 135 insertions(+), 35 deletions(-) (limited to 'sound/i2c/l3/uda1341.c') diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c index 103a7dcd0dde..bc7eb23e615f 100644 --- a/sound/i2c/l3/uda1341.c +++ b/sound/i2c/l3/uda1341.c @@ -17,7 +17,7 @@ * 2002-05-12 Tomas Kasparek another code cleanup */ -/* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */ +/* $Id: uda1341.c,v 1.17 2005/11/17 10:25:22 tiwai Exp $ */ #include #include @@ -56,6 +56,33 @@ /* }}} */ + +static const char *peak_names[] = { + "before", + "after", +}; + +static const char *filter_names[] = { + "flat", + "min", + "min", + "max", +}; + +static const char *mixer_names[] = { + "double differential", + "input channel 1 (line in)", + "input channel 2 (microphone)", + "digital mixer", +}; + +static const char *deemp_names[] = { + "none", + "32 kHz", + "44.1 kHz", + "48 kHz", +}; + enum uda1341_regs_names { stat0, stat1, @@ -73,7 +100,7 @@ enum uda1341_regs_names { uda1341_reg_last, }; -const char *uda1341_reg_names[] = { +static const char *uda1341_reg_names[] = { "stat 0 ", "stat 1 ", "data 00", @@ -89,7 +116,7 @@ const char *uda1341_reg_names[] = { "ext 6", }; -const int uda1341_enum_items[] = { +static const int uda1341_enum_items[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, //peak - before/after 4, //deemp - none/32/44.1/48 @@ -100,7 +127,7 @@ const int uda1341_enum_items[] = { 0, 0, 0, 0, 0, }; -const char ** uda1341_enum_names[] = { +static const char ** uda1341_enum_names[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, peak_names, //peak - before/after deemp_names, //deemp - none/32/44.1/48 @@ -129,11 +156,9 @@ struct uda1341 { #endif }; -//hack for ALSA magic casting -typedef struct l3_client l3_client_t; - /* transfer 8bit integer into string with binary representation */ -void int2str_bin8(uint8_t val, char *buf){ +static void int2str_bin8(uint8_t val, char *buf) +{ const int size = sizeof(val) * 8; int i; @@ -146,7 +171,7 @@ void int2str_bin8(uint8_t val, char *buf){ /* {{{ HW manipulation routines */ -int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned short val) +static int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned short val) { struct uda1341 *uda = clnt->driver_data; unsigned char buf[2] = { 0xc0, 0xe0 }; // for EXT addressing @@ -171,7 +196,7 @@ int snd_uda1341_codec_write(struct l3_client *clnt, unsigned short reg, unsigned return err; } -int snd_uda1341_codec_read(struct l3_client *clnt, unsigned short reg) +static int snd_uda1341_codec_read(struct l3_client *clnt, unsigned short reg) { unsigned char val; int err; @@ -188,8 +213,9 @@ static inline int snd_uda1341_valid_reg(struct l3_client *clnt, unsigned short r return reg < uda1341_reg_last; } -int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, unsigned short mask, - unsigned short shift, unsigned short value, int flush) +static int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, + unsigned short mask, unsigned short shift, + unsigned short value, int flush) { int change; unsigned short old, new; @@ -214,8 +240,8 @@ int snd_uda1341_update_bits(struct l3_client *clnt, unsigned short reg, unsigned return change; } -int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what, - unsigned short value, int flush) +static int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what, + unsigned short value, int flush) { struct uda1341 *uda = clnt->driver_data; int ret = 0; @@ -327,6 +353,81 @@ int snd_uda1341_cfg_write(struct l3_client *clnt, unsigned short what, /* }}} */ /* {{{ Proc interface */ +#ifdef CONFIG_PROC_FS + +static const char *format_names[] = { + "I2S-bus", + "LSB 16bits", + "LSB 18bits", + "LSB 20bits", + "MSB", + "in LSB 16bits/out MSB", + "in LSB 18bits/out MSB", + "in LSB 20bits/out MSB", +}; + +static const char *fs_names[] = { + "512*fs", + "384*fs", + "256*fs", + "Unused - bad value!", +}; + +static const char* bass_values[][16] = { + {"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", + "0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat + {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", + "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min + {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB", + "18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min + {"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB", + "22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max +}; + +static const char *mic_sens_value[] = { + "-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used", +}; + +static const unsigned short AGC_atime[] = { + 11, 16, 11, 16, 21, 11, 16, 21, +}; + +static const unsigned short AGC_dtime[] = { + 100, 100, 200, 200, 200, 400, 400, 400, +}; + +static const char *AGC_level[] = { + "-9.0", "-11.5", "-15.0", "-17.5", +}; + +static const char *ig_small_value[] = { + "-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5", +}; + +/* + * this was computed as peak_value[i] = pow((63-i)*1.42,1.013) + * + * UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2 + * There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29 + * [61]=-2.78, [62] = -1.48, [63] = 0.0 + * I tried to compute it, but using but even using logarithm with base either 10 or 2 + * i was'n able to get values in the table from the formula. So I constructed another + * formula (see above) to interpolate the values as good as possible. If there is some + * mistake, please contact me on tomas.kasparek@seznam.cz. Thanks. + * UDA1341TS datasheet is available at: + * http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf + */ +static const char *peak_value[] = { + "-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB", + "-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB", + "-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB", + "-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB", + "-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB", + "-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB", + "-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB", + "-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 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, snd_info_buffer_t * buffer) @@ -401,7 +502,6 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, int reg; char buf[12]; - spin_lock(&uda->reg_lock); for (reg = 0; reg < uda1341_reg_last; reg ++) { if (reg == empty) continue; @@ -411,9 +511,8 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, int2str_bin8(snd_uda1341_codec_read(clnt, UDA1341_DATA1), buf); snd_iprintf(buffer, "DATA1 = %s\n", buf); - - spin_unlock(&uda->reg_lock); } +#endif /* CONFIG_PROC_FS */ static void __devinit snd_uda1341_proc_init(snd_card_t *card, struct l3_client *clnt) { @@ -647,10 +746,10 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = { UDA1341_2REGS("Gain Input Amplifier Gain (channel 2)", CMD_IG, ext4, ext5, 0, 0, 3, 31, 0), }; -static void uda1341_free(struct l3_client *uda1341) +static void uda1341_free(struct l3_client *clnt) { - l3_detach_client(uda1341); // calls kfree for driver_data (uda1341_t) - kfree(uda1341); + l3_detach_client(clnt); // calls kfree for driver_data (uda1341_t) + kfree(clnt); } static int uda1341_dev_free(snd_device_t *device) @@ -660,41 +759,42 @@ static int uda1341_dev_free(snd_device_t *device) return 0; } -int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt) +int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clntp) { static snd_device_ops_t ops = { .dev_free = uda1341_dev_free, }; - struct l3_client *uda1341; + struct l3_client *clnt; int idx, err; snd_assert(card != NULL, return -EINVAL); - uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL); - if (uda1341 == NULL) + clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); + if (clnt == NULL) return -ENOMEM; - if ((err = l3_attach_client(uda1341, "l3-bit-sa1100-gpio", "snd-uda1341"))) { - kfree(uda1341); - return err; - } - - if ((err = snd_device_new(card, SNDRV_DEV_CODEC, uda1341, &ops)) < 0) { - l3_detach_client(uda1341); - kfree(uda1341); + if ((err = l3_attach_client(clnt, "l3-bit-sa1100-gpio", UDA1341_ALSA_NAME))) { + kfree(clnt); return err; } for (idx = 0; idx < ARRAY_SIZE(snd_uda1341_controls); idx++) { - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], uda1341))) < 0) + if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_uda1341_controls[idx], clnt))) < 0) { + uda1341_free(clnt); return err; + } + } + + if ((err = snd_device_new(card, SNDRV_DEV_CODEC, clnt, &ops)) < 0) { + uda1341_free(clnt); + return err; } - *clnt = uda1341; + *clntp = clnt; strcpy(card->mixername, "UDA1341TS Mixer"); ((uda1341_t *)uda1341->driver_data)->card = card; - snd_uda1341_proc_init(card, uda1341); + snd_uda1341_proc_init(card, clnt); return 0; } -- cgit v1.2.3 From 97f02e05f246a2346275c1c93a3079e8933e74b2 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 14:17:19 +0100 Subject: [ALSA] Remove xxx_t typedefs: I2C drivers Remove xxx_t typedefs from the i2c drivers. Signed-off-by: Takashi Iwai --- include/sound/cs8403.h | 8 +-- include/sound/cs8427.h | 17 +++-- include/sound/i2c.h | 78 +++++++++++----------- include/sound/tea575x-tuner.h | 12 ++-- include/sound/tea6330t.h | 5 +- include/sound/uda1341.h | 4 +- sound/i2c/cs8427.c | 142 ++++++++++++++++++++++------------------ sound/i2c/i2c.c | 79 ++++++++++++---------- sound/i2c/l3/uda1341.c | 69 ++++++++++--------- sound/i2c/other/ak4114.c | 122 +++++++++++++++++----------------- sound/i2c/other/ak4117.c | 122 +++++++++++++++++----------------- sound/i2c/other/ak4xxx-adda.c | 49 ++++++++------ sound/i2c/other/tea575x-tuner.c | 8 +-- sound/i2c/tea6330t.c | 84 ++++++++++++++---------- 14 files changed, 429 insertions(+), 370 deletions(-) (limited to 'sound/i2c/l3/uda1341.c') diff --git a/include/sound/cs8403.h b/include/sound/cs8403.h index 0b7d216e24f1..c6c3f9f0da78 100644 --- a/include/sound/cs8403.h +++ b/include/sound/cs8403.h @@ -36,7 +36,7 @@ #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 & 0x02)) @@ -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; @@ -166,7 +166,7 @@ SND_CS8403_DECL unsigned char SND_CS8403_ENCODE(snd_aes_iec958_t *diga) #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 & 0x20)) @@ -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; diff --git a/include/sound/cs8427.h b/include/sound/cs8427.h index e725b7049a53..97fd9acf8028 100644 --- a/include/sound/cs8427.h +++ b/include/sound/cs8427.h @@ -186,11 +186,16 @@ #define CS8427_VERSHIFT 0 #define CS8427_VER8427A 0x71 -int snd_cs8427_create(snd_i2c_bus_t *bus, unsigned char addr, - 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_iec958_build(snd_i2c_device_t *cs8427, snd_pcm_substream_t *playback_substream, snd_pcm_substream_t *capture_substream); -int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active); -int snd_cs8427_iec958_pcm(snd_i2c_device_t *cs8427, unsigned int rate); +struct snd_pcm_substream; + +int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr, + unsigned int reset_timeout, struct snd_i2c_device **r_cs8427); +int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg, + 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 */ diff --git a/include/sound/i2c.h b/include/sound/i2c.h index a665ddf9c146..81eb23ed761f 100644 --- a/include/sound/i2c.h +++ b/include/sound/i2c.h @@ -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 */ -struct _snd_i2c_device { +struct snd_i2c_device { 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 */ unsigned short flags; /* device flags */ unsigned short addr; /* device address (might be 10-bit) */ unsigned long private_value; 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) - -typedef struct _snd_i2c_bit_ops { - void (*start)(snd_i2c_bus_t *bus); /* transfer start */ - 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); - int (*getclock)(snd_i2c_bus_t *bus); - 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 */ +struct snd_i2c_ops { + int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); + int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); + int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr); +}; + +struct snd_i2c_bus { + struct snd_card *card; /* card which I2C belongs to */ char name[32]; /* some useful label */ 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 devices; /* attached devices to this bus */ union { - snd_i2c_bit_ops_t *bit; + struct snd_i2c_bit_ops *bit; void *ops; } hw_ops; /* lowlevel operations */ - snd_i2c_ops_t *ops; /* midlevel operations */ + struct snd_i2c_ops *ops; /* midlevel operations */ unsigned long private_value; 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_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); -int snd_i2c_device_free(snd_i2c_device_t *device); +int snd_i2c_bus_create(struct snd_card *card, const char *name, + struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c); +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) down(&bus->master->lock_mutex); else 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) up(&bus->master->lock_mutex); else up(&bus->lock_mutex); } -int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); +int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); +int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); +int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr); #endif /* __SOUND_I2C_H */ diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index b82e408e758f..a4f554520197 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -24,15 +24,15 @@ #include -typedef struct snd_tea575x tea575x_t; +struct snd_tea575x; struct snd_tea575x_ops { - void (*write)(tea575x_t *tea, unsigned int val); - unsigned int (*read)(tea575x_t *tea); + void (*write)(struct snd_tea575x *tea, unsigned int val); + unsigned int (*read)(struct snd_tea575x *tea); }; struct snd_tea575x { - snd_card_t *card; + struct snd_card *card; struct video_device vd; /* video device */ struct file_operations fops; int dev_nr; /* requested device number + 1 */ @@ -45,7 +45,7 @@ struct snd_tea575x { void *private_data; }; -void snd_tea575x_init(tea575x_t *tea); -void snd_tea575x_exit(tea575x_t *tea); +void snd_tea575x_init(struct snd_tea575x *tea); +void snd_tea575x_exit(struct snd_tea575x *tea); #endif /* __SOUND_TEA575X_TUNER_H */ diff --git a/include/sound/tea6330t.h b/include/sound/tea6330t.h index 1b265bf24ee1..51b282b76896 100644 --- a/include/sound/tea6330t.h +++ b/include/sound/tea6330t.h @@ -24,7 +24,8 @@ #include "i2c.h" /* generic i2c support */ -int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer); -int snd_tea6330t_update_mixer(snd_card_t * card, snd_i2c_bus_t * bus, int equalizer, int fader); +int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer); +int snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus, + int equalizer, int fader); #endif /* __SOUND_TEA6330T_H */ diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h index 54a048ac6e4f..2e564bfb37fe 100644 --- a/include/sound/uda1341.h +++ b/include/sound/uda1341.h @@ -15,7 +15,7 @@ * 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" @@ -119,7 +119,7 @@ enum write_through { 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: diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 1a05cfbdc7c6..9deba80a587c 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c @@ -30,7 +30,7 @@ #include #include -static void snd_cs8427_reset(snd_i2c_device_t *cs8427); +static void snd_cs8427_reset(struct snd_i2c_device *cs8427); MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic"); @@ -38,22 +38,22 @@ MODULE_LICENSE("GPL"); #define CS8427_ADDR (0x20>>1) /* fixed address */ -typedef struct { - snd_pcm_substream_t *substream; +struct cs8427_stream { + struct snd_pcm_substream *substream; char hw_status[24]; /* hardware status */ char def_status[24]; /* default status */ char pcm_status[24]; /* PCM private status */ char hw_udata[32]; - snd_kcontrol_t *pcm_ctl; -} cs8427_stream_t; + struct snd_kcontrol *pcm_ctl; +}; -typedef struct { +struct cs8427 { unsigned char regmap[0x14]; /* map of first 1 + 13 registers */ unsigned int rate; unsigned int reset_timeout; - cs8427_stream_t playback; - cs8427_stream_t capture; -} cs8427_t; + struct cs8427_stream playback; + struct cs8427_stream capture; +}; static unsigned char swapbits(unsigned char val) { @@ -67,7 +67,8 @@ static unsigned char swapbits(unsigned char val) 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; unsigned char buf[2]; @@ -81,7 +82,7 @@ int snd_cs8427_reg_write(snd_i2c_device_t *device, unsigned char reg, unsigned c 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; unsigned char buf; @@ -97,28 +98,29 @@ static int snd_cs8427_reg_read(snd_i2c_device_t *device, unsigned char reg) 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; udata = udata ? CS8427_BSEL : 0; if (udata != (chip->regmap[CS8427_REG_CSDATABUF] & udata)) { chip->regmap[CS8427_REG_CSDATABUF] &= ~CS8427_BSEL; 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) return err; } 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, unsigned char *ndata, 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 data[32]; int err, idx; @@ -133,7 +135,8 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device, if (memcmp(hw_data, data, count) == 0) { chip->regmap[CS8427_REG_UDATABUF] &= ~CS8427_UBMMASK; 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 0; } @@ -146,15 +149,15 @@ static int snd_cs8427_send_corudata(snd_i2c_device_t *device, 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); } -int snd_cs8427_create(snd_i2c_bus_t *bus, +int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr, unsigned int reset_timeout, - snd_i2c_device_t **r_cs8427) + struct snd_i2c_device **r_cs8427) { static unsigned char initvals1[] = { CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, @@ -194,11 +197,12 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, CS8427_UD | CS8427_EFTUI | CS8427_DETUI, }; int err; - cs8427_t *chip; - snd_i2c_device_t *device; + struct cs8427 *chip; + struct snd_i2c_device *device; 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; chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); if (chip == NULL) { @@ -208,9 +212,13 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, device->private_free = snd_cs8427_free; 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_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; } /* turn off run bit while making changes to configuration */ @@ -279,9 +287,9 @@ int snd_cs8427_create(snd_i2c_bus_t *bus, * put back AES3INPUT. This workaround is described in latest * 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; int data; @@ -289,10 +297,12 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427) chip = cs8427->private_data; snd_i2c_lock(cs8427->bus); 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); 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); snd_i2c_unlock(cs8427->bus); end_time = jiffies + chip->reset_timeout; @@ -307,12 +317,13 @@ static void snd_cs8427_reset(snd_i2c_device_t *cs8427) snd_i2c_lock(cs8427->bus); chip->regmap[CS8427_REG_CLOCKSOURCE] &= ~CS8427_RXDMASK; 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); } -static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_cs8427_in_status_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -321,10 +332,10 @@ static int snd_cs8427_in_status_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_cs8427_in_status_get(struct snd_kcontrol *kcontrol, + 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; snd_i2c_lock(device->bus); @@ -336,18 +347,18 @@ static int snd_cs8427_in_status_get(snd_kcontrol_t *kcontrol, return 0; } -static int snd_cs8427_qsubcode_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_cs8427_qsubcode_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; uinfo->count = 10; return 0; } -static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_cs8427_qsubcode_get(struct snd_kcontrol *kcontrol, + 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; int err; @@ -366,18 +377,18 @@ static int snd_cs8427_qsubcode_get(snd_kcontrol_t *kcontrol, 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->count = 1; return 0; } -static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_cs8427_spdif_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); - cs8427_t *chip = device->private_data; + struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol); + struct cs8427 *chip = device->private_data; snd_i2c_lock(device->bus); memcpy(ucontrol->value.iec958.status, chip->playback.def_status, 24); @@ -385,13 +396,15 @@ static int snd_cs8427_spdif_get(snd_kcontrol_t * kcontrol, return 0; } -static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_cs8427_spdif_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - snd_i2c_device_t *device = snd_kcontrol_chip(kcontrol); - cs8427_t *chip = device->private_data; - unsigned char *status = kcontrol->private_value ? chip->playback.pcm_status : chip->playback.def_status; - snd_pcm_runtime_t *runtime = chip->playback.substream ? chip->playback.substream->runtime : NULL; + struct snd_i2c_device *device = snd_kcontrol_chip(kcontrol); + struct cs8427 *chip = device->private_data; + unsigned char *status = kcontrol->private_value ? + chip->playback.pcm_status : chip->playback.def_status; + struct snd_pcm_runtime *runtime = chip->playback.substream ? + chip->playback.substream->runtime : NULL; int err, change; snd_i2c_lock(device->bus); @@ -406,21 +419,22 @@ static int snd_cs8427_spdif_put(snd_kcontrol_t * kcontrol, 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->count = 1; return 0; } -static int snd_cs8427_spdif_mask_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_cs8427_spdif_mask_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { memset(ucontrol->value.iec958.status, 0xff, 24); 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, .info = snd_cs8427_in_status_info, @@ -469,12 +483,12 @@ static snd_kcontrol_new_t snd_cs8427_iec958_controls[] = { .get = snd_cs8427_qsubcode_get }}; -int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, - snd_pcm_substream_t *play_substream, - snd_pcm_substream_t *cap_substream) +int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427, + struct snd_pcm_substream *play_substream, + struct snd_pcm_substream *cap_substream) { - cs8427_t *chip = cs8427->private_data; - snd_kcontrol_t *kctl; + struct cs8427 *chip = cs8427->private_data; + struct snd_kcontrol *kctl; unsigned int idx; int err; @@ -498,9 +512,9 @@ int snd_cs8427_iec958_build(snd_i2c_device_t *cs8427, 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); chip = cs8427->private_data; @@ -512,9 +526,9 @@ int snd_cs8427_iec958_active(snd_i2c_device_t *cs8427, int active) 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; int err, reset; diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c index e4e505b9d88b..c4e1f2c23ced 100644 --- a/sound/i2c/i2c.c +++ b/sound/i2c/i2c.c @@ -32,20 +32,23 @@ MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("Generic i2c interface for ALSA"); MODULE_LICENSE("GPL"); -static int snd_i2c_bit_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -static int snd_i2c_bit_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); -static int snd_i2c_bit_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); - -static snd_i2c_ops_t snd_i2c_bit_ops = { +static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device, + unsigned char *bytes, int count); +static int snd_i2c_bit_readbytes(struct snd_i2c_device *device, + unsigned char *bytes, int count); +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, .readbytes = snd_i2c_bit_readbytes, .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; - snd_i2c_device_t *device; + struct snd_i2c_bus *slave; + struct snd_i2c_device *device; snd_assert(bus != NULL, return -EINVAL); while (!list_empty(&bus->devices)) { @@ -66,17 +69,18 @@ static int snd_i2c_bus_free(snd_i2c_bus_t *bus) 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); } -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; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .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 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; 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 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) list_del(&device->list); @@ -129,18 +134,18 @@ int snd_i2c_device_free(snd_i2c_device_t *device) 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); } -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); } -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); } @@ -149,31 +154,31 @@ int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr) * 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) 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) 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) 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); } #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) return bus->hw_ops.bit->getclock(bus); @@ -181,12 +186,12 @@ static int snd_i2c_bit_clock(snd_i2c_bus_t *bus) } #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); } -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_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ @@ -195,7 +200,7 @@ static void snd_i2c_bit_start(snd_i2c_bus_t *bus) 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, 1, 0); @@ -203,14 +208,14 @@ static void snd_i2c_bit_stop(snd_i2c_bus_t *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, 1, 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; @@ -223,7 +228,7 @@ static int snd_i2c_bit_ack(snd_i2c_bus_t *bus) 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; @@ -234,7 +239,7 @@ static int snd_i2c_bit_sendbyte(snd_i2c_bus_t *bus, unsigned char data) 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; unsigned char data = 0; @@ -252,9 +257,10 @@ static int snd_i2c_bit_readbyte(snd_i2c_bus_t *bus, int last) 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; 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, 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; 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, 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; diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c index bc7eb23e615f..746500e06950 100644 --- a/sound/i2c/l3/uda1341.c +++ b/sound/i2c/l3/uda1341.c @@ -17,7 +17,7 @@ * 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 #include @@ -140,15 +140,13 @@ static const char ** uda1341_enum_names[] = { typedef int uda1341_cfg[CMD_LAST]; -typedef struct uda1341 uda1341_t; - struct uda1341 { int (*write) (struct l3_client *uda1341, unsigned short reg, unsigned short val); int (*read) (struct l3_client *uda1341, unsigned short reg); unsigned char regs[uda1341_reg_last]; int active; spinlock_t reg_lock; - snd_card_t *card; + struct snd_card *card; uda1341_cfg cfg; #ifdef CONFIG_PM unsigned char suspend_regs[uda1341_reg_last]; @@ -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", }; -static void snd_uda1341_proc_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_uda1341_proc_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { struct l3_client *clnt = entry->private_data; struct uda1341 *uda = clnt->driver_data; @@ -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]]); } -static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, - snd_info_buffer_t * buffer) +static void snd_uda1341_proc_regs_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) { struct l3_client *clnt = entry->private_data; struct uda1341 *uda = clnt->driver_data; @@ -514,9 +512,9 @@ static void snd_uda1341_proc_regs_read(snd_info_entry_t *entry, } #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)) 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 * .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; @@ -547,10 +546,11 @@ static int snd_uda1341_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; int mask = (kcontrol->private_value >> 12) & 63; 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_ 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; int reg = (kcontrol->private_value >> 5) & 15; 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_ .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; const char **texts; @@ -612,20 +614,22 @@ static int snd_uda1341_info_enum(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; ucontrol->value.enumerated.item[0] = uda->cfg[where]; 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; int reg = (kcontrol->private_value >> 5) & 15; 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 } -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_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 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; int mask_1 = (kcontrol->private_value >> 19) & 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 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); - uda1341_t *uda = clnt->driver_data; + struct uda1341 *uda = clnt->driver_data; int where = kcontrol->private_value & 31; int reg_1 = (kcontrol->private_value >> 5) & 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 /* }}} */ -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 Volume", CMD_VOLUME, data0_0, 0, 63, 1), @@ -748,20 +755,20 @@ static snd_kcontrol_new_t snd_uda1341_controls[] = { 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); } -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; uda1341_free(clnt); 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, }; struct l3_client *clnt; @@ -792,7 +799,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clntp *clntp = clnt; 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); diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index d351b3aa1916..12ffffc9e814 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); 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); if (reg <= AK4114_REG_INT1_MASK) @@ -46,13 +46,13 @@ static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char 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); } #if 0 -static void reg_dump(ak4114_t *ak4114) +static void reg_dump(struct ak4114 *ak4114) { int i; @@ -62,7 +62,7 @@ static void reg_dump(ak4114_t *ak4114) } #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 */ mb(); @@ -73,22 +73,22 @@ static void snd_ak4114_free(ak4114_t *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); 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, 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; unsigned char reg; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_ak4114_dev_free, }; @@ -129,7 +129,7 @@ int snd_ak4114_create(snd_card_t *card, 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) 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, 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; @@ -176,8 +176,8 @@ static unsigned int external_rate(unsigned char rcs1) } } -static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4114_in_error_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -186,10 +186,10 @@ static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4114_in_error_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); long *ptr; spin_lock_irq(&chip->lock); @@ -200,8 +200,8 @@ static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4114_in_bit_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -210,10 +210,10 @@ static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4114_in_bit_get(struct snd_kcontrol *kcontrol, + 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 bit = (kcontrol->private_value >> 8) & 0xff; unsigned char inv = (kcontrol->private_value >> 31) & 1; @@ -222,8 +222,8 @@ static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4114_rate_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -232,26 +232,26 @@ static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4114_rate_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4114_rate_get(struct snd_kcontrol *kcontrol, + 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)); 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->count = 1; return 0; } -static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); unsigned i; for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++) @@ -259,10 +259,10 @@ static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol, return 0; } -static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_playback_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); unsigned 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, return 0; } -static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_playback_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); unsigned 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, 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->count = 1; return 0; } -static int snd_ak4114_spdif_mask_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_mask_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE); 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->value.integer.min = 0; @@ -304,10 +304,10 @@ static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_pget(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); unsigned short tmp; ucontrol->value.integer.value[0] = 0xf8f2; @@ -319,17 +319,17 @@ static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol, 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->count = AK4114_REG_QSUB_SIZE; return 0; } -static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4114_spdif_qget(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4114_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4114 *chip = snd_kcontrol_chip(kcontrol); unsigned i; for (i = 0; i < AK4114_REG_QSUB_SIZE; i++) @@ -338,14 +338,14 @@ static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol, } /* 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, .name = "IEC958 Parity Errors", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4114_in_error_info, .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, @@ -353,7 +353,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4114_in_error_info, .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, @@ -361,7 +361,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4114_in_error_info, .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, @@ -369,7 +369,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4114_in_error_info, .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, @@ -447,11 +447,11 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = { } }; -int snd_ak4114_build(ak4114_t *ak4114, - snd_pcm_substream_t *ply_substream, - snd_pcm_substream_t *cap_substream) +int snd_ak4114_build(struct ak4114 *ak4114, + struct snd_pcm_substream *ply_substream, + struct snd_pcm_substream *cap_substream) { - snd_kcontrol_t *kctl; + struct snd_kcontrol *kctl; unsigned int idx; int err; @@ -482,7 +482,7 @@ int snd_ak4114_build(ak4114_t *ak4114, return 0; } -int snd_ak4114_external_rate(ak4114_t *ak4114) +int snd_ak4114_external_rate(struct ak4114 *ak4114) { unsigned char rcs1; @@ -490,9 +490,9 @@ int snd_ak4114_external_rate(ak4114_t *ak4114) 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; int res = 0; unsigned char rcs0, rcs1; @@ -563,7 +563,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags) static void ak4114_stats(void *data) { - ak4114_t *chip = (ak4114_t *)data; + struct ak4114 *chip = (struct ak4114 *)data; if (chip->init) return; diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index 35b4584483a3..4e45952dd95a 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c @@ -37,20 +37,20 @@ MODULE_LICENSE("GPL"); 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); if (reg < sizeof(ak4117->regmap)) 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); } #if 0 -static void reg_dump(ak4117_t *ak4117) +static void reg_dump(struct ak4117 *ak4117) { int i; @@ -60,26 +60,26 @@ static void reg_dump(ak4117_t *ak4117) } #endif -static void snd_ak4117_free(ak4117_t *chip) +static void snd_ak4117_free(struct ak4117 *chip) { del_timer(&chip->timer); 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); return 0; } -int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *write, - unsigned char pgm[5], void *private_data, ak4117_t **r_ak4117) +int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t *write, + unsigned char pgm[5], void *private_data, struct ak4117 **r_ak4117) { - ak4117_t *chip; + struct ak4117 *chip; int err = 0; unsigned char reg; - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .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 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) return; 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; @@ -157,8 +157,8 @@ static unsigned int external_rate(unsigned char rcs1) } } -static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4117_in_error_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -167,10 +167,10 @@ static int snd_ak4117_in_error_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4117_in_error_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4117_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4117 *chip = snd_kcontrol_chip(kcontrol); long *ptr; spin_lock_irq(&chip->lock); @@ -181,8 +181,8 @@ static int snd_ak4117_in_error_get(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4117_in_bit_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; uinfo->count = 1; @@ -191,10 +191,10 @@ static int snd_ak4117_in_bit_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4117_in_bit_get(struct snd_kcontrol *kcontrol, + 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 bit = (kcontrol->private_value >> 8) & 0xff; unsigned char inv = (kcontrol->private_value >> 31) & 1; @@ -203,8 +203,8 @@ static int snd_ak4117_in_bit_get(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4117_rx_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -213,19 +213,19 @@ static int snd_ak4117_rx_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_rx_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4117_rx_get(struct snd_kcontrol *kcontrol, + 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; return 0; } -static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4117_rx_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4117_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4117 *chip = snd_kcontrol_chip(kcontrol); int change; u8 old_val; @@ -238,8 +238,8 @@ static int snd_ak4117_rx_put(snd_kcontrol_t *kcontrol, return change; } -static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol, - snd_ctl_elem_info_t *uinfo) +static int snd_ak4117_rate_info(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; @@ -248,26 +248,26 @@ static int snd_ak4117_rate_info(snd_kcontrol_t *kcontrol, return 0; } -static int snd_ak4117_rate_get(snd_kcontrol_t *kcontrol, - snd_ctl_elem_value_t *ucontrol) +static int snd_ak4117_rate_get(struct snd_kcontrol *kcontrol, + 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)); 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->count = 1; return 0; } -static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4117_spdif_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4117_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4117 *chip = snd_kcontrol_chip(kcontrol); unsigned i; for (i = 0; i < AK4117_REG_RXCSB_SIZE; i++) @@ -275,21 +275,21 @@ static int snd_ak4117_spdif_get(snd_kcontrol_t * kcontrol, 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->count = 1; return 0; } -static int snd_ak4117_spdif_mask_get(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4117_spdif_mask_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { memset(ucontrol->value.iec958.status, 0xff, AK4117_REG_RXCSB_SIZE); 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->value.integer.min = 0; @@ -298,10 +298,10 @@ static int snd_ak4117_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4117_spdif_pget(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4117_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4117 *chip = snd_kcontrol_chip(kcontrol); unsigned short tmp; ucontrol->value.integer.value[0] = 0xf8f2; @@ -313,17 +313,17 @@ static int snd_ak4117_spdif_pget(snd_kcontrol_t * kcontrol, 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->count = AK4117_REG_QSUB_SIZE; return 0; } -static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol, - snd_ctl_elem_value_t * ucontrol) +static int snd_ak4117_spdif_qget(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { - ak4117_t *chip = snd_kcontrol_chip(kcontrol); + struct ak4117 *chip = snd_kcontrol_chip(kcontrol); unsigned i; for (i = 0; i < AK4117_REG_QSUB_SIZE; i++) @@ -332,14 +332,14 @@ static int snd_ak4117_spdif_qget(snd_kcontrol_t * kcontrol, } /* 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, .name = "IEC958 Parity Errors", .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4117_in_error_info, .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, @@ -347,7 +347,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4117_in_error_info, .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, @@ -355,7 +355,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4117_in_error_info, .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, @@ -363,7 +363,7 @@ static snd_kcontrol_new_t snd_ak4117_iec958_controls[] = { .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, .info = snd_ak4117_in_error_info, .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, @@ -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; int err; @@ -456,7 +456,7 @@ int snd_ak4117_build(ak4117_t *ak4117, snd_pcm_substream_t *cap_substream) return 0; } -int snd_ak4117_external_rate(ak4117_t *ak4117) +int snd_ak4117_external_rate(struct ak4117 *ak4117) { unsigned char rcs1; @@ -464,9 +464,9 @@ int snd_ak4117_external_rate(ak4117_t *ak4117) 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; int res = 0; unsigned char rcs0, rcs1, rcs2; @@ -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) { - ak4117_t *chip = (ak4117_t *)data; + struct ak4117 *chip = (struct ak4117 *)data; if (chip->init) return; diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index db2b7274a9d6..045e32a311e0 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c @@ -34,7 +34,7 @@ MODULE_AUTHOR("Jaroslav Kysela , Takashi Iwai "); MODULE_DESCRIPTION("Routines for control of AK452x / AK43xx AD/DA converters"); 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.write(ak, chip, reg, val); @@ -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. */ -void snd_akm4xxx_reset(akm4xxx_t *ak, int state) +void snd_akm4xxx_reset(struct snd_akm4xxx *ak, int state) { unsigned int chip; unsigned char reg; @@ -109,7 +109,7 @@ void snd_akm4xxx_reset(akm4xxx_t *ak, int state) /* * 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[] = { 0x00, 0x07, /* 0: all power up */ @@ -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_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); @@ -258,9 +259,10 @@ static int snd_akm4xxx_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t 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 addr = AK_GET_ADDR(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 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 addr = AK_GET_ADDR(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 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->count = 1; @@ -298,18 +302,20 @@ static int snd_akm4xxx_ipga_gain_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf 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 addr = AK_GET_ADDR(kcontrol->private_value); ucontrol->value.integer.value[0] = snd_akm4xxx_get_ipga(ak, chip, addr) & 0x7f; 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 addr = AK_GET_ADDR(kcontrol->private_value); 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 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] = { "44.1kHz", "Off", "48kHz", "32kHz", @@ -333,9 +340,10 @@ static int snd_akm4xxx_deemphasis_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_in 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 addr = AK_GET_ADDR(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 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 addr = AK_GET_ADDR(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 * 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; - snd_kcontrol_t *ctl; + struct snd_kcontrol *ctl; int err; ctl = kmalloc(sizeof(*ctl), GFP_KERNEL); diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 0f05a2b9a370..4c2fd14c1056 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -58,7 +58,7 @@ MODULE_LICENSE("GPL"); * lowlevel part */ -static void snd_tea575x_set_freq(tea575x_t *tea) +static void snd_tea575x_set_freq(struct snd_tea575x *tea) { unsigned long freq; @@ -89,7 +89,7 @@ static int snd_tea575x_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data) { 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; switch(cmd) { @@ -175,7 +175,7 @@ static void snd_tea575x_release(struct video_device *vfd) /* * initialize all the tea575x chips */ -void snd_tea575x_init(tea575x_t *tea) +void snd_tea575x_init(struct snd_tea575x *tea) { unsigned int val; @@ -209,7 +209,7 @@ void snd_tea575x_init(tea575x_t *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) { video_unregister_device(&tea->vd); diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c index 7bd4948c2a3b..ae5b1e3a68ce 100644 --- a/sound/i2c/tea6330t.c +++ b/sound/i2c/tea6330t.c @@ -44,18 +44,20 @@ MODULE_LICENSE("GPL"); #define TEA6330T_GMU 0x80 /* mute control, general mute */ #define TEA6330T_EQN 0x40 /* equalizer switchover (0=equalizer-on) */ -typedef struct { - snd_i2c_device_t *device; - snd_i2c_bus_t *bus; + +struct tea6330t { + struct snd_i2c_device *device; + struct snd_i2c_bus *bus; int equalizer; int fader; unsigned char regs[8]; unsigned char mleft, mright; unsigned char bass, 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; @@ -66,7 +68,7 @@ int snd_tea6330t_detect(snd_i2c_bus_t *bus, int equalizer) } #if 0 -static void snd_tea6330t_set(tea6330t_t *tea, +static void snd_tea6330t_set(struct tea6330t *tea, unsigned char addr, unsigned char value) { #if 0 @@ -81,7 +83,8 @@ static void snd_tea6330t_set(tea6330t_t *tea, .info = snd_tea6330t_info_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->count = 2; @@ -90,9 +93,10 @@ static int snd_tea6330t_info_master_volume(snd_kcontrol_t *kcontrol, snd_ctl_ele 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); 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 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; unsigned char bytes[3]; unsigned char val1, val2; @@ -137,7 +142,8 @@ static int snd_tea6330t_put_master_volume(snd_kcontrol_t * kcontrol, snd_ctl_ele .info = snd_tea6330t_info_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->count = 2; @@ -146,9 +152,10 @@ static int snd_tea6330t_info_master_switch(snd_kcontrol_t *kcontrol, snd_ctl_ele 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); 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 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; unsigned char bytes[3]; unsigned char oval1, oval2, val1, val2; @@ -186,9 +194,10 @@ static int snd_tea6330t_put_master_switch(snd_kcontrol_t * kcontrol, snd_ctl_ele .info = snd_tea6330t_info_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->count = 1; @@ -197,17 +206,19 @@ static int snd_tea6330t_info_bass(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t 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; 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; unsigned char bytes[2]; unsigned char val1; @@ -230,9 +241,10 @@ static int snd_tea6330t_put_bass(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t .info = snd_tea6330t_info_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->count = 1; @@ -241,17 +253,19 @@ static int snd_tea6330t_info_treble(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_ 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; 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; unsigned char bytes[2]; unsigned char val1; @@ -269,25 +283,25 @@ static int snd_tea6330t_put_treble(snd_kcontrol_t * kcontrol, snd_ctl_elem_value 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_VOLUME("Master Playback Volume", 0), TEA6330T_BASS("Tone Control - Bass", 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); } -int snd_tea6330t_update_mixer(snd_card_t * card, - snd_i2c_bus_t *bus, +int snd_tea6330t_update_mixer(struct snd_card *card, + struct snd_i2c_bus *bus, int equalizer, int fader) { - snd_i2c_device_t *device; - tea6330t_t *tea; - snd_kcontrol_new_t *knew; + struct snd_i2c_device *device; + struct tea6330t *tea; + struct snd_kcontrol_new *knew; unsigned int idx; int err = -ENOMEM; u8 default_treble, default_bass; -- cgit v1.2.3