aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-07-30 03:08:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-30 03:08:53 -0400
commit664a41b8a91bf78a01a751e15175e0008977685a (patch)
treed9dc15c83400ad2dfb430ff27ae3e7fdc9395856 /sound
parent983236b5741e557451f3ed4ec5ebf1f62a5b2c15 (diff)
parentee2ce3a0b43d14d792d34cf88e7bc2091096744b (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (430 commits) [media] ir-mce_kbd-decoder: include module.h for its facilities [media] ov5642: include module.h for its facilities [media] em28xx: Fix DVB-C maxsize for em2884 [media] tda18271c2dd: Fix saw filter configuration for DVB-C @6MHz [media] v4l: mt9v032: Fix Bayer pattern [media] V4L: mt9m111: rewrite set_pixfmt [media] V4L: mt9m111: fix missing return value check mt9m111_reg_clear [media] V4L: initial driver for ov5642 CMOS sensor [media] V4L: sh_mobile_ceu_camera: fix Oops when USERPTR mapping fails [media] V4L: soc-camera: remove soc-camera bus and devices on it [media] V4L: soc-camera: un-export the soc-camera bus [media] V4L: sh_mobile_csi2: switch away from using the soc-camera bus notifier [media] V4L: add media bus configuration subdev operations [media] V4L: soc-camera: group struct field initialisations together [media] V4L: soc-camera: remove now unused soc-camera specific PM hooks [media] V4L: pxa-camera: switch to using standard PM hooks [media] NetUP Dual DVB-T/C CI RF: force card hardware revision by module param [media] Don't OOPS if videobuf_dvb_get_frontend return NULL [media] NetUP Dual DVB-T/C CI RF: load firmware according card revision [media] omap3isp: Support configurable HS/VS polarities ... Fix up conflicts: - arch/arm/mach-omap2/board-rx51-peripherals.c: cleanup regulator supply definitions in mach-omap2 vs OMAP3: RX-51: define vdds_csib regulator supply - drivers/staging/tm6000/tm6000-alsa.c (trivial)
Diffstat (limited to 'sound')
-rw-r--r--sound/i2c/other/tea575x-tuner.c143
-rw-r--r--sound/pci/Kconfig4
2 files changed, 40 insertions, 107 deletions
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index 4831800239d3..484a35b3715f 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -22,11 +22,11 @@
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/interrupt.h>
26#include <linux/init.h> 25#include <linux/init.h>
27#include <linux/slab.h> 26#include <linux/slab.h>
28#include <linux/version.h> 27#include <linux/version.h>
29#include <sound/core.h> 28#include <media/v4l2-dev.h>
29#include <media/v4l2-ioctl.h>
30#include <sound/tea575x-tuner.h> 30#include <sound/tea575x-tuner.h>
31 31
32MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); 32MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
@@ -62,17 +62,6 @@ module_param(radio_nr, int, 0);
62#define TEA575X_BIT_DUMMY (1<<15) /* buffer */ 62#define TEA575X_BIT_DUMMY (1<<15) /* buffer */
63#define TEA575X_BIT_FREQ_MASK 0x7fff 63#define TEA575X_BIT_FREQ_MASK 0x7fff
64 64
65static 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
76/* 65/*
77 * lowlevel part 66 * lowlevel part
78 */ 67 */
@@ -266,83 +255,23 @@ static int vidioc_s_audio(struct file *file, void *priv,
266 return 0; 255 return 0;
267} 256}
268 257
269static int vidioc_queryctrl(struct file *file, void *priv, 258static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
270 struct v4l2_queryctrl *qc)
271{
272 int i;
273
274 for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
275 if (qc->id && qc->id == radio_qctrl[i].id) {
276 memcpy(qc, &(radio_qctrl[i]),
277 sizeof(*qc));
278 return 0;
279 }
280 }
281 return -EINVAL;
282}
283
284static int vidioc_g_ctrl(struct file *file, void *priv,
285 struct v4l2_control *ctrl)
286{ 259{
287 struct snd_tea575x *tea = video_drvdata(file); 260 struct snd_tea575x *tea = container_of(ctrl->handler, struct snd_tea575x, ctrl_handler);
288 261
289 switch (ctrl->id) { 262 switch (ctrl->id) {
290 case V4L2_CID_AUDIO_MUTE: 263 case V4L2_CID_AUDIO_MUTE:
291 ctrl->value = tea->mute; 264 tea->mute = ctrl->val;
265 snd_tea575x_set_freq(tea);
292 return 0; 266 return 0;
293 } 267 }
294 return -EINVAL;
295}
296 268
297static int vidioc_s_ctrl(struct file *file, void *priv,
298 struct v4l2_control *ctrl)
299{
300 struct snd_tea575x *tea = video_drvdata(file);
301
302 switch (ctrl->id) {
303 case V4L2_CID_AUDIO_MUTE:
304 if (tea->mute != ctrl->value) {
305 tea->mute = ctrl->value;
306 snd_tea575x_set_freq(tea);
307 }
308 return 0;
309 }
310 return -EINVAL; 269 return -EINVAL;
311} 270}
312 271
313static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
314{
315 *i = 0;
316 return 0;
317}
318
319static int vidioc_s_input(struct file *filp, void *priv, unsigned int i)
320{
321 if (i != 0)
322 return -EINVAL;
323 return 0;
324}
325
326static int snd_tea575x_exclusive_open(struct file *file)
327{
328 struct snd_tea575x *tea = video_drvdata(file);
329
330 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0;
331}
332
333static int snd_tea575x_exclusive_release(struct file *file)
334{
335 struct snd_tea575x *tea = video_drvdata(file);
336
337 clear_bit(0, &tea->in_use);
338 return 0;
339}
340
341static const struct v4l2_file_operations tea575x_fops = { 272static const struct v4l2_file_operations tea575x_fops = {
342 .owner = THIS_MODULE, 273 .owner = THIS_MODULE,
343 .open = snd_tea575x_exclusive_open, 274 .unlocked_ioctl = video_ioctl2,
344 .release = snd_tea575x_exclusive_release,
345 .ioctl = video_ioctl2,
346}; 275};
347 276
348static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { 277static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
@@ -351,20 +280,19 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
351 .vidioc_s_tuner = vidioc_s_tuner, 280 .vidioc_s_tuner = vidioc_s_tuner,
352 .vidioc_g_audio = vidioc_g_audio, 281 .vidioc_g_audio = vidioc_g_audio,
353 .vidioc_s_audio = vidioc_s_audio, 282 .vidioc_s_audio = vidioc_s_audio,
354 .vidioc_g_input = vidioc_g_input,
355 .vidioc_s_input = vidioc_s_input,
356 .vidioc_g_frequency = vidioc_g_frequency, 283 .vidioc_g_frequency = vidioc_g_frequency,
357 .vidioc_s_frequency = vidioc_s_frequency, 284 .vidioc_s_frequency = vidioc_s_frequency,
358 .vidioc_queryctrl = vidioc_queryctrl,
359 .vidioc_g_ctrl = vidioc_g_ctrl,
360 .vidioc_s_ctrl = vidioc_s_ctrl,
361}; 285};
362 286
363static struct video_device tea575x_radio = { 287static struct video_device tea575x_radio = {
364 .name = "tea575x-tuner", 288 .name = "tea575x-tuner",
365 .fops = &tea575x_fops, 289 .fops = &tea575x_fops,
366 .ioctl_ops = &tea575x_ioctl_ops, 290 .ioctl_ops = &tea575x_ioctl_ops,
367 .release = video_device_release, 291 .release = video_device_release_empty,
292};
293
294static const struct v4l2_ctrl_ops tea575x_ctrl_ops = {
295 .s_ctrl = tea575x_s_ctrl,
368}; 296};
369 297
370/* 298/*
@@ -373,7 +301,6 @@ static struct video_device tea575x_radio = {
373int snd_tea575x_init(struct snd_tea575x *tea) 301int snd_tea575x_init(struct snd_tea575x *tea)
374{ 302{
375 int retval; 303 int retval;
376 struct video_device *tea575x_radio_inst;
377 304
378 tea->mute = 1; 305 tea->mute = 1;
379 306
@@ -381,43 +308,49 @@ int snd_tea575x_init(struct snd_tea575x *tea)
381 if (snd_tea575x_read(tea) != 0x55AA) 308 if (snd_tea575x_read(tea) != 0x55AA)
382 return -ENODEV; 309 return -ENODEV;
383 310
384 tea->in_use = 0;
385 tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40; 311 tea->val = TEA575X_BIT_BAND_FM | TEA575X_BIT_SEARCH_10_40;
386 tea->freq = 90500 * 16; /* 90.5Mhz default */ 312 tea->freq = 90500 * 16; /* 90.5Mhz default */
313 snd_tea575x_set_freq(tea);
387 314
388 tea575x_radio_inst = video_device_alloc(); 315 tea->vd = tea575x_radio;
389 if (tea575x_radio_inst == NULL) { 316 video_set_drvdata(&tea->vd, tea);
390 printk(KERN_ERR "tea575x-tuner: not enough memory\n"); 317 mutex_init(&tea->mutex);
391 return -ENOMEM; 318 tea->vd.lock = &tea->mutex;
392 }
393 319
394 memcpy(tea575x_radio_inst, &tea575x_radio, sizeof(tea575x_radio)); 320 v4l2_ctrl_handler_init(&tea->ctrl_handler, 1);
321 tea->vd.ctrl_handler = &tea->ctrl_handler;
322 v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
323 retval = tea->ctrl_handler.error;
324 if (retval) {
325 printk(KERN_ERR "tea575x-tuner: can't initialize controls\n");
326 v4l2_ctrl_handler_free(&tea->ctrl_handler);
327 return retval;
328 }
395 329
396 strcpy(tea575x_radio.name, tea->tea5759 ? 330 if (tea->ext_init) {
397 "TEA5759 radio" : "TEA5757 radio"); 331 retval = tea->ext_init(tea);
332 if (retval) {
333 v4l2_ctrl_handler_free(&tea->ctrl_handler);
334 return retval;
335 }
336 }
398 337
399 video_set_drvdata(tea575x_radio_inst, tea); 338 v4l2_ctrl_handler_setup(&tea->ctrl_handler);
400 339
401 retval = video_register_device(tea575x_radio_inst, 340 retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, radio_nr);
402 VFL_TYPE_RADIO, radio_nr);
403 if (retval) { 341 if (retval) {
404 printk(KERN_ERR "tea575x-tuner: can't register video device!\n"); 342 printk(KERN_ERR "tea575x-tuner: can't register video device!\n");
405 kfree(tea575x_radio_inst); 343 v4l2_ctrl_handler_free(&tea->ctrl_handler);
406 return retval; 344 return retval;
407 } 345 }
408 346
409 snd_tea575x_set_freq(tea);
410 tea->vd = tea575x_radio_inst;
411
412 return 0; 347 return 0;
413} 348}
414 349
415void snd_tea575x_exit(struct snd_tea575x *tea) 350void snd_tea575x_exit(struct snd_tea575x *tea)
416{ 351{
417 if (tea->vd) { 352 video_unregister_device(&tea->vd);
418 video_unregister_device(tea->vd); 353 v4l2_ctrl_handler_free(&tea->ctrl_handler);
419 tea->vd = NULL;
420 }
421} 354}
422 355
423static int __init alsa_tea575x_module_init(void) 356static int __init alsa_tea575x_module_init(void)
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index e90d103e177e..50abf5bf8e09 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -565,8 +565,8 @@ config SND_FM801_TEA575X_BOOL
565 565
566config SND_TEA575X 566config SND_TEA575X
567 tristate 567 tristate
568 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO 568 depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2
569 default SND_FM801 || SND_ES1968 569 default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2
570 570
571source "sound/pci/hda/Kconfig" 571source "sound/pci/hda/Kconfig"
572 572