diff options
author | Kyle Strickland <kyle@kyle.strickland.name> | 2012-02-18 00:24:53 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-08 09:01:25 -0500 |
commit | 25fa207157102162b1a6abba339dc5fe03f6adc5 (patch) | |
tree | d5475f94bd89842c1cb2411c3351de163038fe94 /drivers/media/video/saa7134/saa7134-input.c | |
parent | 8d834b526a301d2d10db25835d195edf1141f1a0 (diff) |
[media] Add support for KWorld PC150-U ATSC hybrid tuner card
[mchehab@redhat.com: CodingStyle fixes]
Signed-off-by: Kyle Strickland <kyle@kyle.strickland.name>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134/saa7134-input.c')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 22ecd7297d2..48d2878699b 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -210,6 +210,54 @@ static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, | |||
210 | return 1; | 210 | return 1; |
211 | } | 211 | } |
212 | 212 | ||
213 | /* copied and modified from get_key_msi_tvanywhere_plus() */ | ||
214 | static int get_key_kworld_pc150u(struct IR_i2c *ir, u32 *ir_key, | ||
215 | u32 *ir_raw) | ||
216 | { | ||
217 | unsigned char b; | ||
218 | unsigned int gpio; | ||
219 | |||
220 | /* <dev> is needed to access GPIO. Used by the saa_readl macro. */ | ||
221 | struct saa7134_dev *dev = ir->c->adapter->algo_data; | ||
222 | if (dev == NULL) { | ||
223 | i2cdprintk("get_key_kworld_pc150u: " | ||
224 | "ir->c->adapter->algo_data is NULL!\n"); | ||
225 | return -EIO; | ||
226 | } | ||
227 | |||
228 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ | ||
229 | |||
230 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
231 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
232 | |||
233 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | ||
234 | |||
235 | /* GPIO&0x100 is pulsed low when a button is pressed. Don't do | ||
236 | I2C receive if gpio&0x100 is not low. */ | ||
237 | |||
238 | if (gpio & 0x100) | ||
239 | return 0; /* No button press */ | ||
240 | |||
241 | /* GPIO says there is a button press. Get it. */ | ||
242 | |||
243 | if (1 != i2c_master_recv(ir->c, &b, 1)) { | ||
244 | i2cdprintk("read error\n"); | ||
245 | return -EIO; | ||
246 | } | ||
247 | |||
248 | /* No button press */ | ||
249 | |||
250 | if (b == 0xff) | ||
251 | return 0; | ||
252 | |||
253 | /* Button pressed */ | ||
254 | |||
255 | dprintk("get_key_kworld_pc150u: Key = 0x%02X\n", b); | ||
256 | *ir_key = b; | ||
257 | *ir_raw = b; | ||
258 | return 1; | ||
259 | } | ||
260 | |||
213 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | 261 | static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) |
214 | { | 262 | { |
215 | unsigned char b; | 263 | unsigned char b; |
@@ -901,6 +949,21 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
901 | msg_msi.addr, dev->i2c_adap.name, | 949 | msg_msi.addr, dev->i2c_adap.name, |
902 | (1 == rc) ? "yes" : "no"); | 950 | (1 == rc) ? "yes" : "no"); |
903 | break; | 951 | break; |
952 | case SAA7134_BOARD_KWORLD_PC150U: | ||
953 | /* copied and modified from MSI TV@nywhere Plus */ | ||
954 | dev->init_data.name = "Kworld PC150-U"; | ||
955 | dev->init_data.get_key = get_key_kworld_pc150u; | ||
956 | dev->init_data.ir_codes = RC_MAP_KWORLD_PC150U; | ||
957 | info.addr = 0x30; | ||
958 | /* MSI TV@nywhere Plus controller doesn't seem to | ||
959 | respond to probes unless we read something from | ||
960 | an existing device. Weird... | ||
961 | REVISIT: might no longer be needed */ | ||
962 | rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1); | ||
963 | dprintk("probe 0x%02x @ %s: %s\n", | ||
964 | msg_msi.addr, dev->i2c_adap.name, | ||
965 | (1 == rc) ? "yes" : "no"); | ||
966 | break; | ||
904 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: | 967 | case SAA7134_BOARD_HAUPPAUGE_HVR1110: |
905 | dev->init_data.name = "HVR 1110"; | 968 | dev->init_data.name = "HVR 1110"; |
906 | dev->init_data.get_key = get_key_hvr1110; | 969 | dev->init_data.get_key = get_key_hvr1110; |