Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
mxsfb.c File Reference

LCDIF driver for i.MX23 and i.MX28. More...

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/pinctrl/consumer.h>
#include <linux/mxsfb.h>

Go to the source code of this file.

Data Structures

struct  mxsfb_devdata
 
struct  mxsfb_info
 

Macros

#define DRIVER_NAME   "mxsfb"
 
#define REG_SET   4
 
#define REG_CLR   8
 
#define LCDC_CTRL   0x00
 
#define LCDC_CTRL1   0x10
 
#define LCDC_V4_CTRL2   0x20
 
#define LCDC_V3_TRANSFER_COUNT   0x20
 
#define LCDC_V4_TRANSFER_COUNT   0x30
 
#define LCDC_V4_CUR_BUF   0x40
 
#define LCDC_V4_NEXT_BUF   0x50
 
#define LCDC_V3_CUR_BUF   0x30
 
#define LCDC_V3_NEXT_BUF   0x40
 
#define LCDC_TIMING   0x60
 
#define LCDC_VDCTRL0   0x70
 
#define LCDC_VDCTRL1   0x80
 
#define LCDC_VDCTRL2   0x90
 
#define LCDC_VDCTRL3   0xa0
 
#define LCDC_VDCTRL4   0xb0
 
#define LCDC_DVICTRL0   0xc0
 
#define LCDC_DVICTRL1   0xd0
 
#define LCDC_DVICTRL2   0xe0
 
#define LCDC_DVICTRL3   0xf0
 
#define LCDC_DVICTRL4   0x100
 
#define LCDC_V4_DATA   0x180
 
#define LCDC_V3_DATA   0x1b0
 
#define LCDC_V4_DEBUG0   0x1d0
 
#define LCDC_V3_DEBUG0   0x1f0
 
#define CTRL_SFTRST   (1 << 31)
 
#define CTRL_CLKGATE   (1 << 30)
 
#define CTRL_BYPASS_COUNT   (1 << 19)
 
#define CTRL_VSYNC_MODE   (1 << 18)
 
#define CTRL_DOTCLK_MODE   (1 << 17)
 
#define CTRL_DATA_SELECT   (1 << 16)
 
#define CTRL_SET_BUS_WIDTH(x)   (((x) & 0x3) << 10)
 
#define CTRL_GET_BUS_WIDTH(x)   (((x) >> 10) & 0x3)
 
#define CTRL_SET_WORD_LENGTH(x)   (((x) & 0x3) << 8)
 
#define CTRL_GET_WORD_LENGTH(x)   (((x) >> 8) & 0x3)
 
#define CTRL_MASTER   (1 << 5)
 
#define CTRL_DF16   (1 << 3)
 
#define CTRL_DF18   (1 << 2)
 
#define CTRL_DF24   (1 << 1)
 
#define CTRL_RUN   (1 << 0)
 
#define CTRL1_FIFO_CLEAR   (1 << 21)
 
#define CTRL1_SET_BYTE_PACKAGING(x)   (((x) & 0xf) << 16)
 
#define CTRL1_GET_BYTE_PACKAGING(x)   (((x) >> 16) & 0xf)
 
#define TRANSFER_COUNT_SET_VCOUNT(x)   (((x) & 0xffff) << 16)
 
#define TRANSFER_COUNT_GET_VCOUNT(x)   (((x) >> 16) & 0xffff)
 
#define TRANSFER_COUNT_SET_HCOUNT(x)   ((x) & 0xffff)
 
#define TRANSFER_COUNT_GET_HCOUNT(x)   ((x) & 0xffff)
 
#define VDCTRL0_ENABLE_PRESENT   (1 << 28)
 
#define VDCTRL0_VSYNC_ACT_HIGH   (1 << 27)
 
#define VDCTRL0_HSYNC_ACT_HIGH   (1 << 26)
 
#define VDCTRL0_DOTCLK_ACT_FAILING   (1 << 25)
 
#define VDCTRL0_ENABLE_ACT_HIGH   (1 << 24)
 
#define VDCTRL0_VSYNC_PERIOD_UNIT   (1 << 21)
 
#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT   (1 << 20)
 
#define VDCTRL0_HALF_LINE   (1 << 19)
 
#define VDCTRL0_HALF_LINE_MODE   (1 << 18)
 
#define VDCTRL0_SET_VSYNC_PULSE_WIDTH(x)   ((x) & 0x3ffff)
 
