aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-gpio.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 17:53:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 17:53:40 -0400
commit2d5e3e8d28a7820de1eb7b18a7c15d645bb26992 (patch)
treee6af4574977947de83e670dad1f71505b249fe1c /drivers/media/video/cx18/cx18-gpio.c
parentb57ab7632b8fc1eef139bbbb7a89002be61f99e1 (diff)
parentaed6abd662c2903733bea7fcd3856c306e650680 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (28 commits) V4L-DVB(7789a): cx18: fix symbol conflict with ivtv driver V4L/DVB (7789): tuner: remove static dependencies on analog tuner sub-modules V4L/DVB (7785): [2.6 patch] make mt9{m001,v022}_controls[] static V4L/DVB (7786): cx18: new driver for the Conexant CX23418 MPEG encoder chip V4L/DVB (7783): drivers/media/dvb/frontends/s5h1420.c: printk fix V4L/DVB (7782): pvrusb2: Driver is no longer experimental V4L/DVB (7781): pvrusb2-dvb: include dvb support by default and update Kconfig help text V4L/DVB (7780): pvrusb2: always enable support for OnAir Creator / HDTV USB2 V4L/DVB (7779): pvrusb2-dvb: quiet down noise in kernel log for feed debug Rename common tuner Kconfig names to use the same Fix V4L/DVB core help messages V4L/DVB (7769): Move other terrestrial tuners to common/tuners V4L/DVB (7768): reorganize some DVB-S Kconfig items V4L/DVB(7767): Move tuners to common/tuners V4L/DVB (7766): saa7134: add another PCI ID for Beholder M6 V4L/DVB (7765): Add support for Beholder BeholdTV H6 V4L/DVB (7763): ivtv: add tuner support for the AverMedia M116 V4L/DVB (7762): ivtv: fix tuner detection for PAL-N/Nc V4L/DVB (7761): ivtv: increase the DMA timeout from 100 to 300 ms V4L/DVB (7759): ivtv: increase version number to 1.2.1 ...
Diffstat (limited to 'drivers/media/video/cx18/cx18-gpio.c')
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
new file mode 100644
index 000000000000..19253e6b8673
--- /dev/null
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -0,0 +1,74 @@
1/*
2 * cx18 gpio functions
3 *
4 * Derived from ivtv-gpio.c
5 *
6 * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 * 02111-1307 USA
22 */
23
24#include "cx18-driver.h"
25#include "cx18-cards.h"
26#include "cx18-gpio.h"
27#include "tuner-xc2028.h"
28
29/********************* GPIO stuffs *********************/
30
31/* GPIO registers */
32#define CX18_REG_GPIO_IN 0xc72010
33#define CX18_REG_GPIO_OUT1 0xc78100
34#define CX18_REG_GPIO_DIR1 0xc78108
35#define CX18_REG_GPIO_OUT2 0xc78104
36#define CX18_REG_GPIO_DIR2 0xc7810c
37
38/*
39 * HVR-1600 GPIO pins, courtesy of Hauppauge:
40 *
41 * gpio0: zilog ir process reset pin
42 * gpio1: zilog programming pin (you should never use this)
43 * gpio12: cx24227 reset pin
44 * gpio13: cs5345 reset pin
45*/
46
47void cx18_gpio_init(struct cx18 *cx)
48{
49 if (cx->card->gpio_init.direction == 0)
50 return;
51
52 CX18_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n",
53 read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_OUT1));
54
55 /* init output data then direction */
56 write_reg(cx->card->gpio_init.direction << 16, CX18_REG_GPIO_DIR1);
57 write_reg(0, CX18_REG_GPIO_DIR2);
58 write_reg((cx->card->gpio_init.direction << 16) |
59 cx->card->gpio_init.initial_value, CX18_REG_GPIO_OUT1);
60 write_reg(0, CX18_REG_GPIO_OUT2);
61}
62
63/* Xceive tuner reset function */
64int cx18_reset_tuner_gpio(void *dev, int cmd, int value)
65{
66 struct i2c_algo_bit_data *algo = dev;
67 struct cx18 *cx = algo->data;
68/* int curdir, curout;*/
69
70 if (cmd != XC2028_TUNER_RESET)
71 return 0;
72 CX18_DEBUG_INFO("Resetting tuner\n");
73 return 0;
74}