Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f36224d3992a7734349cdd6289ff73c3d007ce09
Commit:     f36224d3992a7734349cdd6289ff73c3d007ce09
Parent:     5c01203fd289214ae3062dab4039fcbab4b2b84f
Author:     Maxim Levitsky <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 23 00:58:59 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:02:46 2008 -0200

    V4L/DVB (6670): V4L: saa7134: tvaudio cleanups
    
    move some tv-audio initialization code out of tvaudio thread,
    and call it on resume too.
    
    Signed-off-by: Maxim Levitsky <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/saa7134/saa7134-core.c    |    1 +
 drivers/media/video/saa7134/saa7134-tvaudio.c |   79 ++++++++++++-------------
 drivers/media/video/saa7134/saa7134.h         |    1 +
 3 files changed, 41 insertions(+), 40 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134-core.c 
b/drivers/media/video/saa7134/saa7134-core.c
index f5e43d3..cbddd35 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1235,6 +1235,7 @@ static int saa7134_resume(struct pci_dev *pci_dev)
        saa7134_set_tvnorm_hw(dev);
        saa7134_tvaudio_setmute(dev);
        saa7134_tvaudio_setvolume(dev, dev->ctl_volume);
+       saa7134_tvaudio_init(dev);
        saa7134_tvaudio_do_scan(dev);
        saa7134_enable_i2s(dev);
        saa7134_hw_enable2(dev);
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c 
b/drivers/media/video/saa7134/saa7134-tvaudio.c
index f8e304c..4e98104 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -163,32 +163,6 @@ static struct saa7134_tvaudio tvaudio[] = {
 
 /* ------------------------------------------------------------------ */
 
-static void tvaudio_init(struct saa7134_dev *dev)
-{
-       int clock = saa7134_boards[dev->board].audio_clock;
-
-       if (UNSET != audio_clock_override)
-               clock = audio_clock_override;
-
-       /* init all audio registers */
-       saa_writeb(SAA7134_AUDIO_PLL_CTRL,   0x00);
-       if (need_resched())
-               schedule();
-       else
-               udelay(10);
-
-       saa_writeb(SAA7134_AUDIO_CLOCK0,      clock        & 0xff);
-       saa_writeb(SAA7134_AUDIO_CLOCK1,     (clock >>  8) & 0xff);
-       saa_writeb(SAA7134_AUDIO_CLOCK2,     (clock >> 16) & 0xff);
-       /* frame locked audio is mandatory for NICAM */
-       saa_writeb(SAA7134_AUDIO_PLL_CTRL,   0x01);
-
-       saa_writeb(SAA7134_NICAM_ERROR_LOW,  0x14);
-       saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50);
-       saa_writeb(SAA7134_MONITOR_SELECT,   0xa0);
-       saa_writeb(SAA7134_FM_DEMATRIX,      0x80);
-}
-
 static u32 tvaudio_carr2reg(u32 carrier)
 {
        u64 a = carrier;
@@ -517,9 +491,13 @@ static int tvaudio_thread(void *data)
                dev->thread.scan1 = dev->thread.scan2;
                dprintk("tvaudio thread scan start [%d]\n",dev->thread.scan1);
                dev->tvaudio  = NULL;
-               tvaudio_init(dev);
+
+               saa_writeb(SAA7134_MONITOR_SELECT,   0xa0);
+               saa_writeb(SAA7134_FM_DEMATRIX,      0x80);
+
                if (dev->ctl_automute)
                        dev->automute = 1;
+
                mute_input_7134(dev);
 
                /* give the tuner some time */
@@ -784,27 +762,15 @@ static int mute_input_7133(struct saa7134_dev *dev)
 static int tvaudio_thread_ddep(void *data)
 {
        struct saa7134_dev *dev = data;
-       u32 value, norms, clock;
+       u32 value, norms;
 
 
        set_freezable();
-
-       clock = saa7134_boards[dev->board].audio_clock;
-       if (UNSET != audio_clock_override)
-               clock = audio_clock_override;
-       saa_writel(0x598 >> 2, clock);
-
-       /* unmute */
-       saa_dsp_writel(dev, 0x474 >> 2, 0x00);
-       saa_dsp_writel(dev, 0x450 >> 2, 0x00);
-
        for (;;) {
                tvaudio_sleep(dev,-1);
                if (kthread_should_stop())
                        goto done;
-
        restart:
-
                try_to_freeze();
 
                dev->thread.scan1 = dev->thread.scan2;
@@ -978,6 +944,38 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev)
        return retval;
 }
 
+void saa7134_tvaudio_init(struct saa7134_dev *dev)
+{
+       int clock = saa7134_boards[dev->board].audio_clock;
+
+       if (UNSET != audio_clock_override)
+               clock = audio_clock_override;
+
+       switch (dev->pci->device) {
+       case PCI_DEVICE_ID_PHILIPS_SAA7134:
+               /* init all audio registers */
+               saa_writeb(SAA7134_AUDIO_PLL_CTRL,   0x00);
+               if (need_resched())
+                       schedule();
+               else
+                       udelay(10);
+
+               saa_writeb(SAA7134_AUDIO_CLOCK0,      clock        & 0xff);
+               saa_writeb(SAA7134_AUDIO_CLOCK1,     (clock >>  8) & 0xff);
+               saa_writeb(SAA7134_AUDIO_CLOCK2,     (clock >> 16) & 0xff);
+               /* frame locked audio is mandatory for NICAM */
+               saa_writeb(SAA7134_AUDIO_PLL_CTRL,   0x01);
+               saa_writeb(SAA7134_NICAM_ERROR_LOW,  0x14);
+               saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50);
+               break;
+       case PCI_DEVICE_ID_PHILIPS_SAA7133:
+       case PCI_DEVICE_ID_PHILIPS_SAA7135:
+               saa_writel(0x598 >> 2, clock);
+               saa_dsp_writel(dev, 0x474 >> 2, 0x00);
+               saa_dsp_writel(dev, 0x450 >> 2, 0x00);
+       }
+}
+
 int saa7134_tvaudio_init2(struct saa7134_dev *dev)
 {
        int (*my_thread)(void *data) = NULL;
@@ -994,6 +992,7 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
 
        dev->thread.thread = NULL;
        if (my_thread) {
+               saa7134_tvaudio_init(dev);
                /* start tvaudio thread */
                dev->thread.thread = kthread_run(my_thread, dev, "%s", 
dev->name);
                if (IS_ERR(dev->thread.thread)) {
diff --git a/drivers/media/video/saa7134/saa7134.h 
b/drivers/media/video/saa7134/saa7134.h
index a531e3c..5c5b074 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -678,6 +678,7 @@ void saa7134_tvaudio_setinput(struct saa7134_dev *dev,
 void saa7134_tvaudio_setvolume(struct saa7134_dev *dev, int level);
 int saa7134_tvaudio_getstereo(struct saa7134_dev *dev);
 
+void saa7134_tvaudio_init(struct saa7134_dev *dev);
 int saa7134_tvaudio_init2(struct saa7134_dev *dev);
 int saa7134_tvaudio_fini(struct saa7134_dev *dev);
 int saa7134_tvaudio_do_scan(struct saa7134_dev *dev);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to