diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 08:17:19 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:18:08 -0500 |
commit | 97f02e05f246a2346275c1c93a3079e8933e74b2 (patch) | |
tree | 218d0a71f8bdeb5e6d2660339c29c46dab1adaa7 /include/sound/i2c.h | |
parent | a42dd420bea7a5cd130162183d95f640c299a337 (diff) |
[ALSA] Remove xxx_t typedefs: I2C drivers
Remove xxx_t typedefs from the i2c drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/i2c.h')
-rw-r--r-- | include/sound/i2c.h | 78 |
1 files changed, 40 insertions, 38 deletions
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 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | typedef struct _snd_i2c_device snd_i2c_device_t; | ||
25 | typedef struct _snd_i2c_bus snd_i2c_bus_t; | ||
26 | |||
27 | #define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ | 24 | #define SND_I2C_DEVICE_ADDRTEN (1<<0) /* 10-bit I2C address */ |
28 | 25 | ||
29 | struct _snd_i2c_device { | 26 | struct snd_i2c_device { |
30 | struct list_head list; | 27 | struct list_head list; |
31 | snd_i2c_bus_t *bus; /* I2C bus */ | 28 | struct snd_i2c_bus *bus; /* I2C bus */ |
32 | char name[32]; /* some useful device name */ | 29 | char name[32]; /* some useful device name */ |
33 | unsigned short flags; /* device flags */ | 30 | unsigned short flags; /* device flags */ |
34 | unsigned short addr; /* device address (might be 10-bit) */ | 31 | unsigned short addr; /* device address (might be 10-bit) */ |
35 | unsigned long private_value; | 32 | unsigned long private_value; |
36 | void *private_data; | 33 | void *private_data; |
37 | void (*private_free)(snd_i2c_device_t *device); | 34 | void (*private_free)(struct snd_i2c_device *device); |
35 | }; | ||
36 | |||
37 | #define snd_i2c_device(n) list_entry(n, struct snd_i2c_device, list) | ||
38 | |||
39 | struct snd_i2c_bit_ops { | ||
40 | void (*start)(struct snd_i2c_bus *bus); /* transfer start */ | ||
41 | void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */ | ||
42 | void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ | ||
43 | void (*setlines)(struct snd_i2c_bus *bus, int clock, int data); | ||
44 | int (*getclock)(struct snd_i2c_bus *bus); | ||
45 | int (*getdata)(struct snd_i2c_bus *bus, int ack); | ||
38 | }; | 46 | }; |
39 | 47 | ||
40 | #define snd_i2c_device(n) list_entry(n, snd_i2c_device_t, list) | 48 | struct snd_i2c_ops { |
41 | 49 | int (*sendbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); | |
42 | typedef struct _snd_i2c_bit_ops { | 50 | int (*readbytes)(struct snd_i2c_device *device, unsigned char *bytes, int count); |
43 | void (*start)(snd_i2c_bus_t *bus); /* transfer start */ | 51 | int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr); |
44 | void (*stop)(snd_i2c_bus_t *bus); /* transfer stop */ | 52 | }; |
45 | void (*direction)(snd_i2c_bus_t *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ | 53 | |
46 | void (*setlines)(snd_i2c_bus_t *bus, int clock, int data); | 54 | struct snd_i2c_bus { |
47 | int (*getclock)(snd_i2c_bus_t *bus); | 55 | struct snd_card *card; /* card which I2C belongs to */ |
48 | int (*getdata)(snd_i2c_bus_t *bus, int ack); | ||
49 | } snd_i2c_bit_ops_t; | ||
50 | |||
51 | typedef struct _snd_i2c_ops { | ||
52 | int (*sendbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count); | ||
53 | int (*readbytes)(snd_i2c_device_t *device, unsigned char *bytes, int count); | ||
54 | int (*probeaddr)(snd_i2c_bus_t *bus, unsigned short addr); | ||
55 | } snd_i2c_ops_t; | ||
56 | |||
57 | struct _snd_i2c_bus { | ||
58 | snd_card_t *card; /* card which I2C belongs to */ | ||
59 | char name[32]; /* some useful label */ | 56 | char name[32]; /* some useful label */ |
60 | 57 | ||
61 | struct semaphore lock_mutex; | 58 | struct semaphore lock_mutex; |
62 | 59 | ||
63 | snd_i2c_bus_t *master; /* master bus when SCK/SCL is shared */ | 60 | struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */ |
64 | struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ | 61 | struct list_head buses; /* master: slave buses sharing SCK/SCL, slave: link list */ |
65 | 62 | ||
66 | struct list_head devices; /* attached devices to this bus */ | 63 | struct list_head devices; /* attached devices to this bus */ |
67 | 64 | ||
68 | union { | 65 | union { |
69 | snd_i2c_bit_ops_t *bit; | 66 | struct snd_i2c_bit_ops *bit; |
70 | void *ops; | 67 | void *ops; |
71 | } hw_ops; /* lowlevel operations */ | 68 | } hw_ops; /* lowlevel operations */ |
72 | snd_i2c_ops_t *ops; /* midlevel operations */ | 69 | struct snd_i2c_ops *ops; /* midlevel operations */ |
73 | 70 | ||
74 | unsigned long private_value; | 71 | unsigned long private_value; |
75 | void *private_data; | 72 | void *private_data; |
76 | void (*private_free)(snd_i2c_bus_t *bus); | 73 | void (*private_free)(struct snd_i2c_bus *bus); |
77 | }; | 74 | }; |
78 | 75 | ||
79 | #define snd_i2c_slave_bus(n) list_entry(n, snd_i2c_bus_t, buses) | 76 | #define snd_i2c_slave_bus(n) list_entry(n, struct snd_i2c_bus, buses) |
80 | 77 | ||
81 | int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master, snd_i2c_bus_t **ri2c); | 78 | int snd_i2c_bus_create(struct snd_card *card, const char *name, |
82 | int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char addr, snd_i2c_device_t **rdevice); | 79 | struct snd_i2c_bus *master, struct snd_i2c_bus **ri2c); |
83 | int snd_i2c_device_free(snd_i2c_device_t *device); | 80 | int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, |
81 | unsigned char addr, struct snd_i2c_device **rdevice); | ||
82 | int snd_i2c_device_free(struct snd_i2c_device *device); | ||
84 | 83 | ||
85 | static inline void snd_i2c_lock(snd_i2c_bus_t *bus) { | 84 | static inline void snd_i2c_lock(struct snd_i2c_bus *bus) |
85 | { | ||
86 | if (bus->master) | 86 | if (bus->master) |
87 | down(&bus->master->lock_mutex); | 87 | down(&bus->master->lock_mutex); |
88 | else | 88 | else |
89 | down(&bus->lock_mutex); | 89 | down(&bus->lock_mutex); |
90 | } | 90 | } |
91 | static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) { | 91 | |
92 | static inline void snd_i2c_unlock(struct snd_i2c_bus *bus) | ||
93 | { | ||
92 | if (bus->master) | 94 | if (bus->master) |
93 | up(&bus->master->lock_mutex); | 95 | up(&bus->master->lock_mutex); |
94 | else | 96 | else |
95 | up(&bus->lock_mutex); | 97 | up(&bus->lock_mutex); |
96 | } | 98 | } |
97 | 99 | ||
98 | int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); | 100 | int snd_i2c_sendbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); |
99 | int snd_i2c_readbytes(snd_i2c_device_t *device, unsigned char *bytes, int count); | 101 | int snd_i2c_readbytes(struct snd_i2c_device *device, unsigned char *bytes, int count); |
100 | int snd_i2c_probeaddr(snd_i2c_bus_t *bus, unsigned short addr); | 102 | int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr); |
101 | 103 | ||
102 | #endif /* __SOUND_I2C_H */ | 104 | #endif /* __SOUND_I2C_H */ |