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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? i2c-old-porting

?? I2C總線LINUX驅動程序
??
?? 第 1 頁 / 共 2 頁
字號:
I2C Conversion Guide for I2C-old to the current I2C APIJuly 2002For Linux Kernel v2.5.xFrank Davis <fdavis@si.rr.com>-------------------------------------------------------There exists several kernel drivers that are using an old version of the I2CAPI. These drivers need to be converted to the current (kernel 2.5.x) version.The following document provides a guideline to make the appropriate changes tothe affected drivers. There maybe slight modifications to this guide that are specific to the driver you are working on. If you see {driver_name}, replace that with the respective name of the driver, such as saa7110.c , {driver_name} = saa7110.-------------------------------------------------------Step 1: Include the right header file Perform the following change within the driver #include <linux/i2c-old.h> --> #include <linux/i2c.h>Step 2: Add and set the i2c modesAdd the following code near the top of the driverstatic unsigned short normal_i2c[] = {34>>1, I2C_CLIENT_END };static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };static unsigned short probe[2] = { I2C_CLIENT_END , I2C_CLIENT_END };static unsigned short probe_range[2] = { I2C_CLIENT_END , I2C_CLIENT_END };	static unsigned short ignore[2] = { I2C_CLIENT_END , I2C_CLIENT_END };static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };static struct i2c_client_address_data addr_data  = {	normal_i2c , normal_i2c_range,	probe , probe_range,	ignore , ignore_range,	force};static struct i2c_client client_template;Step 3: Modify the driver info structWithin the struct for the driver , such as struct {driver_name}  ,  make the following change ,struct i2c_bus *bus --> struct i2c_client *clientMake changes where this change affects references within the file.Add a semaphore to the driver struct (as above)struct semaphore lock Step 5: Remove specific read and write functionsRemove the driver specific write and read functions, usually in the form:{driver_name}_write , {driver_name}_read , {driver_name}_write_block , etc.Step 6: Update the write and read functions for the current I2C APIReplace all references of {driver_name}_write with i2c_smbus_write_byte_dataReplace all references of {driver_name}_read with i2c_smbus_read_byte_data ori2c_smbus_read_byte , depending on args passed in.** Ensure that these functions pass in the i2c_client *client , NOT thedecoder/encoder that was passed in the driver specific write and readfunctions.  Step 7: Modify the driver's attach functionChange the driver attach function prototype :{driver_name}_attach(struct i2c_device *device) --> {driver_name}_attach(struct i2c_adapter *adap, int addr , unsigned short flags, int kind)Create a i2c_client client...Add the following (where "decoder" is a reference to a struct for the driverinfo:struct i2c_client *client;client = kmalloc(sizeof(*client), GFP_KERNEL);if(client == NULL)	return -ENOMEM;client_template.adapter = adap;client_template.addr  = addr;memcpy(client, &client_template, sizeof(*client));strcpy(client->name , "{driver_name}");decoder->client = client;client->data = decoder;decoder->addr = addr;Towards the end of the function, add:init_MUTEX(&decoder->lock);i2c_attach_client(client);Step 8: Modify the driver's detach functionChange the driver detach function prototype :{driver_name}_detach(struct i2c_device *device) --> {driver_name}_detach(struct i2c_client *client)In the beginning of the detach function, add:i2c_detach_client(client);Towards the end of the detach function, add:kfree(client->data);kfree(client);Step 9: Modify the driver's command functionChange the driver command function prototype :Step 10: Add the probe function after the driver's attach function.Add the following code:static int {driver_name}_probe(struct i2c_adapter *adap){	return i2c_probe(adap, &addr_data, {driver_name}_attach);}Step 11: Modify the driver's i2c_driverFind the i2c_driver , such asstatic struct i2c_driver i2c_driver_saa7110It is usually located towards the end of the driver Replace the values from I2C_DRIVERID_{something} to {driver_name}_attach, and add the followingI2C_DRIVERID_{driver_name} , // verify by looking in include/linux/i2c-id.h I2C_DF_NOTIFY,{driver_name}_probe, ....Step 12: Adding the i2c_client Add the i2c_client to the driver. Add the following code:static struct i2c_client client_template = {	"{driver_name}_client",	-1,	0,	0,	NULL,	{i2c_driver reference}};Step 13: Registering and UnregisteringReplace i2c_register_driver with i2c_add_driverReplace i2c_unregister_driver with i2c_del_driver-------------------------------------------------------Example:The following patch provides the i2c coversion patch for the saa7110 driverbased on the above guide (for clarity).--- drivers/media/video/saa7110.c.old	Fri Jun 28 10:22:52 2002+++ drivers/media/video/saa7110.c	Thu Jul  4 16:51:08 2002@@ -26,7 +26,7 @@ #include <asm/io.h> #include <asm/uaccess.h> -#include <linux/i2c-old.h>+#include <linux/i2c.h> #include <linux/videodev.h> #include "linux/video_decoder.h" @@ -37,13 +37,31 @@  #define	I2C_SAA7110		0x9C	/* or 0x9E */ +#define IF_NAME	"saa7110" #define	I2C_DELAY		10	/* 10 us or 100khz */ +static unsigned short normal_i2c[] = {34>>1, I2C_CLIENT_END };+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };+static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };+static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };+static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };+static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };+static unsigned short force[2] = { I2C_CLIENT_END, I2C_CLIENT_END };++static struct i2c_client_address_data addr_data = {+	normal_i2c, normal_i2c_range,+	probe, probe_range,+	ignore, ignore_range,+	force+};++static struct i2c_client client_template;+ struct saa7110 {-	struct	i2c_bus	*bus;+	struct i2c_client *client; 	int		addr; 	unsigned char	reg[36];-+	struct semaphore lock; 	int		norm; 	int		input; 	int		enable;@@ -54,67 +72,10 @@ };  /* ----------------------------------------------------------------------- */-/* I2C support functions						   */-/* ----------------------------------------------------------------------- */-static-int saa7110_write(struct saa7110 *decoder, unsigned char subaddr, unsigned char data)-{-	int ack;--	LOCK_I2C_BUS(decoder->bus);-	i2c_start(decoder->bus);-	i2c_sendbyte(decoder->bus, decoder->addr, I2C_DELAY);-	i2c_sendbyte(decoder->bus, subaddr, I2C_DELAY);-	ack = i2c_sendbyte(decoder->bus, data, I2C_DELAY);-	i2c_stop(decoder->bus);-	decoder->reg[subaddr] = data;-	UNLOCK_I2C_BUS(decoder->bus);-	return ack;-}--static-int saa7110_write_block(struct saa7110* decoder, unsigned const char *data, unsigned int len)-{-	unsigned subaddr = *data;--	LOCK_I2C_BUS(decoder->bus);-        i2c_start(decoder->bus);-        i2c_sendbyte(decoder->bus,decoder->addr,I2C_DELAY);-	while (len-- > 0) {-                if (i2c_sendbyte(decoder->bus,*data,0)) {-                        i2c_stop(decoder->bus);-                        UNLOCK_I2C_BUS(decoder->bus);-                        return -EAGAIN;-                }-		decoder->reg[subaddr++] = *data++;-        }-	i2c_stop(decoder->bus);-	UNLOCK_I2C_BUS(decoder->bus);--	return 0;-}--static-int saa7110_read(struct saa7110* decoder)-{-	int data;--	LOCK_I2C_BUS(decoder->bus);-	i2c_start(decoder->bus);-	i2c_sendbyte(decoder->bus, decoder->addr, I2C_DELAY);-	i2c_start(decoder->bus);-	i2c_sendbyte(decoder->bus, decoder->addr | 1, I2C_DELAY);-	data = i2c_readbyte(decoder->bus, 1);-	i2c_stop(decoder->bus);-	UNLOCK_I2C_BUS(decoder->bus);-	return data;-}--/* ----------------------------------------------------------------------- */ /* SAA7110 functions							   */ /* ----------------------------------------------------------------------- */ static-int saa7110_selmux(struct i2c_device *device, int chan)+int saa7110_selmux(struct i2c_client *client, int chan) { static	const unsigned char modes[9][8] = { /* mode 0 */	{ 0x00, 0xD9, 0x17, 0x40, 0x03, 0x44, 0x75, 0x16 },@@ -126,61 +87,59 @@ /* mode 6 */	{ 0x80, 0x59, 0x17, 0x42, 0xA3, 0x44, 0x75, 0x12 }, /* mode 7 */	{ 0x80, 0x9A, 0x17, 0xB1, 0x13, 0x60, 0xB5, 0x14 }, /* mode 8 */	{ 0x80, 0x3C, 0x27, 0xC1, 0x23, 0x44, 0x75, 0x21 } };-	struct saa7110* decoder = device->data; 	const unsigned char* ptr = modes[chan]; -	saa7110_write(decoder,0x06,ptr[0]);	/* Luminance control	*/-	saa7110_write(decoder,0x20,ptr[1]);	/* Analog Control #1	*/-	saa7110_write(decoder,0x21,ptr[2]);	/* Analog Control #2	*/-	saa7110_write(decoder,0x22,ptr[3]);	/* Mixer Control #1	*/-	saa7110_write(decoder,0x2C,ptr[4]);	/* Mixer Control #2	*/-	saa7110_write(decoder,0x30,ptr[5]);	/* ADCs gain control	*/-	saa7110_write(decoder,0x31,ptr[6]);	/* Mixer Control #3	*/-	saa7110_write(decoder,0x21,ptr[7]);	/* Analog Control #2	*/+	i2c_smbus_write_byte_data(client,0x06,ptr[0]);	/* Luminance control	*/+	i2c_smbus_write_byte_data(client,0x20,ptr[1]);	/* Analog Control #1	*/+	i2c_smbus_write_byte_data(client,0x21,ptr[2]);	/* Analog Control #2	*/+	i2c_smbus_write_byte_data(client,0x22,ptr[3]);	/* Mixer Control #1	*/+	i2c_smbus_write_byte_data(client,0x2C,ptr[4]);	/* Mixer Control #2	*/+	i2c_smbus_write_byte_data(client,0x30,ptr[5]);	/* ADCs gain control	*/+	i2c_smbus_write_byte_data(client,0x31,ptr[6]);	/* Mixer Control #3	*/+	i2c_smbus_write_byte_data(client,0x21,ptr[7]);	/* Analog Control #2	*/  	return 0; }  static-int determine_norm(struct i2c_device* dev)+int determine_norm(struct i2c_client* client) {-	struct	saa7110* decoder = dev->data; 	int	status;  	/* mode changed, start automatic detection */-	status = saa7110_read(decoder);+	status = i2c_smbus_read_byte(client);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜精品影院在线观看| 日韩一级黄色片| 日韩免费高清av| 亚洲免费在线视频一区 二区| 精品一区二区三区免费视频| 欧洲精品中文字幕| 国产精品久久久久久妇女6080 | 中文字幕欧美一| 久热成人在线视频| 欧美日韩一区 二区 三区 久久精品| 日本一区二区三区久久久久久久久不 | 日韩欧美一级二级三级久久久| 亚洲一区二区五区| 成人av在线资源网站| 久久婷婷国产综合精品青草| 日日摸夜夜添夜夜添精品视频| 色久综合一二码| 中文幕一区二区三区久久蜜桃| 国模一区二区三区白浆| 欧美一区二区三区白人| 丝袜美腿亚洲综合| 在线播放中文一区| 亚洲国产精品久久久久婷婷884 | 91精选在线观看| 洋洋av久久久久久久一区| 99久久综合国产精品| 国产精品视频线看| 成人国产精品免费观看视频| 久久久精品欧美丰满| 国产精品99久久久久久久女警| 337p日本欧洲亚洲大胆色噜噜| 久久成人羞羞网站| 精品剧情在线观看| 国产精品亚洲成人| 国产精品日韩成人| 91国模大尺度私拍在线视频| 一区二区三区在线视频播放| 在线欧美日韩国产| 五月综合激情日本mⅴ| 91精品国产一区二区三区| 老司机精品视频在线| 久久女同性恋中文字幕| 成人av电影观看| 一区二区三区欧美日韩| 欧美日韩久久久久久| 美脚の诱脚舐め脚责91| 国产日产精品一区| 色诱视频网站一区| 国产乱码一区二区三区| 国产日韩欧美a| 免费观看一级特黄欧美大片| 欧美日韩国产高清一区| 日韩精品三区四区| 国产女主播视频一区二区| 成人网在线播放| 日韩欧美色电影| 色偷偷成人一区二区三区91 | 一二三区精品福利视频| 国产精品国产三级国产专播品爱网| 91精品国产欧美日韩| 欧美日韩国产小视频| 91麻豆成人久久精品二区三区| 国产白丝精品91爽爽久久| 久久 天天综合| 日本美女一区二区三区视频| 五月天丁香久久| 亚洲午夜电影网| 亚洲亚洲人成综合网络| 一区二区三区丝袜| 亚洲精品久久久蜜桃| 亚洲免费观看高清| 亚洲人成7777| 亚洲一卡二卡三卡四卡| 亚洲国产精品麻豆| 视频一区二区三区中文字幕| 五月激情综合婷婷| 蜜桃在线一区二区三区| 久久精品免费看| 国产一区视频网站| 国产高清精品久久久久| 国产高清视频一区| jizzjizzjizz欧美| 日本韩国一区二区三区视频| 色婷婷亚洲婷婷| 欧美日韩的一区二区| 欧美高清www午色夜在线视频| 欧美情侣在线播放| 日韩欧美色电影| 国产欧美精品区一区二区三区| 国产精品日产欧美久久久久| 亚洲老司机在线| 五月天一区二区三区| 麻豆精品新av中文字幕| 国产白丝网站精品污在线入口 | 色妹子一区二区| 欧美日韩国产高清一区二区| 日韩视频在线一区二区| 国产视频亚洲色图| 亚洲摸摸操操av| 奇米四色…亚洲| 成人毛片老司机大片| 欧美在线视频你懂得| 日韩精品一区二区在线观看| 国产日韩精品久久久| 亚洲国产成人av网| 久久丁香综合五月国产三级网站| 国产成人综合亚洲91猫咪| 在线一区二区三区做爰视频网站| 日韩三级视频中文字幕| 国产精品传媒在线| 日韩中文字幕1| 粉嫩一区二区三区在线看| 91精品办公室少妇高潮对白| 精品国产免费人成在线观看| 亚洲丝袜另类动漫二区| 日韩国产欧美在线视频| 成人妖精视频yjsp地址| 欧美精品一级二级三级| 国产精品视频一二三区| 男女性色大片免费观看一区二区| 国产69精品一区二区亚洲孕妇| 欧洲人成人精品| 国产亚洲成av人在线观看导航| 亚洲国产精品视频| 成人av在线资源网站| 日韩精品自拍偷拍| 亚洲午夜一区二区| 国产成人在线视频播放| 91精品国产综合久久精品图片 | 国产清纯在线一区二区www| 一区二区三区不卡在线观看 | 亚洲国产激情av| 日本在线不卡视频| 91麻豆免费看| 国产亚洲欧美激情| 免费看日韩a级影片| 欧美私模裸体表演在线观看| 欧美经典一区二区三区| 美女视频黄频大全不卡视频在线播放| 99久久精品国产导航| 久久久精品国产99久久精品芒果| 午夜电影网一区| 色婷婷国产精品| 国产精品入口麻豆九色| 国产一区不卡精品| 日韩美女在线视频| 日韩精品欧美精品| 欧美午夜精品久久久久久孕妇| 国产精品美女久久久久av爽李琼| 韩国三级中文字幕hd久久精品| 91精品国产欧美一区二区成人| 亚洲曰韩产成在线| 在线观看一区不卡| 一区在线播放视频| 丁香婷婷综合五月| 国产午夜久久久久| 国产在线不卡一卡二卡三卡四卡| 欧美一区二区美女| 天堂久久一区二区三区| 欧美日产国产精品| 亚洲国产精品久久久久秋霞影院 | 日韩欧美在线观看一区二区三区| 亚洲电影第三页| 欧美午夜免费电影| 香蕉成人啪国产精品视频综合网| 在线亚洲一区二区| 亚洲大型综合色站| 91精品欧美久久久久久动漫 | 亚洲高清免费在线| 欧美久久高跟鞋激| 麻豆精品久久久| 精品国产一区二区精华| 国产一区二区三区在线观看免费视频 | 久久久国产精品不卡| 国产麻豆成人精品| 欧美国产丝袜视频| 99久久综合狠狠综合久久| 亚洲欧美精品午睡沙发| 欧洲一区二区av| 蜜臀久久99精品久久久画质超高清| 91精品国产综合久久小美女| 麻豆成人在线观看| 久久久精品国产免大香伊| 成人av综合在线| 一区二区三区在线视频播放| 欧美精品久久99久久在免费线| 日韩成人一区二区三区在线观看| 日韩精品综合一本久道在线视频| 国产一区二区毛片| 中文字幕中文在线不卡住| 在线视频国内一区二区| 五月综合激情网| 国产亚洲欧洲997久久综合| 99久久精品99国产精品 | 日本不卡的三区四区五区| 精品国免费一区二区三区| 成人免费视频app| 亚洲国产成人va在线观看天堂| 欧美电视剧在线观看完整版| 白白色 亚洲乱淫|