15.1 Method to calculate LCD clock
There are complete LCD drivers in linux 2.6.25.8, and also an example configuration list. We only need to do a simple processing to use LCD controller in TQ2440.
File “drivers/video/s3c2410fb.c” is the source code of LCD driver. We analyze the method to calculate VCLK:
According to datasheet of S3C2440, for TFT LCF,
VCLK=HCLK/[(CLKVAL+1)*2]£¨equation 1£©£»
In line 149 of the above file, there is a function named “s3c2410fb_calc_pixclk”. This function does the LCD clock calculation. In line 431, clkdiv in “int clkdiv =s3c2410fb_calc_pixclk(fbi,var->pixclock)/2;” is CLKVAL called in S3C2440 datasheet. Note from line 437 to 446, because we are using TFT LCD, we decrease clkdiv by 1, then call function S3C2410_LCDCON1_CLKVAL£¨£©to set value of CLKVAL to the corresponding position of register LCDCON1. We get
£¨CLKVAL+1£©×2=div=pixclk×clk÷1012£¬ie.,
CLKVAL= pixclk ×clk÷1012÷2-1£¨equation 2£©.
From line 152 clk’s equation, we know clk=HCLK. Combining equation 1 and equation 2, we arrive at:VCLK=1012÷pixclk. Here pixclk is “.pixclock = 166667,” in line 120 of “arch/arm/machs3c2440/mach-smdk2440.c”. For example, if we set LCD working frequency VCLK to 3.84MHz£¬then the value of pixclock is 260000.
For full article: http://www.cutedigi.com/pub/Linux/LinuxPort/TUT15.pdf
Leave a Reply
You must be logged in to post a comment.