From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maurus Cuelenaere Date: Sun, 13 Feb 2011 01:12:30 +0000 Subject: Question wrt custom LCD controller protocol Message-Id: <4D572FFE.2070405@gmail.com> MIME-Version: 1 Content-Type: multipart/mixed; boundary="------------010404090408070103010009" List-Id: To: linux-fbdev@vger.kernel.org This is a multi-part message in MIME format. --------------010404090408070103010009 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm trying to add SLCD support for the Jz4740 LCD controller, which has a "custom" interface allowing communication (8-18bit, serial/parallel) from CPU to LCD panel through some registers. As this differs from how other LCD panels are currently implemented in Linux (mostly using SPI), and as my board needs LCD initialization, I've exported functions from the jz4740 FB driver which can be used by drivers/video/backlight/*.c users. However, the problem I'm currently facing is that the LCD panel driver gets loaded prior to the framebuffer, which obviously can't work as the LCD controller IP hasn't been initialized yet. I've considered the possibility of emulating an SPI master driver on-top of the LCD controller, but this seems like a lot of boiler-plate for not much added benefit. I've looked into tricking the driver base code getting to probe the framebuffer before the LCD panel driver, but AFAICS this can only be reliably done by making the framebuffer a bus and the LCD panel its child (simply setting the framebuffer as its parent doesn't work). I've attached a patch containing my current implementation. Any pointers would be appreciated. -- Maurus Cuelenaere --------------010404090408070103010009 Content-Type: text/x-patch; name="jz4740-slcd.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="jz4740-slcd.diff" diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_fb.h b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h index 6a50e6f..18af90e 100644 --- a/arch/mips/include/asm/mach-jz4740/jz4740_fb.h +++ b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h @@ -30,8 +30,17 @@ enum jz4740_fb_lcd_type { JZ_LCD_TYPE_DUAL_COLOR_STN = 10, JZ_LCD_TYPE_DUAL_MONOCHROME_STN = 11, JZ_LCD_TYPE_8BIT_SERIAL = 12, + + JZ_SLCD_TYPE_PARALLEL_8_BIT = 1 | (1 << 5), + JZ_SLCD_TYPE_PARALLEL_16_BIT = 0 | (1 << 5), + JZ_SLCD_TYPE_PARALLEL_18_BIT = 2 | (1 << 5), + JZ_SLCD_TYPE_SERIAL_8_BIT = 1 | (3 << 5), + JZ_SLCD_TYPE_SERIAL_16_BIT = 0 | (3 << 5), + JZ_SLCD_TYPE_SERIAL_18_BIT = 2 | (3 << 5), }; +#define JZ4740_FB_IS_SLCD_TYPE(type) ((type) & (1 << 5)) +#define JZ4740_FB_IS_SLCD_SERIAL_TYPE(type) ((type) & (2 << 5)) #define JZ4740_FB_SPECIAL_TFT_CONFIG(start, stop) (((start) << 16) | (stop)) /* @@ -62,6 +71,20 @@ struct jz4740_fb_platform_data { unsigned pixclk_falling_edge:1; unsigned date_enable_active_low:1; + unsigned chip_select_active_low:1; + unsigned register_select_active_low:1; }; +struct platform_device; + +extern void jz4740_fb_slcd_disable_transfer(struct platform_device *pdev); +extern void jz4740_fb_slcd_enable_transfer(struct platform_device *pdev); +extern void jz4740_fb_slcd_send_cmd_data(struct platform_device *pdev, + unsigned int cmd, unsigned int data); +extern void jz4740_fb_slcd_send_cmd(struct platform_device *pdev, + unsigned int cmd); + #endif diff --git a/arch/mips/jz4740/Kconfig b/arch/mips/jz4740/Kconfig index 3e7141f..cc6f9f2 100644 --- a/arch/mips/jz4740/Kconfig +++ b/arch/mips/jz4740/Kconfig @@ -6,6 +6,9 @@ choice config JZ4740_QI_LB60 bool "Qi Hardware Ben NanoNote" +config JZ4740_ONDAVX747 + bool "Onda VX747" + endchoice config HAVE_PWM diff --git a/arch/mips/jz4740/Makefile b/arch/mips/jz4740/Makefile index a604eae..2d6512c 100644 --- a/arch/mips/jz4740/Makefile +++ b/arch/mips/jz4740/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o # board specific support obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o +obj-$(CONFIG_JZ4740_ONDAVX747) += board-ondavx747.o # PM support diff --git a/arch/mips/jz4740/board-ondavx747.c b/arch/mips/jz4740/board-ondavx747.c new file mode 100644 index 0000000..1baa931 --- /dev/null +++ b/arch/mips/jz4740/board-ondavx747.c @@ -0,0 +1,263 @@ +/* + * linux/arch/mips/jz4740/board-ondavx747.c + * + * Onda VX747 board support + * + * Copyright (c) 2010 Maurus Cuelenaere + * based on board-qi_lb60.c + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 or later + * as published by the Free Software Foundation. + */ + +#include +#include +#include + +#include