Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b8195946228c749702dfe5995b98516ea4b04cdc
Commit:     b8195946228c749702dfe5995b98516ea4b04cdc
Parent:     1bb0e8667fab773d6c5a3d7caf506001deaeb7f5
Author:     Hartmut Hackmann <[EMAIL PROTECTED]>
AuthorDate: Fri Apr 27 12:31:11 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Apr 27 15:43:30 2007 -0300

    V4L/DVB (5312): Saa713x: added a GPIO handler function
    
    This function allows to set, clear and tristate the GPIO ports.
    
    Signed-off-by: Hartmut Hackmann <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/saa7134/saa7134-core.c |   41 ++++++++++++++++++++++++++++
 drivers/media/video/saa7134/saa7134.h      |    1 +
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134-core.c 
b/drivers/media/video/saa7134/saa7134-core.c
index ed038ff..2e0518b 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -117,6 +117,47 @@ void saa7134_track_gpio(struct saa7134_dev *dev, char *msg)
               dev->name, mode, (~mode) & status, mode & status, msg);
 }
 
+void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value)
+{
+       u32 index, bitval;
+       u8 sync_control;
+
+       index = 1 << bit_no;
+       switch (value) {
+       case 0: /* static value */
+       case 1: dprintk("setting GPIO%d to static %d\n", bit_no, value);
+               /* turn sync mode off if necessary */
+               if (index & 0x00c00000)
+                       saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00);
+               if (value)
+                       bitval = index;
+               else
+                       bitval = 0;
+               saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, index);
+               saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval);
+               break;
+       case 3: /* tristate */
+               dprintk("setting GPIO%d to tristate\n", bit_no);
+               saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0);
+               break;
+       case 4: /* sync output on GPIO 22 for tda8275a, 50Hz*/
+       case 5: /* sync output on GPIO 22 for tda8275a, 60Hz*/
+               if (bit_no == 22) {
+                       dprintk("setting GPIO22 to vsync %d\n", value - 4);
+                       saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80);
+                       saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03);
+                       if (value == 5)
+                               sync_control = 11;
+                       else
+                               sync_control = 17;
+                       saa_writeb(SAA7134_VGATE_START, sync_control);
+                       saa_writeb(SAA7134_VGATE_STOP, sync_control + 1);
+                       saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00);
+               }
+               break;
+       }
+}
+
 /* ------------------------------------------------------------------ */
 
 
diff --git a/drivers/media/video/saa7134/saa7134.h 
b/drivers/media/video/saa7134/saa7134.h
index b3e3957..7b5ae19 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -562,6 +562,7 @@ extern struct list_head  saa7134_devlist;
 extern int saa7134_no_overlay;
 
 void saa7134_track_gpio(struct saa7134_dev *dev, char *msg);
+void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value);
 
 #define SAA7134_PGTABLE_SIZE 4096
 
-
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