aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-09-21 05:09:22 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-09-21 05:09:22 -0400
commit7cce2f4cb7f5f641f78c8e3eea4e7b1b96cb71c0 (patch)
treeb064d077928cf224660ab1e1841cdab2c9fd8b08 /drivers/media/video/cx18
parente055f7e873d900925c222cf2d1ec955af4a9ca90 (diff)
parentebc79c4f8da0f92efa968e0328f32334a2ce80cf (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into linux-next
Conflicts: fs/ubifs/super.c Merge the upstream tree in order to resolve a conflict with the per-bdi writeback changes from the linux-2.6-block tree.
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-cards.c8
-rw-r--r--drivers/media/video/cx18/cx18-cards.h18
-rw-r--r--drivers/media/video/cx18/cx18-controls.c3
-rw-r--r--drivers/media/video/cx18/cx18-driver.c41
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c2
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c59
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c2
7 files changed, 109 insertions, 24 deletions
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c
index 36f2d76006fd..f11e47a58286 100644
--- a/drivers/media/video/cx18/cx18-cards.c
+++ b/drivers/media/video/cx18/cx18-cards.c
@@ -56,7 +56,8 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
56 .hw_audio_ctrl = CX18_HW_418_AV, 56 .hw_audio_ctrl = CX18_HW_418_AV,
57 .hw_muxer = CX18_HW_CS5345, 57 .hw_muxer = CX18_HW_CS5345,
58 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER | 58 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
59 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, 59 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
60 CX18_HW_Z8F0811_IR_HAUP,
60 .video_inputs = { 61 .video_inputs = {
61 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 }, 62 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
62 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 }, 63 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
@@ -102,7 +103,8 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
102 .hw_audio_ctrl = CX18_HW_418_AV, 103 .hw_audio_ctrl = CX18_HW_418_AV,
103 .hw_muxer = CX18_HW_CS5345, 104 .hw_muxer = CX18_HW_CS5345,
104 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER | 105 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
105 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, 106 CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL |
107 CX18_HW_Z8F0811_IR_HAUP,
106 .video_inputs = { 108 .video_inputs = {
107 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 }, 109 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
108 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 }, 110 { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
@@ -204,7 +206,7 @@ static const struct cx18_card cx18_card_mpc718 = {
204 .v4l2_capabilities = CX18_CAP_ENCODER, 206 .v4l2_capabilities = CX18_CAP_ENCODER,
205 .hw_audio_ctrl = CX18_HW_418_AV, 207 .hw_audio_ctrl = CX18_HW_418_AV,
206 .hw_muxer = CX18_HW_GPIO_MUX, 208 .hw_muxer = CX18_HW_GPIO_MUX,
207 .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | 209 .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
208 CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, 210 CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
209 .video_inputs = { 211 .video_inputs = {
210 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, 212 { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
diff --git a/drivers/media/video/cx18/cx18-cards.h b/drivers/media/video/cx18/cx18-cards.h
index 3c552b6b7c4d..444e3c7c563e 100644
--- a/drivers/media/video/cx18/cx18-cards.h
+++ b/drivers/media/video/cx18/cx18-cards.h
@@ -22,13 +22,17 @@
22 */ 22 */
23 23
24/* hardware flags */ 24/* hardware flags */
25#define CX18_HW_TUNER (1 << 0) 25#define CX18_HW_TUNER (1 << 0)
26#define CX18_HW_TVEEPROM (1 << 1) 26#define CX18_HW_TVEEPROM (1 << 1)
27#define CX18_HW_CS5345 (1 << 2) 27#define CX18_HW_CS5345 (1 << 2)
28#define CX18_HW_DVB (1 << 3) 28#define CX18_HW_DVB (1 << 3)
29#define CX18_HW_418_AV (1 << 4) 29#define CX18_HW_418_AV (1 << 4)
30#define CX18_HW_GPIO_MUX (1 << 5) 30#define CX18_HW_GPIO_MUX (1 << 5)
31#define CX18_HW_GPIO_RESET_CTRL (1 << 6) 31#define CX18_HW_GPIO_RESET_CTRL (1 << 6)
32#define CX18_HW_Z8F0811_IR_TX_HAUP (1 << 7)
33#define CX18_HW_Z8F0811_IR_RX_HAUP (1 << 8)
34#define CX18_HW_Z8F0811_IR_HAUP (CX18_HW_Z8F0811_IR_RX_HAUP | \
35 CX18_HW_Z8F0811_IR_TX_HAUP)
32 36
33/* video inputs */ 37/* video inputs */
34#define CX18_CARD_INPUT_VID_TUNER 1 38#define CX18_CARD_INPUT_VID_TUNER 1
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
index 5136df198338..93f0dae01350 100644
--- a/drivers/media/video/cx18/cx18-controls.c
+++ b/drivers/media/video/cx18/cx18-controls.c
@@ -20,6 +20,7 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 * 02111-1307 USA 21 * 02111-1307 USA
22 */ 22 */
23#include <linux/kernel.h>
23 24
24#include "cx18-driver.h" 25#include "cx18-driver.h"
25#include "cx18-cards.h" 26#include "cx18-cards.h"
@@ -317,7 +318,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
317 idx = p.audio_properties & 0x03; 318 idx = p.audio_properties & 0x03;
318 /* The audio clock of the digitizer must match the codec sample 319 /* The audio clock of the digitizer must match the codec sample
319 rate otherwise you get some very strange effects. */ 320 rate otherwise you get some very strange effects. */
320 if (idx < sizeof(freqs)) 321 if (idx < ARRAY_SIZE(freqs))
321 cx18_call_all(cx, audio, s_clock_freq, freqs[idx]); 322 cx18_call_all(cx, audio, s_clock_freq, freqs[idx]);
322 return err; 323 return err;
323 } 324 }
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 92026e82e10e..dd0224f328ad 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -268,6 +268,20 @@ static void cx18_iounmap(struct cx18 *cx)
268 } 268 }
269} 269}
270 270
271static void cx18_eeprom_dump(struct cx18 *cx, unsigned char *eedata, int len)
272{
273 int i;
274
275 CX18_INFO("eeprom dump:\n");
276 for (i = 0; i < len; i++) {
277 if (0 == (i % 16))
278 CX18_INFO("eeprom %02x:", i);
279 printk(KERN_CONT " %02x", eedata[i]);
280 if (15 == (i % 16))
281 printk(KERN_CONT "\n");
282 }
283}
284
271/* Hauppauge card? get values from tveeprom */ 285/* Hauppauge card? get values from tveeprom */
272void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) 286void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
273{ 287{
@@ -279,8 +293,26 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
279 c.adapter = &cx->i2c_adap[0]; 293 c.adapter = &cx->i2c_adap[0];
280 c.addr = 0xA0 >> 1; 294 c.addr = 0xA0 >> 1;
281 295
282 tveeprom_read(&c, eedata, sizeof(eedata)); 296 memset(tv, 0, sizeof(*tv));
283 tveeprom_hauppauge_analog(&c, tv, eedata); 297 if (tveeprom_read(&c, eedata, sizeof(eedata)))
298 return;
299
300 switch (cx->card->type) {
301 case CX18_CARD_HVR_1600_ESMT:
302 case CX18_CARD_HVR_1600_SAMSUNG:
303 tveeprom_hauppauge_analog(&c, tv, eedata);
304 break;
305 case CX18_CARD_YUAN_MPC718:
306 tv->model = 0x718;
307 cx18_eeprom_dump(cx, eedata, sizeof(eedata));
308 CX18_INFO("eeprom PCI ID: %02x%02x:%02x%02x\n",
309 eedata[2], eedata[1], eedata[4], eedata[3]);
310 break;
311 default:
312 tv->model = 0xffffffff;
313 cx18_eeprom_dump(cx, eedata, sizeof(eedata));
314 break;
315 }
284} 316}
285 317
286static void cx18_process_eeprom(struct cx18 *cx) 318static void cx18_process_eeprom(struct cx18 *cx)
@@ -298,6 +330,11 @@ static void cx18_process_eeprom(struct cx18 *cx)
298 case 74000 ... 74999: 330 case 74000 ... 74999:
299 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); 331 cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT);
300 break; 332 break;
333 case 0x718:
334 return;
335 case 0xffffffff:
336 CX18_INFO("Unknown EEPROM encoding\n");
337 return;
301 case 0: 338 case 0:
302 CX18_ERR("Invalid EEPROM\n"); 339 CX18_ERR("Invalid EEPROM\n");
303 return; 340 return;
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 29969c18949c..04d9c2508b86 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -690,7 +690,7 @@ int cx18_v4l2_open(struct file *filp)
690 int res; 690 int res;
691 struct video_device *video_dev = video_devdata(filp); 691 struct video_device *video_dev = video_devdata(filp);
692 struct cx18_stream *s = video_get_drvdata(video_dev); 692 struct cx18_stream *s = video_get_drvdata(video_dev);
693 struct cx18 *cx = s->cx;; 693 struct cx18 *cx = s->cx;
694 694
695 mutex_lock(&cx->serialize_lock); 695 mutex_lock(&cx->serialize_lock);
696 if (cx18_init_on_first_open(cx)) { 696 if (cx18_init_on_first_open(cx)) {
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index 8591e4fc359f..da395fef50df 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -28,6 +28,7 @@
28#include "cx18-gpio.h" 28#include "cx18-gpio.h"
29#include "cx18-i2c.h" 29#include "cx18-i2c.h"
30#include "cx18-irq.h" 30#include "cx18-irq.h"
31#include <media/ir-kbd-i2c.h>
31 32
32#define CX18_REG_I2C_1_WR 0xf15000 33#define CX18_REG_I2C_1_WR 0xf15000
33#define CX18_REG_I2C_1_RD 0xf15008 34#define CX18_REG_I2C_1_RD 0xf15008
@@ -40,16 +41,20 @@
40#define GETSDL_BIT 0x0008 41#define GETSDL_BIT 0x0008
41 42
42#define CX18_CS5345_I2C_ADDR 0x4c 43#define CX18_CS5345_I2C_ADDR 0x4c
44#define CX18_Z8F0811_IR_TX_I2C_ADDR 0x70
45#define CX18_Z8F0811_IR_RX_I2C_ADDR 0x71
43 46
44/* This array should match the CX18_HW_ defines */ 47/* This array should match the CX18_HW_ defines */
45static const u8 hw_addrs[] = { 48static const u8 hw_addrs[] = {
46 0, /* CX18_HW_TUNER */ 49 0, /* CX18_HW_TUNER */
47 0, /* CX18_HW_TVEEPROM */ 50 0, /* CX18_HW_TVEEPROM */
48 CX18_CS5345_I2C_ADDR, /* CX18_HW_CS5345 */ 51 CX18_CS5345_I2C_ADDR, /* CX18_HW_CS5345 */
49 0, /* CX18_HW_DVB */ 52 0, /* CX18_HW_DVB */
50 0, /* CX18_HW_418_AV */ 53 0, /* CX18_HW_418_AV */
51 0, /* CX18_HW_GPIO_MUX */ 54 0, /* CX18_HW_GPIO_MUX */
52 0, /* CX18_HW_GPIO_RESET_CTRL */ 55 0, /* CX18_HW_GPIO_RESET_CTRL */
56 CX18_Z8F0811_IR_TX_I2C_ADDR, /* CX18_HW_Z8F0811_IR_TX_HAUP */
57 CX18_Z8F0811_IR_RX_I2C_ADDR, /* CX18_HW_Z8F0811_IR_RX_HAUP */
53}; 58};
54 59
55/* This array should match the CX18_HW_ defines */ 60/* This array should match the CX18_HW_ defines */
@@ -62,6 +67,8 @@ static const u8 hw_bus[] = {
62 0, /* CX18_HW_418_AV */ 67 0, /* CX18_HW_418_AV */
63 0, /* CX18_HW_GPIO_MUX */ 68 0, /* CX18_HW_GPIO_MUX */
64 0, /* CX18_HW_GPIO_RESET_CTRL */ 69 0, /* CX18_HW_GPIO_RESET_CTRL */
70 0, /* CX18_HW_Z8F0811_IR_TX_HAUP */
71 0, /* CX18_HW_Z8F0811_IR_RX_HAUP */
65}; 72};
66 73
67/* This array should match the CX18_HW_ defines */ 74/* This array should match the CX18_HW_ defines */
@@ -73,6 +80,8 @@ static const char * const hw_modules[] = {
73 NULL, /* CX18_HW_418_AV */ 80 NULL, /* CX18_HW_418_AV */
74 NULL, /* CX18_HW_GPIO_MUX */ 81 NULL, /* CX18_HW_GPIO_MUX */
75 NULL, /* CX18_HW_GPIO_RESET_CTRL */ 82 NULL, /* CX18_HW_GPIO_RESET_CTRL */
83 NULL, /* CX18_HW_Z8F0811_IR_TX_HAUP */
84 NULL, /* CX18_HW_Z8F0811_IR_RX_HAUP */
76}; 85};
77 86
78/* This array should match the CX18_HW_ defines */ 87/* This array should match the CX18_HW_ defines */
@@ -84,8 +93,38 @@ static const char * const hw_devicenames[] = {
84 "cx23418_AV", 93 "cx23418_AV",
85 "gpio_mux", 94 "gpio_mux",
86 "gpio_reset_ctrl", 95 "gpio_reset_ctrl",
96 "ir_tx_z8f0811_haup",
97 "ir_rx_z8f0811_haup",
87}; 98};
88 99
100static const struct IR_i2c_init_data z8f0811_ir_init_data = {
101 .ir_codes = &ir_codes_hauppauge_new_table,
102 .internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR,
103 .type = IR_TYPE_RC5,
104 .name = "CX23418 Z8F0811 Hauppauge",
105};
106
107static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type,
108 u8 addr)
109{
110 struct i2c_board_info info;
111 unsigned short addr_list[2] = { addr, I2C_CLIENT_END };
112
113 memset(&info, 0, sizeof(struct i2c_board_info));
114 strlcpy(info.type, type, I2C_NAME_SIZE);
115
116 /* Our default information for ir-kbd-i2c.c to use */
117 switch (hw) {
118 case CX18_HW_Z8F0811_IR_RX_HAUP:
119 info.platform_data = &z8f0811_ir_init_data;
120 break;
121 default:
122 break;
123 }
124
125 return i2c_new_probed_device(adap, &info, addr_list) == NULL ? -1 : 0;
126}
127
89int cx18_i2c_register(struct cx18 *cx, unsigned idx) 128int cx18_i2c_register(struct cx18 *cx, unsigned idx)
90{ 129{
91 struct v4l2_subdev *sd; 130 struct v4l2_subdev *sd;
@@ -115,11 +154,14 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
115 return sd != NULL ? 0 : -1; 154 return sd != NULL ? 0 : -1;
116 } 155 }
117 156
157 if (hw & CX18_HW_Z8F0811_IR_HAUP)
158 return cx18_i2c_new_ir(adap, hw, type, hw_addrs[idx]);
159
118 /* Is it not an I2C device or one we do not wish to register? */ 160 /* Is it not an I2C device or one we do not wish to register? */
119 if (!hw_addrs[idx]) 161 if (!hw_addrs[idx])
120 return -1; 162 return -1;
121 163
122 /* It's an I2C device other than an analog tuner */ 164 /* It's an I2C device other than an analog tuner or IR chip */
123 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]); 165 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]);
124 if (sd != NULL) 166 if (sd != NULL)
125 sd->grp_id = hw; 167 sd->grp_id = hw;
@@ -190,7 +232,6 @@ static int cx18_getsda(void *data)
190/* template for i2c-bit-algo */ 232/* template for i2c-bit-algo */
191static struct i2c_adapter cx18_i2c_adap_template = { 233static struct i2c_adapter cx18_i2c_adap_template = {
192 .name = "cx18 i2c driver", 234 .name = "cx18 i2c driver",
193 .id = I2C_HW_B_CX2341X,
194 .algo = NULL, /* set by i2c-algo-bit */ 235 .algo = NULL, /* set by i2c-algo-bit */
195 .algo_data = NULL, /* filled from template */ 236 .algo_data = NULL, /* filled from template */
196 .owner = THIS_MODULE, 237 .owner = THIS_MODULE,
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index d7b1921e6666..fc76e4d6ffa7 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -605,7 +605,7 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp)
605 if (ret) 605 if (ret)
606 return ret; 606 return ret;
607 607
608 if (inp < 0 || inp >= cx->nof_inputs) 608 if (inp >= cx->nof_inputs)
609 return -EINVAL; 609 return -EINVAL;
610 610
611 if (inp == cx->active_input) { 611 if (inp == cx->active_input) {