Re: [PATCH 1/1] pxa168: added initial support for TPO TD043MTEA1 LCDdisplay on Aspenite

From: Eric Miao
Date: Tue Aug 24 2010 - 22:31:54 EST


On Wed, Aug 25, 2010 at 10:02 AM, Mark F. Brown <mark.brown314@xxxxxxxxx> wrote:
> Signed-off-by: Mark F. Brown <mark.brown314@xxxxxxxxx>
> ---
> Âarch/arm/configs/pxa168_defconfig    |  10 +++++
> Âarch/arm/mach-mmp/aspenite.c      Â|  59 +++++++++++++++++++++++++++++++
> Âarch/arm/mach-mmp/include/mach/pxa168.h | Â Â8 ++++
> Âarch/arm/mach-mmp/pxa168.c       Â|  Â4 ++
> Âdrivers/video/pxa168fb.c        Â|  Â4 +-
> Â5 files changed, 83 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/configs/pxa168_defconfig b/arch/arm/configs/pxa168_defconfig
> index 74d7e01..32f433d 100644
> --- a/arch/arm/configs/pxa168_defconfig
> +++ b/arch/arm/configs/pxa168_defconfig
> @@ -68,3 +68,13 @@ CONFIG_DEBUG_ERRORS=y
> ÂCONFIG_DEBUG_LL=y
> Â# CONFIG_CRYPTO_ANSI_CPRNG is not set
> ÂCONFIG_CRC_CCITT=y
> +CONFIG_FB=y
> +CONFIG_FB_PXA168=y
> +CONFIG_FRAMEBUFFER_CONSOLE=y
> +CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
> +CONFIG_FONTS=y
> +CONFIG_FONT_8x8=y
> +CONFIG_LOGO=y
> +CONFIG_LOGO_LINUX_MONO=y
> +CONFIG_LOGO_LINUX_VGA16=y
> +CONFIG_LOGO_LINUX_CLUT224=y

Not sure about the status of the _defconfig story, but better to leave
this part out at this moment until that's been completely figured out.

> diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
> index 0629394..4f5f4dd 100644
> --- a/arch/arm/mach-mmp/aspenite.c
> +++ b/arch/arm/mach-mmp/aspenite.c
> @@ -23,6 +23,7 @@
> Â#include <mach/mfp-pxa168.h>
> Â#include <mach/pxa168.h>
> Â#include <mach/gpio.h>
> +#include <video/pxa168fb.h>
>
> Â#include "common.h"
>
> @@ -66,6 +67,36 @@ static unsigned long common_pin_config[] __initdata = {
> Â Â Â ÂGPIO115_I2S_BCLK,
> Â Â Â ÂGPIO116_I2S_RXD,
> Â Â Â ÂGPIO117_I2S_TXD,
> +
> + Â Â Â /* LCD */
> + Â Â Â GPIO56_LCD_FCLK_RD,
> + Â Â Â GPIO57_LCD_LCLK_A0,
> + Â Â Â GPIO58_LCD_PCLK_WR,
> + Â Â Â GPIO59_LCD_DENA_BIAS,
> + Â Â Â GPIO60_LCD_DD0,
> + Â Â Â GPIO61_LCD_DD1,
> + Â Â Â GPIO62_LCD_DD2,
> + Â Â Â GPIO63_LCD_DD3,
> + Â Â Â GPIO64_LCD_DD4,
> + Â Â Â GPIO65_LCD_DD5,
> + Â Â Â GPIO66_LCD_DD6,
> + Â Â Â GPIO67_LCD_DD7,
> + Â Â Â GPIO68_LCD_DD8,
> + Â Â Â GPIO69_LCD_DD9,
> + Â Â Â GPIO70_LCD_DD10,
> + Â Â Â GPIO71_LCD_DD11,
> + Â Â Â GPIO72_LCD_DD12,
> + Â Â Â GPIO73_LCD_DD13,
> + Â Â Â GPIO74_LCD_DD14,
> + Â Â Â GPIO75_LCD_DD15,
> + Â Â Â GPIO76_LCD_DD16,
> + Â Â Â GPIO77_LCD_DD17,
> + Â Â Â GPIO78_LCD_DD18,
> + Â Â Â GPIO79_LCD_DD19,
> + Â Â Â GPIO80_LCD_DD20,
> + Â Â Â GPIO81_LCD_DD21,
> + Â Â Â GPIO82_LCD_DD22,
> + Â Â Â GPIO83_LCD_DD23,
> Â};
>
> Âstatic struct smc91x_platdata smc91x_info = {
> @@ -134,6 +165,33 @@ static struct i2c_board_info aspenite_i2c_info[] __initdata = {
> Â Â Â Â{ I2C_BOARD_INFO("wm8753", 0x1b), },
> Â};
>
> +static struct fb_videomode video_modes[] = {
> + Â Â Â [0] = {
> +        .pixclock    = 30120,
> +        .refresh    Â= 60,
> +        .xres      = 800,
> +        .yres      = 480,
> +        .hsync_len   Â= 1,
> +        .left_margin  Â= 215,
> +        .right_margin  = 40,
> +        .vsync_len   Â= 1,
> +        .upper_margin  = 34,
> +        .lower_margin  = 10,
> +        .sync      = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
> + Â Â Â },
> +};

Blank line would be good here, but I'm not picky.

> +struct pxa168fb_mach_info aspenite_lcd_info __initdata = {

Need to check if this is referenced at run-time in pxa168fb.c, if that's true,
the modes[] array above possibly won't be referenced as well, and can be
marked as __initdata too. Otherwise, we'd want to remove this __initdata
here.

> +    .id           = "Graphic Frame",
> +    .modes         Â= video_modes,
> +    .num_modes       Â= ARRAY_SIZE(video_modes),
> +    .pix_fmt        Â= PIX_FMT_RGB565,
> + Â Â Â .io_pin_allocation_mode = PIN_MODE_DUMB_24,
> +    .dumb_mode       Â= DUMB_MODE_RGB888,
> +    .active         = 1,
> +    .panel_rbswap      = 0,
> +    .invert_pixclock    Â= 0,
> +};
> +
> Âstatic void __init common_init(void)
> Â{
> Â Â Â Âmfp_config(ARRAY_AND_SIZE(common_pin_config));
> @@ -143,6 +201,7 @@ static void __init common_init(void)
> Â Â Â Âpxa168_add_twsi(1, NULL, ARRAY_AND_SIZE(aspenite_i2c_info));
> Â Â Â Âpxa168_add_ssp(1);
> Â Â Â Âpxa168_add_nand(&aspenite_nand_info);
> + Â Â Â pxa168_add_fb(&aspenite_lcd_info);
>
> Â Â Â Â/* off-chip devices */
> Â Â Â Âplatform_device_register(&smc91x_device);
> diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
> index 27e1bc7..220738f 100644
> --- a/arch/arm/mach-mmp/include/mach/pxa168.h
> +++ b/arch/arm/mach-mmp/include/mach/pxa168.h
> @@ -10,6 +10,7 @@ extern void __init pxa168_init_irq(void);
> Â#include <mach/devices.h>
> Â#include <plat/i2c.h>
> Â#include <plat/pxa3xx_nand.h>
> +#include <video/pxa168fb.h>
>
> Âextern struct pxa_device_desc pxa168_device_uart1;
> Âextern struct pxa_device_desc pxa168_device_uart2;
> @@ -25,6 +26,7 @@ extern struct pxa_device_desc pxa168_device_ssp3;
> Âextern struct pxa_device_desc pxa168_device_ssp4;
> Âextern struct pxa_device_desc pxa168_device_ssp5;
> Âextern struct pxa_device_desc pxa168_device_nand;
> +extern struct pxa_device_desc pxa168_device_fb;
>
> Âstatic inline int pxa168_add_uart(int id)
> Â{
> @@ -97,4 +99,10 @@ static inline int pxa168_add_nand(struct pxa3xx_nand_platform_data *info)
> Â{
> Â Â Â Âreturn pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
> Â}
> +
> +static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
> +{
> + Â Â Â return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
> +}
> +
> Â#endif /* __ASM_MACH_PXA168_H */
> diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
> index 652ae66..9c57a32 100644
> --- a/arch/arm/mach-mmp/pxa168.c
> +++ b/arch/arm/mach-mmp/pxa168.c
> @@ -25,6 +25,7 @@
> Â#include <mach/dma.h>
> Â#include <mach/devices.h>
> Â#include <mach/mfp.h>
> +#include <video/pxa168fb.h>
>
> Â#include "common.h"
> Â#include "clock.h"
> @@ -79,6 +80,7 @@ static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
> Âstatic APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
>
> Âstatic APMU_CLK(nand, NAND, 0x01db, 208000000);
> +static APMU_CLK(lcd, LCD, 0x7f, 312000000);
>
> Â/* device and clock bindings */
> Âstatic struct clk_lookup pxa168_clkregs[] = {
> @@ -96,6 +98,7 @@ static struct clk_lookup pxa168_clkregs[] = {
> Â Â Â ÂINIT_CLKREG(&clk_ssp4, "pxa168-ssp.3", NULL),
> Â Â Â ÂINIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
> Â Â Â ÂINIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
> + Â Â Â INIT_CLKREG(&clk_lcd, NULL, "LCDCLK"),

Or

INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),

clk_get() will match the dev_id name first, and then the clock name,
so dev_id should be normally enough, and clock name can be NULL
if there is no other clocks for this same device.

> Â};
>
> Âstatic int __init pxa168_init(void)
> @@ -147,3 +150,4 @@ PXA168_DEVICE(ssp2, "pxa168-ssp", 1, SSP2, 0xd401c000, 0x40, 54, 55);
> ÂPXA168_DEVICE(ssp3, "pxa168-ssp", 2, SSP3, 0xd401f000, 0x40, 56, 57);
> ÂPXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59);
> ÂPXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
> +PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
> diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c
> index c91a7f7..d3e597e 100644
> --- a/drivers/video/pxa168fb.c
> +++ b/drivers/video/pxa168fb.c
> @@ -559,7 +559,7 @@ static struct fb_ops pxa168fb_ops = {
>    Â.fb_imageblit  = cfb_imageblit,
> Â};
>
> -static int __init pxa168fb_init_mode(struct fb_info *info,
> +static int pxa168fb_init_mode(struct fb_info *info,

??

> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âstruct pxa168fb_mach_info *mi)
> Â{
> Â Â Â Âstruct pxa168fb_info *fbi = info->par;
> @@ -599,7 +599,7 @@ static int __init pxa168fb_init_mode(struct fb_info *info,
> Â Â Â Âreturn ret;
> Â}
>
> -static int __init pxa168fb_probe(struct platform_device *pdev)
> +static int pxa168fb_probe(struct platform_device *pdev)

??

> Â{
> Â Â Â Âstruct pxa168fb_mach_info *mi;
> Â Â Â Âstruct fb_info *info = 0;
> --
> 1.7.0.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/