2 * Copyright (C) 2008-2009 MontaVista Software Inc.
3 * Copyright (C) 2008-2009 Texas Instruments Inc
5 * Based on the LCD driver for TI Avalanche processors written by
6 * Ajay Singh and Shalom Hai.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option)any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/module.h>
23 #include <linux/kernel.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/device.h>
27 #include <linux/platform_device.h>
28 #include <linux/uaccess.h>
29 #include <linux/interrupt.h>
30 #include <linux/clk.h>
31 #include <linux/cpufreq.h>
32 #include <linux/console.h>
33 #include <linux/spinlock.h>
34 #include <linux/slab.h>
35 #include <linux/delay.h>
36 #include <linux/lcm.h>
37 #include <video/da8xx-fb.h>
38 #include <asm/div64.h>
40 #define DRIVER_NAME "da8xx_lcdc"
42 #define LCD_VERSION_1 1
43 #define LCD_VERSION_2 2
45 /* LCD Status Register */
46 #define LCD_END_OF_FRAME1 BIT(9)
47 #define LCD_END_OF_FRAME0 BIT(8)
48 #define LCD_PL_LOAD_DONE BIT(6)
49 #define LCD_FIFO_UNDERFLOW BIT(5)
50 #define LCD_SYNC_LOST BIT(2)
52 /* LCD DMA Control Register */
53 #define LCD_DMA_BURST_SIZE(x) ((x) << 4)
54 #define LCD_DMA_BURST_1 0x0
55 #define LCD_DMA_BURST_2 0x1
56 #define LCD_DMA_BURST_4 0x2
57 #define LCD_DMA_BURST_8 0x3
58 #define LCD_DMA_BURST_16 0x4
59 #define LCD_V1_END_OF_FRAME_INT_ENA BIT(2)
60 #define LCD_V2_END_OF_FRAME0_INT_ENA BIT(8)
61 #define LCD_V2_END_OF_FRAME1_INT_ENA BIT(9)
62 #define LCD_DUAL_FRAME_BUFFER_ENABLE BIT(0)
64 /* LCD Control Register */
65 #define LCD_CLK_DIVISOR(x) ((x) << 8)
66 #define LCD_RASTER_MODE 0x01
68 /* LCD Raster Control Register */
69 #define LCD_PALETTE_LOAD_MODE(x) ((x) << 20)
70 #define PALETTE_AND_DATA 0x00
71 #define PALETTE_ONLY 0x01
72 #define DATA_ONLY 0x02
74 #define LCD_MONO_8BIT_MODE BIT(9)
75 #define LCD_RASTER_ORDER BIT(8)
76 #define LCD_TFT_MODE BIT(7)
77 #define LCD_V1_UNDERFLOW_INT_ENA BIT(6)
78 #define LCD_V2_UNDERFLOW_INT_ENA BIT(5)
79 #define LCD_V1_PL_INT_ENA BIT(4)
80 #define LCD_V2_PL_INT_ENA BIT(6)
81 #define LCD_MONOCHROME_MODE BIT(1)
82 #define LCD_RASTER_ENABLE BIT(0)
83 #define LCD_TFT_ALT_ENABLE BIT(23)
84 #define LCD_STN_565_ENABLE BIT(24)
85 #define LCD_V2_DMA_CLK_EN BIT(2)
86 #define LCD_V2_LIDD_CLK_EN BIT(1)
87 #define LCD_V2_CORE_CLK_EN BIT(0)
88 #define LCD_V2_LPP_B10 26
90 /* LCD Raster Timing 2 Register */
91 #define LCD_AC_BIAS_TRANSITIONS_PER_INT(x) ((x) << 16)
92 #define LCD_AC_BIAS_FREQUENCY(x) ((x) << 8)
93 #define LCD_SYNC_CTRL BIT(25)
94 #define LCD_SYNC_EDGE BIT(24)
95 #define LCD_INVERT_PIXEL_CLOCK BIT(22)
96 #define LCD_INVERT_LINE_CLOCK BIT(21)
97 #define LCD_INVERT_FRAME_CLOCK BIT(20)
100 #define LCD_PID_REG 0x0
101 #define LCD_CTRL_REG 0x4
102 #define LCD_STAT_REG 0x8
103 #define LCD_RASTER_CTRL_REG 0x28
104 #define LCD_RASTER_TIMING_0_REG 0x2C
105 #define LCD_RASTER_TIMING_1_REG 0x30
106 #define LCD_RASTER_TIMING_2_REG 0x34
107 #define LCD_DMA_CTRL_REG 0x40
108 #define LCD_DMA_FRM_BUF_BASE_ADDR_0_REG 0x44
109 #define LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG 0x48
110 #define LCD_DMA_FRM_BUF_BASE_ADDR_1_REG 0x4C
111 #define LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG 0x50
113 /* Interrupt Registers available only in Version 2 */
114 #define LCD_RAW_STAT_REG 0x58
115 #define LCD_MASKED_STAT_REG 0x5c
116 #define LCD_INT_ENABLE_SET_REG 0x60
117 #define LCD_INT_ENABLE_CLR_REG 0x64
118 #define LCD_END_OF_INT_IND_REG 0x68
120 /* Clock registers available only on Version 2 */
121 #define LCD_CLK_ENABLE_REG 0x6c
122 #define LCD_CLK_RESET_REG 0x70
123 #define LCD_CLK_MAIN_RESET BIT(3)
125 #define LCD_NUM_BUFFERS 2
127 #define WSI_TIMEOUT 50
128 #define PALETTE_SIZE 256
129 #define LEFT_MARGIN 64
130 #define RIGHT_MARGIN 64
131 #define UPPER_MARGIN 32
132 #define LOWER_MARGIN 32
134 static resource_size_t da8xx_fb_reg_base
;
135 static struct resource
*lcdc_regs
;
136 static unsigned int lcd_revision
;
137 static irq_handler_t lcdc_irq_handler
;
139 static inline unsigned int lcdc_read(unsigned int addr
)
141 return (unsigned int)__raw_readl(da8xx_fb_reg_base
+ (addr
));
144 static inline void lcdc_write(unsigned int val
, unsigned int addr
)
146 __raw_writel(val
, da8xx_fb_reg_base
+ (addr
));
149 struct da8xx_fb_par
{
150 resource_size_t p_palette_base
;
151 unsigned char *v_palette_base
;
152 dma_addr_t vram_phys
;
153 unsigned long vram_size
;
155 unsigned int dma_start
;
156 unsigned int dma_end
;
157 struct clk
*lcdc_clk
;
159 unsigned short pseudo_palette
[16];
160 unsigned int palette_sz
;
161 unsigned int pxl_clk
;
163 wait_queue_head_t vsync_wait
;
166 spinlock_t lock_for_chan_update
;
169 * LCDC has 2 ping pong DMA channels, channel 0
172 unsigned int which_dma_channel_done
;
173 #ifdef CONFIG_CPU_FREQ
174 struct notifier_block freq_transition
;
175 unsigned int lcd_fck_rate
;
177 void (*panel_power_ctrl
)(int);
180 /* Variable Screen Information */
181 static struct fb_var_screeninfo da8xx_fb_var __devinitdata
= {
190 .left_margin
= LEFT_MARGIN
,
191 .right_margin
= RIGHT_MARGIN
,
192 .upper_margin
= UPPER_MARGIN
,
193 .lower_margin
= LOWER_MARGIN
,
195 .vmode
= FB_VMODE_NONINTERLACED
198 static struct fb_fix_screeninfo da8xx_fb_fix __devinitdata
= {
199 .id
= "DA8xx FB Drv",
200 .type
= FB_TYPE_PACKED_PIXELS
,
202 .visual
= FB_VISUAL_PSEUDOCOLOR
,
206 .accel
= FB_ACCEL_NONE
210 const char name
[25]; /* Full name <vendor>_<model> */
211 unsigned short width
;
212 unsigned short height
;
213 int hfp
; /* Horizontal front porch */
214 int hbp
; /* Horizontal back porch */
215 int hsw
; /* Horizontal Sync Pulse Width */
216 int vfp
; /* Vertical front porch */
217 int vbp
; /* Vertical back porch */
218 int vsw
; /* Vertical Sync Pulse Width */
219 unsigned int pxl_clk
; /* Pixel clock */
220 unsigned char invert_pxl_clk
; /* Invert Pixel clock */
223 static struct da8xx_panel known_lcd_panels
[] = {
224 /* Sharp LCD035Q3DG01 */
226 .name
= "Sharp_LCD035Q3DG01",
238 /* Sharp LK043T1DG01 */
240 .name
= "Sharp_LK043T1DG01",
253 /* Hitachi SP10Q010 */
268 /* Enable the Raster Engine of the LCD Controller */
269 static inline void lcd_enable_raster(void)
273 /* Put LCDC in reset for several cycles */
274 if (lcd_revision
== LCD_VERSION_2
)
275 /* Write 1 to reset LCDC */
276 lcdc_write(LCD_CLK_MAIN_RESET
, LCD_CLK_RESET_REG
);
279 /* Bring LCDC out of reset */
280 if (lcd_revision
== LCD_VERSION_2
)
281 lcdc_write(0, LCD_CLK_RESET_REG
);
284 /* Above reset sequence doesnot reset register context */
285 reg
= lcdc_read(LCD_RASTER_CTRL_REG
);
286 if (!(reg
& LCD_RASTER_ENABLE
))
287 lcdc_write(reg
| LCD_RASTER_ENABLE
, LCD_RASTER_CTRL_REG
);
290 /* Disable the Raster Engine of the LCD Controller */
291 static inline void lcd_disable_raster(void)
295 reg
= lcdc_read(LCD_RASTER_CTRL_REG
);
296 if (reg
& LCD_RASTER_ENABLE
)
297 lcdc_write(reg
& ~LCD_RASTER_ENABLE
, LCD_RASTER_CTRL_REG
);
300 static void lcd_blit(int load_mode
, struct da8xx_fb_par
*par
)
308 /* init reg to clear PLM (loading mode) fields */
309 reg_ras
= lcdc_read(LCD_RASTER_CTRL_REG
);
310 reg_ras
&= ~(3 << 20);
312 reg_dma
= lcdc_read(LCD_DMA_CTRL_REG
);
314 if (load_mode
== LOAD_DATA
) {
315 start
= par
->dma_start
;
318 reg_ras
|= LCD_PALETTE_LOAD_MODE(DATA_ONLY
);
319 if (lcd_revision
== LCD_VERSION_1
) {
320 reg_dma
|= LCD_V1_END_OF_FRAME_INT_ENA
;
322 reg_int
= lcdc_read(LCD_INT_ENABLE_SET_REG
) |
323 LCD_V2_END_OF_FRAME0_INT_ENA
|
324 LCD_V2_END_OF_FRAME1_INT_ENA
;
325 lcdc_write(reg_int
, LCD_INT_ENABLE_SET_REG
);
327 reg_dma
|= LCD_DUAL_FRAME_BUFFER_ENABLE
;
329 lcdc_write(start
, LCD_DMA_FRM_BUF_BASE_ADDR_0_REG
);
330 lcdc_write(end
, LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG
);
331 lcdc_write(start
, LCD_DMA_FRM_BUF_BASE_ADDR_1_REG
);
332 lcdc_write(end
, LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG
);
333 } else if (load_mode
== LOAD_PALETTE
) {
334 start
= par
->p_palette_base
;
335 end
= start
+ par
->palette_sz
- 1;
337 reg_ras
|= LCD_PALETTE_LOAD_MODE(PALETTE_ONLY
);
339 if (lcd_revision
== LCD_VERSION_1
) {
340 reg_ras
|= LCD_V1_PL_INT_ENA
;
342 reg_int
= lcdc_read(LCD_INT_ENABLE_SET_REG
) |
344 lcdc_write(reg_int
, LCD_INT_ENABLE_SET_REG
);
347 lcdc_write(start
, LCD_DMA_FRM_BUF_BASE_ADDR_0_REG
);
348 lcdc_write(end
, LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG
);
351 lcdc_write(reg_dma
, LCD_DMA_CTRL_REG
);
352 lcdc_write(reg_ras
, LCD_RASTER_CTRL_REG
);
355 * The Raster enable bit must be set after all other control fields are
361 /* Configure the Burst Size and fifo threhold of DMA */
362 static int lcd_cfg_dma(int burst_size
, int fifo_th
)
366 reg
= lcdc_read(LCD_DMA_CTRL_REG
) & 0x00000001;
367 switch (burst_size
) {
369 reg
|= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_1
);
372 reg
|= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_2
);
375 reg
|= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_4
);
378 reg
|= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_8
);
381 reg
|= LCD_DMA_BURST_SIZE(LCD_DMA_BURST_16
);
387 reg
|= (fifo_th
<< 8);
389 lcdc_write(reg
, LCD_DMA_CTRL_REG
);
394 static void lcd_cfg_ac_bias(int period
, int transitions_per_int
)
398 /* Set the AC Bias Period and Number of Transisitons per Interrupt */
399 reg
= lcdc_read(LCD_RASTER_TIMING_2_REG
) & 0xFFF00000;
400 reg
|= LCD_AC_BIAS_FREQUENCY(period
) |
401 LCD_AC_BIAS_TRANSITIONS_PER_INT(transitions_per_int
);
402 lcdc_write(reg
, LCD_RASTER_TIMING_2_REG
);
405 static void lcd_cfg_horizontal_sync(int back_porch
, int pulse_width
,
410 reg
= lcdc_read(LCD_RASTER_TIMING_0_REG
) & 0xf;
411 reg
|= ((back_porch
& 0xff) << 24)
412 | ((front_porch
& 0xff) << 16)
413 | ((pulse_width
& 0x3f) << 10);
414 lcdc_write(reg
, LCD_RASTER_TIMING_0_REG
);
417 static void lcd_cfg_vertical_sync(int back_porch
, int pulse_width
,
422 reg
= lcdc_read(LCD_RASTER_TIMING_1_REG
) & 0x3ff;
423 reg
|= ((back_porch
& 0xff) << 24)
424 | ((front_porch
& 0xff) << 16)
425 | ((pulse_width
& 0x3f) << 10);
426 lcdc_write(reg
, LCD_RASTER_TIMING_1_REG
);
429 static int lcd_cfg_display(const struct lcd_ctrl_config
*cfg
)
434 reg
= lcdc_read(LCD_RASTER_CTRL_REG
) & ~(LCD_TFT_MODE
|
436 LCD_MONOCHROME_MODE
);
438 switch (cfg
->p_disp_panel
->panel_shade
) {
440 reg
|= LCD_MONOCHROME_MODE
;
441 if (cfg
->mono_8bit_mode
)
442 reg
|= LCD_MONO_8BIT_MODE
;
446 if (cfg
->tft_alt_mode
)
447 reg
|= LCD_TFT_ALT_ENABLE
;
451 if (cfg
->stn_565_mode
)
452 reg
|= LCD_STN_565_ENABLE
;
459 /* enable additional interrupts here */
460 if (lcd_revision
== LCD_VERSION_1
) {
461 reg
|= LCD_V1_UNDERFLOW_INT_ENA
;
463 reg_int
= lcdc_read(LCD_INT_ENABLE_SET_REG
) |
464 LCD_V2_UNDERFLOW_INT_ENA
;
465 lcdc_write(reg_int
, LCD_INT_ENABLE_SET_REG
);
468 lcdc_write(reg
, LCD_RASTER_CTRL_REG
);
470 reg
= lcdc_read(LCD_RASTER_TIMING_2_REG
);
473 reg
|= LCD_SYNC_CTRL
;
475 reg
&= ~LCD_SYNC_CTRL
;
478 reg
|= LCD_SYNC_EDGE
;
480 reg
&= ~LCD_SYNC_EDGE
;
482 if (cfg
->invert_line_clock
)
483 reg
|= LCD_INVERT_LINE_CLOCK
;
485 reg
&= ~LCD_INVERT_LINE_CLOCK
;
487 if (cfg
->invert_frm_clock
)
488 reg
|= LCD_INVERT_FRAME_CLOCK
;
490 reg
&= ~LCD_INVERT_FRAME_CLOCK
;
492 lcdc_write(reg
, LCD_RASTER_TIMING_2_REG
);
497 static int lcd_cfg_frame_buffer(struct da8xx_fb_par
*par
, u32 width
, u32 height
,
498 u32 bpp
, u32 raster_order
)
502 /* Set the Panel Width */
503 /* Pixels per line = (PPL + 1)*16 */
504 if (lcd_revision
== LCD_VERSION_1
) {
506 * 0x3F in bits 4..9 gives max horizontal resolution = 1024
512 * 0x7F in bits 4..10 gives max horizontal resolution = 2048
518 reg
= lcdc_read(LCD_RASTER_TIMING_0_REG
);
520 if (lcd_revision
== LCD_VERSION_1
) {
521 reg
|= ((width
>> 4) - 1) << 4;
523 width
= (width
>> 4) - 1;
524 reg
|= ((width
& 0x3f) << 4) | ((width
& 0x40) >> 3);
526 lcdc_write(reg
, LCD_RASTER_TIMING_0_REG
);
528 /* Set the Panel Height */
529 /* Set bits 9:0 of Lines Per Pixel */
530 reg
= lcdc_read(LCD_RASTER_TIMING_1_REG
);
531 reg
= ((height
- 1) & 0x3ff) | (reg
& 0xfffffc00);
532 lcdc_write(reg
, LCD_RASTER_TIMING_1_REG
);
534 /* Set bit 10 of Lines Per Pixel */
535 if (lcd_revision
== LCD_VERSION_2
) {
536 reg
= lcdc_read(LCD_RASTER_TIMING_2_REG
);
537 reg
|= ((height
- 1) & 0x400) << 16;
538 lcdc_write(reg
, LCD_RASTER_TIMING_2_REG
);
541 /* Set the Raster Order of the Frame Buffer */
542 reg
= lcdc_read(LCD_RASTER_CTRL_REG
) & ~(1 << 8);
544 reg
|= LCD_RASTER_ORDER
;
545 lcdc_write(reg
, LCD_RASTER_CTRL_REG
);
552 par
->palette_sz
= 16 * 2;
556 par
->palette_sz
= 256 * 2;
566 static int fb_setcolreg(unsigned regno
, unsigned red
, unsigned green
,
567 unsigned blue
, unsigned transp
,
568 struct fb_info
*info
)
570 struct da8xx_fb_par
*par
= info
->par
;
571 unsigned short *palette
= (unsigned short *) par
->v_palette_base
;
578 if (info
->fix
.visual
== FB_VISUAL_DIRECTCOLOR
)
581 if (info
->var
.bits_per_pixel
== 4) {
585 if (info
->var
.grayscale
) {
592 pal
= (red
& 0x0f00);
593 pal
|= (green
& 0x00f0);
594 pal
|= (blue
& 0x000f);
598 palette
[regno
] = pal
;
600 } else if (info
->var
.bits_per_pixel
== 8) {
605 pal
= (red
& 0x0f00);
606 pal
|= (green
& 0x00f0);
607 pal
|= (blue
& 0x000f);
609 if (palette
[regno
] != pal
) {
611 palette
[regno
] = pal
;
613 } else if ((info
->var
.bits_per_pixel
== 16) && regno
< 16) {
614 red
>>= (16 - info
->var
.red
.length
);
615 red
<<= info
->var
.red
.offset
;
617 green
>>= (16 - info
->var
.green
.length
);
618 green
<<= info
->var
.green
.offset
;
620 blue
>>= (16 - info
->var
.blue
.length
);
621 blue
<<= info
->var
.blue
.offset
;
623 par
->pseudo_palette
[regno
] = red
| green
| blue
;
625 if (palette
[0] != 0x4000) {
631 /* Update the palette in the h/w as needed. */
633 lcd_blit(LOAD_PALETTE
, par
);
638 static void lcd_reset(struct da8xx_fb_par
*par
)
640 /* Disable the Raster if previously Enabled */
641 lcd_disable_raster();
643 /* DMA has to be disabled */
644 lcdc_write(0, LCD_DMA_CTRL_REG
);
645 lcdc_write(0, LCD_RASTER_CTRL_REG
);
647 if (lcd_revision
== LCD_VERSION_2
) {
648 lcdc_write(0, LCD_INT_ENABLE_SET_REG
);
649 /* Write 1 to reset */
650 lcdc_write(LCD_CLK_MAIN_RESET
, LCD_CLK_RESET_REG
);
651 lcdc_write(0, LCD_CLK_RESET_REG
);
655 static void lcd_calc_clk_divider(struct da8xx_fb_par
*par
)
657 unsigned int lcd_clk
, div
;
659 lcd_clk
= clk_get_rate(par
->lcdc_clk
);
660 div
= lcd_clk
/ par
->pxl_clk
;
662 /* Configure the LCD clock divisor. */
663 lcdc_write(LCD_CLK_DIVISOR(div
) |
664 (LCD_RASTER_MODE
& 0x1), LCD_CTRL_REG
);
666 if (lcd_revision
== LCD_VERSION_2
)
667 lcdc_write(LCD_V2_DMA_CLK_EN
| LCD_V2_LIDD_CLK_EN
|
668 LCD_V2_CORE_CLK_EN
, LCD_CLK_ENABLE_REG
);
672 static int lcd_init(struct da8xx_fb_par
*par
, const struct lcd_ctrl_config
*cfg
,
673 struct da8xx_panel
*panel
)
680 /* Calculate the divider */
681 lcd_calc_clk_divider(par
);
683 if (panel
->invert_pxl_clk
)
684 lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG
) |
685 LCD_INVERT_PIXEL_CLOCK
), LCD_RASTER_TIMING_2_REG
);
687 lcdc_write((lcdc_read(LCD_RASTER_TIMING_2_REG
) &
688 ~LCD_INVERT_PIXEL_CLOCK
), LCD_RASTER_TIMING_2_REG
);
690 /* Configure the DMA burst size and fifo threshold. */
691 ret
= lcd_cfg_dma(cfg
->dma_burst_sz
, cfg
->fifo_th
);
695 /* Configure the AC bias properties. */
696 lcd_cfg_ac_bias(cfg
->ac_bias
, cfg
->ac_bias_intrpt
);
698 /* Configure the vertical and horizontal sync properties. */
699 lcd_cfg_vertical_sync(panel
->vbp
, panel
->vsw
, panel
->vfp
);
700 lcd_cfg_horizontal_sync(panel
->hbp
, panel
->hsw
, panel
->hfp
);
702 /* Configure for disply */
703 ret
= lcd_cfg_display(cfg
);
707 if (QVGA
!= cfg
->p_disp_panel
->panel_type
)
710 if (cfg
->bpp
<= cfg
->p_disp_panel
->max_bpp
&&
711 cfg
->bpp
>= cfg
->p_disp_panel
->min_bpp
)
714 bpp
= cfg
->p_disp_panel
->max_bpp
;
717 ret
= lcd_cfg_frame_buffer(par
, (unsigned int)panel
->width
,
718 (unsigned int)panel
->height
, bpp
,
724 lcdc_write((lcdc_read(LCD_RASTER_CTRL_REG
) & 0xfff00fff) |
725 (cfg
->fdd
<< 12), LCD_RASTER_CTRL_REG
);
730 /* IRQ handler for version 2 of LCDC */
731 static irqreturn_t
lcdc_irq_handler_rev02(int irq
, void *arg
)
733 struct da8xx_fb_par
*par
= arg
;
734 u32 stat
= lcdc_read(LCD_MASKED_STAT_REG
);
736 if ((stat
& LCD_SYNC_LOST
) && (stat
& LCD_FIFO_UNDERFLOW
)) {
737 lcd_disable_raster();
738 lcdc_write(stat
, LCD_MASKED_STAT_REG
);
740 } else if (stat
& LCD_PL_LOAD_DONE
) {
742 * Must disable raster before changing state of any control bit.
743 * And also must be disabled before clearing the PL loading
744 * interrupt via the following write to the status register. If
745 * this is done after then one gets multiple PL done interrupts.
747 lcd_disable_raster();
749 lcdc_write(stat
, LCD_MASKED_STAT_REG
);
751 /* Disable PL completion interrupt */
752 lcdc_write(LCD_V2_PL_INT_ENA
, LCD_INT_ENABLE_CLR_REG
);
754 /* Setup and start data loading mode */
755 lcd_blit(LOAD_DATA
, par
);
757 lcdc_write(stat
, LCD_MASKED_STAT_REG
);
759 if (stat
& LCD_END_OF_FRAME0
) {
760 par
->which_dma_channel_done
= 0;
761 lcdc_write(par
->dma_start
,
762 LCD_DMA_FRM_BUF_BASE_ADDR_0_REG
);
763 lcdc_write(par
->dma_end
,
764 LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG
);
766 wake_up_interruptible(&par
->vsync_wait
);
769 if (stat
& LCD_END_OF_FRAME1
) {
770 par
->which_dma_channel_done
= 1;
771 lcdc_write(par
->dma_start
,
772 LCD_DMA_FRM_BUF_BASE_ADDR_1_REG
);
773 lcdc_write(par
->dma_end
,
774 LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG
);
776 wake_up_interruptible(&par
->vsync_wait
);
780 lcdc_write(0, LCD_END_OF_INT_IND_REG
);
784 /* IRQ handler for version 1 LCDC */
785 static irqreturn_t
lcdc_irq_handler_rev01(int irq
, void *arg
)
787 struct da8xx_fb_par
*par
= arg
;
788 u32 stat
= lcdc_read(LCD_STAT_REG
);
791 if ((stat
& LCD_SYNC_LOST
) && (stat
& LCD_FIFO_UNDERFLOW
)) {
792 lcd_disable_raster();
793 lcdc_write(stat
, LCD_STAT_REG
);
795 } else if (stat
& LCD_PL_LOAD_DONE
) {
797 * Must disable raster before changing state of any control bit.
798 * And also must be disabled before clearing the PL loading
799 * interrupt via the following write to the status register. If
800 * this is done after then one gets multiple PL done interrupts.
802 lcd_disable_raster();
804 lcdc_write(stat
, LCD_STAT_REG
);
806 /* Disable PL completion inerrupt */
807 reg_ras
= lcdc_read(LCD_RASTER_CTRL_REG
);
808 reg_ras
&= ~LCD_V1_PL_INT_ENA
;
809 lcdc_write(reg_ras
, LCD_RASTER_CTRL_REG
);
811 /* Setup and start data loading mode */
812 lcd_blit(LOAD_DATA
, par
);
814 lcdc_write(stat
, LCD_STAT_REG
);
816 if (stat
& LCD_END_OF_FRAME0
) {
817 par
->which_dma_channel_done
= 0;
818 lcdc_write(par
->dma_start
,
819 LCD_DMA_FRM_BUF_BASE_ADDR_0_REG
);
820 lcdc_write(par
->dma_end
,
821 LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG
);
823 wake_up_interruptible(&par
->vsync_wait
);
826 if (stat
& LCD_END_OF_FRAME1
) {
827 par
->which_dma_channel_done
= 1;
828 lcdc_write(par
->dma_start
,
829 LCD_DMA_FRM_BUF_BASE_ADDR_1_REG
);
830 lcdc_write(par
->dma_end
,
831 LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG
);
833 wake_up_interruptible(&par
->vsync_wait
);
840 static int fb_check_var(struct fb_var_screeninfo
*var
,
841 struct fb_info
*info
)
845 switch (var
->bits_per_pixel
) {
850 var
->green
.offset
= 0;
851 var
->green
.length
= 8;
852 var
->blue
.offset
= 0;
853 var
->blue
.length
= 8;
854 var
->transp
.offset
= 0;
855 var
->transp
.length
= 0;
861 var
->green
.offset
= 0;
862 var
->green
.length
= 4;
863 var
->blue
.offset
= 0;
864 var
->blue
.length
= 4;
865 var
->transp
.offset
= 0;
866 var
->transp
.length
= 0;
867 var
->nonstd
= FB_NONSTD_REV_PIX_IN_B
;
869 case 16: /* RGB 565 */
870 var
->red
.offset
= 11;
872 var
->green
.offset
= 5;
873 var
->green
.length
= 6;
874 var
->blue
.offset
= 0;
875 var
->blue
.length
= 5;
876 var
->transp
.offset
= 0;
877 var
->transp
.length
= 0;
884 var
->red
.msb_right
= 0;
885 var
->green
.msb_right
= 0;
886 var
->blue
.msb_right
= 0;
887 var
->transp
.msb_right
= 0;
891 #ifdef CONFIG_CPU_FREQ
892 static int lcd_da8xx_cpufreq_transition(struct notifier_block
*nb
,
893 unsigned long val
, void *data
)
895 struct da8xx_fb_par
*par
;
897 par
= container_of(nb
, struct da8xx_fb_par
, freq_transition
);
898 if (val
== CPUFREQ_POSTCHANGE
) {
899 if (par
->lcd_fck_rate
!= clk_get_rate(par
->lcdc_clk
)) {
900 par
->lcd_fck_rate
= clk_get_rate(par
->lcdc_clk
);
901 lcd_disable_raster();
902 lcd_calc_clk_divider(par
);
910 static inline int lcd_da8xx_cpufreq_register(struct da8xx_fb_par
*par
)
912 par
->freq_transition
.notifier_call
= lcd_da8xx_cpufreq_transition
;
914 return cpufreq_register_notifier(&par
->freq_transition
,
915 CPUFREQ_TRANSITION_NOTIFIER
);
918 static inline void lcd_da8xx_cpufreq_deregister(struct da8xx_fb_par
*par
)
920 cpufreq_unregister_notifier(&par
->freq_transition
,
921 CPUFREQ_TRANSITION_NOTIFIER
);
925 static int __devexit
fb_remove(struct platform_device
*dev
)
927 struct fb_info
*info
= dev_get_drvdata(&dev
->dev
);
930 struct da8xx_fb_par
*par
= info
->par
;
932 #ifdef CONFIG_CPU_FREQ
933 lcd_da8xx_cpufreq_deregister(par
);
935 if (par
->panel_power_ctrl
)
936 par
->panel_power_ctrl(0);
938 lcd_disable_raster();
939 lcdc_write(0, LCD_RASTER_CTRL_REG
);
942 lcdc_write(0, LCD_DMA_CTRL_REG
);
944 unregister_framebuffer(info
);
945 fb_dealloc_cmap(&info
->cmap
);
946 dma_free_coherent(NULL
, PALETTE_SIZE
, par
->v_palette_base
,
947 par
->p_palette_base
);
948 dma_free_coherent(NULL
, par
->vram_size
, par
->vram_virt
,
950 free_irq(par
->irq
, par
);
951 clk_disable(par
->lcdc_clk
);
952 clk_put(par
->lcdc_clk
);
953 framebuffer_release(info
);
954 iounmap((void __iomem
*)da8xx_fb_reg_base
);
955 release_mem_region(lcdc_regs
->start
, resource_size(lcdc_regs
));
962 * Function to wait for vertical sync which for this LCD peripheral
963 * translates into waiting for the current raster frame to complete.
965 static int fb_wait_for_vsync(struct fb_info
*info
)
967 struct da8xx_fb_par
*par
= info
->par
;
971 * Set flag to 0 and wait for isr to set to 1. It would seem there is a
972 * race condition here where the ISR could have occurred just before or
973 * just after this set. But since we are just coarsely waiting for
974 * a frame to complete then that's OK. i.e. if the frame completed
975 * just before this code executed then we have to wait another full
976 * frame time but there is no way to avoid such a situation. On the
977 * other hand if the frame completed just after then we don't need
978 * to wait long at all. Either way we are guaranteed to return to the
979 * user immediately after a frame completion which is all that is
983 ret
= wait_event_interruptible_timeout(par
->vsync_wait
,
984 par
->vsync_flag
!= 0,
994 static int fb_ioctl(struct fb_info
*info
, unsigned int cmd
,
997 struct lcd_sync_arg sync_arg
;
1000 case FBIOGET_CONTRAST
:
1001 case FBIOPUT_CONTRAST
:
1002 case FBIGET_BRIGHTNESS
:
1003 case FBIPUT_BRIGHTNESS
:
1008 if (copy_from_user(&sync_arg
, (char *)arg
,
1009 sizeof(struct lcd_sync_arg
)))
1011 lcd_cfg_horizontal_sync(sync_arg
.back_porch
,
1012 sync_arg
.pulse_width
,
1013 sync_arg
.front_porch
);
1016 if (copy_from_user(&sync_arg
, (char *)arg
,
1017 sizeof(struct lcd_sync_arg
)))
1019 lcd_cfg_vertical_sync(sync_arg
.back_porch
,
1020 sync_arg
.pulse_width
,
1021 sync_arg
.front_porch
);
1023 case FBIO_WAITFORVSYNC
:
1024 return fb_wait_for_vsync(info
);
1031 static int cfb_blank(int blank
, struct fb_info
*info
)
1033 struct da8xx_fb_par
*par
= info
->par
;
1036 if (par
->blank
== blank
)
1041 case FB_BLANK_UNBLANK
:
1042 lcd_enable_raster();
1044 if (par
->panel_power_ctrl
)
1045 par
->panel_power_ctrl(1);
1047 case FB_BLANK_NORMAL
:
1048 case FB_BLANK_VSYNC_SUSPEND
:
1049 case FB_BLANK_HSYNC_SUSPEND
:
1050 case FB_BLANK_POWERDOWN
:
1051 if (par
->panel_power_ctrl
)
1052 par
->panel_power_ctrl(0);
1054 lcd_disable_raster();
1064 * Set new x,y offsets in the virtual display for the visible area and switch
1067 static int da8xx_pan_display(struct fb_var_screeninfo
*var
,
1068 struct fb_info
*fbi
)
1071 struct fb_var_screeninfo new_var
;
1072 struct da8xx_fb_par
*par
= fbi
->par
;
1073 struct fb_fix_screeninfo
*fix
= &fbi
->fix
;
1076 unsigned long irq_flags
;
1078 if (var
->xoffset
!= fbi
->var
.xoffset
||
1079 var
->yoffset
!= fbi
->var
.yoffset
) {
1080 memcpy(&new_var
, &fbi
->var
, sizeof(new_var
));
1081 new_var
.xoffset
= var
->xoffset
;
1082 new_var
.yoffset
= var
->yoffset
;
1083 if (fb_check_var(&new_var
, fbi
))
1086 memcpy(&fbi
->var
, &new_var
, sizeof(new_var
));
1088 start
= fix
->smem_start
+
1089 new_var
.yoffset
* fix
->line_length
+
1090 new_var
.xoffset
* fbi
->var
.bits_per_pixel
/ 8;
1091 end
= start
+ fbi
->var
.yres
* fix
->line_length
- 1;
1092 par
->dma_start
= start
;
1094 spin_lock_irqsave(&par
->lock_for_chan_update
,
1096 if (par
->which_dma_channel_done
== 0) {
1097 lcdc_write(par
->dma_start
,
1098 LCD_DMA_FRM_BUF_BASE_ADDR_0_REG
);
1099 lcdc_write(par
->dma_end
,
1100 LCD_DMA_FRM_BUF_CEILING_ADDR_0_REG
);
1101 } else if (par
->which_dma_channel_done
== 1) {
1102 lcdc_write(par
->dma_start
,
1103 LCD_DMA_FRM_BUF_BASE_ADDR_1_REG
);
1104 lcdc_write(par
->dma_end
,
1105 LCD_DMA_FRM_BUF_CEILING_ADDR_1_REG
);
1107 spin_unlock_irqrestore(&par
->lock_for_chan_update
,
1115 static struct fb_ops da8xx_fb_ops
= {
1116 .owner
= THIS_MODULE
,
1117 .fb_check_var
= fb_check_var
,
1118 .fb_setcolreg
= fb_setcolreg
,
1119 .fb_pan_display
= da8xx_pan_display
,
1120 .fb_ioctl
= fb_ioctl
,
1121 .fb_fillrect
= cfb_fillrect
,
1122 .fb_copyarea
= cfb_copyarea
,
1123 .fb_imageblit
= cfb_imageblit
,
1124 .fb_blank
= cfb_blank
,
1127 /* Calculate and return pixel clock period in pico seconds */
1128 static unsigned int da8xxfb_pixel_clk_period(struct da8xx_fb_par
*par
)
1130 unsigned int lcd_clk
, div
;
1131 unsigned int configured_pix_clk
;
1132 unsigned long long pix_clk_period_picosec
= 1000000000000ULL;
1134 lcd_clk
= clk_get_rate(par
->lcdc_clk
);
1135 div
= lcd_clk
/ par
->pxl_clk
;
1136 configured_pix_clk
= (lcd_clk
/ div
);
1138 do_div(pix_clk_period_picosec
, configured_pix_clk
);
1140 return pix_clk_period_picosec
;
1143 static int __devinit
fb_probe(struct platform_device
*device
)
1145 struct da8xx_lcdc_platform_data
*fb_pdata
=
1146 device
->dev
.platform_data
;
1147 struct lcd_ctrl_config
*lcd_cfg
;
1148 struct da8xx_panel
*lcdc_info
;
1149 struct fb_info
*da8xx_fb_info
;
1150 struct clk
*fb_clk
= NULL
;
1151 struct da8xx_fb_par
*par
;
1152 resource_size_t len
;
1156 if (fb_pdata
== NULL
) {
1157 dev_err(&device
->dev
, "Can not get platform data\n");
1161 lcdc_regs
= platform_get_resource(device
, IORESOURCE_MEM
, 0);
1163 dev_err(&device
->dev
,
1164 "Can not get memory resource for LCD controller\n");
1168 len
= resource_size(lcdc_regs
);
1170 lcdc_regs
= request_mem_region(lcdc_regs
->start
, len
, lcdc_regs
->name
);
1174 da8xx_fb_reg_base
= (resource_size_t
)ioremap(lcdc_regs
->start
, len
);
1175 if (!da8xx_fb_reg_base
) {
1177 goto err_request_mem
;
1180 fb_clk
= clk_get(&device
->dev
, NULL
);
1181 if (IS_ERR(fb_clk
)) {
1182 dev_err(&device
->dev
, "Can not get device clock\n");
1186 ret
= clk_enable(fb_clk
);
1190 /* Determine LCD IP Version */
1191 switch (lcdc_read(LCD_PID_REG
)) {
1193 lcd_revision
= LCD_VERSION_1
;
1196 lcd_revision
= LCD_VERSION_2
;
1199 dev_warn(&device
->dev
, "Unknown PID Reg value 0x%x, "
1200 "defaulting to LCD revision 1\n",
1201 lcdc_read(LCD_PID_REG
));
1202 lcd_revision
= LCD_VERSION_1
;
1206 for (i
= 0, lcdc_info
= known_lcd_panels
;
1207 i
< ARRAY_SIZE(known_lcd_panels
);
1209 if (strcmp(fb_pdata
->type
, lcdc_info
->name
) == 0)
1213 if (i
== ARRAY_SIZE(known_lcd_panels
)) {
1214 dev_err(&device
->dev
, "GLCD: No valid panel found\n");
1216 goto err_clk_disable
;
1218 dev_info(&device
->dev
, "GLCD: Found %s panel\n",
1221 lcd_cfg
= (struct lcd_ctrl_config
*)fb_pdata
->controller_data
;
1223 da8xx_fb_info
= framebuffer_alloc(sizeof(struct da8xx_fb_par
),
1225 if (!da8xx_fb_info
) {
1226 dev_dbg(&device
->dev
, "Memory allocation failed for fb_info\n");
1228 goto err_clk_disable
;
1231 par
= da8xx_fb_info
->par
;
1232 par
->lcdc_clk
= fb_clk
;
1233 #ifdef CONFIG_CPU_FREQ
1234 par
->lcd_fck_rate
= clk_get_rate(fb_clk
);
1236 par
->pxl_clk
= lcdc_info
->pxl_clk
;
1237 if (fb_pdata
->panel_power_ctrl
) {
1238 par
->panel_power_ctrl
= fb_pdata
->panel_power_ctrl
;
1239 par
->panel_power_ctrl(1);
1242 if (lcd_init(par
, lcd_cfg
, lcdc_info
) < 0) {
1243 dev_err(&device
->dev
, "lcd_init failed\n");
1245 goto err_release_fb
;
1248 /* allocate frame buffer */
1249 par
->vram_size
= lcdc_info
->width
* lcdc_info
->height
* lcd_cfg
->bpp
;
1250 ulcm
= lcm((lcdc_info
->width
* lcd_cfg
->bpp
)/8, PAGE_SIZE
);
1251 par
->vram_size
= roundup(par
->vram_size
/8, ulcm
);
1252 par
->vram_size
= par
->vram_size
* LCD_NUM_BUFFERS
;
1254 par
->vram_virt
= dma_alloc_coherent(NULL
,
1256 (resource_size_t
*) &par
->vram_phys
,
1257 GFP_KERNEL
| GFP_DMA
);
1258 if (!par
->vram_virt
) {
1259 dev_err(&device
->dev
,
1260 "GLCD: kmalloc for frame buffer failed\n");
1262 goto err_release_fb
;
1265 da8xx_fb_info
->screen_base
= (char __iomem
*) par
->vram_virt
;
1266 da8xx_fb_fix
.smem_start
= par
->vram_phys
;
1267 da8xx_fb_fix
.smem_len
= par
->vram_size
;
1268 da8xx_fb_fix
.line_length
= (lcdc_info
->width
* lcd_cfg
->bpp
) / 8;
1270 par
->dma_start
= par
->vram_phys
;
1271 par
->dma_end
= par
->dma_start
+ lcdc_info
->height
*
1272 da8xx_fb_fix
.line_length
- 1;
1274 /* allocate palette buffer */
1275 par
->v_palette_base
= dma_alloc_coherent(NULL
,
1278 &par
->p_palette_base
,
1279 GFP_KERNEL
| GFP_DMA
);
1280 if (!par
->v_palette_base
) {
1281 dev_err(&device
->dev
,
1282 "GLCD: kmalloc for palette buffer failed\n");
1284 goto err_release_fb_mem
;
1286 memset(par
->v_palette_base
, 0, PALETTE_SIZE
);
1288 par
->irq
= platform_get_irq(device
, 0);
1291 goto err_release_pl_mem
;
1294 /* Initialize par */
1295 da8xx_fb_info
->var
.bits_per_pixel
= lcd_cfg
->bpp
;
1297 da8xx_fb_var
.xres
= lcdc_info
->width
;
1298 da8xx_fb_var
.xres_virtual
= lcdc_info
->width
;
1300 da8xx_fb_var
.yres
= lcdc_info
->height
;
1301 da8xx_fb_var
.yres_virtual
= lcdc_info
->height
* LCD_NUM_BUFFERS
;
1303 da8xx_fb_var
.grayscale
=
1304 lcd_cfg
->p_disp_panel
->panel_shade
== MONOCHROME
? 1 : 0;
1305 da8xx_fb_var
.bits_per_pixel
= lcd_cfg
->bpp
;
1307 da8xx_fb_var
.hsync_len
= lcdc_info
->hsw
;
1308 da8xx_fb_var
.vsync_len
= lcdc_info
->vsw
;
1309 da8xx_fb_var
.right_margin
= lcdc_info
->hfp
;
1310 da8xx_fb_var
.left_margin
= lcdc_info
->hbp
;
1311 da8xx_fb_var
.lower_margin
= lcdc_info
->vfp
;
1312 da8xx_fb_var
.upper_margin
= lcdc_info
->vbp
;
1313 da8xx_fb_var
.pixclock
= da8xxfb_pixel_clk_period(par
);
1315 /* Initialize fbinfo */
1316 da8xx_fb_info
->flags
= FBINFO_FLAG_DEFAULT
;
1317 da8xx_fb_info
->fix
= da8xx_fb_fix
;
1318 da8xx_fb_info
->var
= da8xx_fb_var
;
1319 da8xx_fb_info
->fbops
= &da8xx_fb_ops
;
1320 da8xx_fb_info
->pseudo_palette
= par
->pseudo_palette
;
1321 da8xx_fb_info
->fix
.visual
= (da8xx_fb_info
->var
.bits_per_pixel
<= 8) ?
1322 FB_VISUAL_PSEUDOCOLOR
: FB_VISUAL_TRUECOLOR
;
1324 ret
= fb_alloc_cmap(&da8xx_fb_info
->cmap
, PALETTE_SIZE
, 0);
1326 goto err_release_pl_mem
;
1327 da8xx_fb_info
->cmap
.len
= par
->palette_sz
;
1329 /* initialize var_screeninfo */
1330 da8xx_fb_var
.activate
= FB_ACTIVATE_FORCE
;
1331 fb_set_var(da8xx_fb_info
, &da8xx_fb_var
);
1333 dev_set_drvdata(&device
->dev
, da8xx_fb_info
);
1335 /* initialize the vsync wait queue */
1336 init_waitqueue_head(&par
->vsync_wait
);
1337 par
->vsync_timeout
= HZ
/ 5;
1338 par
->which_dma_channel_done
= -1;
1339 spin_lock_init(&par
->lock_for_chan_update
);
1341 /* Register the Frame Buffer */
1342 if (register_framebuffer(da8xx_fb_info
) < 0) {
1343 dev_err(&device
->dev
,
1344 "GLCD: Frame Buffer Registration Failed!\n");
1346 goto err_dealloc_cmap
;
1349 #ifdef CONFIG_CPU_FREQ
1350 ret
= lcd_da8xx_cpufreq_register(par
);
1352 dev_err(&device
->dev
, "failed to register cpufreq\n");
1357 if (lcd_revision
== LCD_VERSION_1
)
1358 lcdc_irq_handler
= lcdc_irq_handler_rev01
;
1360 lcdc_irq_handler
= lcdc_irq_handler_rev02
;
1362 ret
= request_irq(par
->irq
, lcdc_irq_handler
, 0,
1369 #ifdef CONFIG_CPU_FREQ
1370 lcd_da8xx_cpufreq_deregister(par
);
1373 unregister_framebuffer(da8xx_fb_info
);
1376 fb_dealloc_cmap(&da8xx_fb_info
->cmap
);
1379 dma_free_coherent(NULL
, PALETTE_SIZE
, par
->v_palette_base
,
1380 par
->p_palette_base
);
1383 dma_free_coherent(NULL
, par
->vram_size
, par
->vram_virt
, par
->vram_phys
);
1386 framebuffer_release(da8xx_fb_info
);
1389 clk_disable(fb_clk
);
1395 iounmap((void __iomem
*)da8xx_fb_reg_base
);
1398 release_mem_region(lcdc_regs
->start
, len
);
1404 static int fb_suspend(struct platform_device
*dev
, pm_message_t state
)
1406 struct fb_info
*info
= platform_get_drvdata(dev
);
1407 struct da8xx_fb_par
*par
= info
->par
;
1410 if (par
->panel_power_ctrl
)
1411 par
->panel_power_ctrl(0);
1413 fb_set_suspend(info
, 1);
1414 lcd_disable_raster();
1415 clk_disable(par
->lcdc_clk
);
1420 static int fb_resume(struct platform_device
*dev
)
1422 struct fb_info
*info
= platform_get_drvdata(dev
);
1423 struct da8xx_fb_par
*par
= info
->par
;
1426 clk_enable(par
->lcdc_clk
);
1427 lcd_enable_raster();
1429 if (par
->panel_power_ctrl
)
1430 par
->panel_power_ctrl(1);
1432 fb_set_suspend(info
, 0);
1438 #define fb_suspend NULL
1439 #define fb_resume NULL
1442 static struct platform_driver da8xx_fb_driver
= {
1444 .remove
= __devexit_p(fb_remove
),
1445 .suspend
= fb_suspend
,
1446 .resume
= fb_resume
,
1448 .name
= DRIVER_NAME
,
1449 .owner
= THIS_MODULE
,
1453 static int __init
da8xx_fb_init(void)
1455 return platform_driver_register(&da8xx_fb_driver
);
1458 static void __exit
da8xx_fb_cleanup(void)
1460 platform_driver_unregister(&da8xx_fb_driver
);
1463 module_init(da8xx_fb_init
);
1464 module_exit(da8xx_fb_cleanup
);
1466 MODULE_DESCRIPTION("Framebuffer driver for TI da8xx/omap-l1xx");
1467 MODULE_AUTHOR("Texas Instruments");
1468 MODULE_LICENSE("GPL");