Release 4.7 drivers/media/pci/zoran/zoran_procfs.c
/*
* Zoran zr36057/zr36067 PCI controller driver, for the
* Pinnacle/Miro DC10/DC10+/DC30/DC30+, Iomega Buz, Linux
* Media Labs LML33/LML33R10.
*
* This part handles the procFS entries (/proc/ZORAN[%d])
*
* Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx>
*
* Currently maintained by:
* Ronald Bultje <rbultje@ronald.bitfreak.net>
* Laurent Pinchart <laurent.pinchart@skynet.be>
* Mailinglist <mjpeg-users@lists.sf.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/videodev2.h>
#include <linux/spinlock.h>
#include <linux/sem.h>
#include <linux/seq_file.h>
#include <linux/ctype.h>
#include <linux/poll.h>
#include <asm/io.h>
#include "videocodec.h"
#include "zoran.h"
#include "zoran_procfs.h"
#include "zoran_card.h"
#ifdef CONFIG_PROC_FS
struct procfs_params_zr36067 {
char *name;
short reg;
u32 mask;
short bit;
};
static const struct procfs_params_zr36067 zr67[] = {
{"HSPol", 0x000, 1, 30},
{"HStart", 0x000, 0x3ff, 10},
{"HEnd", 0x000, 0x3ff, 0},
{"VSPol", 0x004, 1, 30},
{"VStart", 0x004, 0x3ff, 10},
{"VEnd", 0x004, 0x3ff, 0},
{"ExtFl", 0x008, 1, 26},
{"TopField", 0x008, 1, 25},
{"VCLKPol", 0x008, 1, 24},
{"DupFld", 0x008, 1, 20},
{"LittleEndian", 0x008, 1, 0},
{"HsyncStart", 0x10c, 0xffff, 16},
{"LineTot", 0x10c, 0xffff, 0},
{"NAX", 0x110, 0xffff, 16},
{"PAX", 0x110, 0xffff, 0},
{"NAY", 0x114, 0xffff, 16},
{"PAY", 0x114, 0xffff, 0},
/* {"",,,}, */
{NULL, 0, 0, 0},
};
static void
setparam (struct zoran *zr,
char *name,
char *sval)
{
int i = 0, reg0, reg, val;
while (zr67[i].name != NULL) {
if (!strncmp(name, zr67[i].name, strlen(zr67[i].name))) {
reg = reg0 = btread(zr67[i].reg);
reg &= ~(zr67[i].mask << zr67[i].bit);
if (!isdigit(sval[0]))
break;
val = simple_strtoul(sval, NULL, 0);
if ((val & ~zr67[i].mask))
break;
reg |= (val & zr67[i].mask) << zr67[i].bit;
dprintk(4,
KERN_INFO
"%s: setparam: setting ZR36067 register 0x%03x: 0x%08x=>0x%08x %s=%d\n",
ZR_DEVNAME(zr), zr67[i].reg, reg0, reg,
zr67[i].name, val);
btwrite(reg, zr67[i].reg);
break;
}
i++;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 202 | 96.19% | 1 | 50.00% |
ronald bultje | ronald bultje | 8 | 3.81% | 1 | 50.00% |
| Total | 210 | 100.00% | 2 | 100.00% |
static int zoran_show(struct seq_file *p, void *v)
{
struct zoran *zr = p->private;
int i;
seq_printf(p, "ZR36067 registers:\n");
for (i = 0; i < 0x130; i += 16)
seq_printf(p, "%03X %08X %08X %08X %08X \n", i,
btread(i), btread(i+4), btread(i+8), btread(i+12));
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 43 | 50.00% | 1 | 33.33% |
al viro | al viro | 39 | 45.35% | 1 | 33.33% |
ronald bultje | ronald bultje | 4 | 4.65% | 1 | 33.33% |
| Total | 86 | 100.00% | 3 | 100.00% |
static int zoran_open(struct inode *inode, struct file *file)
{
struct zoran *data = PDE_DATA(inode);
return single_open(file, zoran_show, data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
al viro | al viro | 20 | 55.56% | 2 | 50.00% |
ronald bultje | ronald bultje | 14 | 38.89% | 1 | 25.00% |
linus torvalds | linus torvalds | 2 | 5.56% | 1 | 25.00% |
| Total | 36 | 100.00% | 4 | 100.00% |
static ssize_t zoran_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
struct zoran *zr = PDE_DATA(file_inode(file));
char *string, *sp;
char *line, *ldelim, *varname, *svar, *tdelim;
if (count > 32768) /* Stupidity filter */
return -EINVAL;
string = sp = vmalloc(count + 1);
if (!string) {
dprintk(1,
KERN_ERR
"%s: write_proc: can not allocate memory\n",
ZR_DEVNAME(zr));
return -ENOMEM;
}
if (copy_from_user(string, buffer, count)) {
vfree (string);
return -EFAULT;
}
string[count] = 0;
dprintk(4, KERN_INFO "%s: write_proc: name=%pD count=%zu zr=%p\n",
ZR_DEVNAME(zr), file, count, zr);
ldelim = " \t\n";
tdelim = "=";
line = strpbrk(sp, ldelim);
while (line) {
*line = 0;
svar = strpbrk(sp, tdelim);
if (svar) {
*svar = 0;
varname = sp;
svar++;
setparam(zr, varname, svar);
}
sp = line + 1;
line = strpbrk(sp, ldelim);
}
vfree(string);
return count;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 183 | 75.93% | 1 | 10.00% |
andrew morton | andrew morton | 25 | 10.37% | 3 | 30.00% |
al viro | al viro | 21 | 8.71% | 5 | 50.00% |
ronald bultje | ronald bultje | 12 | 4.98% | 1 | 10.00% |
| Total | 241 | 100.00% | 10 | 100.00% |
static const struct file_operations zoran_operations = {
.owner = THIS_MODULE,
.open = zoran_open,
.read = seq_read,
.write = zoran_write,
.llseek = seq_lseek,
.release = single_release,
};
#endif
int
zoran_proc_init (struct zoran *zr)
{
#ifdef CONFIG_PROC_FS
char name[8];
snprintf(name, 7, "zoran%d", zr->id);
zr->zoran_proc = proc_create_data(name, 0, NULL, &zoran_operations, zr);
if (zr->zoran_proc != NULL) {
dprintk(2,
KERN_INFO
"%s: procfs entry /proc/%s allocated. data=%p\n",
ZR_DEVNAME(zr), name, zr);
} else {
dprintk(1, KERN_ERR "%s: Unable to initialise /proc/%s\n",
ZR_DEVNAME(zr), name);
return 1;
}
#endif
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 57 | 55.34% | 1 | 25.00% |
ronald bultje | ronald bultje | 33 | 32.04% | 1 | 25.00% |
denis v. lunev | denis v. lunev | 12 | 11.65% | 1 | 25.00% |
al viro | al viro | 1 | 0.97% | 1 | 25.00% |
| Total | 103 | 100.00% | 4 | 100.00% |
void
zoran_proc_cleanup (struct zoran *zr)
{
#ifdef CONFIG_PROC_FS
char name[8];
snprintf(name, 7, "zoran%d", zr->id);
if (zr->zoran_proc)
remove_proc_entry(name, NULL);
zr->zoran_proc = NULL;
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 38 | 71.70% | 1 | 33.33% |
ronald bultje | ronald bultje | 14 | 26.42% | 1 | 33.33% |
al viro | al viro | 1 | 1.89% | 1 | 33.33% |
| Total | 53 | 100.00% | 3 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
linus torvalds | linus torvalds | 734 | 70.71% | 1 | 5.88% |
ronald bultje | ronald bultje | 136 | 13.10% | 1 | 5.88% |
al viro | al viro | 117 | 11.27% | 6 | 35.29% |
andrew morton | andrew morton | 25 | 2.41% | 3 | 17.65% |
denis v. lunev | denis v. lunev | 17 | 1.64% | 1 | 5.88% |
mauro carvalho chehab | mauro carvalho chehab | 4 | 0.39% | 2 | 11.76% |
jean delvare | jean delvare | 3 | 0.29% | 1 | 5.88% |
arjan van de ven | arjan van de ven | 1 | 0.10% | 1 | 5.88% |
hans verkuil | hans verkuil | 1 | 0.10% | 1 | 5.88% |
| Total | 1038 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.