#define VDCTRL0_GET_VSYNC_PULSE_WIDTH(x)   ((x) & 0x3ffff)
 
#define VDCTRL2_SET_HSYNC_PERIOD(x)   ((x) & 0x3ffff)
 
#define VDCTRL2_GET_HSYNC_PERIOD(x)   ((x) & 0x3ffff)
 
#define VDCTRL3_MUX_SYNC_SIGNALS   (1 << 29)
 
#define VDCTRL3_VSYNC_ONLY   (1 << 28)
 
#define SET_HOR_WAIT_CNT(x)   (((x) & 0xfff) << 16)
 
#define GET_HOR_WAIT_CNT(x)   (((x) >> 16) & 0xfff)
 
#define SET_VERT_WAIT_CNT(x)   ((x) & 0xffff)
 
#define GET_VERT_WAIT_CNT(x)   ((x) & 0xffff)
 
#define VDCTRL4_SET_DOTCLK_DLY(x)   (((x) & 0x7) << 29) /* v4 only */
 
#define VDCTRL4_GET_DOTCLK_DLY(x)   (((x) >> 29) & 0x7) /* v4 only */
 
#define VDCTRL4_SYNC_SIGNALS_ON   (1 << 18)
 
#define SET_DOTCLK_H_VALID_DATA_CNT(x)   ((x) & 0x3ffff)
 
#define DEBUG0_HSYNC   (1 < 26)
 
#define DEBUG0_VSYNC   (1 < 25)
 
#define MIN_XRES   120
 
#define MIN_YRES   120
 
#define RED   0
 
#define GREEN   1
 
#define BLUE   2
 
#define TRANSP   3
 
#define mxsfb_is_v3(host)   (host->devdata->ipversion == 3)
 
#define mxsfb_is_v4(host)   (host->devdata->ipversion == 4)
 
#define to_imxfb_host(x)   (container_of(x, struct mxsfb_info, fb_info))
 

Enumerations

enum  mxsfb_devtype { MXSFB_V3, MXSFB_V4 }
 

Functions

 MODULE_DEVICE_TABLE (platform, mxsfb_devtype)
 
 MODULE_DEVICE_TABLE (of, mxsfb_dt_ids)
 
 module_platform_driver (mxsfb_driver)
 
 MODULE_DESCRIPTION ("Freescale mxs framebuffer driver")
 
 MODULE_AUTHOR ("Sascha Hauer, Pengutronix")
 
 MODULE_LICENSE ("GPL")
 

Detailed Description

LCDIF driver for i.MX23 and i.MX28.

The LCDIF support four modes of operation

This driver depends on a correct setup of the pins used for this purpose (platform specific).

For the developer: Don't forget to set the data bus width to the display in the imx_fb_videomode structure. You will else end up with ugly colours. If you fight against jitter you can vary the clock delay. This is a feature of the i.MX28 and you can vary it between 2 ns ... 8 ns in 2 ns steps. Give the required value in the imx_fb_videomode structure.

Definition in file mxsfb.c.

Macro Definition Documentation

#define BLUE   2

Definition at line 142 of file mxsfb.c.

#define CTRL1_FIFO_CLEAR   (1 << 21)

Definition at line 97 of file mxsfb.c.

#define CTRL1_GET_BYTE_PACKAGING (   x)    (((x) >> 16) & 0xf)

Definition at line 99 of file mxsfb.c.

#define CTRL1_SET_BYTE_PACKAGING (   x)    (((x) & 0xf) << 16)

Definition at line 98 of file mxsfb.c.

#define CTRL_BYPASS_COUNT   (1 << 19)

Definition at line 83 of file mxsfb.c.

#define CTRL_CLKGATE   (1 << 30)

Definition at line 82 of file mxsfb.c.

#define CTRL_DATA_SELECT   (1 << 16)

Definition at line 86 of file mxsfb.c.

#define CTRL_DF16   (1 << 3)

Definition at line 92 of file mxsfb.c.

#define CTRL_DF18   (1 << 2)

Definition at line 93 of file mxsfb.c.

#define CTRL_DF24   (1 << 1)

Definition at line 94 of file mxsfb.c.

#define CTRL_DOTCLK_MODE   (1 << 17)

Definition at line 85 of file mxsfb.c.

#define CTRL_GET_BUS_WIDTH (   x)    (((x) >> 10) & 0x3)

Definition at line 88 of file mxsfb.c.

