⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x

📁 omap3 linux 2.6 用nocc去除了冗余代码
💻
📖 第 1 页 / 共 2 页
字号:
--- /home/khasim/beagle/500/2.6_kernel/drivers/video/omap/omap_disp_out.c	2008-03-14 16:30:25.000000000 +0530+++ omap_disp_out.c	2008-07-04 15:29:03.000000000 +0530@@ -38,7 +38,7 @@ #include <asm/arch/display.h> #include <asm/arch/gpio.h> #include <asm/arch/clock.h>-#if defined(CONFIG_MACH_OMAP_2430SDP) || defined(CONFIG_MACH_OMAP_3430LABRADOR)|| defined(CONFIG_MACH_OMAP3_BEAGLE)+#if defined(CONFIG_MACH_OMAP_2430SDP) ||  defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP3_BEAGLE) || defined(CONFIG_MACH_OMAP_3430LABRADOR) #include <asm/arch/twl4030.h> #endif #include <linux/workqueue.h>@@ -67,7 +67,7 @@ #define OMAP24xx_TV_DEVICE		"sdp2430_tv" #endif -#if defined(CONFIG_MACH_OMAP_3430SDP) || defined(CONFIG_MACH_OMAP_3430LABRADOR)+#if defined(CONFIG_MACH_OMAP_3430SDP) ||  defined(CONFIG_MACH_OMAP3EVM) || defined(CONFIG_MACH_OMAP3_BEAGLE) || defined(CONFIG_MACH_OMAP_3430LABRADOR) #if 0 #define OMAP24xx_LCD_DEVICE		"sdp3430_lcd" #define OMAP24xx_TV_DEVICE		"sdp3430_tv"@@ -77,28 +77,17 @@ #endif #endif -#ifdef CONFIG_MACH_OMAP3_BEAGLE-#define OMAP24xx_LCD_DEVICE            "omap2_lcd"-#define OMAP24xx_TV_DEVICE             "omap2_tv"-#define LCD_PANEL_ENABLE_GPIO          5-#define LCD_PANEL_BACKLIGHT_GPIO       8-#endif--#ifdef CONFIG_FB_OMAP_LCD_VGA-#define H4_LCD_XRES	 	480-#define H4_LCD_YRES 		640+#if defined(CONFIG_OMAP3EVM_LCD_VGA) || defined(CONFIG_FB_OMAP_LCD_VGA) || defined(CONFIG_MACH_OMAP3_BEAGLE)+#define H4_LCD_XRES	 	1024 // 1024+#define H4_LCD_YRES 		768 // 720 #define H4_LCD_PIXCLOCK_MAX	41700 /* in pico seconds  */ #define H4_LCD_PIXCLOCK_MIN	38000  /* in pico seconds */ #else #ifdef CONFIG_OMAP3430_ES2-//#define H4_LCD_XRES	 	240-//#define H4_LCD_YRES 		320+#define H4_LCD_XRES	 	240+#define H4_LCD_YRES 		320 #define H4_LCD_PIXCLOCK_MAX	167000 /* in pico seconds  */ #define H4_LCD_PIXCLOCK_MIN	152000  /* in pico seconds */-//#define H4_LCD_XRES            1280    /* 240 Khasim */-//#define H4_LCD_YRES             720    /* 320*/-#define H4_LCD_XRES              1024    /* 240 Khasim */-#define H4_LCD_YRES               768    /* 320*/ #else #define H4_LCD_XRES	 	240 #define H4_LCD_YRES 		320@@ -121,15 +110,31 @@ #define LCD_PANEL_RESET_GPIO		55 #define LCD_PANEL_QVGA_GPIO		56 #define LCD_PANEL_BACKLIGHT_GPIO 	7-#elif defined(CONFIG_OMAP3430_ES2)+#elif defined(CONFIG_ARCH_OMAP3430SDP) && defined(CONFIG_OMAP3430_ES2) #define LCD_PANEL_ENABLE_GPIO 		5 #define LCD_PANEL_BACKLIGHT_GPIO 	8+#elif defined(CONFIG_MACH_OMAP3EVM)+#define LCD_PANEL_ENABLE_GPIO       153+#define LCD_PANEL_LR                2+#define LCD_PANEL_UD                3+#define LCD_PANEL_INI               152+#define LCD_PANEL_QVGA              154+#define LCD_PANEL_RESB              155 #else #define LCD_PANEL_ENABLE_GPIO 		28 #define LCD_PANEL_BACKLIGHT_GPIO 	24 #endif #endif +#ifdef CONFIG_MACH_OMAP3EVM+#define LCD_PANEL_ENABLE_GPIO       153+#define LCD_PANEL_LR                2+#define LCD_PANEL_UD                3+#define LCD_PANEL_INI               152+#define LCD_PANEL_QVGA              154+#define LCD_PANEL_RESB              155+#endif+ #define CONFIG_OMAP2_LCD #define ENABLE_VDAC_DEDICATED		0x03 #define ENABLE_VDAC_DEV_GRP             0x20	     @@ -141,6 +146,13 @@ #define MENELAUS_I2C_ADAP_ID		0 #endif +#ifdef CONFIG_MACH_OMAP3EVM+extern void omap2_disp_replication_enable (void);+#endif++#define CONFIG_TWL4030_CORE_T2+#define CONFIG_I2C_TWL4030_CORE+ extern int omap24xx_get_dss1_clock(void); extern ssize_t  fb_out_show(struct class_device *cdev, char *buf);@@ -285,32 +297,37 @@ static void lcd_panel_enable(struct work_struct *work) { #ifdef CONFIG_MACH_OMAP_H4-        unsigned char expa;-        int err;+	unsigned char expa;+	int err; -        /* read current state of GPIO EXPA outputs */-        if ((err = h4_read_gpio_expa(&expa))) {-                printk(KERN_ERR DRIVER-                       "Error reading GPIO EXPA\n");-                return;-        }-        /* Set GPIO EXPA P7 (LCD_ENVDD) to power-up LCD and-         * set GPIO EXPA P5 (LCD_ENBKL) to turn on backlight-         */-        if ((err = h4_write_gpio_expa(expa | 0x80))) {-                printk(KERN_ERR DRIVER-                       "Error writing to GPIO EXPA\n");-                return;-        }+	/* read current state of GPIO EXPA outputs */+	if ((err = h4_read_gpio_expa(&expa))) {+		printk(KERN_ERR DRIVER+				"Error reading GPIO EXPA\n");+		return;+	}+	/* Set GPIO EXPA P7 (LCD_ENVDD) to power-up LCD and+	 * set GPIO EXPA P5 (LCD_ENBKL) to turn on backlight+	 */+	if ((err = h4_write_gpio_expa(expa | 0x80))) {+		printk(KERN_ERR DRIVER+				"Error writing to GPIO EXPA\n");+		return;+	} #endif-#if defined(CONFIG_MACH_OMAP_2430SDP) || defined(CONFIG_MACH_OMAP_3430SDP)  || defined(CONFIG_MACH_OMAP3_BEAGLE)+#if defined(CONFIG_MACH_OMAP_2430SDP) || defined(CONFIG_MACH_OMAP_3430SDP) 	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1); 	/* power to the RGB lines from T2 is issued separately in 	 * omap2_dss-rgb_enable */ #elif defined(CONFIG_MACH_OMAP_3430LABRADOR) 	twl4030_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1); #endif++#ifdef CONFIG_MACH_OMAP3EVM+	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0);+#endif }+ void omap2_dss_rgb_enable(void) {@@ -322,50 +339,52 @@ omap2_dss_rgb_enable(void) 			printk(KERN_WARNING "omap2_disp: twl4030_vaux3_ldo_use returns error \n"); 	} 	else {-	+ 		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER, 				ENABLE_VPLL2_DEDICATED,TWL4030_VPLL2_DEDICATED);  		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER, 				ENABLE_VPLL2_DEV_GRP,TWL4030_VPLL2_DEV_GRP);-		+ 		mdelay(4); 	} #endif }- EXPORT_SYMBOL(omap2_dss_rgb_enable); - static void lcd_panel_disable(struct work_struct *work) { #ifdef CONFIG_MACH_OMAP_H4-        unsigned char expa;-        int err;+	unsigned char expa;+	int err; -        /* read current state of GPIO EXPA outputs */-        if ((err = h4_read_gpio_expa(&expa))) {-                printk(KERN_ERR DRIVER-                       "Error reading GPIO EXPA\n");-                return;-        }--        /* Clear GPIO EXPA P7 (LCD_ENVDD) to power-uoff LCD and-         * clear GPIO EXPA P5 (LCD_ENBKL) to turn off backlight-         */-        if ((err = h4_write_gpio_expa(expa & ~0x80))) {-                printk(KERN_ERR DRIVER-                       "Error writing to GPIO EXPA\n");-                return;-        }+	/* read current state of GPIO EXPA outputs */+	if ((err = h4_read_gpio_expa(&expa))) {+		printk(KERN_ERR DRIVER+				"Error reading GPIO EXPA\n");+		return;+	}++	/* Clear GPIO EXPA P7 (LCD_ENVDD) to power-uoff LCD and+	 * clear GPIO EXPA P5 (LCD_ENBKL) to turn off backlight+	 */+	if ((err = h4_write_gpio_expa(expa & ~0x80))) {+		printk(KERN_ERR DRIVER+				"Error writing to GPIO EXPA\n");+		return;+	} #endif-#if defined(CONFIG_MACH_OMAP_2430SDP) || defined(CONFIG_MACH_OMAP_3430SDP)  || defined(CONFIG_MACH_OMAP3_BEAGLE)+#if defined(CONFIG_MACH_OMAP_2430SDP) || defined(CONFIG_MACH_OMAP_3430SDP) 	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0); 	/* power to the RGB lines is disabled in omap2_dss_rgb_disable */ #elif defined(CONFIG_MACH_OMAP_3430LABRADOR) 	twl4030_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0); #endif+#ifdef CONFIG_MACH_OMAP3EVM+	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);+#endif+ }  void@@ -374,18 +393,18 @@ omap2_dss_rgb_disable(void) #ifdef CONFIG_MACH_OMAP_2430SDP 	twl4030_vaux2_ldo_unuse(); #else-     	if(is_sil_rev_less_than(OMAP3430_REV_ES2_0)) {-                if( 0 != twl4030_vaux3_ldo_unuse())-                        printk(KERN_WARNING "omap2_disp: twl4030_vaux3_ldo_unuse returns error \n");-        }-        else {-                twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,-                                0x0,TWL4030_VPLL2_DEDICATED);--                twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,-                                0x0,TWL4030_VPLL2_DEV_GRP);	-				mdelay(4);      -		}+	if(is_sil_rev_less_than(OMAP3430_REV_ES2_0)) {+		if( 0 != twl4030_vaux3_ldo_unuse())+			printk(KERN_WARNING "omap2_disp: twl4030_vaux3_ldo_unuse returns error \n");+	}+	else {+		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,+				0x0,TWL4030_VPLL2_DEDICATED);++		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,+				0x0,TWL4030_VPLL2_DEV_GRP);	+		mdelay(4);      +	} #endif  }@@ -401,7 +420,7 @@ lcd_backlight_on(struct work_struct *wor 	/* read current state of GPIO EXPA outputs */ 	if ((err = h4_read_gpio_expa(&expa))) { 		printk(KERN_ERR DRIVER-		       "Error reading GPIO EXPA\n");+				"Error reading GPIO EXPA\n"); 		return; 	} @@ -410,7 +429,7 @@ lcd_backlight_on(struct work_struct *wor 	 */ 	if ((err = h4_write_gpio_expa(expa | 0x20))) { 		printk(KERN_ERR DRIVER-		       "Error writing to GPIO EXPA\n");+				"Error writing to GPIO EXPA\n"); 		return; 	} 	lcd_backlight_state = LCD_ON;@@ -422,6 +441,11 @@ lcd_backlight_on(struct work_struct *wor 	twl4030_set_gpio_dataout(LCD_PANEL_BACKLIGHT_GPIO, 1); 	lcd_backlight_state = LCD_ON; #endif++#ifdef CONFIG_MACH_OMAP3EVM+	twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x32, 0);+	lcd_backlight_state = LCD_ON;+#endif }  static void@@ -434,7 +458,7 @@ lcd_backlight_off(struct work_struct *wo 	/* read current state of GPIO EXPA outputs */ 	if ((err = h4_read_gpio_expa(&expa))) { 		printk(KERN_ERR DRIVER-		       "Error reading GPIO EXPA\n");+				"Error reading GPIO EXPA\n"); 		return; 	} @@ -443,7 +467,7 @@ lcd_backlight_off(struct work_struct *wo 	 */ 	if ((err = h4_write_gpio_expa(expa & ~0x20))) { 		printk(KERN_ERR DRIVER-		       "Error writing to GPIO EXPA\n");+				"Error writing to GPIO EXPA\n"); 		return; 	} 	lcd_backlight_state = LCD_OFF;@@ -455,6 +479,10 @@ lcd_backlight_off(struct work_struct *wo 	twl4030_set_gpio_dataout(LCD_PANEL_BACKLIGHT_GPIO, 0); 	lcd_backlight_state = LCD_OFF; #endif+#ifdef CONFIG_MACH_OMAP3EVM+	twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x31, 0);+	lcd_backlight_state = LCD_OFF;+#endif }  void enable_backlight(void)@@ -493,7 +521,7 @@ static #endif int omap_lcd_init(struct omap_lcd_info *info) {-#ifdef CONFIG_FB_OMAP_LCD_VGA+#if defined(CONFIG_OMAP3EVM_LCD_VGA) || defined(CONFIG_FB_OMAP_LCD_VGA) 	u32	pixclock	= H4_LCD_PIXCLOCK_MAX,/* picoseconds */ 		left_margin	= 79,		/* pixclocks */ 		right_margin	= 89,		/* pixclocks */@@ -531,9 +559,12 @@ int omap_lcd_init(struct omap_lcd_info * 		ipc		= 0,		/* Invert pixel clock */ 		onoff		= 0;		/* HSYNC/VSYNC Pixel clk Control*/ -#endif	+#endif #endif 	u32 clkdiv;+#ifdef CONFIG_OMAP_DSI+	u32 * handle;+#endif  #ifdef CONFIG_LCD_IOCTL 	if (info) {@@ -578,6 +609,25 @@ int omap_lcd_init(struct omap_lcd_info * 	omap_set_gpio_dataout(LCD_PANEL_RESET_GPIO, 1); #endif +#if defined(CONFIG_MACH_OMAP3EVM)+        omap_request_gpio(LCD_PANEL_LR);     /* LR */+        omap_request_gpio(LCD_PANEL_UD);     /* UD */+        omap_request_gpio(LCD_PANEL_INI);    /* INI */+        omap_request_gpio(LCD_PANEL_RESB);   /* RESB */+        omap_request_gpio(LCD_PANEL_QVGA);   /* QVGA */++        omap_set_gpio_direction(LCD_PANEL_LR, 0); /* output */+        omap_set_gpio_direction(LCD_PANEL_UD, 0); /* output */+        omap_set_gpio_direction(LCD_PANEL_INI, 0); /* output */+        omap_set_gpio_direction(LCD_PANEL_RESB, 0); /* output */+        omap_set_gpio_direction(LCD_PANEL_QVGA, 0);++        twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x7F, 0);+        twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x7F, 1);+        twl4030_i2c_write_u8(TWL4030_MODULE_PWMB, 0x7F, 0);+        twl4030_i2c_write_u8(TWL4030_MODULE_PWMB, 0x7F, 1);+#endif+ #ifdef CONFIG_LCD_IOCTL bypass_gpio: 	gpio_reserved = 1;@@ -585,6 +635,19 @@ bypass_gpio: 	omap2_dss_rgb_enable(); 	omap2_disp_get_dss(); +#if defined(CONFIG_MACH_OMAP3EVM) +       omap_set_gpio_dataout(LCD_PANEL_RESB, 1);+       omap_set_gpio_dataout(LCD_PANEL_INI, 1);+#ifdef CONFIG_OMAP3EVM_LCD_VGA+       omap_set_gpio_dataout(LCD_PANEL_QVGA, 0);+#else+       omap_set_gpio_dataout(LCD_PANEL_QVGA, 1);+#endif+       omap_set_gpio_dataout(LCD_PANEL_LR, 1);+       omap_set_gpio_dataout(LCD_PANEL_UD, 1);+#endif++#ifndef CONFIG_OMAP_DSI 	omap2_disp_set_panel_size(OMAP2_OUTPUT_LCD, H4_LCD_XRES, H4_LCD_YRES);  	/* clkdiv = pixclock / (omap2 dss1 clock period) */@@ -606,20 +669,43 @@ bypass_gpio: 					ipc,    // IPC 					onoff   // ONOFF 				);-	--	/* khasim enable DVI for Beagle */-	omap_writel(0x001C001C, 0x480021C4);-	omap_request_gpio(170);-	omap_set_gpio_direction(170,0);-	omap_set_gpio_dataout(170,1);-	/* till here */+#ifdef CONFIG_MACH_OMAP3EVM+        omap2_disp_replication_enable();+#endif +																									  	omap2_disp_enable_output_dev(OMAP2_OUTPUT_LCD); 	udelay(20);	+#else++	/* Enable power to DSI, edisco and initialize the edisco */+	if( 0 != twl4030_vaux3_ldo_use())+			printk(KERN_WARNING "omap2_disp: twl4030_vaux3_ldo_unuse returns error \n");++	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);+	+	omap_set_gpio_dataout(LCD_PANEL_BACKLIGHT_GPIO, 1);++	twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,+					ENABLE_VPLL2_DEDICATED,TWL4030_VPLL2_DEDICATED);++	twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECIEVER,+					ENABLE_VPLL2_DEV_GRP,TWL4030_VPLL2_DEV_GRP);++	printk("Setting pin mux for DSI !!!! \n");+	omap_writel(0x02010201,0x480020dc);+	omap_writel(0x02010201,0x480020e0);+	omap_writel(0x02010201,0x480020e4);+	printk("Calling to initialize edisco !!!! \n");+	edisco_init(handle);+	// edisco_write(handle, 0x12,&ebuf_len,&ebuf);+#endif	+	 	enable_backlight(); 	power_lcd_panel(LCD_ON);+#ifndef CONFIG_OMAP_DSI 	omap2_disp_put_dss();+#endif  	printk(KERN_DEBUG DRIVER 	       "LCD panel %dx%d\n", H4_LCD_XRES, H4_LCD_YRES);@@ -734,7 +820,7 @@ power_tv(int level) 				h4_i2c_tvout_on(NULL); 			else 				schedule_work(&h4_tvout_on);-		break;+			break; 	} } @@ -753,7 +839,7 @@ h4_i2c_tvout_off(struct work_struct *wor 	adap = i2c_get_adapter(MENELAUS_I2C_ADAP_ID); 	if (!adap) { 		printk(KERN_ERR DRIVER-		       "Unable to get I2C adapter \n");+				"Unable to get I2C adapter \n"); 	} 	msg->addr = 0x72;/* I2C address of Menelaus Chip */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -