diff options
author | Hans de Goede <hdegoede@redhat.com> | 2012-05-18 11:21:57 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-30 16:57:01 -0400 |
commit | 3d0fe51cfa3d07751224c034f8226136a7dd05f2 (patch) | |
tree | a19162d70ec86dcae23bb404c1baa643a52195df | |
parent | 31a62d415726d94bae5caf5f2e50232aa06babf6 (diff) |
[media] snd_tea575x: Add a cannot_mute flag
Some devices which use the tea575x tuner chip don't allow direct control
over the IO pins, and thus cannot mute the audio output.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
CC: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | include/sound/tea575x-tuner.h | 1 | ||||
-rw-r--r-- | sound/i2c/other/tea575x-tuner.c | 35 |
2 files changed, 20 insertions, 16 deletions
diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 7bd6f6145a38..fe8590cac5c2 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h | |||
@@ -53,6 +53,7 @@ struct snd_tea575x { | |||
53 | int radio_nr; /* radio_nr */ | 53 | int radio_nr; /* radio_nr */ |
54 | bool tea5759; /* 5759 chip is present */ | 54 | bool tea5759; /* 5759 chip is present */ |
55 | bool cannot_read_data; /* Device cannot read the data pin */ | 55 | bool cannot_read_data; /* Device cannot read the data pin */ |
56 | bool cannot_mute; /* Device cannot mute */ | ||
56 | bool mute; /* Device is muted? */ | 57 | bool mute; /* Device is muted? */ |
57 | bool stereo; /* receiving stereo */ | 58 | bool stereo; /* receiving stereo */ |
58 | bool tuned; /* tuned to a station */ | 59 | bool tuned; /* tuned to a station */ |
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 080aae9d1198..d14edb7d6484 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c | |||
@@ -385,7 +385,6 @@ int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) | |||
385 | strlcpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); | 385 | strlcpy(tea->vd.name, tea->v4l2_dev->name, sizeof(tea->vd.name)); |
386 | tea->vd.lock = &tea->mutex; | 386 | tea->vd.lock = &tea->mutex; |
387 | tea->vd.v4l2_dev = tea->v4l2_dev; | 387 | tea->vd.v4l2_dev = tea->v4l2_dev; |
388 | tea->vd.ctrl_handler = &tea->ctrl_handler; | ||
389 | tea->fops = tea575x_fops; | 388 | tea->fops = tea575x_fops; |
390 | tea->fops.owner = owner; | 389 | tea->fops.owner = owner; |
391 | tea->vd.fops = &tea->fops; | 390 | tea->vd.fops = &tea->fops; |
@@ -394,29 +393,33 @@ int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) | |||
394 | if (tea->cannot_read_data) | 393 | if (tea->cannot_read_data) |
395 | v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK); | 394 | v4l2_disable_ioctl(&tea->vd, VIDIOC_S_HW_FREQ_SEEK); |
396 | 395 | ||
397 | v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); | 396 | if (!tea->cannot_mute) { |
398 | v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); | 397 | tea->vd.ctrl_handler = &tea->ctrl_handler; |
399 | retval = tea->ctrl_handler.error; | 398 | v4l2_ctrl_handler_init(&tea->ctrl_handler, 1); |
400 | if (retval) { | 399 | v4l2_ctrl_new_std(&tea->ctrl_handler, &tea575x_ctrl_ops, |
401 | v4l2_err(tea->v4l2_dev, "can't initialize controls\n"); | 400 | V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); |
402 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | 401 | retval = tea->ctrl_handler.error; |
403 | return retval; | ||
404 | } | ||
405 | |||
406 | if (tea->ext_init) { | ||
407 | retval = tea->ext_init(tea); | ||
408 | if (retval) { | 402 | if (retval) { |
403 | v4l2_err(tea->v4l2_dev, "can't initialize controls\n"); | ||
409 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | 404 | v4l2_ctrl_handler_free(&tea->ctrl_handler); |
410 | return retval; | 405 | return retval; |
411 | } | 406 | } |
412 | } | ||
413 | 407 | ||
414 | v4l2_ctrl_handler_setup(&tea->ctrl_handler); | 408 | if (tea->ext_init) { |
409 | retval = tea->ext_init(tea); | ||
410 | if (retval) { | ||
411 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | ||
412 | return retval; | ||
413 | } | ||
414 | } | ||
415 | |||
416 | v4l2_ctrl_handler_setup(&tea->ctrl_handler); | ||
417 | } | ||
415 | 418 | ||
416 | retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->radio_nr); | 419 | retval = video_register_device(&tea->vd, VFL_TYPE_RADIO, tea->radio_nr); |
417 | if (retval) { | 420 | if (retval) { |
418 | v4l2_err(tea->v4l2_dev, "can't register video device!\n"); | 421 | v4l2_err(tea->v4l2_dev, "can't register video device!\n"); |
419 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | 422 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); |
420 | return retval; | 423 | return retval; |
421 | } | 424 | } |
422 | 425 | ||
@@ -426,7 +429,7 @@ int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner) | |||
426 | void snd_tea575x_exit(struct snd_tea575x *tea) | 429 | void snd_tea575x_exit(struct snd_tea575x *tea) |
427 | { | 430 | { |
428 | video_unregister_device(&tea->vd); | 431 | video_unregister_device(&tea->vd); |
429 | v4l2_ctrl_handler_free(&tea->ctrl_handler); | 432 | v4l2_ctrl_handler_free(tea->vd.ctrl_handler); |
430 | } | 433 | } |
431 | 434 | ||
432 | static int __init alsa_tea575x_module_init(void) | 435 | static int __init alsa_tea575x_module_init(void) |