#define CTRL_GET_WORD_LENGTH (   x)    (((x) >> 8) & 0x3)

Definition at line 90 of file mxsfb.c.

#define CTRL_MASTER   (1 << 5)

Definition at line 91 of file mxsfb.c.

#define CTRL_RUN   (1 << 0)

Definition at line 95 of file mxsfb.c.

#define CTRL_SET_BUS_WIDTH (   x)    (((x) & 0x3) << 10)

Definition at line 87 of file mxsfb.c.

#define CTRL_SET_WORD_LENGTH (   x)    (((x) & 0x3) << 8)

Definition at line 89 of file mxsfb.c.

#define CTRL_SFTRST   (1 << 31)

Definition at line 81 of file mxsfb.c.

#define CTRL_VSYNC_MODE   (1 << 18)

Definition at line 84 of file mxsfb.c.

#define DEBUG0_HSYNC   (1 < 26)

Definition at line 134 of file mxsfb.c.

#define DEBUG0_VSYNC   (1 < 25)

Definition at line 135 of file mxsfb.c.

#define DRIVER_NAME   "mxsfb"

Definition at line 20 of file mxsfb.c.

#define GET_HOR_WAIT_CNT (   x)    (((x) >> 16) & 0xfff)

Definition at line 125 of file mxsfb.c.

#define GET_VERT_WAIT_CNT (   x)    ((x) & 0xffff)

Definition at line 127 of file mxsfb.c.

#define GREEN   1

Definition at line 141 of file mxsfb.c.

#define LCDC_CTRL   0x00

Definition at line 56 of file mxsfb.c.

#define LCDC_CTRL1   0x10

Definition at line 57 of file mxsfb.c.

#define LCDC_DVICTRL0   0xc0

Definition at line 71 of file mxsfb.c.

#define LCDC_DVICTRL1   0xd0

Definition at line 72 of file mxsfb.c.

#define LCDC_DVICTRL2   0xe0

Definition at line 73 of file mxsfb.c.

#define LCDC_DVICTRL3   0xf0

Definition at line 74 of file mxsfb.c.

#define LCDC_DVICTRL4   0x100

Definition at line 75 of file mxsfb.c.

#define LCDC_TIMING   0x60

Definition at line 65 of file mxsfb.c.

#define LCDC_V3_CUR_BUF   0x30

Definition at line 63 of file mxsfb.c.

#define LCDC_V3_DATA   0x1b0

Definition at line 77 of file mxsfb.c.

#define LCDC_V3_DEBUG0   0x1f0

Definition at line 79 of file mxsfb.c.

#define LCDC_V3_NEXT_BUF   0x40

Definition at line 64 of file mxsfb.c.

#define LCDC_V3_TRANSFER_COUNT   0x20

Definition at line 59 of file mxsfb.c.

#define LCDC_V4_CTRL2   0x20

Definition at line 58 of file mxsfb.c.

#define LCDC_V4_CUR_BUF   0x40

Definition at line 61 of file mxsfb.c.

#define LCDC_V4_DATA   0x180

Definition at line 76 of file mxsfb.c.

#define LCDC_V4_DEBUG0   0x1d0

Definition at line 78 of file mxsfb.c.

#define LCDC_V4_NEXT_BUF   0x50

Definition at line 62 of file mxsfb.c.

#define LCDC_V4_TRANSFER_COUNT   0x30

Definition at line 60 of file mxsfb.c.

#define LCDC_VDCTRL0   0x70

Definition at line 66 of file mxsfb.c.

#define LCDC_VDCTRL1   0x80

Definition at line 67 of file mxsfb.c.

#define LCDC_VDCTRL2   0x90

Definition at line 68 of file mxsfb.c.

#define LCDC_VDCTRL3   0xa0

Definition at line 69 of file mxsfb.c.

#define LCDC_VDCTRL4   0xb0

Definition at line 70 of file mxsfb.c.

#define MIN_XRES   120

Definition at line 137 of file mxsfb.c.

#define MIN_YRES   120

Definition at line 138 of file mxsfb.c.

#define mxsfb_is_v3 (   host)    (host->devdata->ipversion == 3)

Definition at line 174 of file mxsfb.c.

#define mxsfb_is_v4 (   host)    (host->devdata->ipversion == 4)

Definition at line 175 of file mxsfb.c.

#define RED   0

Definition at line 140 of file mxsfb.c.

#define REG_CLR   8

