summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/em28xx/em28xx-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-27 10:10:40 -0200
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-11-27 10:10:40 -0200
commit3a1f2e4b150aba36c07a25ec58986cf12469ba94 (patch)
tree8456d7e6052e694d014530ead1d29e1e8b912845 /linux/drivers/media/video/em28xx/em28xx-core.c
parenta1e782e39b16be26c0d2a5a18f29cc85251d2cb1 (diff)
downloadmediapointer-dvb-s2-3a1f2e4b150aba36c07a25ec58986cf12469ba94.tar.gz
mediapointer-dvb-s2-3a1f2e4b150aba36c07a25ec58986cf12469ba94.tar.bz2
em28xx: Add support for suspend the device when not used
From: Mauro Carvalho Chehab <mchehab@redhat.com> Several chips may be turned off when the device is not used, like audio, video and dvb demods. This patch adds a gpio callback at the core structs to allow turning off such devices. Priority: normal Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-core.c')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-core.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-core.c b/linux/drivers/media/video/em28xx/em28xx-core.c
index 729120807..f62b05eae 100644
--- a/linux/drivers/media/video/em28xx/em28xx-core.c
+++ b/linux/drivers/media/video/em28xx/em28xx-core.c
@@ -741,12 +741,14 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio)
if (!gpio)
return rc;
- em28xx_write_reg(dev, 0x48, 0x00);
- if (dev->mode == EM28XX_ANALOG_MODE)
- em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x67);
- else
- em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x37);
- msleep(6);
+ if (dev->mode != EM28XX_SUSPEND) {
+ em28xx_write_reg(dev, 0x48, 0x00);
+ if (dev->mode == EM28XX_ANALOG_MODE)
+ em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x67);
+ else
+ em28xx_write_reg(dev, EM28XX_R12_VINENABLE, 0x37);
+ msleep(6);
+ }
/* Send GPIO reset sequences specified at board entry */
while (gpio->sleep >= 0) {
@@ -771,14 +773,17 @@ int em28xx_set_mode(struct em28xx *dev, enum em28xx_mode set_mode)
if (dev->mode == set_mode)
return 0;
- if (set_mode == EM28XX_MODE_UNDEFINED) {
+ if (set_mode == EM28XX_SUSPEND) {
dev->mode = set_mode;
- return 0;
+
+ /* FIXME: add suspend support for ac97 */
+
+ return em28xx_gpio_set(dev, dev->board.suspend_gpio);
}
#if 0
/* Resource is locked */
- if (dev->mode != EM28XX_MODE_UNDEFINED)
+ if (dev->mode != EM28XX_SUSPEND)
return -EINVAL;
#endif
dev->mode = set_mode;