aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-10 14:48:02 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-10 14:48:02 -0500
commit68c404b18f6fba404b2753622d0459c68ee128ae (patch)
treec1ec0bb12f19d91071b461cc2831d9d3dd4c74f3 /drivers/media/video/cx88
parentd035c36c58dd9183ad6aa7875dea89893faedb55 (diff)
parent6650239a4b01077e80d5a4468562756d77afaa59 (diff)
Merge branch 'bugfixes' into nfs-for-2.6.38
Conflicts: fs/nfs/nfs2xdr.c fs/nfs/nfs3xdr.c fs/nfs/nfs4xdr.c
Diffstat (limited to 'drivers/media/video/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c99
-rw-r--r--drivers/media/video/cx88/cx88-cards.c7
-rw-r--r--drivers/media/video/cx88/cx88-video.c27
-rw-r--r--drivers/media/video/cx88/cx88.h6
4 files changed, 22 insertions, 117 deletions
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 4aaa47c0eabf..54b7fcd469a8 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -40,7 +40,6 @@
40#include <sound/control.h> 40#include <sound/control.h>
41#include <sound/initval.h> 41#include <sound/initval.h>
42#include <sound/tlv.h> 42#include <sound/tlv.h>
43#include <media/wm8775.h>
44 43
45#include "cx88.h" 44#include "cx88.h"
46#include "cx88-reg.h" 45#include "cx88-reg.h"
@@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
587 int left, right, v, b; 586 int left, right, v, b;
588 int changed = 0; 587 int changed = 0;
589 u32 old; 588 u32 old;
590 struct v4l2_control client_ctl;
591
592 /* Pass volume & balance onto any WM8775 */
593 if (value->value.integer.value[0] >= value->value.integer.value[1]) {
594 v = value->value.integer.value[0] << 10;
595 b = value->value.integer.value[0] ?
596 (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
597 0x8000;
598 } else {
599 v = value->value.integer.value[1] << 10;
600 b = value->value.integer.value[1] ?
601 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
602 0x8000;
603 }
604 client_ctl.value = v;
605 client_ctl.id = V4L2_CID_AUDIO_VOLUME;
606 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
607
608 client_ctl.value = b;
609 client_ctl.id = V4L2_CID_AUDIO_BALANCE;
610 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
611 589
612 left = value->value.integer.value[0] & 0x3f; 590 left = value->value.integer.value[0] & 0x3f;
613 right = value->value.integer.value[1] & 0x3f; 591 right = value->value.integer.value[1] & 0x3f;
614 b = right - left; 592 b = right - left;
615 if (b < 0) { 593 if (b < 0) {
616 v = 0x3f - left; 594 v = 0x3f - left;
617 b = (-b) | 0x40; 595 b = (-b) | 0x40;
618 } else { 596 } else {
619 v = 0x3f - right; 597 v = 0x3f - right;
620 } 598 }
621 /* Do we really know this will always be called with IRQs on? */ 599 /* Do we really know this will always be called with IRQs on? */
622 spin_lock_irq(&chip->reg_lock); 600 spin_lock_irq(&chip->reg_lock);
623 old = cx_read(AUD_VOL_CTL); 601 old = cx_read(AUD_VOL_CTL);
624 if (v != (old & 0x3f)) { 602 if (v != (old & 0x3f)) {
625 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v); 603 cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
626 changed = 1; 604 changed = 1;
627 } 605 }
628 if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) { 606 if (cx_read(AUD_BAL_CTL) != b) {
629 cx_write(AUD_BAL_CTL, b); 607 cx_write(AUD_BAL_CTL, b);
630 changed = 1; 608 changed = 1;
631 } 609 }
632 spin_unlock_irq(&chip->reg_lock); 610 spin_unlock_irq(&chip->reg_lock);
633 611
@@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = {
640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
641 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 619 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
642 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 620 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
643 .name = "Analog-TV Volume", 621 .name = "Playback Volume",
644 .info = snd_cx88_volume_info, 622 .info = snd_cx88_volume_info,
645 .get = snd_cx88_volume_get, 623 .get = snd_cx88_volume_get,
646 .put = snd_cx88_volume_put, 624 .put = snd_cx88_volume_put,
@@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
671 vol = cx_read(AUD_VOL_CTL); 649 vol = cx_read(AUD_VOL_CTL);
672 if (value->value.integer.value[0] != !(vol & bit)) { 650 if (value->value.integer.value[0] != !(vol & bit)) {
673 vol ^= bit; 651 vol ^= bit;
674 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); 652 cx_write(AUD_VOL_CTL, vol);
675 /* Pass mute onto any WM8775 */
676 if ((1<<6) == bit) {
677 struct v4l2_control client_ctl;
678 client_ctl.value = 0 != (vol & bit);
679 client_ctl.id = V4L2_CID_AUDIO_MUTE;
680 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
681 }
682 ret = 1; 653 ret = 1;
683 } 654 }
684 spin_unlock_irq(&chip->reg_lock); 655 spin_unlock_irq(&chip->reg_lock);
@@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
687 658
688static const struct snd_kcontrol_new snd_cx88_dac_switch = { 659static const struct snd_kcontrol_new snd_cx88_dac_switch = {
689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
690 .name = "Audio-Out Switch", 661 .name = "Playback Switch",
691 .info = snd_ctl_boolean_mono_info, 662 .info = snd_ctl_boolean_mono_info,
692 .get = snd_cx88_switch_get, 663 .get = snd_cx88_switch_get,
693 .put = snd_cx88_switch_put, 664 .put = snd_cx88_switch_put,
@@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = {
696 667
697static const struct snd_kcontrol_new snd_cx88_source_switch = { 668static const struct snd_kcontrol_new snd_cx88_source_switch = {
698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
699 .name = "Analog-TV Switch", 670 .name = "Capture Switch",
700 .info = snd_ctl_boolean_mono_info, 671 .info = snd_ctl_boolean_mono_info,
701 .get = snd_cx88_switch_get, 672 .get = snd_cx88_switch_get,
702 .put = snd_cx88_switch_put, 673 .put = snd_cx88_switch_put,
703 .private_value = (1<<6), 674 .private_value = (1<<6),
704}; 675};
705 676
706static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *value)
708{
709 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
710 struct cx88_core *core = chip->core;
711 struct v4l2_control client_ctl;
712
713 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
714 call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl);
715 value->value.integer.value[0] = client_ctl.value ? 1 : 0;
716
717 return 0;
718}
719
720static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *value)
722{
723 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
724 struct cx88_core *core = chip->core;
725 struct v4l2_control client_ctl;
726
727 client_ctl.value = 0 != value->value.integer.value[0];
728 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
729 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
730
731 return 0;
732}
733
734static struct snd_kcontrol_new snd_cx88_alc_switch = {
735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
736 .name = "Line-In ALC Switch",
737 .info = snd_ctl_boolean_mono_info,
738 .get = snd_cx88_alc_get,
739 .put = snd_cx88_alc_put,
740};
741
742/**************************************************************************** 677/****************************************************************************
743 Basic Flow for Sound Devices 678 Basic Flow for Sound Devices
744 ****************************************************************************/ 679 ****************************************************************************/
@@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
860{ 795{
861 struct snd_card *card; 796 struct snd_card *card;
862 snd_cx88_card_t *chip; 797 snd_cx88_card_t *chip;
863 struct v4l2_subdev *sd;
864 int err; 798 int err;
865 799
866 if (devno >= SNDRV_CARDS) 800 if (devno >= SNDRV_CARDS)
@@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
896 if (err < 0) 830 if (err < 0)
897 goto error; 831 goto error;
898 832
899 /* If there's a wm8775 then add a Line-In ALC switch */
900 list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) {
901 if (WM8775_GID == sd->grp_id) {
902 snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch,
903 chip));
904 break;
905 }
906 }
907
908 strcpy (card->driver, "CX88x"); 833 strcpy (card->driver, "CX88x");
909 sprintf(card->shortname, "Conexant CX%x", pci->device); 834 sprintf(card->shortname, "Conexant CX%x", pci->device);
910 sprintf(card->longname, "%s at %#llx", 835 sprintf(card->longname, "%s at %#llx",
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 9b9e169cce90..0ccc2afd7266 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = {
1007 .radio_type = UNSET, 1007 .radio_type = UNSET,
1008 .tuner_addr = ADDR_UNSET, 1008 .tuner_addr = ADDR_UNSET,
1009 .radio_addr = ADDR_UNSET, 1009 .radio_addr = ADDR_UNSET,
1010 .audio_chip = V4L2_IDENT_WM8775,
1010 .input = {{ 1011 .input = {{
1011 .type = CX88_VMUX_DVB, 1012 .type = CX88_VMUX_DVB,
1012 .vmux = 0, 1013 .vmux = 0,
1014 /* 2: Line-In */
1015 .audioroute = 2,
1013 },{ 1016 },{
1014 .type = CX88_VMUX_COMPOSITE1, 1017 .type = CX88_VMUX_COMPOSITE1,
1015 .vmux = 1, 1018 .vmux = 1,
1019 /* 2: Line-In */
1020 .audioroute = 2,
1016 },{ 1021 },{
1017 .type = CX88_VMUX_SVIDEO, 1022 .type = CX88_VMUX_SVIDEO,
1018 .vmux = 2, 1023 .vmux = 2,
1024 /* 2: Line-In */
1025 .audioroute = 2,
1019 }}, 1026 }},
1020 .mpeg = CX88_MPEG_DVB, 1027 .mpeg = CX88_MPEG_DVB,
1021 }, 1028 },
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 62cea9549404..d9249e5a04c9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -40,7 +40,6 @@
40#include "cx88.h" 40#include "cx88.h"
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h> 42#include <media/v4l2-ioctl.h>
43#include <media/wm8775.h>
44 43
45MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 44MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
46MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 45MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
977 const struct cx88_ctrl *c = NULL; 976 const struct cx88_ctrl *c = NULL;
978 u32 value,mask; 977 u32 value,mask;
979 int i; 978 int i;
980 struct v4l2_control client_ctl;
981 979
982 for (i = 0; i < CX8800_CTLS; i++) { 980 for (i = 0; i < CX8800_CTLS; i++) {
983 if (cx8800_ctls[i].v.id == ctl->id) { 981 if (cx8800_ctls[i].v.id == ctl->id) {
@@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
991 ctl->value = c->v.minimum; 989 ctl->value = c->v.minimum;
992 if (ctl->value > c->v.maximum) 990 if (ctl->value > c->v.maximum)
993 ctl->value = c->v.maximum; 991 ctl->value = c->v.maximum;
994
995 /* Pass changes onto any WM8775 */
996 client_ctl.id = ctl->id;
997 switch (ctl->id) {
998 case V4L2_CID_AUDIO_MUTE:
999 client_ctl.value = ctl->value;
1000 break;
1001 case V4L2_CID_AUDIO_VOLUME:
1002 client_ctl.value = (ctl->value) ?
1003 (0x90 + ctl->value) << 8 : 0;
1004 break;
1005 case V4L2_CID_AUDIO_BALANCE:
1006 client_ctl.value = ctl->value << 9;
1007 break;
1008 default:
1009 client_ctl.id = 0;
1010 break;
1011 }
1012 if (client_ctl.id)
1013 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
1014
1015 mask=c->mask; 992 mask=c->mask;
1016 switch (ctl->id) { 993 switch (ctl->id) {
1017 case V4L2_CID_AUDIO_BALANCE: 994 case V4L2_CID_AUDIO_BALANCE:
@@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv,
1558 if (c->id < V4L2_CID_BASE || 1535 if (c->id < V4L2_CID_BASE ||
1559 c->id >= V4L2_CID_LASTP1) 1536 c->id >= V4L2_CID_LASTP1)
1560 return -EINVAL; 1537 return -EINVAL;
1561 if (c->id == V4L2_CID_AUDIO_MUTE || 1538 if (c->id == V4L2_CID_AUDIO_MUTE) {
1562 c->id == V4L2_CID_AUDIO_VOLUME ||
1563 c->id == V4L2_CID_AUDIO_BALANCE) {
1564 for (i = 0; i < CX8800_CTLS; i++) { 1539 for (i = 0; i < CX8800_CTLS; i++) {
1565 if (cx8800_ctls[i].v.id == c->id) 1540 if (cx8800_ctls[i].v.id == c->id)
1566 break; 1541 break;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index e8c732e7ae4f..c9981e77416a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev); 398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
399} 399}
400 400
401#define call_hw(core, grpid, o, f, args...) \ 401#define call_all(core, o, f, args...) \
402 do { \ 402 do { \
403 if (!core->i2c_rc) { \ 403 if (!core->i2c_rc) { \
404 if (core->gate_ctrl) \ 404 if (core->gate_ctrl) \
405 core->gate_ctrl(core, 1); \ 405 core->gate_ctrl(core, 1); \
406 v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \ 406 v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \
407 if (core->gate_ctrl) \ 407 if (core->gate_ctrl) \
408 core->gate_ctrl(core, 0); \ 408 core->gate_ctrl(core, 0); \
409 } \ 409 } \
410 } while (0) 410 } while (0)
411 411
412#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
413
414struct cx8800_dev; 412struct cx8800_dev;
415struct cx8802_dev; 413struct cx8802_dev;
416 414