1 /* $Id: vino.c,v 1.4 1999/02/09 23:59:36 ulfc Exp $
4 * (incomplete) Driver for the Vino Video input system found in SGI Indys.
6 * Copyright (C) 1999 Ulf Carlsson (ulfc@bun.falkenberg.se)
8 * This isn't complete yet, please don't expect any video until I've written
12 #include <linux/config.h>
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/types.h>
17 #include <linux/errno.h>
18 #include <linux/videodev.h>
20 #include <asm/addrspace.h>
21 #include <asm/system.h>
26 struct video_device vdev
;
33 #define VINO_DMA_ACTIVE (1<<0)
36 /* We can actually receive TV and IndyCam input at the same time. Believe it or
39 static struct vino_device vino
[2];
41 /* Those registers have to be accessed by either *one* 64 bit write or *one* 64
42 * bit read. We need some asm to fix this. We can't use mips3 as standard
43 * because we just save 32 bits at context switch.
46 static __inline__
unsigned long long vino_reg_read(unsigned long addr
)
48 unsigned long long ret
__attribute__ ((aligned (64)));
49 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
69 static __inline__
void vino_reg_write(unsigned long long value
,
72 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
75 /* we might lose the upper parts of the registers which are not saved
76 * if there comes an interrupt in our way, play safe */
93 static __inline__
void vino_reg_and(unsigned long long value
,
96 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
100 __asm__
__volatile__(
113 restore_flags(flags
);
116 static __inline__
void vino_reg_or(unsigned long long value
,
119 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
123 __asm__
__volatile__(
136 restore_flags(flags
);
139 static int vino_dma_setup(void)
144 static void vino_dma_stop(void)
149 static int vino_init(void)
152 unsigned short rev
, id
;
153 unsigned long long foo
;
156 bar
= (unsigned long *) &foo
;
158 ret
= vino_reg_read(VINO_REVID
);
160 rev
= (ret
& VINO_REVID_REV_MASK
);
161 id
= (ret
& VINO_REVID_ID_MASK
) >> 4;
163 printk("Vino: ID:%02hx Rev:%02hx\n", id
, rev
);
165 foo
= vino_reg_read(VINO_A_DESC_DATA0
);
166 printk("0x%lx", bar
[0]);
167 printk("%lx ", bar
[1]);
168 foo
= vino_reg_read(VINO_A_DESC_DATA1
);
169 printk("0x%lx", bar
[0]);
170 printk("%lx ", bar
[1]);
171 foo
= vino_reg_read(VINO_A_DESC_DATA2
);
172 printk("0x%lx", bar
[0]);
173 printk("%lx ", bar
[1]);
174 foo
= vino_reg_read(VINO_A_DESC_DATA3
);
175 printk("0x%lx", bar
[0]);
176 printk("%lx\n", bar
[1]);
177 foo
= vino_reg_read(VINO_B_DESC_DATA0
);
178 printk("0x%lx", bar
[0]);
179 printk("%lx ", bar
[1]);
180 foo
= vino_reg_read(VINO_B_DESC_DATA1
);
181 printk("0x%lx", bar
[0]);
182 printk("%lx ", bar
[1]);
183 foo
= vino_reg_read(VINO_B_DESC_DATA2
);
184 printk("0x%lx", bar
[0]);
185 printk("%lx ", bar
[1]);
186 foo
= vino_reg_read(VINO_B_DESC_DATA3
);
187 printk("0x%lx", bar
[0]);
188 printk("%lx\n", bar
[1]);
193 static void vino_dma_go(struct vino_device
*v
)
198 /* Reset the vino back to default state */
200 static void vino_setup(struct vino_device
*v
)
205 static int vino_open(struct video_device
*dev
, int flags
)
211 static void vino_close(struct video_device
*dev
)
216 static int vino_ioctl(struct video_device
*dev
, unsigned int cmd
, void *arg
)
221 static int vino_mmap(struct video_device
*dev
, const char *adr
,
227 static struct video_device vino_dev
= {
233 NULL
, /* vino_read */
234 NULL
, /* vino_write */
235 NULL
, /* vino_poll */
238 NULL
, /* vino_init */
244 __initfunc(int init_vino(struct video_device
*dev
))
253 if (video_register_device(&vinodev
, VFL_TYPE_GRABBER
) == -1) {
262 int init_module(void)
273 void cleanup_module(void)