Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips |
| 3 | * |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 4 | * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | * |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 21 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <asm/io.h> |
| 24 | #include <linux/delay.h> |
| 25 | #include <linux/interrupt.h> |
| 26 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 28 | #include <linux/version.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #include <sound/core.h> |
| 30 | #include <sound/tea575x-tuner.h> |
| 31 | |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 32 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); |
| 34 | MODULE_LICENSE("GPL"); |
| 35 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 36 | static int radio_nr = -1; |
| 37 | module_param(radio_nr, int, 0); |
| 38 | |
| 39 | #define RADIO_VERSION KERNEL_VERSION(0, 0, 2) |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 40 | #define FREQ_LO (50UL * 16000) |
| 41 | #define FREQ_HI (150UL * 16000) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* |
| 44 | * definitions |
| 45 | */ |
| 46 | |
| 47 | #define TEA575X_BIT_SEARCH (1<<24) /* 1 = search action, 0 = tuned */ |
| 48 | #define TEA575X_BIT_UPDOWN (1<<23) /* 0 = search down, 1 = search up */ |
| 49 | #define TEA575X_BIT_MONO (1<<22) /* 0 = stereo, 1 = mono */ |
| 50 | #define TEA575X_BIT_BAND_MASK (3<<20) |
| 51 | #define TEA575X_BIT_BAND_FM (0<<20) |
| 52 | #define TEA575X_BIT_BAND_MW (1<<20) |
| 53 | #define TEA575X_BIT_BAND_LW (1<<21) |
| 54 | #define TEA575X_BIT_BAND_SW (1<<22) |
| 55 | #define TEA575X_BIT_PORT_0 (1<<19) /* user bit */ |
| 56 | #define TEA575X_BIT_PORT_1 (1<<18) /* user bit */ |
| 57 | #define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */ |
| 58 | #define TEA575X_BIT_SEARCH_5_28 (0<<16) /* FM >5uV, AM >28uV */ |
| 59 | #define TEA575X_BIT_SEARCH_10_40 (1<<16) /* FM >10uV, AM > 40uV */ |
| 60 | #define TEA575X_BIT_SEARCH_30_63 (2<<16) /* FM >30uV, AM > 63uV */ |
| 61 | #define TEA575X_BIT_SEARCH_150_1000 (3<<16) /* FM > 150uV, AM > 1000uV */ |
| 62 | #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ |
| 63 | #define TEA575X_BIT_FREQ_MASK 0x7fff |
| 64 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 65 | static struct v4l2_queryctrl radio_qctrl[] = { |
| 66 | { |
| 67 | .id = V4L2_CID_AUDIO_MUTE, |
| 68 | .name = "Mute", |
| 69 | .minimum = 0, |
| 70 | .maximum = 1, |
| 71 | .default_value = 1, |
| 72 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
| 73 | } |
| 74 | }; |
| 75 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | /* |
| 77 | * lowlevel part |
| 78 | */ |
| 79 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 80 | static void snd_tea575x_get_freq(struct snd_tea575x *tea) |
| 81 | { |
| 82 | unsigned long freq; |
| 83 | |
| 84 | freq = tea->ops->read(tea) & TEA575X_BIT_FREQ_MASK; |
| 85 | /* freq *= 12.5 */ |
| 86 | freq *= 125; |
| 87 | freq /= 10; |
| 88 | /* crystal fixup */ |
| 89 | if (tea->tea5759) |
| 90 | freq += tea->freq_fixup; |
| 91 | else |
| 92 | freq -= tea->freq_fixup; |
| 93 | |
| 94 | tea->freq = freq * 16; /* from kHz */ |
| 95 | } |
| 96 | |
Takashi Iwai | 97f02e0 | 2005-11-17 14:17:19 +0100 | [diff] [blame] | 97 | static void snd_tea575x_set_freq(struct snd_tea575x *tea) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | { |
| 99 | unsigned long freq; |
| 100 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 101 | freq = clamp(tea->freq, FREQ_LO, FREQ_HI); |
| 102 | freq /= 16; /* to kHz */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | /* crystal fixup */ |
| 104 | if (tea->tea5759) |
| 105 | freq -= tea->freq_fixup; |
| 106 | else |
| 107 | freq += tea->freq_fixup; |
| 108 | /* freq /= 12.5 */ |
| 109 | freq *= 10; |
| 110 | freq /= 125; |
| 111 | |
| 112 | tea->val &= ~TEA575X_BIT_FREQ_MASK; |
| 113 | tea->val |= freq & TEA575X_BIT_FREQ_MASK; |
| 114 | tea->ops->write(tea, tea->val); |
| 115 | } |
| 116 | |
| 117 | /* |
| 118 | * Linux Video interface |
| 119 | */ |
| 120 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 121 | static int vidioc_querycap(struct file *file, void *priv, |
| 122 | struct v4l2_capability *v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | { |
Hans Verkuil | c170ecf | 2008-08-23 08:32:09 -0300 | [diff] [blame] | 124 | struct snd_tea575x *tea = video_drvdata(file); |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 125 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 126 | strlcpy(v->driver, "tea575x-tuner", sizeof(v->driver)); |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 127 | strlcpy(v->card, tea->tea5759 ? "TEA5759" : "TEA5757", sizeof(v->card)); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 128 | sprintf(v->bus_info, "PCI"); |
| 129 | v->version = RADIO_VERSION; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 130 | v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 131 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | } |
| 133 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 134 | static int vidioc_g_tuner(struct file *file, void *priv, |
| 135 | struct v4l2_tuner *v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | { |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 137 | struct snd_tea575x *tea = video_drvdata(file); |
| 138 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 139 | if (v->index > 0) |
| 140 | return -EINVAL; |
| 141 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 142 | tea->ops->read(tea); |
| 143 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 144 | strcpy(v->name, "FM"); |
| 145 | v->type = V4L2_TUNER_RADIO; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 146 | v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 147 | v->rangelow = FREQ_LO; |
| 148 | v->rangehigh = FREQ_HI; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 149 | v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; |
| 150 | v->audmode = tea->stereo ? V4L2_TUNER_MODE_STEREO : V4L2_TUNER_MODE_MONO; |
| 151 | v->signal = tea->tuned ? 0xffff : 0; |
| 152 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | static int vidioc_s_tuner(struct file *file, void *priv, |
| 157 | struct v4l2_tuner *v) |
| 158 | { |
| 159 | if (v->index > 0) |
| 160 | return -EINVAL; |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | static int vidioc_g_frequency(struct file *file, void *priv, |
| 165 | struct v4l2_frequency *f) |
| 166 | { |
| 167 | struct snd_tea575x *tea = video_drvdata(file); |
| 168 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 169 | if (f->tuner != 0) |
| 170 | return -EINVAL; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 171 | f->type = V4L2_TUNER_RADIO; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 172 | snd_tea575x_get_freq(tea); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 173 | f->frequency = tea->freq; |
| 174 | return 0; |
| 175 | } |
| 176 | |
| 177 | static int vidioc_s_frequency(struct file *file, void *priv, |
| 178 | struct v4l2_frequency *f) |
| 179 | { |
| 180 | struct snd_tea575x *tea = video_drvdata(file); |
| 181 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame^] | 182 | if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) |
| 183 | return -EINVAL; |
| 184 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 185 | if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) |
| 186 | return -EINVAL; |
| 187 | |
| 188 | tea->freq = f->frequency; |
| 189 | |
| 190 | snd_tea575x_set_freq(tea); |
| 191 | |
| 192 | return 0; |
| 193 | } |
| 194 | |
| 195 | static int vidioc_g_audio(struct file *file, void *priv, |
| 196 | struct v4l2_audio *a) |
| 197 | { |
| 198 | if (a->index > 1) |
| 199 | return -EINVAL; |
| 200 | |
| 201 | strcpy(a->name, "Radio"); |
| 202 | a->capability = V4L2_AUDCAP_STEREO; |
| 203 | return 0; |
| 204 | } |
| 205 | |
| 206 | static int vidioc_s_audio(struct file *file, void *priv, |
| 207 | struct v4l2_audio *a) |
| 208 | { |
| 209 | if (a->index != 0) |
| 210 | return -EINVAL; |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | static int vidioc_queryctrl(struct file *file, void *priv, |
| 215 | struct v4l2_queryctrl *qc) |
| 216 | { |
| 217 | int i; |
| 218 | |
| 219 | for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { |
| 220 | if (qc->id && qc->id == radio_qctrl[i].id) { |
| 221 | memcpy(qc, &(radio_qctrl[i]), |
| 222 | sizeof(*qc)); |
| 223 | return 0; |
| 224 | } |
| 225 | } |
| 226 | return -EINVAL; |
| 227 | } |
| 228 | |
| 229 | static int vidioc_g_ctrl(struct file *file, void *priv, |
| 230 | struct v4l2_control *ctrl) |
| 231 | { |
| 232 | struct snd_tea575x *tea = video_drvdata(file); |
| 233 | |
| 234 | switch (ctrl->id) { |
| 235 | case V4L2_CID_AUDIO_MUTE: |
| 236 | if (tea->ops->mute) { |
| 237 | ctrl->value = tea->mute; |
| 238 | return 0; |
| 239 | } |
| 240 | } |
| 241 | return -EINVAL; |
| 242 | } |
| 243 | |
| 244 | static int vidioc_s_ctrl(struct file *file, void *priv, |
| 245 | struct v4l2_control *ctrl) |
| 246 | { |
| 247 | struct snd_tea575x *tea = video_drvdata(file); |
| 248 | |
| 249 | switch (ctrl->id) { |
| 250 | case V4L2_CID_AUDIO_MUTE: |
| 251 | if (tea->ops->mute) { |
| 252 | tea->ops->mute(tea, ctrl->value); |
Ondrej Zary | 1233faa | 2009-11-27 18:19:28 +0100 | [diff] [blame] | 253 | tea->mute = ctrl->value; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 254 | return 0; |
| 255 | } |
| 256 | } |
| 257 | return -EINVAL; |
| 258 | } |
| 259 | |
| 260 | static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) |
| 261 | { |
| 262 | *i = 0; |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) |
| 267 | { |
| 268 | if (i != 0) |
| 269 | return -EINVAL; |
| 270 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame] | 273 | static int snd_tea575x_exclusive_open(struct file *file) |
Hans Verkuil | 2f3d002 | 2008-08-23 04:52:00 -0300 | [diff] [blame] | 274 | { |
Hans Verkuil | c170ecf | 2008-08-23 08:32:09 -0300 | [diff] [blame] | 275 | struct snd_tea575x *tea = video_drvdata(file); |
Hans Verkuil | 2f3d002 | 2008-08-23 04:52:00 -0300 | [diff] [blame] | 276 | |
| 277 | return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; |
| 278 | } |
| 279 | |
Hans Verkuil | bec4366 | 2008-12-30 06:58:20 -0300 | [diff] [blame] | 280 | static int snd_tea575x_exclusive_release(struct file *file) |
Hans Verkuil | 2f3d002 | 2008-08-23 04:52:00 -0300 | [diff] [blame] | 281 | { |
Hans Verkuil | c170ecf | 2008-08-23 08:32:09 -0300 | [diff] [blame] | 282 | struct snd_tea575x *tea = video_drvdata(file); |
Hans Verkuil | 2f3d002 | 2008-08-23 04:52:00 -0300 | [diff] [blame] | 283 | |
| 284 | clear_bit(0, &tea->in_use); |
| 285 | return 0; |
| 286 | } |
| 287 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 288 | static const struct v4l2_file_operations tea575x_fops = { |
| 289 | .owner = THIS_MODULE, |
| 290 | .open = snd_tea575x_exclusive_open, |
| 291 | .release = snd_tea575x_exclusive_release, |
| 292 | .ioctl = video_ioctl2, |
| 293 | }; |
| 294 | |
| 295 | static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { |
| 296 | .vidioc_querycap = vidioc_querycap, |
| 297 | .vidioc_g_tuner = vidioc_g_tuner, |
| 298 | .vidioc_s_tuner = vidioc_s_tuner, |
| 299 | .vidioc_g_audio = vidioc_g_audio, |
| 300 | .vidioc_s_audio = vidioc_s_audio, |
| 301 | .vidioc_g_input = vidioc_g_input, |
| 302 | .vidioc_s_input = vidioc_s_input, |
| 303 | .vidioc_g_frequency = vidioc_g_frequency, |
| 304 | .vidioc_s_frequency = vidioc_s_frequency, |
| 305 | .vidioc_queryctrl = vidioc_queryctrl, |
| 306 | .vidioc_g_ctrl = vidioc_g_ctrl, |
| 307 | .vidioc_s_ctrl = vidioc_s_ctrl, |
| 308 | }; |
| 309 | |
| 310 | static struct video_device tea575x_radio = { |
| 311 | .name = "tea575x-tuner", |
| 312 | .fops = &tea575x_fops, |
| 313 | .ioctl_ops = &tea575x_ioctl_ops, |
| 314 | .release = video_device_release, |
| 315 | }; |
| 316 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | /* |
| 318 | * initialize all the tea575x chips |
| 319 | */ |
Takashi Iwai | 97f02e0 | 2005-11-17 14:17:19 +0100 | [diff] [blame] | 320 | void snd_tea575x_init(struct snd_tea575x *tea) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | { |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 322 | int retval; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | unsigned int val; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 324 | struct video_device *tea575x_radio_inst; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | |
| 326 | val = tea->ops->read(tea); |
| 327 | if (val == 0x1ffffff || val == 0) { |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 328 | snd_printk(KERN_ERR |
| 329 | "tea575x-tuner: Cannot find TEA575x chip\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | return; |
| 331 | } |
| 332 | |
Hans Verkuil | 2f3d002 | 2008-08-23 04:52:00 -0300 | [diff] [blame] | 333 | tea->in_use = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 334 | tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; |
| 335 | tea->freq = 90500 * 16; /* 90.5Mhz default */ |
| 336 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 337 | tea575x_radio_inst = video_device_alloc(); |
| 338 | if (tea575x_radio_inst == NULL) { |
| 339 | printk(KERN_ERR "tea575x-tuner: not enough memory\n"); |
| 340 | return; |
| 341 | } |
| 342 | |
| 343 | memcpy(tea575x_radio_inst, &tea575x_radio, sizeof(tea575x_radio)); |
| 344 | |
| 345 | strcpy(tea575x_radio.name, tea->tea5759 ? |
| 346 | "TEA5759 radio" : "TEA5757 radio"); |
| 347 | |
| 348 | video_set_drvdata(tea575x_radio_inst, tea); |
| 349 | |
| 350 | retval = video_register_device(tea575x_radio_inst, |
| 351 | VFL_TYPE_RADIO, radio_nr); |
| 352 | if (retval) { |
| 353 | printk(KERN_ERR "tea575x-tuner: can't register video device!\n"); |
| 354 | kfree(tea575x_radio_inst); |
| 355 | return; |
| 356 | } |
| 357 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | snd_tea575x_set_freq(tea); |
Andy Shevchenko | 6925212 | 2008-01-24 18:11:53 +0100 | [diff] [blame] | 359 | |
| 360 | /* mute on init */ |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 361 | if (tea->ops->mute) { |
Andy Shevchenko | 6925212 | 2008-01-24 18:11:53 +0100 | [diff] [blame] | 362 | tea->ops->mute(tea, 1); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 363 | tea->mute = 1; |
| 364 | } |
| 365 | tea->vd = tea575x_radio_inst; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Takashi Iwai | 97f02e0 | 2005-11-17 14:17:19 +0100 | [diff] [blame] | 368 | void snd_tea575x_exit(struct snd_tea575x *tea) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 369 | { |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 370 | if (tea->vd) { |
| 371 | video_unregister_device(tea->vd); |
| 372 | tea->vd = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | } |
| 374 | } |
| 375 | |
| 376 | static int __init alsa_tea575x_module_init(void) |
| 377 | { |
| 378 | return 0; |
| 379 | } |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 380 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | static void __exit alsa_tea575x_module_exit(void) |
| 382 | { |
| 383 | } |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 384 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 385 | module_init(alsa_tea575x_module_init) |
| 386 | module_exit(alsa_tea575x_module_exit) |
| 387 | |
| 388 | EXPORT_SYMBOL(snd_tea575x_init); |
| 389 | EXPORT_SYMBOL(snd_tea575x_exit); |