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

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

?? kernel-2.6.19_mx-modular_rel1_1-5_update.patch

?? si4702 linux patch,this is FM chip si4702 driver,based on iMX31 platform
?? PATCH
?? 第 1 頁 / 共 3 頁
字號:
diff --exclude CVS -uNr linux-2.6.19.2/drivers/char/si4702.c linux-2.6.19.2.modified/drivers/char/si4702.c
--- linux-2.6.19.2/drivers/char/si4702.c	1970-01-01 07:00:00.000000000 +0700
+++ linux-2.6.19.2.modified/drivers/char/si4702.c	2007-10-26 13:10:09.000000000 +0800
@@ -0,0 +1,1122 @@
+/*
+ * linux/drivers/char/si4702.c
+ *
+ * Copyright 2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/*!
+ * @defgroup Character device driver for si4702 FM radio
+ */
+
+/*
+ * @file si4702.c
+ *
+ * @brief si4702 Radio FM driver
+ *
+ * @ingroup Character
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/fcntl.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/spinlock.h>
+#include <linux/i2c.h>
+#include <linux/platform_device.h>
+#include <asm/arch/mxc_i2c.h>
+#include <asm/arch/pmic_power.h>
+#include <asm/arch/pmic_audio.h>
+
+#include <asm/uaccess.h>
+
+#include "si4702.h"
+
+#define DEBUG_SI4702
+#ifdef DEBUG_SI4702
+#define DPRINTK(format,args...) printk("SI4702: "format,##args)
+#else
+#define DPRINTK(format,args...)
+#endif
+
+/* major number of this device */
+static int major;
+static int count = 0;	/* open count */
+static spinlock_t count_lock; 	/* spin lock for count */
+static struct si4702_device si4702_dev = {0};
+static struct class *radio_class = NULL; /* class struct */
+
+static char si4702_reg_buf[SI4702_REG_BYTE];
+
+static void dump_reg(void);
+static int si4702_read_reg(u8 reg, u16 *word);
+static int si4702_write_reg(u8 reg, u16 word);
+static int fm_sys_init(void);
+static int fm_sys_exit(void);
+
+/*!
+  * si4702_gpio_active
+  *
+  * audio line selection for FM and
+  * power on for FM 
+  */
+static void si4702_gpio_active(void)
+{
+	/* reset pin */
+	mxc_request_iomux(MX31_PIN_SRST0, OUTPUTCONFIG_GPIO, 
+				INPUTCONFIG_NONE);
+	mxc_set_gpio_direction(MX31_PIN_SRST0, 0);
+
+	mxc_request_iomux(MX31_PIN_SIMPD0, OUTPUTCONFIG_GPIO, 
+				INPUTCONFIG_NONE);
+	mxc_set_gpio_direction(MX31_PIN_SIMPD0, 0);
+
+}
+
+/*!
+  * si4702_gpio_inactive
+  *
+  * power off for FM 
+  * free the GPIOs
+  */
+static void si4702_gpio_inactive(void)
+{
+	mxc_free_iomux(MX31_PIN_SRST0, OUTPUTCONFIG_GPIO, INPUTCONFIG_NONE);
+	mxc_free_iomux(MX31_PIN_SIMPD0, OUTPUTCONFIG_GPIO, INPUTCONFIG_NONE);
+}
+
+//extern int pmic_read(int reg_num, unsigned int *reg_val);
+//extern int pmic_write(int reg_num, const unsigned int reg_val);
+/*!
+  * si4702_gpio_reset
+  *
+  * Reset the si4702
+  */
+static void si4702_gpio_reset(void)
+{
+	DPRINTK("reset si4702\n");
+
+	//DPRINTK("reset reg 34 to 0\n");
+	//pmic_write(REG_POWER_MISCELLANEOUS, 0);
+	//ndelay(DURATION_INIT_1);
+	//DPRINTK("set reg 34 to 0x%x\n", 0x1 << 6 | 0x1 << 10);
+	//pmic_write(REG_POWER_MISCELLANEOUS, 0x1 << 6 | 0x1 << 10);
+	//ndelay(DURATION_INIT_1);
+	
+	/* reset FM */
+	mxc_set_gpio_dataout(MX31_PIN_SRST0, 0);
+	mdelay(100);
+	
+	/* set sdio direction for output */
+	mxc_set_gpio_dataout(MX31_PIN_SRST0, 1);
+	mdelay(100);
+}
+
+/*!
+  * si4702_startup
+  * Startup and initial the si4702
+  * @param 
+  * @return
+  * 	0 successful
+  */
+static int si4702_startup(void)
+{
+	u16 magic = 0, count = 0, id;
+
+#ifdef MORE_TIME
+	si4702_read_reg(SI4702_DEVICEID, &id);
+	printk(KERN_ERR "si4702: DEVICEID: 0x%x\n", id);
+#endif	
+		
+	mxc_set_gpio_dataout(MX31_PIN_SIMPD0, 1);
+	mdelay(100);
+
+	si4702_write_reg(SI4702_POWERCFG, 0x4001); /* disable mute, stereo, seek down, powerup */
+	mdelay(500);
+	si4702_read_reg(SI4702_TEST1, &magic);
+	if(magic != 0x3C04) // this means the chip power on normally
+		DPRINTK("magic number 0x%x.\n", magic);
+	si4702_write_reg(SI4702_CHANNEL, 0); /* close tune, set channel to 0 */
+	si4702_write_reg(SI4702_SYSCONFIG1, 0); /* disable interrupt, disable GPIO */
+	si4702_write_reg(SI4702_SYSCONFIG2, 0x0f13); /* seek threshold, band, space select to Europe, volume to max */
+	si4702_write_reg(SI4702_SYSCONFIG3, 0x48); 
+	
+	return 0;
+}
+
+/*!
+  * si4702_shutdown
+  * Shutdown the si4702
+  */
+static void si4702_shutdown(void)
+{
+#if 0
+	u8 si4702_shutdown_regs[] = {
+		0x40,	/* disable mute, stereo, seek down */
+		0x40	/* power down */
+	};
+#endif
+	
+	//si4702_operation(SD_WRITE, &(si4702_shutdown_regs[0]), 2);
+	si4702_write_reg(SI4702_POWERCFG, 0x4041);
+
+	mxc_set_gpio_dataout(MX31_PIN_SIMPD0, 0);
+}
+
+/*!
+  * si4702_channel_select
+  *
+  * Select a channel
+  * @param
+  * 	freq	frequence to select in KHz unit
+  * @return
+  * 	0 successful
+  *
+  */
+static u8 si4702_channel_select(u32 freq)
+{
+	u16 loop_counter = 0;
+	s16 channel;
+	u16 si4702_read_data, si4702_write_data;
+	u8 error_ind = 0;
+	u8 si4702_channel_start_tune[] = {0x40,0x01,0x80,0x00};
+	u8 si4702_channel_stop_tune[] = {0x40,0x01,0x00};	
+
+	if (si4702_dev.mute) {
+		/* enable mute */
+		si4702_channel_start_tune[0] = 0;
+		si4702_channel_stop_tune[0] = 0;
+	}
+	DPRINTK("Input frequnce is %d\n", freq);
+	/* convert freq to channel */
+	channel = (freq - BAND) / SPACING;
+	//channel = freq;
+	if (channel < 0 || channel > 1023) {
+		DPRINTK("Input frequnce is invalid\n");
+		return -1;
+	}
+	/* fill channel bits */
+	si4702_channel_start_tune[2] |= channel >> 8;
+	si4702_channel_start_tune[3] |= channel & 0xFF;
+
+	/* set tune bit */
+ 	//error_ind = si4702_operation(SD_WRITE, &(si4702_channel_start_tune[0]), 4);
+ 	si4702_write_data = BYTE_TO_WORD(si4702_channel_start_tune[0], si4702_channel_start_tune[1]);
+	error_ind = si4702_write_reg(SI4702_POWERCFG, si4702_write_data);
+
+	si4702_write_data = BYTE_TO_WORD(si4702_channel_start_tune[2], si4702_channel_start_tune[3]);
+	error_ind = si4702_write_reg(SI4702_CHANNEL, si4702_write_data);
+
+	if (error_ind) {
+		DPRINTK("Failed to set start tune\n");
+		return -1;
+	}
+
+	//si4702_read_reg(SI4702_POWERCFG, &si4702_read_data);
+	//si4702_read_reg(SI4702_CHANNEL, &si4702_read_data);
+	/* wait for STC == 1 */
+	do {	
+		//error_ind = si4702_operation(SD_READ, &(si4702_reg_data[0]), 1);
+		error_ind = si4702_read_reg(SI4702_STATUSRSSI, &si4702_read_data);
+		
+		if(error_ind) {
+			DPRINTK("Failed to read setted STC\n");
+			return -1;	
+		}
+		if ((si4702_read_data & 0x4000) != 0)
+			break;
+		/* sleep to wait */
+		msleep(200);
+		
+	} while(++loop_counter < DELAY_WAIT);
+
+	/* check loop_counter */
+	if (loop_counter >= DELAY_WAIT) {
+		DPRINTK("Can't wait for STC bit set");
+		return -1;
+	}
+	loop_counter = 0;
+
+	/* clear tune bit */
+	//error_ind = si4702_operation(SD_WRITE, &(si4702_channel_stop_tune[0]), 2);
+	error_ind = si4702_write_reg(SI4702_CHANNEL, 0);
+	
+	if (error_ind) {
+		DPRINTK("Failed to set stop tune\n");
+		return -1;
+	}	
+
+	/* wait for STC == 0 */
+	do {	
+		//error_ind = si4702_operation(SD_READ, &(si4702_reg_data[0]), 1);
+		error_ind = si4702_read_reg(SI4702_STATUSRSSI, &si4702_read_data);
+		
+		if(error_ind) {
+			DPRINTK("Failed to set read STC\n");
+			return -1;	
+		}
+		if ((si4702_read_data & 0x4000) == 0)
+			break;
+		/* sleep to wait */
+		msleep(200);
+		
+	} while(++loop_counter < DELAY_WAIT);	
+		
+	/* check loop_counter */
+	if (loop_counter >= DELAY_WAIT) {
+		DPRINTK("Can't wait for STC bit set");
+		return -1;
+	}
+#if 1
+	/* read RSSI */
+	//error_ind = si4702_operation(SD_READ, &(si4702_reg_data[0]), 4);	
+	error_ind = si4702_read_reg(SI4702_READCHAN, &si4702_read_data);
+	
+	if(error_ind) {
+		DPRINTK("Failed to read RSSI\n");
+		return -1;
+	}
+	
+	channel = si4702_read_data & 0x03ff;
+	DPRINTK("seek finish: channel(%d)\n", channel);
+#endif
+	return 0;
+}
+
+/*!
+  * si4702_channel_seek
+  * @param	seek info, direction. 1 seekup
+  * @return 
+  * 	frequnce been seeked
+  * 	-1 	I2C error 
+  * 	-2	seek fail
+  */
+static s32 si4702_channel_seek(s16 dir)
+{
+	u16 loop_counter = 0;
+	u16 si4702_reg_data;
+	u8 error_ind = 0;
+	s32 seek_error = 0;
+	u8 si4702_channel_seek_start[] = {0x41};
+	u8 si4702_channel_seek_stop[] = {0x40};
+	u32 channel;
+
+	if (si4702_dev.mute) {
+		/* check disable mute */
+		si4702_channel_seek_start[0] = 0x01;
+		si4702_channel_seek_stop[0] = 0x00;
+	}
+	if (dir) {
+		DPRINTK("Change to SEEKUP\n");
+		si4702_channel_seek_start[0] |= 0x02;
+		si4702_channel_seek_stop[0] |= 0x02;
+	}
+	/* set seek bit */
+ 	//error_ind = si4702_operation(SD_WRITE, &(si4702_channel_seek_start[0]), 1);
+
+	error_ind = si4702_read_reg(SI4702_POWERCFG, &si4702_reg_data);
+	si4702_reg_data &= 0x0F;
+	si4702_reg_data |= si4702_channel_seek_start[0] << 8;
+	error_ind = si4702_write_reg(SI4702_POWERCFG, si4702_reg_data);
+	
+	if (error_ind) {
+		DPRINTK("Failed to set seek start bit\n");
+		return -1;
+	}
+
+	/* wait STC == 1 */
+	do {	
+		//error_ind = si4702_operation(SD_READ, &(si4702_reg_data[0]), 1);
+		error_ind = si4702_read_reg(SI4702_STATUSRSSI, &si4702_reg_data);
+		if(error_ind) {
+			DPRINTK("Failed to read STC bit\n");
+			return -1;	
+		}
+
+		if ((si4702_reg_data & 0x4000) != 0) 
+			break;
+		/* sleep to wait */
+		msleep(200);
+
+	} while (++loop_counter < DELAY_WAIT);		
+
+	if (loop_counter >= DELAY_WAIT) {
+		DPRINTK("Can't wait for STC bit set");
+		return -1;
+	}
+	loop_counter = 0;
+
+	/* check whether SF==1 (seek failed bit) */
+	if ((si4702_reg_data & 0x2000) != 0) {
+		DPRINTK("Failed to seek any channel\n");
+		seek_error = -2;
+	}
+
+	/* clear seek bit */
+	//error_ind = si4702_operation(SD_WRITE, &(si4702_channel_seek_stop[0]), 1);
+	error_ind = si4702_read_reg(SI4702_POWERCFG, &si4702_reg_data);
+	si4702_reg_data &= 0x0F;
+	si4702_reg_data |= si4702_channel_seek_stop[0] << 8;
+	error_ind = si4702_write_reg(SI4702_POWERCFG, si4702_reg_data);
+	
+	if (error_ind) {
+		DPRINTK("Failed to stop seek\n");
+		return -1;	
+	}
+	/* wait STC == 0 */
+	do {	
+		//error_ind = si4702_operation(SD_READ, &(si4702_reg_data[0]), 1);
+		error_ind = si4702_read_reg(SI4702_STATUSRSSI, &si4702_reg_data);
+		
+		if (error_ind) {
+			DPRINTK("Failed to wait STC bit to clear\n");
+			return -1;	
+		}
+		if ((si4702_reg_data & 0x40) == 0)
+			break;
+		/* sleep to wait */
+		msleep(200);
+	} while (++loop_counter < DELAY_WAIT);
+
+	/* check loop_counter */
+	if (loop_counter >= DELAY_WAIT) {
+		DPRINTK("Can't wait for STC bit set");
+		return -1;
+	}
+
+	error_ind = si4702_read_reg(SI4702_READCHAN, &si4702_reg_data);
+	
+	if (error_ind) {
+		DPRINTK("I2C simulate failed\n");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产资源在线一区| 欧美一区二区精美| 欧美一级电影网站| 亚洲欧美自拍偷拍色图| 久久69国产一区二区蜜臀| 91丨九色丨黑人外教| 久久先锋资源网| 亚州成人在线电影| 色激情天天射综合网| 国产日韩精品一区| 久久国产精品第一页| 欧美三级电影网| 亚洲免费观看高清完整版在线观看| 久久国产剧场电影| 欧美一区二区私人影院日本| 亚洲欧美国产毛片在线| 成人黄色a**站在线观看| 精品久久久久久久久久久久久久久久久 | 成人精品视频一区二区三区 | 972aa.com艺术欧美| 精品国产亚洲在线| 日本女人一区二区三区| 欧美日韩亚洲国产综合| 成人免费在线观看入口| 国产成人高清视频| 久久综合久久久久88| 日本欧美在线看| 欧美日韩第一区日日骚| 亚洲午夜视频在线| 欧美人狂配大交3d怪物一区| 亚洲一区av在线| 欧美日韩另类国产亚洲欧美一级| 一区二区三区在线影院| 日本国产一区二区| 亚洲国产欧美日韩另类综合 | 欧美sm美女调教| 另类综合日韩欧美亚洲| 欧美电视剧免费观看| 国产夫妻精品视频| www激情久久| 国产精品系列在线观看| 国产欧美日韩久久| 成人av免费观看| 悠悠色在线精品| 欧美色图片你懂的| 人禽交欧美网站| 欧美精品一区二区三区高清aⅴ | 日韩欧美国产wwwww| 精品一区二区三区免费| 久久久久国产精品麻豆ai换脸| 国内外成人在线| 亚洲欧洲99久久| 欧美色中文字幕| 免费观看一级欧美片| 久久久久久9999| 不卡欧美aaaaa| 亚洲va在线va天堂| 欧美va亚洲va香蕉在线| 成人黄色a**站在线观看| 亚洲精品乱码久久久久| 欧美一区二区三区在线看| 国产精品亚洲人在线观看| 亚洲欧美综合另类在线卡通| 欧美另类变人与禽xxxxx| 国产一区二区免费看| 亚洲男人电影天堂| 精品免费99久久| 91麻豆自制传媒国产之光| 日韩电影免费一区| 欧美激情一区二区三区四区| 欧美日韩一区三区四区| 国产成a人亚洲精| 五月天激情综合| 国产欧美日韩麻豆91| 欧美日韩一区 二区 三区 久久精品| 国产专区欧美精品| 亚洲一区二区三区视频在线| 久久色.com| 91超碰这里只有精品国产| 成人性色生活片免费看爆迷你毛片| 亚洲成年人影院| 国产精品进线69影院| 日韩精品中文字幕一区| 欧美色手机在线观看| av一区二区三区| 久久狠狠亚洲综合| 日韩精品一区第一页| 亚洲色图欧美偷拍| 国产欧美在线观看一区| 欧美一区二区日韩| 欧美三级三级三级| 91污片在线观看| 国产成人在线视频免费播放| 免费精品视频在线| 亚洲成人精品在线观看| 亚洲欧美成人一区二区三区| 欧美国产欧美综合| 精品国产1区二区| 91精品国产入口| 欧美日韩久久一区| 91成人看片片| 97成人超碰视| 99国产欧美另类久久久精品| 国产一区二区导航在线播放| 开心九九激情九九欧美日韩精美视频电影| 亚洲愉拍自拍另类高清精品| 美女被吸乳得到大胸91| 亚洲一区在线播放| 亚洲男人电影天堂| 亚洲精品免费看| 亚洲视频综合在线| 亚洲欧美日本在线| 亚洲欧美日韩中文播放 | 亚洲小少妇裸体bbw| 亚洲免费观看高清在线观看| 中文字幕一区二区三| 自拍av一区二区三区| 亚洲免费色视频| 亚洲成精国产精品女| 天堂成人免费av电影一区| 日韩精品一级中文字幕精品视频免费观看 | 日日欢夜夜爽一区| 日韩不卡手机在线v区| 人人狠狠综合久久亚洲| 久久se这里有精品| 国产精品18久久久久久久久久久久 | 99精品久久久久久| 在线观看一区二区精品视频| 欧美私模裸体表演在线观看| 欧美日韩高清一区| 欧美一二三区在线观看| 精品美女一区二区| 日本一区二区综合亚洲| 亚洲欧美激情视频在线观看一区二区三区 | 国产夜色精品一区二区av| 国产精品免费看片| 亚洲已满18点击进入久久| 视频一区二区中文字幕| 激情综合网av| 成人一区二区三区在线观看 | 日韩精品一区在线| 中文字幕av一区 二区| 亚洲图片另类小说| 成人综合在线观看| 91丝袜美女网| 欧美精品粉嫩高潮一区二区| 久久网站热最新地址| 亚洲图片你懂的| 麻豆一区二区在线| 99久久精品免费精品国产| 欧美挠脚心视频网站| 国产日韩精品视频一区| 亚洲观看高清完整版在线观看| 精品一区二区在线视频| 91蜜桃在线观看| 精品捆绑美女sm三区| 亚洲影视在线观看| 国产91精品一区二区麻豆亚洲| 在线看国产日韩| 久久久99精品久久| 天使萌一区二区三区免费观看| 国产91精品露脸国语对白| 欧美精品九九99久久| 1000精品久久久久久久久| 免费不卡在线视频| 91麻豆蜜桃一区二区三区| 2020国产精品自拍| 亚洲高清免费视频| 99久久99久久久精品齐齐| 精品少妇一区二区三区| 亚洲一区二区三区中文字幕| 福利91精品一区二区三区| 69堂成人精品免费视频| 一区二区成人在线| 成人av免费观看| 久久久综合九色合综国产精品| 日韩在线观看一区二区| 欧美在线视频日韩| 中文字幕一区二区三区不卡在线| 久久99国产精品麻豆| 欧美日韩一卡二卡三卡| 亚洲欧美日韩中文播放 | 激情六月婷婷久久| 欧美精品乱码久久久久久按摩| 亚洲人成伊人成综合网小说| 精品无人区卡一卡二卡三乱码免费卡| 欧美午夜在线一二页| 自拍偷拍亚洲欧美日韩| 成人免费黄色大片| 国产欧美日韩一区二区三区在线观看| 毛片av中文字幕一区二区| 日韩丝袜情趣美女图片| 日日夜夜一区二区| 91精品国产欧美一区二区成人| 亚洲一区在线看| 8x8x8国产精品| 秋霞国产午夜精品免费视频| 欧美一区二区三区思思人| 99re在线视频这里只有精品| 国产日韩欧美激情|