diff options
-rw-r--r-- | drivers/media/video/ir-kbd-i2c.c | 3 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 22 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 62 |
3 files changed, 86 insertions, 1 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 64360d26b32d..2856e780772e 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -353,6 +353,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
353 | ir_type = IR_TYPE_RC5; | 353 | ir_type = IR_TYPE_RC5; |
354 | ir_codes = &ir_codes_fusionhdtv_mce_table; | 354 | ir_codes = &ir_codes_fusionhdtv_mce_table; |
355 | break; | 355 | break; |
356 | case 0x0b: | ||
356 | case 0x47: | 357 | case 0x47: |
357 | case 0x71: | 358 | case 0x71: |
358 | if (adap->id == I2C_HW_B_CX2388x || | 359 | if (adap->id == I2C_HW_B_CX2388x || |
@@ -422,7 +423,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
422 | 423 | ||
423 | /* Make sure we are all setup before going on */ | 424 | /* Make sure we are all setup before going on */ |
424 | if (!name || !ir->get_key || !ir_type || !ir_codes) { | 425 | if (!name || !ir->get_key || !ir_type || !ir_codes) { |
425 | dprintk(1, DEVNAME ": Unsupported device at address 0x%02x\n", | 426 | dprintk(1, ": Unsupported device at address 0x%02x\n", |
426 | addr); | 427 | addr); |
427 | err = -ENODEV; | 428 | err = -ENODEV; |
428 | goto err_out_free; | 429 | goto err_out_free; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 7e40d6d99dd0..03f572708b85 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -7211,9 +7211,31 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
7211 | } | 7211 | } |
7212 | case SAA7134_BOARD_FLYDVB_TRIO: | 7212 | case SAA7134_BOARD_FLYDVB_TRIO: |
7213 | { | 7213 | { |
7214 | u8 temp = 0; | ||
7215 | int rc; | ||
7214 | u8 data[] = { 0x3c, 0x33, 0x62}; | 7216 | u8 data[] = { 0x3c, 0x33, 0x62}; |
7215 | struct i2c_msg msg = {.addr=0x09, .flags=0, .buf=data, .len = sizeof(data)}; | 7217 | struct i2c_msg msg = {.addr=0x09, .flags=0, .buf=data, .len = sizeof(data)}; |
7216 | i2c_transfer(&dev->i2c_adap, &msg, 1); | 7218 | i2c_transfer(&dev->i2c_adap, &msg, 1); |
7219 | |||
7220 | /* | ||
7221 | * send weak up message to pic16C505 chip | ||
7222 | * @ LifeView FlyDVB Trio | ||
7223 | */ | ||
7224 | msg.buf = &temp; | ||
7225 | msg.addr = 0x0b; | ||
7226 | msg.len = 1; | ||
7227 | if (1 != i2c_transfer(&dev->i2c_adap, &msg, 1)) { | ||
7228 | printk(KERN_WARNING "%s: send wake up byte to pic16C505" | ||
7229 | "(IR chip) failed\n", dev->name); | ||
7230 | } else { | ||
7231 | msg.flags = I2C_M_RD; | ||
7232 | rc = i2c_transfer(&dev->i2c_adap, &msg, 1); | ||
7233 | printk(KERN_INFO "%s: probe IR chip @ i2c 0x%02x: %s\n", | ||
7234 | dev->name, msg.addr, | ||
7235 | (1 == rc) ? "yes" : "no"); | ||
7236 | if (rc == 1) | ||
7237 | dev->has_remote = SAA7134_REMOTE_I2C; | ||
7238 | } | ||
7217 | break; | 7239 | break; |
7218 | } | 7240 | } |
7219 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: | 7241 | case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: |
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 744918b1cd47..411a8410620e 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c | |||
@@ -127,6 +127,61 @@ static int build_key(struct saa7134_dev *dev) | |||
127 | 127 | ||
128 | /* --------------------- Chip specific I2C key builders ----------------- */ | 128 | /* --------------------- Chip specific I2C key builders ----------------- */ |
129 | 129 | ||
130 | static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) | ||
131 | { | ||
132 | int gpio; | ||
133 | int attempt = 0; | ||
134 | unsigned char b; | ||
135 | |||
136 | /* We need this to access GPI Used by the saa_readl macro. */ | ||
137 | struct saa7134_dev *dev = ir->c->adapter->algo_data; | ||
138 | |||
139 | if (dev == NULL) { | ||
140 | dprintk("get_key_flydvb_trio: " | ||
141 | "gir->c->adapter->algo_data is NULL!\n"); | ||
142 | return -EIO; | ||
143 | } | ||
144 | |||
145 | /* rising SAA7134_GPIGPRESCAN reads the status */ | ||
146 | saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
147 | saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN); | ||
148 | |||
149 | gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2); | ||
150 | |||
151 | if (0x40000 & ~gpio) | ||
152 | return 0; /* No button press */ | ||
153 | |||
154 | /* No button press - only before first key pressed */ | ||
155 | if (b == 0xFF) | ||
156 | return 0; | ||
157 | |||
158 | /* poll IR chip */ | ||
159 | /* weak up the IR chip */ | ||
160 | b = 0; | ||
161 | |||
162 | while (1 != i2c_master_send(ir->c, &b, 1)) { | ||
163 | if ((attempt++) < 10) { | ||
164 | /* | ||
165 | * wait a bit for next attempt - | ||
166 | * I don't know how make it better | ||
167 | */ | ||
168 | msleep(10); | ||
169 | continue; | ||
170 | } | ||
171 | i2cdprintk("send wake up byte to pic16C505 (IR chip)" | ||
172 | "failed %dx\n", attempt); | ||
173 | return -EIO; | ||
174 | } | ||
175 | if (1 != i2c_master_recv(ir->c, &b, 1)) { | ||
176 | i2cdprintk("read error\n"); | ||
177 | return -EIO; | ||
178 | } | ||
179 | |||
180 | *ir_key = b; | ||
181 | *ir_raw = b; | ||
182 | return 1; | ||
183 | } | ||
184 | |||
130 | static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, | 185 | static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key, |
131 | u32 *ir_raw) | 186 | u32 *ir_raw) |
132 | { | 187 | { |
@@ -622,6 +677,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) | |||
622 | mask_keyup = 0x020000; | 677 | mask_keyup = 0x020000; |
623 | polling = 50; /* ms */ | 678 | polling = 50; /* ms */ |
624 | break; | 679 | break; |
680 | break; | ||
625 | } | 681 | } |
626 | if (NULL == ir_codes) { | 682 | if (NULL == ir_codes) { |
627 | printk("%s: Oops: IR config error [card=%d]\n", | 683 | printk("%s: Oops: IR config error [card=%d]\n", |
@@ -788,6 +844,12 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev) | |||
788 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: | 844 | case SAA7134_BOARD_AVERMEDIA_CARDBUS_506: |
789 | info.addr = 0x40; | 845 | info.addr = 0x40; |
790 | break; | 846 | break; |
847 | case SAA7134_BOARD_FLYDVB_TRIO: | ||
848 | dev->init_data.name = "FlyDVB Trio"; | ||
849 | dev->init_data.get_key = get_key_flydvb_trio; | ||
850 | dev->init_data.ir_codes = &ir_codes_flydvb_table; | ||
851 | info.addr = 0x0b; | ||
852 | break; | ||
791 | default: | 853 | default: |
792 | dprintk("No I2C IR support for board %x\n", dev->board); | 854 | dprintk("No I2C IR support for board %x\n", dev->board); |
793 | return; | 855 | return; |