iTOP-4412 Development Board driver LCD graphics and Linux boot log modification method

Source: Internet
Author: User
Tags bmp image get ip goto

iTOP-4412 Development Board LCD screen driver, iTOP-4412 Development Board support 4.3-inch, 7-inch, 9.7-inch LCD display. One of the 4.3-inch screen is the CPU directly out of the RGB signal, 7-inch screen and 9.7-inch screen is used for the LVDS signal, hardware using an RGB to LVDS chip implementation. Let's take a look at the display driver, the display driver under the "Drivers/video/samsung" directory of the kernel, this driver is provided by Samsung, and we only talk about several files that we need to modify.
The first is about the resolution of the screen changes, because different screen resolution, frequency and some other hardware parameters are different, so we need to configure the CPU display controller according to these parameters, about these parameters are in the "driversvideo/samsung/s3cfb_ WA101S.C "This file, open this file we can see this file is mainly defined as a type is S3CFB_LCD variable wa101, the hardware parameters of the screen (resolution, clock frequency and other) is stored in this variable, Now let's look at the definition of this variable structure type:
struct S3CFB_LCD {
int width;
int height;
int BPP;
int freq;
struct s3cfb_lcd_timing timing;
struct s3cfb_lcd_polarity polarity;
void (*init_ldi) (void);
void (*deinit_ldi) (void);
};
Where the width and height refer to the screen resolution, freq is the clock frequency, and the BPP is the data bit. Timing is a few other parameters of the screen, the type of timing is defined as follows:
struct S3cfb_lcd_timing {
int h_fp;
int h_bp;
int h_sw;
int v_fp;
int V_FPE;
int v_bp;
int v_bpe;
int v_sw;
};
This structure represents the screen's hardware parameters such as the left, right, horizontal sync signal width, and the number of valid rows for the vertical sync signal, which can be obtained by viewing the data sheet on the screen.
Here is the polarity variable, which is defined as follows:
struct S3cfb_lcd_polarity {
int RISE_VCLK;
int Inv_hsync;
int Inv_vsync;
int Inv_vden;
};
This variable represents the polarity of the clock line field.
By modifying these parameters in this file, we can set the CPU's display controller to support the LCD screen we use.
iTIO-4412 Development Board Kernel boot when the LCD will display logo, about this logo is saved in the "drivers/video/samsung/itop-4412.h" file, open this file, you will see the inside instructions define a number Group Ibitmapdata_q, the contents of this array is the logo to be displayed. We modify the logo, we need to prepare a 480x640 BMP image and then use the IMAGE2LCD software to convert the array, the contents of ibitmapdata_q with the newly generated arrays replaced.
It is possible that our own logo is not displayed in the center of the screen, then we need to modify the following file "DRIVERS/VIDEO/SAMSUNG/S3CFB_OPS.C" in this file to find the function: S3cfb_draw_logo
int S3cfb_draw_logo (struct fb_info *fb)
{
#ifdef Config_fb_s5p_splash_screen
struct Fb_fix_screeninfo *fix = &fb->fix;
struct Fb_var_screeninfo *var = &fb->var;
#if 0
struct S3C_PLATFORM_FB *pdata = To_fb_plat (Fbdev->dev);
memcpy (Fbdev->fb[pdata->default_win]->screen_base,
Logo_rgb24, Fix->line_length * var->yres);
#else
U32 height = var->yres/3;
U32 line = fix->line_length;
U32 I, J;
U32 index;
U32 Top,left;
Const unsigned char *plog =null;
memset (Fb->screen_base, 0x00, var->yres * line);
PRINTK ("\ n CPU type: \ n");
if (soc_is_exynos4412 ()) {
PRINTK ("Exynos 4412\n");
Plog = ibitmapdata_q;
}else{
PRINTK ("Exynos 4212\n");
Plog = Ibitmapdata;
}
top = 170;
left = 230;
index = 0;
for (i = 0; i < 480; i++) {
for (j = 0; J < 640; J + +) {
memset (Fb->screen_base + (i + top) * line + (j + left) * 4 + 0, Plog[index], 1);//b
memset (Fb->screen_base + (i + top) * line + (j + left) * 4 + 1, plog[index+1], 1);//g
memset (Fb->screen_base + (i + top) * line + (j + left) * 4 + 2, plog[index+2], 1);//r
memset (Fb->screen_base + (i + top) * line + (j + left) * 4 + 3, 0x00, 1);
Index + = 3;
}
}
#endif
#endif
return 0;
}
Modify the top and left of this function to control where the picture appears on the screen. Let's take a look at the LCD control file: Arch/arm/mach-exynos/setup-fb-s5p.c The S3cfb_cfg_gpio function in this file completes the LCD data pin initialization, the drive capacity is set to the highest s5p_gpio_drvstr _LV4, PIN drive capability, s5p_gpio_drvstr_lv1-4 four rating options, and set the Enable PIN output of the LVDS chip High:
void S3cfb_cfg_gpio (struct platform_device *pdev)
{
int err;
S3CFB_GPIO_SETUP_24BPP (exynos4_gpf0 (0), 8, S3C_GPIO_SFN (2), S5P_GPIO_DRVSTR_LV4);
S3CFB_GPIO_SETUP_24BPP (EXYNOS4_GPF1 (0), 8, S3C_GPIO_SFN (2), S5P_GPIO_DRVSTR_LV4);
S3CFB_GPIO_SETUP_24BPP (EXYNOS4_GPF2 (0), 8, S3C_GPIO_SFN (2), S5P_GPIO_DRVSTR_LV4);
S3CFB_GPIO_SETUP_24BPP (EXYNOS4_GPF3 (0), 4, S3C_GPIO_SFN (2), S5P_GPIO_DRVSTR_LV4);
#if 1//TC4
Lvds_pwdn
Err = gpio_request (exynos4_gpl1 (0), "Gpl1_0");
if (err) {
PRINTK (kern_err "failed to request GPL1 for"
"LCD power control\n");
return err;
}
Gpio_direction_output (EXYNOS4_GPL1 (0), 1);
S3c_gpio_cfgpin (EXYNOS4_GPL1 (0), s3c_gpio_output);
Gpio_free (EXYNOS4_GPL1 (0));
#endif
}
Then is the clock control function, which completes the clock's enable and shutdown:
int s3cfb_clk_on (struct platform_device *pdev, struct CLK **s3cfb_clk)
{
struct CLK *sclk = NULL;
struct CLK *MOUT_MPLL = NULL;
struct CLK *lcd_clk = NULL;
U32 rate = 0;
int ret = 0;
LCD_CLK = Clk_get (&pdev->dev, "LCD");
if (Is_err (LCD_CLK)) {
Dev_err (&pdev->dev, "failed to get operation CLK for fimd\n");
Goto Err_clk0;
}
ret = clk_enable (LCD_CLK);
if (Ret < 0) {
Dev_err (&pdev->dev, "failed to clk_enable of the LCD CLK for fimd\n");
Goto Err_clk0;
}
Clk_put (LCD_CLK);
SCLK = Clk_get (&pdev->dev, "SCLK_FIMD");
if (Is_err (SCLK)) {
Dev_err (&pdev->dev, "failed to get SCLK for fimd\n");
Goto ERR_CLK1;
}
if (soc_is_exynos4210 ())
MOUT_MPLL = Clk_get (&pdev->dev, "MOUT_MPLL");
Else
MOUT_MPLL = Clk_get (&pdev->dev, "Mout_mpll_user");
if (Is_err (MOUT_MPLL)) {
Dev_err (&pdev->dev, "failed to get MOUT_MPLL for fimd\n");
Goto ERR_CLK2;
}
ret = Clk_set_parent (SCLK, MOUT_MPLL);
if (Ret < 0) {
Dev_err (&pdev->dev, "failed to clk_set_parent for fimd\n");
Goto ERR_CLK2;
}
ret = Clk_set_rate (SCLK, 800000000);
if (Ret < 0) {
Dev_err (&pdev->dev, "failed to clk_set_rate of SCLK for fimd\n");
Goto ERR_CLK2;
}
dev_dbg (&pdev->dev, "set FIMD SCLK-%d\n", rate);
Clk_put (MOUT_MPLL);
ret = clk_enable (SCLK);
if (Ret < 0) {
Dev_err (&pdev->dev, "failed to clk_enable of SCLK for fimd\n");
Goto ERR_CLK2;
}
*S3CFB_CLK = SCLK;
return 0;
ERR_CLK2:
Clk_put (MOUT_MPLL);
ERR_CLK1:
Clk_put (SCLK);
Err_clk0:
Clk_put (LCD_CLK);
Return-einval;
}
int S3cfb_clk_off (struct platform_device *pdev, struct CLK **clk)
{
struct CLK *lcd_clk = NULL;
LCD_CLK = Clk_get (&pdev->dev, "LCD");
if (Is_err (LCD_CLK)) {
PRINTK (kern_err "failed to get IP clk for fimd0\n");
Goto Err_clk0;
}
Clk_disable (LCD_CLK);
Clk_put (LCD_CLK);
Clk_disable (*CLK);
Clk_put (*CLK);
*CLK = NULL;
return 0;
Err_clk0:
Clk_put (LCD_CLK);
Return-einval;
}
void S3cfb_get_clk_name (char *clk_name)
{
strcpy (Clk_name, "SCLK_FIMD");
}
Then is the S3CFB_BACKLIGHT_ON function, which is the Enable screen to display, s3cfb_backlight_off off the screen display.

More information: http://topeetboard.com/More about: https://arm-board.taobao.com/

iTOP-4412 Development Board driver LCD graphics and Linux boot log modification method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.