aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter De Schrijver <p2@psychaos.be>2011-11-06 08:15:47 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-08 08:17:57 -0500
commitde2843b663fd621e9a6c75fed4da73e8c9a1b094 (patch)
treea5d53e6a8b48fea6afd63998d132c7741fd76d8a
parent3822c7cef7b422833f1b58949a01bd87b822d280 (diff)
[media] bt8xx: add support for Tongwei Video Technology TD-3116
The following patch adds support for the Tongwei Video Technology TD-3116 board. This is a Bt878 based capture card with 16 inputs meant for surveilance applications. It also offers a way to check which inputs have a video signal while capturing another input. In addition there are a number of alarm inputs and outputs available and there is microcontroller which is presumably intended for use as a system watchdog. None of these extra capabilities are supported by the patch. Signed-off-by: Peter De Schrijver <p2@psychaos.be> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c49
-rw-r--r--drivers/media/video/bt8xx/bttv.h1
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index 076b7f216538..ff2933ab705f 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -80,6 +80,8 @@ static void phytec_muxsel(struct bttv *btv, unsigned int input);
80static void gv800s_muxsel(struct bttv *btv, unsigned int input); 80static void gv800s_muxsel(struct bttv *btv, unsigned int input);
81static void gv800s_init(struct bttv *btv); 81static void gv800s_init(struct bttv *btv);
82 82
83static void td3116_muxsel(struct bttv *btv, unsigned int input);
84
83static int terratec_active_radio_upgrade(struct bttv *btv); 85static int terratec_active_radio_upgrade(struct bttv *btv);
84static int tea5757_read(struct bttv *btv); 86static int tea5757_read(struct bttv *btv);
85static int tea5757_write(struct bttv *btv, int value); 87static int tea5757_write(struct bttv *btv, int value);
@@ -342,6 +344,7 @@ static struct CARD {
342 { 0x15401835, BTTV_BOARD_PV183, "Provideo PV183-6" }, 344 { 0x15401835, BTTV_BOARD_PV183, "Provideo PV183-6" },
343 { 0x15401836, BTTV_BOARD_PV183, "Provideo PV183-7" }, 345 { 0x15401836, BTTV_BOARD_PV183, "Provideo PV183-7" },
344 { 0x15401837, BTTV_BOARD_PV183, "Provideo PV183-8" }, 346 { 0x15401837, BTTV_BOARD_PV183, "Provideo PV183-8" },
347 { 0x3116f200, BTTV_BOARD_TVT_TD3116, "Tongwei Video Technology TD-3116" },
345 348
346 { 0, -1, NULL } 349 { 0, -1, NULL }
347}; 350};
@@ -2880,6 +2883,16 @@ struct tvcard bttv_tvcards[] = {
2880 .tuner_type = TUNER_ABSENT, 2883 .tuner_type = TUNER_ABSENT,
2881 .tuner_addr = ADDR_UNSET, 2884 .tuner_addr = ADDR_UNSET,
2882 }, 2885 },
2886 [BTTV_BOARD_TVT_TD3116] = {
2887 .name = "Tongwei Video Technology TD-3116",
2888 .video_inputs = 16,
2889 .gpiomask = 0xc00ff,
2890 .muxsel = MUXSEL(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2),
2891 .muxsel_hook = td3116_muxsel,
2892 .svhs = NO_SVHS,
2893 .pll = PLL_28,
2894 .tuner_type = TUNER_ABSENT,
2895 },
2883}; 2896};
2884 2897
2885static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); 2898static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards);
@@ -3229,6 +3242,42 @@ static void geovision_muxsel(struct bttv *btv, unsigned int input)
3229 gpio_bits(0xf, inmux); 3242 gpio_bits(0xf, inmux);
3230} 3243}
3231 3244
3245/*
3246 * The TD3116 has 2 74HC4051 muxes wired to the MUX0 input of a bt878.
3247 * The first 74HC4051 has the lower 8 inputs, the second one the higher 8.
3248 * The muxes are controlled via a 74HC373 latch which is connected to
3249 * GPIOs 0-7. GPIO 18 is connected to the LE signal of the latch.
3250 * Q0 of the latch is connected to the Enable (~E) input of the first
3251 * 74HC4051. Q1 - Q3 are connected to S0 - S2 of the same 74HC4051.
3252 * Q4 - Q7 are connected to the second 74HC4051 in the same way.
3253 */
3254
3255static void td3116_latch_value(struct bttv *btv, u32 value)
3256{
3257 gpio_bits((1<<18) | 0xff, value);
3258 gpio_bits((1<<18) | 0xff, (1<<18) | value);
3259 udelay(1);
3260 gpio_bits((1<<18) | 0xff, value);
3261}
3262
3263static void td3116_muxsel(struct bttv *btv, unsigned int input)
3264{
3265 u32 value;
3266 u32 highbit;
3267
3268 highbit = (input & 0x8) >> 3 ;
3269
3270 /* Disable outputs and set value in the mux */
3271 value = 0x11; /* Disable outputs */
3272 value |= ((input & 0x7) << 1) << (4 * highbit);
3273 td3116_latch_value(btv, value);
3274
3275 /* Enable the correct output */
3276 value &= ~0x11;
3277 value |= ((highbit ^ 0x1) << 4) | highbit;
3278 td3116_latch_value(btv, value);
3279}
3280
3232/* ----------------------------------------------------------------------- */ 3281/* ----------------------------------------------------------------------- */
3233 3282
3234static void bttv_reset_audio(struct bttv *btv) 3283static void bttv_reset_audio(struct bttv *btv)
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h
index 4db8b7d25da6..c5171619ac79 100644
--- a/drivers/media/video/bt8xx/bttv.h
+++ b/drivers/media/video/bt8xx/bttv.h
@@ -183,6 +183,7 @@
183#define BTTV_BOARD_GEOVISION_GV800S 0x9d 183#define BTTV_BOARD_GEOVISION_GV800S 0x9d
184#define BTTV_BOARD_GEOVISION_GV800S_SL 0x9e 184#define BTTV_BOARD_GEOVISION_GV800S_SL 0x9e
185#define BTTV_BOARD_PV183 0x9f 185#define BTTV_BOARD_PV183 0x9f
186#define BTTV_BOARD_TVT_TD3116 0xa0
186 187
187 188
188/* more card-specific defines */ 189/* more card-specific defines */