27 #define ZR016_VERSION "v0.7"
29 #include <linux/module.h>
31 #include <linux/slab.h>
34 #include <linux/types.h>
35 #include <linux/wait.h>
53 static int zr36016_codecs;
60 #define dprintk(num, format, args...) \
63 printk(format, ##args); \
80 if (ptr->
codec->master_data->readreg)
82 (ptr->
codec->master_data->
86 KERN_ERR "%s: invalid I/O setup, nothing read!\n",
89 dprintk(4,
"%s: reading from 0x%04x: %02x\n", ptr->
name, reg,
100 dprintk(4,
"%s: writing 0x%02x to 0x%04x\n", ptr->
name, value,
104 if (ptr->
codec->master_data->writereg) {
105 ptr->
codec->master_data->writereg(ptr->
codec, reg, value);
109 "%s: invalid I/O setup, nothing written!\n",
117 zr36016_readi (
struct zr36016 *ptr,
123 if ((ptr->
codec->master_data->writereg) &&
124 (ptr->
codec->master_data->readreg)) {
130 "%s: invalid I/O setup, nothing read (i)!\n",
133 dprintk(4,
"%s: reading indirect from 0x%04x: %02x\n", ptr->
name,
139 zr36016_writei (
struct zr36016 *ptr,
143 dprintk(4,
"%s: writing indirect 0x%02x to 0x%04x\n", ptr->
name,
147 if (ptr->
codec->master_data->writereg) {
153 "%s: invalid I/O setup, nothing written (i)!\n",
165 zr36016_read_version (
struct zr36016 *ptr)
167 ptr->
version = zr36016_read(ptr, 0) >> 4;
178 zr36016_basic_test (
struct zr36016 *ptr)
184 for (i = 0; i <= 0x0b; i++)
185 dprintk(1,
"%02x ", zr36016_readi(ptr, i));
194 "%s: attach failed, can't connect to vfe processor!\n",
202 "%s: attach failed, can't connect to vfe processor!\n",
207 zr36016_read_version(ptr);
211 "%s: attach failed, suspicious version %d found...\n",
226 static int zr36016_pushit (
struct zr36016 *ptr,
233 dprintk(4,
"%s: write data block to 0x%04x (len=%d)\n",
234 ptr->
name, startreg,len);
236 zr36016_writei(ptr, startreg++, data[i++]);
250 static const int zr016_xoff[] = { 20, 20, 20 };
251 static const int zr016_yoff[] = { 8, 9, 7 };
254 zr36016_init (
struct zr36016 *ptr)
300 dprintk(2,
"%s: set_mode %d call\n", ptr->
name, mode);
320 dprintk(2,
"%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n",
357 int *ival = (
int *)
data;
359 dprintk(2,
"%s: control %d call with %d byte\n", ptr->
name, type,
364 if (size !=
sizeof(
int))
370 if (size !=
sizeof(
int))
376 if (size !=
sizeof(
int))
439 dprintk(2,
"zr36016: initializing VFE subsystem #%d.\n",
444 KERN_ERR "zr36016: Can't attach more codecs!\n");
456 ptr->
num = zr36016_codecs++;
460 res = zr36016_basic_test(ptr);
462 zr36016_unset(codec);
479 static const struct videocodec zr36016_codec = {
487 .setup = zr36016_setup,
488 .unset = zr36016_unset,
489 .set_mode = zr36016_set_mode,
490 .set_video = zr36016_set_video,
491 .control = zr36016_control,
500 zr36016_init_module (
void)
508 zr36016_cleanup_module (
void)
510 if (zr36016_codecs) {
512 "zr36016: something's wrong - %d codecs left somehow.\n",