18 #include <linux/module.h>
19 #include <linux/kernel.h>
22 #include <linux/wait.h>
23 #include <linux/list.h>
24 #include <linux/slab.h>
25 #include <linux/time.h>
28 #include <linux/i2c.h>
29 #include <asm/byteorder.h>
36 #define GO7007_HPI_DEBUG
68 .firmware =
"go7007tv.bin",
141 static int saa7134_go7007_interface_reset(
struct go7007 *
go)
146 u16 intr_val, intr_data;
175 }
while (--count > 0);
179 (intr_val & ~0x1) != 0x55aa) {
181 "saa7134-go7007: unable to reset the GO7007\n");
187 static int saa7134_go7007_write_interrupt(
struct go7007 *go,
int addr,
int data)
194 #ifdef GO7007_HPI_DEBUG
196 "saa7134-go7007: WriteInterrupt: %04x %04x\n", addr, data);
199 for (i = 0; i < 100; ++
i) {
201 if (!(status_reg & 0x0010))
207 "saa7134-go7007: device is hung, status reg = 0x%04x\n",
217 static int saa7134_go7007_read_interrupt(
struct go7007 *go)
226 #ifdef GO7007_HPI_DEBUG
233 static void saa7134_go7007_irq_ts_done(
struct saa7134_dev *dev,
234 unsigned long status)
241 if (0 != (status & 0x000f0000))
243 (status >> 16) & 0x0f);
244 if (status & 0x100000) {
257 static int saa7134_go7007_stream_start(
struct go7007 *go)
315 static int saa7134_go7007_stream_stop(
struct go7007 *go)
344 static int saa7134_go7007_send_firmware(
struct go7007 *go,
u8 *data,
int len)
351 #ifdef GO7007_HPI_DEBUG
353 "sending %d bytes\n", len);
357 i = len > 64 ? 64 : len;
369 for (i = 0; i < 100; ++
i) {
371 if (!(status_reg & 0x0002))
376 "status reg = 0x%04x\n", status_reg);
383 static int saa7134_go7007_send_command(
struct go7007 *go,
unsigned int cmd,
425 .interface_reset = saa7134_go7007_interface_reset,
426 .write_interrupt = saa7134_go7007_write_interrupt,
427 .read_interrupt = saa7134_go7007_read_interrupt,
428 .stream_start = saa7134_go7007_stream_start,
429 .stream_stop = saa7134_go7007_stream_stop,
430 .send_firmware = saa7134_go7007_send_firmware,
431 .send_command = saa7134_go7007_send_command,
436 static int saa7134_go7007_init(
struct saa7134_dev *dev)
460 go->
hpi_ops = &saa7134_go7007_hpi_ops;
476 go->
status = STATUS_ONLINE;
480 go->
status = STATUS_SHUTDOWN;
492 static int saa7134_go7007_fini(
struct saa7134_dev *dev)
502 go->
status = STATUS_SHUTDOWN;
513 .type = SAA7134_MPEG_GO7007,
514 .init = saa7134_go7007_init,
515 .fini = saa7134_go7007_fini,
516 .irq_ts_done = saa7134_go7007_irq_ts_done,
519 static int __init saa7134_go7007_mod_init(
void)
524 static void __exit saa7134_go7007_mod_cleanup(
void)