diff options
author | Lukas Karas <lukas.karas@centrum.cz> | 2009-11-24 10:06:52 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-15 21:18:25 -0500 |
commit | d995a18733a683c1c086a4d48315976f8c25d89b (patch) | |
tree | 403341b8344062521067c435266b596a9853f69a /drivers/media/video/saa7134 | |
parent | 7eca61eb6a57a3aae10e77d9306cda0b8c23cdab (diff) |
V4L/DVB (13591): add support for IR on FlyDVB Trio (saa7134)
saa7134: Add support for IR reciever on card LifeView FlyDVB Trio
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[mchehab@redhat.com: CodingStyle fixes and ported upstream]
Tested-by: Petr Fiala <petr.fiala@gmail.com>
Signed-off-by: Lukas Karas <lukas.karas@centrum.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 22 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-input.c | 62 |
2 files changed, 84 insertions, 0 deletions
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; |