diff options
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 41 | ||||
-rw-r--r-- | 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 ed038fff3b4f..2e0518bb9efd 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) | |||
117 | dev->name, mode, (~mode) & status, mode & status, msg); | 117 | dev->name, mode, (~mode) & status, mode & status, msg); |
118 | } | 118 | } |
119 | 119 | ||
120 | void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value) | ||
121 | { | ||
122 | u32 index, bitval; | ||
123 | u8 sync_control; | ||
124 | |||
125 | index = 1 << bit_no; | ||
126 | switch (value) { | ||
127 | case 0: /* static value */ | ||
128 | case 1: dprintk("setting GPIO%d to static %d\n", bit_no, value); | ||
129 | /* turn sync mode off if necessary */ | ||
130 | if (index & 0x00c00000) | ||
131 | saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00); | ||
132 | if (value) | ||
133 | bitval = index; | ||
134 | else | ||
135 | bitval = 0; | ||
136 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, index); | ||
137 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval); | ||
138 | break; | ||
139 | case 3: /* tristate */ | ||
140 | dprintk("setting GPIO%d to tristate\n", bit_no); | ||
141 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0); | ||
142 | break; | ||
143 | case 4: /* sync output on GPIO 22 for tda8275a, 50Hz*/ | ||
144 | case 5: /* sync output on GPIO 22 for tda8275a, 60Hz*/ | ||
145 | if (bit_no == 22) { | ||
146 | dprintk("setting GPIO22 to vsync %d\n", value - 4); | ||
147 | saa_andorb(SAA7134_VIDEO_PORT_CTRL3, 0x80, 0x80); | ||
148 | saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x03); | ||
149 | if (value == 5) | ||
150 | sync_control = 11; | ||
151 | else | ||
152 | sync_control = 17; | ||
153 | saa_writeb(SAA7134_VGATE_START, sync_control); | ||
154 | saa_writeb(SAA7134_VGATE_STOP, sync_control + 1); | ||
155 | saa_andorb(SAA7134_MISC_VGATE_MSB, 0x03, 0x00); | ||
156 | } | ||
157 | break; | ||
158 | } | ||
159 | } | ||
160 | |||
120 | /* ------------------------------------------------------------------ */ | 161 | /* ------------------------------------------------------------------ */ |
121 | 162 | ||
122 | 163 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index b3e3957c89b5..7b5ae194bb11 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; | |||
562 | extern int saa7134_no_overlay; | 562 | extern int saa7134_no_overlay; |
563 | 563 | ||
564 | void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); | 564 | void saa7134_track_gpio(struct saa7134_dev *dev, char *msg); |
565 | void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value); | ||
565 | 566 | ||
566 | #define SAA7134_PGTABLE_SIZE 4096 | 567 | #define SAA7134_PGTABLE_SIZE 4096 |
567 | 568 | ||