aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-12-21 19:33:36 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:04:15 -0500
commit0e614cd1a5a09b36a3b6d0fff8a08a97800d3cce (patch)
treeae5eb3832437a256976353302e57313579f580c3
parent3f51451b516eeb19d3c1ea311ee8845fc80b5135 (diff)
V4L/DVB (6896): ivtv: add XC2028 support for Club3D cards
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/ivtv/ivtv-cards.c18
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c19
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h1
-rw-r--r--drivers/media/video/ivtv/ivtv-gpio.c24
-rw-r--r--drivers/media/video/ivtv/ivtv-i2c.c4
5 files changed, 48 insertions, 18 deletions
diff --git a/drivers/media/video/ivtv/ivtv-cards.c b/drivers/media/video/ivtv/ivtv-cards.c
index 26322e933999..f23c6b8d6911 100644
--- a/drivers/media/video/ivtv/ivtv-cards.c
+++ b/drivers/media/video/ivtv/ivtv-cards.c
@@ -880,7 +880,7 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
880 .hw_video = IVTV_HW_CX25840, 880 .hw_video = IVTV_HW_CX25840,
881 .hw_audio = IVTV_HW_CX25840, 881 .hw_audio = IVTV_HW_CX25840,
882 .hw_audio_ctrl = IVTV_HW_CX25840, 882 .hw_audio_ctrl = IVTV_HW_CX25840,
883 .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER, 883 .hw_all = IVTV_HW_CX25840,
884 .video_inputs = { 884 .video_inputs = {
885 { IVTV_CARD_INPUT_SVIDEO1, 0, 885 { IVTV_CARD_INPUT_SVIDEO1, 0,
886 CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 }, 886 CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 },
@@ -889,9 +889,6 @@ static const struct ivtv_card ivtv_card_pg600v2 = {
889 .audio_inputs = { 889 .audio_inputs = {
890 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, 890 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
891 }, 891 },
892 .tuners = {
893 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
894 },
895 .pci_list = ivtv_pci_pg600v2, 892 .pci_list = ivtv_pci_pg600v2,
896 .i2c = &ivtv_i2c_std, 893 .i2c = &ivtv_i2c_std,
897}; 894};
@@ -914,13 +911,17 @@ static const struct ivtv_card ivtv_card_club3d = {
914 .hw_audio_ctrl = IVTV_HW_CX25840, 911 .hw_audio_ctrl = IVTV_HW_CX25840,
915 .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER, 912 .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER,
916 .video_inputs = { 913 .video_inputs = {
917 { IVTV_CARD_INPUT_SVIDEO1, 0, 914 { IVTV_CARD_INPUT_VID_TUNER, 0, CX25840_COMPOSITE2 },
915 { IVTV_CARD_INPUT_SVIDEO1, 1,
918 CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 }, 916 CX25840_SVIDEO_LUMA3 | CX25840_SVIDEO_CHROMA4 },
919 { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE3 }, 917 { IVTV_CARD_INPUT_COMPOSITE1, 1, CX25840_COMPOSITE3 },
920 }, 918 },
921 .audio_inputs = { 919 .audio_inputs = {
920 { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
922 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL }, 921 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL },
923 }, 922 },
923 .radio_input = { IVTV_CARD_INPUT_AUD_TUNER, CX25840_AUDIO5 },
924 .gpio_init = { .direction = 0x1000, .initial_value = 0x1000 }, /* tuner reset */
924 .tuners = { 925 .tuners = {
925 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, 926 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
926 }, 927 },
@@ -944,7 +945,7 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
944 .hw_video = IVTV_HW_CX25840, 945 .hw_video = IVTV_HW_CX25840,
945 .hw_audio = IVTV_HW_CX25840, 946 .hw_audio = IVTV_HW_CX25840,
946 .hw_audio_ctrl = IVTV_HW_CX25840, 947 .hw_audio_ctrl = IVTV_HW_CX25840,
947 .hw_all = IVTV_HW_CX25840 | IVTV_HW_TUNER | IVTV_HW_WM8739, 948 .hw_all = IVTV_HW_CX25840 | IVTV_HW_WM8739,
948 .video_inputs = { 949 .video_inputs = {
949 { IVTV_CARD_INPUT_SVIDEO1, 0, CX25840_SVIDEO3 }, 950 { IVTV_CARD_INPUT_SVIDEO1, 0, CX25840_SVIDEO3 },
950 { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 }, 951 { IVTV_CARD_INPUT_COMPOSITE1, 0, CX25840_COMPOSITE1 },
@@ -953,9 +954,6 @@ static const struct ivtv_card ivtv_card_avertv_mce116 = {
953 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 }, 954 { IVTV_CARD_INPUT_LINE_IN1, CX25840_AUDIO_SERIAL, 1 },
954 }, 955 },
955 .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, /* enable line-in */ 956 .gpio_init = { .direction = 0xe000, .initial_value = 0x4000 }, /* enable line-in */
956 .tuners = {
957 { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 },
958 },
959 .pci_list = ivtv_pci_avertv_mce116, 957 .pci_list = ivtv_pci_avertv_mce116,
960 .i2c = &ivtv_i2c_std, 958 .i2c = &ivtv_i2c_std,
961}; 959};
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 2765624b230f..0cb832a21357 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -59,6 +59,7 @@
59#include <media/tveeprom.h> 59#include <media/tveeprom.h>
60#include <media/saa7115.h> 60#include <media/saa7115.h>
61#include <media/v4l2-chip-ident.h> 61#include <media/v4l2-chip-ident.h>
62#include "tuner-xc2028.h"
62 63
63/* var to keep track of the number of array elements in use */ 64/* var to keep track of the number of array elements in use */
64int ivtv_cards_active = 0; 65int ivtv_cards_active = 0;
@@ -844,11 +845,6 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
844 unsigned i; 845 unsigned i;
845 846
846 /* load modules */ 847 /* load modules */
847 if ((hw & IVTV_HW_TUNER) && itv->options.tuner == TUNER_XC2028) {
848 IVTV_INFO("Xceive tuner not yet supported, only composite\n");
849 IVTV_INFO("and S-Video inputs will be available\n");
850 hw &= ~IVTV_HW_TUNER;
851 }
852#ifndef CONFIG_VIDEO_TUNER 848#ifndef CONFIG_VIDEO_TUNER
853 hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER); 849 hw = ivtv_request_module(itv, hw, "tuner", IVTV_HW_TUNER);
854#endif 850#endif
@@ -1150,7 +1146,20 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
1150 setup.addr = ADDR_UNSET; 1146 setup.addr = ADDR_UNSET;
1151 setup.type = itv->options.tuner; 1147 setup.type = itv->options.tuner;
1152 setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ 1148 setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */
1149 setup.tuner_callback = (setup.type == TUNER_XC2028) ?
1150 ivtv_reset_tuner_gpio : NULL;
1153 ivtv_call_i2c_clients(itv, TUNER_SET_TYPE_ADDR, &setup); 1151 ivtv_call_i2c_clients(itv, TUNER_SET_TYPE_ADDR, &setup);
1152 if (setup.type == TUNER_XC2028) {
1153 static struct xc2028_ctrl ctrl = {
1154 .fname = XC2028_DEFAULT_FIRMWARE,
1155 .max_len = 64,
1156 };
1157 struct v4l2_priv_tun_config cfg = {
1158 .tuner = itv->options.tuner,
1159 .priv = &ctrl,
1160 };
1161 ivtv_call_i2c_clients(itv, TUNER_SET_CONFIG, &cfg);
1162 }
1154 } 1163 }
1155 1164
1156 /* The tuner is fixed to the standard. The other inputs (e.g. S-Video) 1165 /* The tuner is fixed to the standard. The other inputs (e.g. S-Video)
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index 8eeea3a0c700..536140f0c19e 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -65,7 +65,6 @@
65 65
66#include <linux/ivtv.h> 66#include <linux/ivtv.h>
67 67
68
69/* Memory layout */ 68/* Memory layout */
70#define IVTV_ENCODER_OFFSET 0x00000000 69#define IVTV_ENCODER_OFFSET 0x00000000
71#define IVTV_ENCODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */ 70#define IVTV_ENCODER_SIZE 0x00800000 /* Total size is 0x01000000, but only first half is used */
diff --git a/drivers/media/video/ivtv/ivtv-gpio.c b/drivers/media/video/ivtv/ivtv-gpio.c
index 132fb5f71366..688cd3856685 100644
--- a/drivers/media/video/ivtv/ivtv-gpio.c
+++ b/drivers/media/video/ivtv/ivtv-gpio.c
@@ -22,6 +22,7 @@
22#include "ivtv-driver.h" 22#include "ivtv-driver.h"
23#include "ivtv-cards.h" 23#include "ivtv-cards.h"
24#include "ivtv-gpio.h" 24#include "ivtv-gpio.h"
25#include "tuner-xc2028.h"
25#include <media/tuner.h> 26#include <media/tuner.h>
26 27
27/* 28/*
@@ -122,6 +123,29 @@ void ivtv_reset_ir_gpio(struct ivtv *itv)
122 write_reg(curdir, IVTV_REG_GPIO_DIR); 123 write_reg(curdir, IVTV_REG_GPIO_DIR);
123} 124}
124 125
126/* Xceive tuner reset function */
127int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
128{
129 struct i2c_algo_bit_data *algo = dev;
130 struct ivtv *itv = algo->data;
131 int curdir, curout;
132
133 if (cmd != XC2028_TUNER_RESET)
134 return 0;
135 IVTV_DEBUG_INFO("Resetting tuner\n");
136 curout = read_reg(IVTV_REG_GPIO_OUT);
137 curdir = read_reg(IVTV_REG_GPIO_DIR);
138 curdir |= (1 << 12); /* GPIO bit 12 */
139
140 curout &= ~(1 << 12);
141 write_reg(curout, IVTV_REG_GPIO_OUT);
142 schedule_timeout_interruptible(msecs_to_jiffies(1));
143
144 curout |= (1 << 12);
145 write_reg(curout, IVTV_REG_GPIO_OUT);
146 schedule_timeout_interruptible(msecs_to_jiffies(1));
147 return 0;
148}
125 149
126void ivtv_gpio_init(struct ivtv *itv) 150void ivtv_gpio_init(struct ivtv *itv)
127{ 151{
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c
index 9acfde68116a..efd4a1324dc5 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -777,9 +777,9 @@ int init_ivtv_i2c(struct ivtv *itv)
777 sizeof(struct i2c_adapter)); 777 sizeof(struct i2c_adapter));
778 memcpy(&itv->i2c_algo, &ivtv_i2c_algo_template, 778 memcpy(&itv->i2c_algo, &ivtv_i2c_algo_template,
779 sizeof(struct i2c_algo_bit_data)); 779 sizeof(struct i2c_algo_bit_data));
780 itv->i2c_algo.data = itv;
781 itv->i2c_adap.algo_data = &itv->i2c_algo;
782 } 780 }
781 itv->i2c_algo.data = itv;
782 itv->i2c_adap.algo_data = &itv->i2c_algo;
783 783
784 sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d", 784 sprintf(itv->i2c_adap.name + strlen(itv->i2c_adap.name), " #%d",
785 itv->num); 785 itv->num);