aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7134/saa7134-input.c
diff options
context:
space:
mode:
authorBrian Rogers <brian_rogers@comcast.net>2008-10-13 07:37:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-13 07:57:34 -0400
commitba340b40a5f65261731583f67d7ec8cafbf5cfaa (patch)
treeb62243ecb18ccf1d38b60e5919e8ab7eeaa7d6f4 /drivers/media/video/saa7134/saa7134-input.c
parentfa405d7094489828014315a34f0c21fba30be38c (diff)
V4L/DVB (9168): Add support for MSI TV@nywhere Plus remote
The IR controller has a couple quirks. It won't respond until some other device on the bus is probed. To work around that, probe 0x50 first. Then, since it won't respond to a zero-byte read, probe with a one-byte read. Signed-off-by: Brian Rogers <brian_rogers@comcast.net> [mchehab.redhat.com: Fix merge conflicts and remove an unused var] 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.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 72a1c67a8c39..c53fd5f9f6b5 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -118,6 +118,53 @@ static int build_key(struct saa7134_dev *dev)
118 118
119/* --------------------- Chip specific I2C key builders ----------------- */ 119/* --------------------- Chip specific I2C key builders ----------------- */
120 120
121static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key,
122 u32 *ir_raw)
123{
124 unsigned char b;
125 int gpio;
126
127 /* <dev> is needed to access GPIO. Used by the saa_readl macro. */
128 struct saa7134_dev *dev = ir->c.adapter->algo_data;
129 if (dev == NULL) {
130 dprintk("get_key_msi_tvanywhere_plus: "
131 "gir->c.adapter->algo_data is NULL!\n");
132 return -EIO;
133 }
134
135 /* rising SAA7134_GPIO_GPRESCAN reads the status */
136
137 saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
138 saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
139
140 gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
141
142 /* GPIO&0x40 is pulsed low when a button is pressed. Don't do
143 I2C receive if gpio&0x40 is not low. */
144
145 if (gpio & 0x40)
146 return 0; /* No button press */
147
148 /* GPIO says there is a button press. Get it. */
149
150 if (1 != i2c_master_recv(&ir->c, &b, 1)) {
151 i2cdprintk("read error\n");
152 return -EIO;
153 }
154
155 /* No button press */
156
157 if (b == 0xff)
158 return 0;
159
160 /* Button pressed */
161
162 dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
163 *ir_key = b;
164 *ir_raw = b;
165 return 1;
166}
167
121static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 168static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
122{ 169{
123 unsigned char b; 170 unsigned char b;
@@ -641,6 +688,11 @@ void saa7134_set_i2c_ir(struct saa7134_dev *dev, struct IR_i2c *ir)
641 ir->get_key = get_key_purpletv; 688 ir->get_key = get_key_purpletv;
642 ir->ir_codes = ir_codes_purpletv; 689 ir->ir_codes = ir_codes_purpletv;
643 break; 690 break;
691 case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS:
692 snprintf(ir->c.name, sizeof(ir->c.name), "MSI TV@nywhere Plus");
693 ir->get_key = get_key_msi_tvanywhere_plus;
694 ir->ir_codes = ir_codes_msi_tvanywhere_plus;
695 break;
644 case SAA7134_BOARD_HAUPPAUGE_HVR1110: 696 case SAA7134_BOARD_HAUPPAUGE_HVR1110:
645 snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110"); 697 snprintf(ir->c.name, sizeof(ir->c.name), "HVR 1110");
646 ir->get_key = get_key_hvr1110; 698 ir->get_key = get_key_hvr1110;