Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * ALSA driver for TEA5757/5759 Philips AM/FM radio tuner chips |
| 4 | * |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 5 | * Copyright (c) 2004 Jaroslav Kysela <perex@perex.cz> |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 6 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/delay.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 9 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/init.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 11 | #include <linux/slab.h> |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 12 | #include <linux/sched.h> |
Mauro Carvalho Chehab | eab924d | 2014-01-13 15:54:59 -0200 | [diff] [blame] | 13 | #include <asm/io.h> |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 14 | #include <media/v4l2-device.h> |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 15 | #include <media/v4l2-dev.h> |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 16 | #include <media/v4l2-fh.h> |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 17 | #include <media/v4l2-ioctl.h> |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 18 | #include <media/v4l2-event.h> |
Mauro Carvalho Chehab | d647f0b | 2015-11-13 19:40:07 -0200 | [diff] [blame] | 19 | #include <media/drv-intf/tea575x.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 21 | MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); |
| 23 | MODULE_LICENSE("GPL"); |
| 24 | |
| 25 | /* |
| 26 | * definitions |
| 27 | */ |
| 28 | |
| 29 | #define TEA575X_BIT_SEARCH (1<<24) /* 1 = search action, 0 = tuned */ |
| 30 | #define TEA575X_BIT_UPDOWN (1<<23) /* 0 = search down, 1 = search up */ |
| 31 | #define TEA575X_BIT_MONO (1<<22) /* 0 = stereo, 1 = mono */ |
| 32 | #define TEA575X_BIT_BAND_MASK (3<<20) |
| 33 | #define TEA575X_BIT_BAND_FM (0<<20) |
| 34 | #define TEA575X_BIT_BAND_MW (1<<20) |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 35 | #define TEA575X_BIT_BAND_LW (2<<20) |
| 36 | #define TEA575X_BIT_BAND_SW (3<<20) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #define TEA575X_BIT_PORT_0 (1<<19) /* user bit */ |
| 38 | #define TEA575X_BIT_PORT_1 (1<<18) /* user bit */ |
| 39 | #define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */ |
| 40 | #define TEA575X_BIT_SEARCH_5_28 (0<<16) /* FM >5uV, AM >28uV */ |
| 41 | #define TEA575X_BIT_SEARCH_10_40 (1<<16) /* FM >10uV, AM > 40uV */ |
| 42 | #define TEA575X_BIT_SEARCH_30_63 (2<<16) /* FM >30uV, AM > 63uV */ |
| 43 | #define TEA575X_BIT_SEARCH_150_1000 (3<<16) /* FM > 150uV, AM > 1000uV */ |
| 44 | #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ |
| 45 | #define TEA575X_BIT_FREQ_MASK 0x7fff |
| 46 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 47 | enum { BAND_FM, BAND_FM_JAPAN, BAND_AM }; |
| 48 | |
| 49 | static const struct v4l2_frequency_band bands[] = { |
| 50 | { |
| 51 | .type = V4L2_TUNER_RADIO, |
| 52 | .index = 0, |
| 53 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | |
| 54 | V4L2_TUNER_CAP_FREQ_BANDS, |
| 55 | .rangelow = 87500 * 16, |
| 56 | .rangehigh = 108000 * 16, |
| 57 | .modulation = V4L2_BAND_MODULATION_FM, |
| 58 | }, |
| 59 | { |
| 60 | .type = V4L2_TUNER_RADIO, |
| 61 | .index = 0, |
| 62 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | |
| 63 | V4L2_TUNER_CAP_FREQ_BANDS, |
| 64 | .rangelow = 76000 * 16, |
| 65 | .rangehigh = 91000 * 16, |
| 66 | .modulation = V4L2_BAND_MODULATION_FM, |
| 67 | }, |
| 68 | { |
| 69 | .type = V4L2_TUNER_RADIO, |
| 70 | .index = 1, |
| 71 | .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS, |
| 72 | .rangelow = 530 * 16, |
| 73 | .rangehigh = 1710 * 16, |
| 74 | .modulation = V4L2_BAND_MODULATION_AM, |
| 75 | }, |
| 76 | }; |
| 77 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | /* |
| 79 | * lowlevel part |
| 80 | */ |
| 81 | |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 82 | static void snd_tea575x_write(struct snd_tea575x *tea, unsigned int val) |
| 83 | { |
| 84 | u16 l; |
| 85 | u8 data; |
| 86 | |
Hans de Goede | 31a62d4 | 2012-05-18 09:36:17 -0300 | [diff] [blame] | 87 | if (tea->ops->write_val) |
| 88 | return tea->ops->write_val(tea, val); |
| 89 | |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 90 | tea->ops->set_direction(tea, 1); |
| 91 | udelay(16); |
| 92 | |
| 93 | for (l = 25; l > 0; l--) { |
| 94 | data = (val >> 24) & TEA575X_DATA; |
| 95 | val <<= 1; /* shift data */ |
| 96 | tea->ops->set_pins(tea, data | TEA575X_WREN); |
| 97 | udelay(2); |
| 98 | tea->ops->set_pins(tea, data | TEA575X_WREN | TEA575X_CLK); |
| 99 | udelay(2); |
| 100 | tea->ops->set_pins(tea, data | TEA575X_WREN); |
| 101 | udelay(2); |
| 102 | } |
| 103 | |
| 104 | if (!tea->mute) |
| 105 | tea->ops->set_pins(tea, 0); |
| 106 | } |
| 107 | |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 108 | static u32 snd_tea575x_read(struct snd_tea575x *tea) |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 109 | { |
| 110 | u16 l, rdata; |
| 111 | u32 data = 0; |
| 112 | |
Hans de Goede | 31a62d4 | 2012-05-18 09:36:17 -0300 | [diff] [blame] | 113 | if (tea->ops->read_val) |
| 114 | return tea->ops->read_val(tea); |
| 115 | |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 116 | tea->ops->set_direction(tea, 0); |
| 117 | tea->ops->set_pins(tea, 0); |
| 118 | udelay(16); |
| 119 | |
| 120 | for (l = 24; l--;) { |
| 121 | tea->ops->set_pins(tea, TEA575X_CLK); |
| 122 | udelay(2); |
| 123 | if (!l) |
| 124 | tea->tuned = tea->ops->get_pins(tea) & TEA575X_MOST ? 0 : 1; |
| 125 | tea->ops->set_pins(tea, 0); |
| 126 | udelay(2); |
| 127 | data <<= 1; /* shift data */ |
| 128 | rdata = tea->ops->get_pins(tea); |
| 129 | if (!l) |
| 130 | tea->stereo = (rdata & TEA575X_MOST) ? 0 : 1; |
| 131 | if (rdata & TEA575X_DATA) |
| 132 | data++; |
| 133 | udelay(2); |
| 134 | } |
| 135 | |
| 136 | if (tea->mute) |
| 137 | tea->ops->set_pins(tea, TEA575X_WREN); |
| 138 | |
| 139 | return data; |
| 140 | } |
| 141 | |
Hans de Goede | 40e006a | 2012-05-19 11:19:06 -0300 | [diff] [blame] | 142 | static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val) |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 143 | { |
Hans de Goede | 40e006a | 2012-05-19 11:19:06 -0300 | [diff] [blame] | 144 | u32 freq = val & TEA575X_BIT_FREQ_MASK; |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 145 | |
| 146 | if (freq == 0) |
| 147 | return freq; |
| 148 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 149 | switch (tea->band) { |
| 150 | case BAND_FM: |
| 151 | /* freq *= 12.5 */ |
| 152 | freq *= 125; |
| 153 | freq /= 10; |
| 154 | /* crystal fixup */ |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 155 | freq -= TEA575X_FMIF; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 156 | break; |
| 157 | case BAND_FM_JAPAN: |
| 158 | /* freq *= 12.5 */ |
| 159 | freq *= 125; |
| 160 | freq /= 10; |
| 161 | /* crystal fixup */ |
| 162 | freq += TEA575X_FMIF; |
| 163 | break; |
| 164 | case BAND_AM: |
| 165 | /* crystal fixup */ |
| 166 | freq -= TEA575X_AMIF; |
| 167 | break; |
| 168 | } |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 169 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 170 | return clamp(freq * 16, bands[tea->band].rangelow, |
| 171 | bands[tea->band].rangehigh); /* from kHz */ |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 172 | } |
| 173 | |
Hans de Goede | 40e006a | 2012-05-19 11:19:06 -0300 | [diff] [blame] | 174 | static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) |
| 175 | { |
| 176 | return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea)); |
| 177 | } |
| 178 | |
Hans de Goede | 559c200 | 2012-08-11 12:55:22 -0300 | [diff] [blame] | 179 | void snd_tea575x_set_freq(struct snd_tea575x *tea) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | { |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 181 | u32 freq = tea->freq / 16; /* to kHz */ |
| 182 | u32 band = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 184 | switch (tea->band) { |
| 185 | case BAND_FM: |
| 186 | band = TEA575X_BIT_BAND_FM; |
| 187 | /* crystal fixup */ |
Ondrej Zary | ea27316 | 2011-05-12 22:17:56 +0200 | [diff] [blame] | 188 | freq += TEA575X_FMIF; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 189 | /* freq /= 12.5 */ |
| 190 | freq *= 10; |
| 191 | freq /= 125; |
| 192 | break; |
| 193 | case BAND_FM_JAPAN: |
| 194 | band = TEA575X_BIT_BAND_FM; |
| 195 | /* crystal fixup */ |
| 196 | freq -= TEA575X_FMIF; |
| 197 | /* freq /= 12.5 */ |
| 198 | freq *= 10; |
| 199 | freq /= 125; |
| 200 | break; |
| 201 | case BAND_AM: |
| 202 | band = TEA575X_BIT_BAND_MW; |
| 203 | /* crystal fixup */ |
| 204 | freq += TEA575X_AMIF; |
| 205 | break; |
| 206 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 207 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 208 | tea->val &= ~(TEA575X_BIT_FREQ_MASK | TEA575X_BIT_BAND_MASK); |
| 209 | tea->val |= band; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | tea->val |= freq & TEA575X_BIT_FREQ_MASK; |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 211 | snd_tea575x_write(tea, tea->val); |
Hans de Goede | 40e006a | 2012-05-19 11:19:06 -0300 | [diff] [blame] | 212 | tea->freq = snd_tea575x_val_to_freq(tea, tea->val); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | } |
Andy Shevchenko | 0e2a706 | 2015-12-18 18:32:00 -0200 | [diff] [blame] | 214 | EXPORT_SYMBOL(snd_tea575x_set_freq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | /* |
| 217 | * Linux Video interface |
| 218 | */ |
| 219 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 220 | static int vidioc_querycap(struct file *file, void *priv, |
| 221 | struct v4l2_capability *v) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | { |
Hans Verkuil | c170ecf | 2008-08-23 08:32:09 -0300 | [diff] [blame] | 223 | struct snd_tea575x *tea = video_drvdata(file); |
Igor M. Liplianin | 4b29631 | 2008-11-09 15:25:31 -0300 | [diff] [blame] | 224 | |
Mauro Carvalho Chehab | c0decac | 2018-09-10 08:19:14 -0400 | [diff] [blame] | 225 | strscpy(v->driver, tea->v4l2_dev->name, sizeof(v->driver)); |
| 226 | strscpy(v->card, tea->card, sizeof(v->card)); |
Ondrej Zary | 10ca720 | 2011-05-12 22:18:22 +0200 | [diff] [blame] | 227 | strlcat(v->card, tea->tea5759 ? " TEA5759" : " TEA5757", sizeof(v->card)); |
Mauro Carvalho Chehab | c0decac | 2018-09-10 08:19:14 -0400 | [diff] [blame] | 228 | strscpy(v->bus_info, tea->bus_info, sizeof(v->bus_info)); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 229 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | } |
| 231 | |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 232 | int snd_tea575x_enum_freq_bands(struct snd_tea575x *tea, |
| 233 | struct v4l2_frequency_band *band) |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 234 | { |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 235 | int index; |
| 236 | |
| 237 | if (band->tuner != 0) |
| 238 | return -EINVAL; |
| 239 | |
| 240 | switch (band->index) { |
| 241 | case 0: |
| 242 | if (tea->tea5759) |
| 243 | index = BAND_FM_JAPAN; |
| 244 | else |
| 245 | index = BAND_FM; |
| 246 | break; |
| 247 | case 1: |
| 248 | if (tea->has_am) { |
| 249 | index = BAND_AM; |
| 250 | break; |
| 251 | } |
Gustavo A. R. Silva | df561f66 | 2020-08-23 17:36:59 -0500 | [diff] [blame] | 252 | fallthrough; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 253 | default: |
| 254 | return -EINVAL; |
| 255 | } |
| 256 | |
| 257 | *band = bands[index]; |
| 258 | if (!tea->cannot_read_data) |
| 259 | band->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED; |
| 260 | |
| 261 | return 0; |
| 262 | } |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 263 | EXPORT_SYMBOL(snd_tea575x_enum_freq_bands); |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 264 | |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 265 | static int vidioc_enum_freq_bands(struct file *file, void *priv, |
| 266 | struct v4l2_frequency_band *band) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | { |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 268 | struct snd_tea575x *tea = video_drvdata(file); |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 269 | |
| 270 | return snd_tea575x_enum_freq_bands(tea, band); |
| 271 | } |
| 272 | |
| 273 | int snd_tea575x_g_tuner(struct snd_tea575x *tea, struct v4l2_tuner *v) |
| 274 | { |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 275 | struct v4l2_frequency_band band_fm = { 0, }; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 276 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 277 | if (v->index > 0) |
| 278 | return -EINVAL; |
| 279 | |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 280 | snd_tea575x_read(tea); |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 281 | snd_tea575x_enum_freq_bands(tea, &band_fm); |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 282 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 283 | memset(v, 0, sizeof(*v)); |
Mauro Carvalho Chehab | c0decac | 2018-09-10 08:19:14 -0400 | [diff] [blame] | 284 | strscpy(v->name, tea->has_am ? "FM/AM" : "FM", sizeof(v->name)); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 285 | v->type = V4L2_TUNER_RADIO; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 286 | v->capability = band_fm.capability; |
| 287 | v->rangelow = tea->has_am ? bands[BAND_AM].rangelow : band_fm.rangelow; |
| 288 | v->rangehigh = band_fm.rangehigh; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 289 | v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; |
| 290 | v->audmode = (tea->val & TEA575X_BIT_MONO) ? |
| 291 | V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO; |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 292 | v->signal = tea->tuned ? 0xffff : 0; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 293 | return 0; |
| 294 | } |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 295 | EXPORT_SYMBOL(snd_tea575x_g_tuner); |
| 296 | |
| 297 | static int vidioc_g_tuner(struct file *file, void *priv, |
| 298 | struct v4l2_tuner *v) |
| 299 | { |
| 300 | struct snd_tea575x *tea = video_drvdata(file); |
| 301 | |
| 302 | return snd_tea575x_g_tuner(tea, v); |
| 303 | } |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 304 | |
| 305 | static int vidioc_s_tuner(struct file *file, void *priv, |
Hans Verkuil | 2f73c7c | 2013-03-15 06:10:06 -0300 | [diff] [blame] | 306 | const struct v4l2_tuner *v) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 307 | { |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 308 | struct snd_tea575x *tea = video_drvdata(file); |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 309 | u32 orig_val = tea->val; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 310 | |
| 311 | if (v->index) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 312 | return -EINVAL; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 313 | tea->val &= ~TEA575X_BIT_MONO; |
| 314 | if (v->audmode == V4L2_TUNER_MODE_MONO) |
| 315 | tea->val |= TEA575X_BIT_MONO; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 316 | /* Only apply changes if currently tuning FM */ |
| 317 | if (tea->band != BAND_AM && tea->val != orig_val) |
| 318 | snd_tea575x_set_freq(tea); |
| 319 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 320 | return 0; |
| 321 | } |
| 322 | |
| 323 | static int vidioc_g_frequency(struct file *file, void *priv, |
| 324 | struct v4l2_frequency *f) |
| 325 | { |
| 326 | struct snd_tea575x *tea = video_drvdata(file); |
| 327 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 328 | if (f->tuner != 0) |
| 329 | return -EINVAL; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 330 | f->type = V4L2_TUNER_RADIO; |
| 331 | f->frequency = tea->freq; |
| 332 | return 0; |
| 333 | } |
| 334 | |
| 335 | static int vidioc_s_frequency(struct file *file, void *priv, |
Hans Verkuil | b530a44 | 2013-03-19 04:09:26 -0300 | [diff] [blame] | 336 | const struct v4l2_frequency *f) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 337 | { |
| 338 | struct snd_tea575x *tea = video_drvdata(file); |
| 339 | |
Ondrej Zary | 375d135 | 2011-03-19 16:32:53 +0100 | [diff] [blame] | 340 | if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) |
| 341 | return -EINVAL; |
| 342 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 343 | if (tea->has_am && f->frequency < (20000 * 16)) |
| 344 | tea->band = BAND_AM; |
| 345 | else if (tea->tea5759) |
| 346 | tea->band = BAND_FM_JAPAN; |
| 347 | else |
| 348 | tea->band = BAND_FM; |
| 349 | |
Hans Verkuil | b530a44 | 2013-03-19 04:09:26 -0300 | [diff] [blame] | 350 | tea->freq = clamp_t(u32, f->frequency, bands[tea->band].rangelow, |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 351 | bands[tea->band].rangehigh); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 352 | snd_tea575x_set_freq(tea); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 353 | return 0; |
| 354 | } |
| 355 | |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 356 | int snd_tea575x_s_hw_freq_seek(struct file *file, struct snd_tea575x *tea, |
| 357 | const struct v4l2_hw_freq_seek *a) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 358 | { |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 359 | unsigned long timeout; |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 360 | int i, spacing; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 361 | |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 362 | if (tea->cannot_read_data) |
| 363 | return -ENOTTY; |
| 364 | if (a->tuner || a->wrap_around) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 365 | return -EINVAL; |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 366 | |
Hans Verkuil | 617ade6 | 2012-09-21 09:33:35 -0300 | [diff] [blame] | 367 | if (file->f_flags & O_NONBLOCK) |
| 368 | return -EWOULDBLOCK; |
| 369 | |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 370 | if (a->rangelow || a->rangehigh) { |
| 371 | for (i = 0; i < ARRAY_SIZE(bands); i++) { |
| 372 | if ((i == BAND_FM && tea->tea5759) || |
| 373 | (i == BAND_FM_JAPAN && !tea->tea5759) || |
| 374 | (i == BAND_AM && !tea->has_am)) |
| 375 | continue; |
| 376 | if (bands[i].rangelow == a->rangelow && |
| 377 | bands[i].rangehigh == a->rangehigh) |
| 378 | break; |
| 379 | } |
| 380 | if (i == ARRAY_SIZE(bands)) |
| 381 | return -EINVAL; /* No matching band found */ |
| 382 | if (i != tea->band) { |
| 383 | tea->band = i; |
| 384 | tea->freq = clamp(tea->freq, bands[i].rangelow, |
| 385 | bands[i].rangehigh); |
| 386 | snd_tea575x_set_freq(tea); |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | spacing = (tea->band == BAND_AM) ? 5 : 50; /* kHz */ |
| 391 | |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 392 | /* clear the frequency, HW will fill it in */ |
| 393 | tea->val &= ~TEA575X_BIT_FREQ_MASK; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 394 | tea->val |= TEA575X_BIT_SEARCH; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 395 | if (a->seek_upward) |
| 396 | tea->val |= TEA575X_BIT_UPDOWN; |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 397 | else |
| 398 | tea->val &= ~TEA575X_BIT_UPDOWN; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 399 | snd_tea575x_write(tea, tea->val); |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 400 | timeout = jiffies + msecs_to_jiffies(10000); |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 401 | for (;;) { |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 402 | if (time_after(jiffies, timeout)) |
| 403 | break; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 404 | if (schedule_timeout_interruptible(msecs_to_jiffies(10))) { |
| 405 | /* some signal arrived, stop search */ |
| 406 | tea->val &= ~TEA575X_BIT_SEARCH; |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 407 | snd_tea575x_set_freq(tea); |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 408 | return -ERESTARTSYS; |
| 409 | } |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 410 | if (!(snd_tea575x_read(tea) & TEA575X_BIT_SEARCH)) { |
| 411 | u32 freq; |
| 412 | |
| 413 | /* Found a frequency, wait until it can be read */ |
| 414 | for (i = 0; i < 100; i++) { |
| 415 | msleep(10); |
| 416 | freq = snd_tea575x_get_freq(tea); |
| 417 | if (freq) /* available */ |
| 418 | break; |
| 419 | } |
| 420 | if (freq == 0) /* shouldn't happen */ |
| 421 | break; |
| 422 | /* |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 423 | * if we moved by less than the spacing, or in the |
| 424 | * wrong direction, continue seeking |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 425 | */ |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 426 | if (abs(tea->freq - freq) < 16 * spacing || |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 427 | (a->seek_upward && freq < tea->freq) || |
| 428 | (!a->seek_upward && freq > tea->freq)) { |
| 429 | snd_tea575x_write(tea, tea->val); |
| 430 | continue; |
| 431 | } |
| 432 | tea->freq = freq; |
| 433 | tea->val &= ~TEA575X_BIT_SEARCH; |
| 434 | return 0; |
| 435 | } |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 436 | } |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 437 | tea->val &= ~TEA575X_BIT_SEARCH; |
| 438 | snd_tea575x_set_freq(tea); |
Hans Verkuil | 54f6019 | 2012-05-27 07:25:06 -0300 | [diff] [blame] | 439 | return -ENODATA; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 440 | } |
Ondrej Zary | 6994ca3d | 2015-01-15 17:10:46 -0300 | [diff] [blame] | 441 | EXPORT_SYMBOL(snd_tea575x_s_hw_freq_seek); |
| 442 | |
| 443 | static int vidioc_s_hw_freq_seek(struct file *file, void *fh, |
| 444 | const struct v4l2_hw_freq_seek *a) |
| 445 | { |
| 446 | struct snd_tea575x *tea = video_drvdata(file); |
| 447 | |
| 448 | return snd_tea575x_s_hw_freq_seek(file, tea, a); |
| 449 | } |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 450 | |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 451 | static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl) |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 452 | { |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 453 | struct snd_tea575x *tea = container_of(ctrl->handler, struct snd_tea575x, ctrl_handler); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 454 | |
| 455 | switch (ctrl->id) { |
| 456 | case V4L2_CID_AUDIO_MUTE: |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 457 | tea->mute = ctrl->val; |
| 458 | snd_tea575x_set_freq(tea); |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 459 | return 0; |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 460 | } |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 461 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 462 | return -EINVAL; |
| 463 | } |
| 464 | |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 465 | static const struct v4l2_file_operations tea575x_fops = { |
Ondrej Zary | 6a529c1 | 2011-06-11 10:28:59 -0300 | [diff] [blame] | 466 | .unlocked_ioctl = video_ioctl2, |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 467 | .open = v4l2_fh_open, |
| 468 | .release = v4l2_fh_release, |
| 469 | .poll = v4l2_ctrl_poll, |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 470 | }; |
| 471 | |
| 472 | static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { |
| 473 | .vidioc_querycap = vidioc_querycap, |
| 474 | .vidioc_g_tuner = vidioc_g_tuner, |
| 475 | .vidioc_s_tuner = vidioc_s_tuner, |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 476 | .vidioc_g_frequency = vidioc_g_frequency, |
| 477 | .vidioc_s_frequency = vidioc_s_frequency, |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 478 | .vidioc_s_hw_freq_seek = vidioc_s_hw_freq_seek, |
Hans de Goede | fc48851 | 2012-07-12 17:39:18 -0300 | [diff] [blame] | 479 | .vidioc_enum_freq_bands = vidioc_enum_freq_bands, |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 480 | .vidioc_log_status = v4l2_ctrl_log_status, |
| 481 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, |
| 482 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 483 | }; |
| 484 | |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 485 | static const struct video_device tea575x_radio = { |
Mauro Carvalho Chehab | 6e6a8b5 | 2018-01-04 13:08:56 -0500 | [diff] [blame] | 486 | .ioctl_ops = &tea575x_ioctl_ops, |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 487 | .release = video_device_release_empty, |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 488 | }; |
| 489 | |
| 490 | static const struct v4l2_ctrl_ops tea575x_ctrl_ops = { |
| 491 | .s_ctrl = tea575x_s_ctrl, |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 492 | }; |
| 493 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | |
Ondrej Zary | 8fd7957 | 2013-05-14 16:54:43 -0300 | [diff] [blame] | 495 | int snd_tea575x_hw_init(struct snd_tea575x *tea) |
| 496 | { |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 497 | tea->mute = true; |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 498 | |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 499 | /* Not all devices can or know how to read the data back. |
| 500 | Such devices can set cannot_read_data to true. */ |
| 501 | if (!tea->cannot_read_data) { |
| 502 | snd_tea575x_write(tea, 0x55AA); |
| 503 | if (snd_tea575x_read(tea) != 0x55AA) |
| 504 | return -ENODEV; |
| 505 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | |
Hans Verkuil | bc2b395 | 2012-02-27 05:31:58 -0300 | [diff] [blame] | 507 | tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_5_28; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | tea->freq = 90500 * 16; /* 90.5Mhz default */ |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 509 | snd_tea575x_set_freq(tea); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 510 | |
Ondrej Zary | 8fd7957 | 2013-05-14 16:54:43 -0300 | [diff] [blame] | 511 | return 0; |
| 512 | } |
| 513 | EXPORT_SYMBOL(snd_tea575x_hw_init); |
| 514 | |
| 515 | int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) |
| 516 | { |
| 517 | int retval = snd_tea575x_hw_init(tea); |
| 518 | |
| 519 | if (retval) |
| 520 | return retval; |
| 521 | |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 522 | tea->vd = tea575x_radio; |
| 523 | video_set_drvdata(&tea->vd, tea); |
Ondrej Zary | 6a529c1 | 2011-06-11 10:28:59 -0300 | [diff] [blame] | 524 | mutex_init(&tea->mutex); |
Mauro Carvalho Chehab | c0decac | 2018-09-10 08:19:14 -0400 | [diff] [blame] | 525 | strscpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); |
Ondrej Zary | 6a529c1 | 2011-06-11 10:28:59 -0300 | [diff] [blame] | 526 | tea->vd.lock = &tea->mutex; |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 527 | tea->vd.v4l2_dev = tea->v4l2_dev; |
Hans Verkuil | e83ce30 | 2019-06-04 07:19:52 -0400 | [diff] [blame] | 528 | tea->vd.device_caps = V4L2_CAP_TUNER | V4L2_CAP_RADIO; |
| 529 | if (!tea->cannot_read_data) |
| 530 | tea->vd.device_caps |= V4L2_CAP_HW_FREQ_SEEK; |
Hans de Goede | 5daf53a | 2012-05-19 07:57:03 -0300 | [diff] [blame] | 531 | tea->fops = tea575x_fops; |
| 532 | tea->fops.owner = owner; |
| 533 | tea->vd.fops = &tea->fops; |
Hans Verkuil | 6539799 | 2012-05-10 03:16:14 -0300 | [diff] [blame] | 534 | /* disable hw_freq_seek if we can't use it */ |
| 535 | if (tea->cannot_read_data) |
Hans Verkuil | 152a3a7 | 2012-05-14 11:32:48 -0300 | [diff] [blame] | 536 | v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK); |
Mauro Carvalho Chehab | 9b76ede | 2009-02-27 11:51:24 -0300 | [diff] [blame] | 537 | |
Hans de Goede | 3d0fe51 | 2012-05-18 12:21:57 -0300 | [diff] [blame] | 538 | if (!tea->cannot_mute) { |
| 539 | tea->vd.ctrl_handler = &tea->ctrl_handler; |
| 540 | v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); |
| 541 | v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, |
| 542 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); |
| 543 | retval = tea->ctrl_handler.error; |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 544 | if (retval) { |
Hans de Goede | 3d0fe51 | 2012-05-18 12:21:57 -0300 | [diff] [blame] | 545 | v4l2_err(tea->v4l2_dev, "can't initialize controls\n"); |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 546 | v4l2_ctrl_handler_free(&tea->ctrl_handler); |
| 547 | return retval; |
| 548 | } |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 549 | |
Hans de Goede | 3d0fe51 | 2012-05-18 12:21:57 -0300 | [diff] [blame] | 550 | if (tea->ext_init) { |
| 551 | retval = tea->ext_init(tea); |
| 552 | if (retval) { |
| 553 | v4l2_ctrl_handler_free(&tea->ctrl_handler); |
| 554 | return retval; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | v4l2_ctrl_handler_setup(&tea->ctrl_handler); |
| 559 | } |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 560 | |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 561 | retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->radio_nr); |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 562 | if (retval) { |
Hans Verkuil | d4ecc83 | 2012-02-27 05:30:13 -0300 | [diff] [blame] | 563 | v4l2_err(tea->v4l2_dev, "can't register video device!\n"); |
Hans de Goede | 3d0fe51 | 2012-05-18 12:21:57 -0300 | [diff] [blame] | 564 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 565 | return retval; |
| 566 | } |
Ondrej Zary | 14219d0 | 2011-05-09 23:39:26 +0200 | [diff] [blame] | 567 | |
| 568 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 569 | } |
Andy Shevchenko | 0e2a706 | 2015-12-18 18:32:00 -0200 | [diff] [blame] | 570 | EXPORT_SYMBOL(snd_tea575x_init); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | |
Takashi Iwai | 97f02e0 | 2005-11-17 14:17:19 +0100 | [diff] [blame] | 572 | void snd_tea575x_exit(struct snd_tea575x *tea) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | { |
Ondrej Zary | 4522e82 | 2011-05-23 09:17:19 -0300 | [diff] [blame] | 574 | video_unregister_device(&tea->vd); |
Hans de Goede | 3d0fe51 | 2012-05-18 12:21:57 -0300 | [diff] [blame] | 575 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 576 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | EXPORT_SYMBOL(snd_tea575x_exit); |