亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ovcamchip_core.c

?? linux-2.6.15.6
?? C
字號:
/* Shared Code for OmniVision Camera Chip Drivers * * Copyright (c) 2004 Mark McClelland <mark@alpha.dyndns.org> * http://alpha.dyndns.org/ov511/ * * 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. NO WARRANTY OF ANY KIND is expressed or implied. */#define DEBUG#include <linux/init.h>#include <linux/module.h>#include <linux/moduleparam.h>#include <linux/slab.h>#include <linux/delay.h>#include "ovcamchip_priv.h"#define DRIVER_VERSION "v2.27 for Linux 2.6"#define DRIVER_AUTHOR "Mark McClelland <mark@alpha.dyndns.org>"#define DRIVER_DESC "OV camera chip I2C driver"#define PINFO(fmt, args...) printk(KERN_INFO "ovcamchip: " fmt "\n" , ## args);#define PERROR(fmt, args...) printk(KERN_ERR "ovcamchip: " fmt "\n" , ## args);#ifdef DEBUGint ovcamchip_debug = 0;static int debug;module_param(debug, int, 0);MODULE_PARM_DESC(debug,  "Debug level: 0=none, 1=inits, 2=warning, 3=config, 4=functions, 5=all");#endif/* By default, let bridge driver tell us if chip is monochrome. mono=0 * will ignore that and always treat chips as color. mono=1 will force * monochrome mode for all chips. */static int mono = -1;module_param(mono, int, 0);MODULE_PARM_DESC(mono,  "1=chips are monochrome (OVx1xx), 0=force color, -1=autodetect (default)");MODULE_AUTHOR(DRIVER_AUTHOR);MODULE_DESCRIPTION(DRIVER_DESC);MODULE_LICENSE("GPL");/* Registers common to all chips, that are needed for detection */#define GENERIC_REG_ID_HIGH       0x1C	/* manufacturer ID MSB */#define GENERIC_REG_ID_LOW        0x1D	/* manufacturer ID LSB */#define GENERIC_REG_COM_I         0x29	/* misc ID bits */extern struct ovcamchip_ops ov6x20_ops;extern struct ovcamchip_ops ov6x30_ops;extern struct ovcamchip_ops ov7x10_ops;extern struct ovcamchip_ops ov7x20_ops;extern struct ovcamchip_ops ov76be_ops;static char *chip_names[NUM_CC_TYPES] = {	[CC_UNKNOWN]	= "Unknown chip",	[CC_OV76BE]	= "OV76BE",	[CC_OV7610]	= "OV7610",	[CC_OV7620]	= "OV7620",	[CC_OV7620AE]	= "OV7620AE",	[CC_OV6620]	= "OV6620",	[CC_OV6630]	= "OV6630",	[CC_OV6630AE]	= "OV6630AE",	[CC_OV6630AF]	= "OV6630AF",};/* Forward declarations */static struct i2c_driver driver;static struct i2c_client client_template;/* ----------------------------------------------------------------------- */int ov_write_regvals(struct i2c_client *c, struct ovcamchip_regvals *rvals){	int rc;	while (rvals->reg != 0xff) {		rc = ov_write(c, rvals->reg, rvals->val);		if (rc < 0)			return rc;		rvals++;	}	return 0;}/* Writes bits at positions specified by mask to an I2C reg. Bits that are in * the same position as 1's in "mask" are cleared and set to "value". Bits * that are in the same position as 0's in "mask" are preserved, regardless * of their respective state in "value". */int ov_write_mask(struct i2c_client *c,		  unsigned char reg,		  unsigned char value,		  unsigned char mask){	int rc;	unsigned char oldval, newval;	if (mask == 0xff) {		newval = value;	} else {		rc = ov_read(c, reg, &oldval);		if (rc < 0)			return rc;		oldval &= (~mask);		/* Clear the masked bits */		value &= mask;			/* Enforce mask on value */		newval = oldval | value;	/* Set the desired bits */	}	return ov_write(c, reg, newval);}/* ----------------------------------------------------------------------- *//* Reset the chip and ensure that I2C is synchronized. Returns <0 if failure. */static int init_camchip(struct i2c_client *c){	int i, success;	unsigned char high, low;	/* Reset the chip */	ov_write(c, 0x12, 0x80);	/* Wait for it to initialize */	msleep(150);	for (i = 0, success = 0; i < I2C_DETECT_RETRIES && !success; i++) {		if (ov_read(c, GENERIC_REG_ID_HIGH, &high) >= 0) {			if (ov_read(c, GENERIC_REG_ID_LOW, &low) >= 0) {				if (high == 0x7F && low == 0xA2) {					success = 1;					continue;				}			}		}		/* Reset the chip */		ov_write(c, 0x12, 0x80);		/* Wait for it to initialize */		msleep(150);		/* Dummy read to sync I2C */		ov_read(c, 0x00, &low);	}	if (!success)		return -EIO;	PDEBUG(1, "I2C synced in %d attempt(s)", i);	return 0;}/* This detects the OV7610, OV7620, or OV76BE chip. */static int ov7xx0_detect(struct i2c_client *c){	struct ovcamchip *ov = i2c_get_clientdata(c);	int rc;	unsigned char val;	PDEBUG(4, "");	/* Detect chip (sub)type */	rc = ov_read(c, GENERIC_REG_COM_I, &val);	if (rc < 0) {		PERROR("Error detecting ov7xx0 type");		return rc;	}	if ((val & 3) == 3) {		PINFO("Camera chip is an OV7610");		ov->subtype = CC_OV7610;	} else if ((val & 3) == 1) {		rc = ov_read(c, 0x15, &val);		if (rc < 0) {			PERROR("Error detecting ov7xx0 type");			return rc;		}		if (val & 1) {			PINFO("Camera chip is an OV7620AE");			/* OV7620 is a close enough match for now. There are			 * some definite differences though, so this should be			 * fixed */			ov->subtype = CC_OV7620;		} else {			PINFO("Camera chip is an OV76BE");			ov->subtype = CC_OV76BE;		}	} else if ((val & 3) == 0) {		PINFO("Camera chip is an OV7620");		ov->subtype = CC_OV7620;	} else {		PERROR("Unknown camera chip version: %d", val & 3);		return -ENOSYS;	}	if (ov->subtype == CC_OV76BE)		ov->sops = &ov76be_ops;	else if (ov->subtype == CC_OV7620)		ov->sops = &ov7x20_ops;	else		ov->sops = &ov7x10_ops;	return 0;}/* This detects the OV6620, OV6630, OV6630AE, or OV6630AF chip. */static int ov6xx0_detect(struct i2c_client *c){	struct ovcamchip *ov = i2c_get_clientdata(c);	int rc;	unsigned char val;	PDEBUG(4, "");	/* Detect chip (sub)type */	rc = ov_read(c, GENERIC_REG_COM_I, &val);	if (rc < 0) {		PERROR("Error detecting ov6xx0 type");		return -1;	}	if ((val & 3) == 0) {		ov->subtype = CC_OV6630;		PINFO("Camera chip is an OV6630");	} else if ((val & 3) == 1) {		ov->subtype = CC_OV6620;		PINFO("Camera chip is an OV6620");	} else if ((val & 3) == 2) {		ov->subtype = CC_OV6630;		PINFO("Camera chip is an OV6630AE");	} else if ((val & 3) == 3) {		ov->subtype = CC_OV6630;		PINFO("Camera chip is an OV6630AF");	}	if (ov->subtype == CC_OV6620)		ov->sops = &ov6x20_ops;	else		ov->sops = &ov6x30_ops;	return 0;}static int ovcamchip_detect(struct i2c_client *c){	/* Ideally we would just try a single register write and see if it NAKs.	 * That isn't possible since the OV518 can't report I2C transaction	 * failures. So, we have to try to initialize the chip (i.e. reset it	 * and check the ID registers) to detect its presence. */	/* Test for 7xx0 */	PDEBUG(3, "Testing for 0V7xx0");	c->addr = OV7xx0_SID;	if (init_camchip(c) < 0) {		/* Test for 6xx0 */		PDEBUG(3, "Testing for 0V6xx0");		c->addr = OV6xx0_SID;		if (init_camchip(c) < 0) { 			return -ENODEV;		} else {			if (ov6xx0_detect(c) < 0) {				PERROR("Failed to init OV6xx0"); 				return -EIO;			}		}	} else {		if (ov7xx0_detect(c) < 0) {			PERROR("Failed to init OV7xx0"); 			return -EIO;		}	}	return 0;}/* ----------------------------------------------------------------------- */static int ovcamchip_attach(struct i2c_adapter *adap){	int rc = 0;	struct ovcamchip *ov;	struct i2c_client *c;	/* I2C is not a PnP bus, so we can never be certain that we're talking	 * to the right chip. To prevent damage to EEPROMS and such, only	 * attach to adapters that are known to contain OV camera chips. */	switch (adap->id) {	case I2C_HW_SMBUS_OV511:	case I2C_HW_SMBUS_OV518:	case I2C_HW_SMBUS_OVFX2:	case I2C_HW_SMBUS_W9968CF:		PDEBUG(1, "Adapter ID 0x%06x accepted", adap->id);		break;	default:		PDEBUG(1, "Adapter ID 0x%06x rejected", adap->id);		return -ENODEV;	}	c = kmalloc(sizeof *c, GFP_KERNEL);	if (!c) {		rc = -ENOMEM;		goto no_client;	}	memcpy(c, &client_template, sizeof *c);	c->adapter = adap;	strcpy(c->name, "OV????");	ov = kmalloc(sizeof *ov, GFP_KERNEL);	if (!ov) {		rc = -ENOMEM;		goto no_ov;	}	memset(ov, 0, sizeof *ov);	i2c_set_clientdata(c, ov);	rc = ovcamchip_detect(c);	if (rc < 0)		goto error;	strcpy(c->name, chip_names[ov->subtype]);	PDEBUG(1, "Camera chip detection complete");	i2c_attach_client(c);	return rc;error:	kfree(ov);no_ov:	kfree(c);no_client:	PDEBUG(1, "returning %d", rc);	return rc;}static int ovcamchip_detach(struct i2c_client *c){	struct ovcamchip *ov = i2c_get_clientdata(c);	int rc;	rc = ov->sops->free(c);	if (rc < 0)		return rc;	i2c_detach_client(c);	kfree(ov);	kfree(c);	return 0;}static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg){	struct ovcamchip *ov = i2c_get_clientdata(c);	if (!ov->initialized &&	    cmd != OVCAMCHIP_CMD_Q_SUBTYPE &&	    cmd != OVCAMCHIP_CMD_INITIALIZE) {		dev_err(&c->dev, "ERROR: Camera chip not initialized yet!\n");		return -EPERM;	}	switch (cmd) {	case OVCAMCHIP_CMD_Q_SUBTYPE:	{		*(int *)arg = ov->subtype;		return 0;	}	case OVCAMCHIP_CMD_INITIALIZE:	{		int rc;		if (mono == -1)			ov->mono = *(int *)arg;		else			ov->mono = mono;		if (ov->mono) {			if (ov->subtype != CC_OV7620)				dev_warn(&c->dev, "Warning: Monochrome not "					"implemented for this chip\n");			else				dev_info(&c->dev, "Initializing chip as "					"monochrome\n");		}		rc = ov->sops->init(c);		if (rc < 0)			return rc;		ov->initialized = 1;		return 0;	}	default:		return ov->sops->command(c, cmd, arg);	}}/* ----------------------------------------------------------------------- */static struct i2c_driver driver = {	.owner =		THIS_MODULE,	.name =			"ovcamchip",	.id =			I2C_DRIVERID_OVCAMCHIP,	.class =		I2C_CLASS_CAM_DIGITAL,	.flags =		I2C_DF_NOTIFY,	.attach_adapter =	ovcamchip_attach,	.detach_client =	ovcamchip_detach,	.command =		ovcamchip_command,};static struct i2c_client client_template = {	.name =		"(unset)",	.driver =	&driver,};static int __init ovcamchip_init(void){#ifdef DEBUG	ovcamchip_debug = debug;#endif	PINFO(DRIVER_VERSION " : " DRIVER_DESC);	return i2c_add_driver(&driver);}static void __exit ovcamchip_exit(void){	i2c_del_driver(&driver);}module_init(ovcamchip_init);module_exit(ovcamchip_exit);

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕第一区第二区| 欧美日韩二区三区| 麻豆精品一区二区| 日韩福利视频导航| 麻豆视频观看网址久久| 乱一区二区av| 国产成人一区二区精品非洲| 懂色一区二区三区免费观看| k8久久久一区二区三区| 91原创在线视频| 欧美日韩一区中文字幕| 制服.丝袜.亚洲.另类.中文| 日韩精品中文字幕在线一区| 精品噜噜噜噜久久久久久久久试看| 精品日产卡一卡二卡麻豆| 色久优优欧美色久优优| 欧美在线观看视频一区二区| 7777精品伊人久久久大香线蕉完整版 | 久久久美女毛片| 欧美大片在线观看| 欧美国产一区二区| 一区二区三区影院| 老司机精品视频导航| 成人免费黄色大片| 欧美另类z0zxhd电影| 久久久久国产精品免费免费搜索| 91小宝寻花一区二区三区| 欧美日韩免费电影| 精品剧情v国产在线观看在线| 91国偷自产一区二区三区成为亚洲经典 | 欧美日韩精品一区二区三区| 欧美日韩中文字幕一区二区| 日韩精品一区二区三区在线观看| 色婷婷激情久久| 日韩网站在线看片你懂的| 国产精品婷婷午夜在线观看| 亚洲一区二区在线观看视频| 国产精品综合网| 欧美亚洲自拍偷拍| 久久久久久久久免费| 亚洲一区二区三区四区在线免费观看 | 91精品国产综合久久久蜜臀粉嫩| 成人高清视频在线观看| 91精品国产色综合久久| 国产精品第13页| 精品一区二区综合| 欧美日韩成人综合在线一区二区| 99视频精品全部免费在线| 91麻豆精品国产自产在线| 《视频一区视频二区| 免费高清在线一区| 色先锋资源久久综合| 久久久无码精品亚洲日韩按摩| 91精品国产综合久久精品麻豆| 91麻豆swag| 久久久久99精品国产片| 日韩精品乱码av一区二区| 99re免费视频精品全部| 久久精品一区二区三区不卡| 亚洲福利视频一区二区| 99久久精品99国产精品| 国产日产亚洲精品系列| 国内精品第一页| 欧美一级欧美一级在线播放| 亚洲大片精品永久免费| 欧美系列在线观看| 一区二区三区在线免费播放| 99久久久精品| 中文字幕一区二区三区四区不卡 | 三级精品在线观看| 色婷婷综合久久久中文字幕| 中文字幕在线不卡一区| 不卡av在线免费观看| 国产欧美一区二区三区沐欲| 国产成人自拍网| 欧美极品aⅴ影院| bt7086福利一区国产| 亚洲精品免费播放| 欧洲一区二区三区免费视频| 久久青草欧美一区二区三区| 丝袜脚交一区二区| 91精品国产91久久综合桃花| 日韩精品一级二级 | 欧美亚洲国产bt| 亚洲日本丝袜连裤袜办公室| 国产aⅴ综合色| 中文字幕一区二区三区av | 欧美精品v国产精品v日韩精品 | 欧美欧美午夜aⅴ在线观看| 中文字幕不卡在线| 91小视频在线| 日韩综合在线视频| 91精品国产91久久久久久最新毛片| 中文字幕欧美区| 不卡一二三区首页| 亚洲午夜久久久久久久久久久| 久久99精品久久久| 国产精品丝袜一区| 欧美日韩一本到| 国产乱子伦一区二区三区国色天香| 99久久精品一区二区| 午夜伊人狠狠久久| 久久免费国产精品| 欧美色视频一区| 国产精品一区二区在线观看网站| 欧美午夜精品一区二区三区| 蜜桃一区二区三区在线| 国产精品色眯眯| 欧美一区二区三区电影| 粉嫩欧美一区二区三区高清影视| 欧美久久久久久久久中文字幕| 国产三级精品在线| 欧美猛男男办公室激情| 国产v综合v亚洲欧| 日韩精品国产欧美| 亚洲欧美一区二区久久| 91精品国产综合久久福利 | 欧美一区二区视频在线观看 | 亚洲少妇最新在线视频| 91精品国产91综合久久蜜臀| 成人免费高清视频| 久久精品国产亚洲一区二区三区| 色综合久久88色综合天天免费| 精品国产91洋老外米糕| 91丝袜美女网| 国产99一区视频免费| 午夜精品久久久久久久久久久 | 国产肉丝袜一区二区| 欧美日韩一区三区| 99精品一区二区| 国产麻豆精品在线| 久久精品国产久精国产爱| 亚洲视频1区2区| 国产精品毛片无遮挡高清| 精品国产一区二区三区不卡| 欧美精品免费视频| 91福利区一区二区三区| 99久久综合国产精品| 国产精品66部| 欧美亚洲综合色| 91小视频免费观看| 99久久精品国产精品久久| 国产高清不卡一区| 国内精品久久久久影院色| 美女视频一区在线观看| 日韩成人一区二区三区在线观看| 精品欧美一区二区三区精品久久 | 欧美精品亚洲一区二区在线播放| 亚洲自拍另类综合| 亚洲精品中文在线观看| 1024成人网| 亚洲欧美在线另类| 国产精品久久久爽爽爽麻豆色哟哟| 91丝袜美腿高跟国产极品老师| 亚洲影视在线播放| 亚洲成国产人片在线观看| 亚洲国产乱码最新视频| 亚洲成人动漫在线免费观看| 五月天丁香久久| 捆绑紧缚一区二区三区视频| 激情综合网av| 成人黄色网址在线观看| 99国产精品国产精品久久| eeuss鲁一区二区三区| eeuss鲁一区二区三区| 在线亚洲精品福利网址导航| 欧美久久久久久久久| 2021中文字幕一区亚洲| 欧美韩日一区二区三区四区| 亚洲人成人一区二区在线观看 | 成人午夜免费电影| 成人短视频下载| 欧美电视剧在线看免费| 国产欧美一区二区精品婷婷| 久久久久久久久一| 亚洲激情图片qvod| 久久国产精品第一页| 国产高清在线精品| 欧美三级日韩三级国产三级| 欧美成人精品二区三区99精品| 色天使色偷偷av一区二区| 91麻豆精品国产91久久久使用方法 | 亚洲日本va午夜在线电影| 亚洲地区一二三色| 国产中文字幕精品| 欧美亚洲综合网| 国产人成一区二区三区影院| 一卡二卡三卡日韩欧美| 久久精品国产一区二区| 色丁香久综合在线久综合在线观看| 韩国av一区二区三区在线观看| 自拍偷拍国产亚洲| 久久精品国产精品亚洲精品| 国产一级精品在线| 欧美亚洲日本国产| 久久亚洲精精品中文字幕早川悠里| 欧美v国产在线一区二区三区| 欧美日韩1234| 国产精品视频免费看| 蜜臀av性久久久久蜜臀aⅴ|