diff options
author | Andy Walls <awalls@radix.net> | 2009-07-28 10:48:18 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:18:25 -0400 |
commit | 8ca955689a957ecf956bb052f60412da2753a977 (patch) | |
tree | a9b3e6a02236c376204b7bdfef0cf4dbf86926ed /drivers/media/video | |
parent | 1b6e59e3f48eecdab97bdd1568422e22f7d2f4f5 (diff) |
V4L/DVB (12367): cx18: Add i2c initialization for Z8F0811/Hauppage IR transceivers
This patch add support to the cx18 driver for setting up the
Z8F0811/Hauppauge IR Tx/Rx chip with the i2c binding model in newer
kernels.
Signed-off-by: Andy Walls <awalls@radix.net>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx18/cx18-cards.c | 6 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-cards.h | 18 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-i2c.c | 57 |
3 files changed, 64 insertions, 17 deletions
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index 96b687be8329..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 }, |
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-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index 237d84841b26..ba754e8056fb 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 */ |
45 | static const u8 hw_addrs[] = { | 48 | static 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,37 @@ 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 | ||
100 | static int cx18_i2c_new_ir(struct i2c_adapter *adap, u32 hw, const char *type, | ||
101 | u8 addr) | ||
102 | { | ||
103 | struct i2c_board_info info; | ||
104 | struct IR_i2c_init_data ir_init_data; | ||
105 | unsigned short addr_list[2] = { addr, I2C_CLIENT_END }; | ||
106 | |||
107 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
108 | strlcpy(info.type, type, I2C_NAME_SIZE); | ||
109 | |||
110 | /* Our default information for ir-kbd-i2c.c to use */ | ||
111 | switch (hw) { | ||
112 | case CX18_HW_Z8F0811_IR_RX_HAUP: | ||
113 | memset(&ir_init_data, 0, sizeof(struct IR_i2c_init_data)); | ||
114 | ir_init_data.ir_codes = ir_codes_hauppauge_new; | ||
115 | ir_init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; | ||
116 | ir_init_data.type = IR_TYPE_RC5; | ||
117 | ir_init_data.name = "CX23418 Z8F0811 Hauppauge"; | ||
118 | info.platform_data = &ir_init_data; | ||
119 | break; | ||
120 | default: | ||
121 | break; | ||
122 | } | ||
123 | |||
124 | return i2c_new_probed_device(adap, &info, addr_list) == NULL ? -1 : 0; | ||
125 | } | ||
126 | |||
89 | int cx18_i2c_register(struct cx18 *cx, unsigned idx) | 127 | int cx18_i2c_register(struct cx18 *cx, unsigned idx) |
90 | { | 128 | { |
91 | struct v4l2_subdev *sd; | 129 | struct v4l2_subdev *sd; |
@@ -115,11 +153,14 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
115 | return sd != NULL ? 0 : -1; | 153 | return sd != NULL ? 0 : -1; |
116 | } | 154 | } |
117 | 155 | ||
156 | if (hw & CX18_HW_Z8F0811_IR_HAUP) | ||
157 | return cx18_i2c_new_ir(adap, hw, type, hw_addrs[idx]); | ||
158 | |||
118 | /* Is it not an I2C device or one we do not wish to register? */ | 159 | /* Is it not an I2C device or one we do not wish to register? */ |
119 | if (!hw_addrs[idx]) | 160 | if (!hw_addrs[idx]) |
120 | return -1; | 161 | return -1; |
121 | 162 | ||
122 | /* It's an I2C device other than an analog tuner */ | 163 | /* 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]); | 164 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]); |
124 | if (sd != NULL) | 165 | if (sd != NULL) |
125 | sd->grp_id = hw; | 166 | sd->grp_id = hw; |