diff options
author | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2007-01-22 23:44:47 +0100 |
---|---|---|
committer | Hartmut Hackmann <hartmut.hackmann@t-online.de> | 2007-01-22 23:44:47 +0100 |
commit | eb69d8221127090471e67cdb38e3d97f4ae5ca80 (patch) | |
tree | 535444918f27f068ad3fec18018d21cdd1589bca /linux/drivers/media/video/saa7134/saa7134-core.c | |
parent | f68b595469707a626aa84101487a76ef1c25e140 (diff) | |
download | mediapointer-dvb-s2-eb69d8221127090471e67cdb38e3d97f4ae5ca80.tar.gz mediapointer-dvb-s2-eb69d8221127090471e67cdb38e3d97f4ae5ca80.tar.bz2 |
saa713x: added a GPIO handler function
From: Hartmut Hackmann <hartmut.hackmann@t-online.de>
This function allows to set, clear and tristate the GPIO ports.
Signed-off-by: Hartmut Hackmann <hartmut.hackmann@t-online.de>
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-core.c')
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-core.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 601c093eb..d52d2ae59 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -137,6 +137,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; + } +} + /* ------------------------------------------------------------------ */ #if 0 |