Definition at line 54 of file mxsfb.c.

#define REG_SET   4

Definition at line 53 of file mxsfb.c.

#define SET_DOTCLK_H_VALID_DATA_CNT (   x)    ((x) & 0x3ffff)

Definition at line 132 of file mxsfb.c.

#define SET_HOR_WAIT_CNT (   x)    (((x) & 0xfff) << 16)

Definition at line 124 of file mxsfb.c.

#define SET_VERT_WAIT_CNT (   x)    ((x) & 0xffff)

Definition at line 126 of file mxsfb.c.

#define to_imxfb_host (   x)    (container_of(x, struct mxsfb_info, fb_info))

Definition at line 198 of file mxsfb.c.

#define TRANSFER_COUNT_GET_HCOUNT (   x)    ((x) & 0xffff)

Definition at line 104 of file mxsfb.c.

#define TRANSFER_COUNT_GET_VCOUNT (   x)    (((x) >> 16) & 0xffff)

Definition at line 102 of file mxsfb.c.

#define TRANSFER_COUNT_SET_HCOUNT (   x)    ((x) & 0xffff)

Definition at line 103 of file mxsfb.c.

#define TRANSFER_COUNT_SET_VCOUNT (   x)    (((x) & 0xffff) << 16)

Definition at line 101 of file mxsfb.c.

#define TRANSP   3

Definition at line 143 of file mxsfb.c.

#define VDCTRL0_DOTCLK_ACT_FAILING   (1 << 25)

Definition at line 110 of file mxsfb.c.

#define VDCTRL0_ENABLE_ACT_HIGH   (1 << 24)

Definition at line 111 of file mxsfb.c.

#define VDCTRL0_ENABLE_PRESENT   (1 << 28)

Definition at line 107 of file mxsfb.c.

#define VDCTRL0_GET_VSYNC_PULSE_WIDTH (   x)    ((x) & 0x3ffff)

Definition at line 117 of file mxsfb.c.

#define VDCTRL0_HALF_LINE   (1 << 19)

Definition at line 114 of file mxsfb.c.

#define VDCTRL0_HALF_LINE_MODE   (1 << 18)

Definition at line 115 of file mxsfb.c.

#define VDCTRL0_HSYNC_ACT_HIGH   (1 << 26)

Definition at line 109 of file mxsfb.c.

#define VDCTRL0_SET_VSYNC_PULSE_WIDTH (   x)    ((x) & 0x3ffff)

Definition at line 116 of file mxsfb.c.

#define VDCTRL0_VSYNC_ACT_HIGH   (1 << 27)

Definition at line 108 of file mxsfb.c.

#define VDCTRL0_VSYNC_PERIOD_UNIT   (1 << 21)

Definition at line 112 of file mxsfb.c.

#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT   (1 << 20)

Definition at line 113 of file mxsfb.c.

#define VDCTRL2_GET_HSYNC_PERIOD (   x)    ((x) & 0x3ffff)

Definition at line 120 of file mxsfb.c.

#define VDCTRL2_SET_HSYNC_PERIOD (   x)    ((x) & 0x3ffff)

Definition at line 119 of file mxsfb.c.

#define VDCTRL3_MUX_SYNC_SIGNALS   (1 << 29)

Definition at line 122 of file mxsfb.c.

#define VDCTRL3_VSYNC_ONLY   (1 << 28)

Definition at line 123 of file mxsfb.c.

#define VDCTRL4_GET_DOTCLK_DLY (   x)    (((x) >> 29) & 0x7) /* v4 only */

Definition at line 130 of file mxsfb.c.

#define VDCTRL4_SET_DOTCLK_DLY (   x)    (((x) & 0x7) << 29) /* v4 only */

Definition at line 129 of file mxsfb.c.

#define VDCTRL4_SYNC_SIGNALS_ON   (1 << 18)

Definition at line 131 of file mxsfb.c.

Enumeration Type Documentation

Enumerator:
MXSFB_V3 
MXSFB_V4 

Definition at line 145 of file mxsfb.c.

Function Documentation

MODULE_AUTHOR ( "Sascha  Hauer,
Pengutronix"   
)
MODULE_DESCRIPTION ( "Freescale mxs framebuffer driver )
MODULE_DEVICE_TABLE ( platform  ,
mxsfb_devtype   
)
MODULE_DEVICE_TABLE ( of  ,
mxsfb_dt_ids   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( mxsfb_driver  )