diff options
author | Michael Hunold <devnull@localhost> | 2003-11-20 10:50:15 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2003-11-20 10:50:15 +0000 |
commit | bbff4037e33929d1353b8f065862d9fc66ef05a9 (patch) | |
tree | 9c54699a1dc4072a7d6660b81928b26e15a5c623 /linux/drivers/media/common | |
parent | 73ee18fbc6b15911cd9c4f47bc90d2212e2d09dd (diff) | |
download | mediapointer-dvb-s2-bbff4037e33929d1353b8f065862d9fc66ef05a9.tar.gz mediapointer-dvb-s2-bbff4037e33929d1353b8f065862d9fc66ef05a9.tar.bz2 |
- move saa7146_set_gpio() from saa7146_vv to saa7146_core
- add "new" saa7146_wait_for_debi_done() function, remove other versions
from av7110 and budget.ci
- make budget-ci use this gpio function and the new wait_...() function,
therefore fix
BORROWED_FROM_AV7110_H_BUT_REALLY_BELONGS_IN_SAA7146_DEFS_H remark
Diffstat (limited to 'linux/drivers/media/common')
-rw-r--r-- | linux/drivers/media/common/saa7146_core.c | 54 | ||||
-rw-r--r-- | linux/drivers/media/common/saa7146_hlp.c | 18 |
2 files changed, 54 insertions, 18 deletions
diff --git a/linux/drivers/media/common/saa7146_core.c b/linux/drivers/media/common/saa7146_core.c index 84c6beb92..206a942af 100644 --- a/linux/drivers/media/common/saa7146_core.c +++ b/linux/drivers/media/common/saa7146_core.c @@ -45,6 +45,59 @@ static void dump_registers(struct saa7146_dev* dev) #endif /**************************************************************************** + * gpio and debi helper functions + ****************************************************************************/ + +/* write "data" to the gpio-pin "pin" */ +void saa7146_set_gpio(struct saa7146_dev *dev, u8 pin, u8 data) +{ + u32 value = 0; + + /* sanity check */ + if(pin > 3) + return; + + /* read old register contents */ + value = saa7146_read(dev, GPIO_CTRL ); + + value &= ~(0xff << (8*pin)); + value |= (data << (8*pin)); + + saa7146_write(dev, GPIO_CTRL, value); +} + +/* This DEBI code is based on the saa7146 Stradis driver by Nathan Laredo */ +int saa7146_wait_for_debi_done(struct saa7146_dev *dev) +{ + int start; + + /* wait for registers to be programmed */ + start = jiffies; + while (1) { + if (saa7146_read(dev, MC2) & 2) + break; + if (jiffies-start > HZ/20) { + DEB_S(("timed out while waiting for registers getting programmed\n")); + return -ETIMEDOUT; + } + } + + /* wait for transfer to complete */ + start = jiffies; + while (1) { + if (!(saa7146_read(dev, PSR) & SPCI_DEBI_S)) + break; + saa7146_read(dev, MC2); + if (jiffies-start > HZ/4) { + DEB_S(("timed out while waiting for transfer completion\n")); + return -ETIMEDOUT; + } + } + + return 0; +} + +/**************************************************************************** * general helper functions ****************************************************************************/ @@ -515,6 +568,7 @@ EXPORT_SYMBOL_GPL(saa7146_pgtable_alloc); EXPORT_SYMBOL_GPL(saa7146_pgtable_free); EXPORT_SYMBOL_GPL(saa7146_pgtable_build_single); EXPORT_SYMBOL_GPL(saa7146_vmalloc_build_pgtable); +EXPORT_SYMBOL_GPL(saa7146_wait_for_debi_done); EXPORT_SYMBOL_GPL(saa7146_setgpio); diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c index d28ef02a5..0fa8cd7ab 100644 --- a/linux/drivers/media/common/saa7146_hlp.c +++ b/linux/drivers/media/common/saa7146_hlp.c @@ -660,24 +660,6 @@ void saa7146_set_hps_source_and_sync(struct saa7146_dev *dev, int source, int sy vv->current_hps_sync = sync; } -/* write "data" to the gpio-pin "pin" */ -void saa7146_set_gpio(struct saa7146_dev *dev, u8 pin, u8 data) -{ - u32 value = 0; - - /* sanity check */ - if(pin > 3) - return; - - /* read old register contents */ - value = saa7146_read(dev, GPIO_CTRL ); - - value &= ~(0xff << (8*pin)); - value |= (data << (8*pin)); - - saa7146_write(dev, GPIO_CTRL, value); -} - /* reprogram hps, enable(1) / disable(0) video */ void saa7146_set_overlay(struct saa7146_dev *dev, struct saa7146_fh *fh, int v) { |