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/module.h>
13 #include <linux/init.h>
14 #include <linux/types.h>
16 #include <linux/errno.h>
17 #include <linux/videodev.h>
19 #include <asm/addrspace.h>
20 #include <asm/system.h>
25 struct video_device vdev
;
32 #define VINO_DMA_ACTIVE (1<<0)
35 /* We can actually receive TV and IndyCam input at the same time. Believe it or
38 static struct vino_device vino
[2];
40 /* Those registers have to be accessed by either *one* 64 bit write or *one* 64
41 * bit read. We need some asm to fix this. We can't use mips3 as standard
42 * because we just save 32 bits at context switch.
45 static __inline__
unsigned long long vino_reg_read(unsigned long addr
)
47 unsigned long long ret
__attribute__ ((aligned (64)));
48 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
68 static __inline__
void vino_reg_write(unsigned long long value
,
71 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
74 /* we might lose the upper parts of the registers which are not saved
75 * if there comes an interrupt in our way, play safe */
92 static __inline__
void vino_reg_and(unsigned long long value
,
95 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
112 restore_flags(flags
);
115 static __inline__
void vino_reg_or(unsigned long long value
,
118 unsigned long virt_addr
= KSEG1ADDR(addr
+ VINO_BASE
);
122 __asm__
__volatile__(
135 restore_flags(flags
);
138 static int vino_dma_setup(void)
143 static void vino_dma_stop(void)
148 static int vino_init(void)
151 unsigned short rev
, id
;
152 unsigned long long foo
;
155 bar
= (unsigned long *) &foo
;
157 ret
= vino_reg_read(VINO_REVID
);
159 rev
= (ret
& VINO_REVID_REV_MASK
);
160 id
= (ret
& VINO_REVID_ID_MASK
) >> 4;
162 printk("Vino: ID:%02hx Rev:%02hx\n", id
, rev
);
164 foo
= vino_reg_read(VINO_A_DESC_DATA0
);
165 printk("0x%lx", bar
[0]);
166 printk("%lx ", bar
[1]);
167 foo
= vino_reg_read(VINO_A_DESC_DATA1
);
168 printk("0x%lx", bar
[0]);
169 printk("%lx ", bar
[1]);
170 foo
= vino_reg_read(VINO_A_DESC_DATA2
);
171 printk("0x%lx", bar
[0]);
172 printk("%lx ", bar
[1]);
173 foo
= vino_reg_read(VINO_A_DESC_DATA3
);
174 printk("0x%lx", bar
[0]);
175 printk("%lx\n", bar
[1]);
176 foo
= vino_reg_read(VINO_B_DESC_DATA0
);
177 printk("0x%lx", bar
[0]);
178 printk("%lx ", bar
[1]);
179 foo
= vino_reg_read(VINO_B_DESC_DATA1
);
180 printk("0x%lx", bar
[0]);
181 printk("%lx ", bar
[1]);
182 foo
= vino_reg_read(VINO_B_DESC_DATA2
);
183 printk("0x%lx", bar
[0]);
184 printk("%lx ", bar
[1]);
185 foo
= vino_reg_read(VINO_B_DESC_DATA3
);
186 printk("0x%lx", bar
[0]);
187 printk("%lx\n", bar
[1]);
192 static void vino_dma_go(struct vino_device
*v
)
197 /* Reset the vino back to default state */
199 static void vino_setup(struct vino_device
*v
)
204 static int vino_open(struct video_device
*dev
, int flags
)
210 static void vino_close(struct video_device
*dev
)
215 static int vino_ioctl(struct video_device
*dev
, unsigned int cmd
, void *arg
)
220 static int vino_mmap(struct video_device
*dev
, const char *adr
,
226 static struct video_device vino_dev
= {
232 NULL
, /* vino_read */
233 NULL
, /* vino_write */
234 NULL
, /* vino_poll */
237 NULL
, /* vino_init */
243 __initfunc(int init_vino(struct video_device
*dev
))
252 if (video_register_device(&vinodev
, VFL_TYPE_GRABBER
) == -1) {
261 int init_module(void)
272 void cleanup_module(void)