atmel_lcdfb.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. /*
  2. * Driver for AT91/AT32 LCD Controller
  3. *
  4. * Copyright (C) 2007 Atmel Corporation
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file COPYING in the main directory of this archive for
  8. * more details.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/dma-mapping.h>
  13. #include <linux/interrupt.h>
  14. #include <linux/clk.h>
  15. #include <linux/fb.h>
  16. #include <linux/init.h>
  17. #include <linux/delay.h>
  18. #include <linux/backlight.h>
  19. #include <linux/gfp.h>
  20. #include <mach/board.h>
  21. #include <mach/cpu.h>
  22. #include <mach/gpio.h>
  23. #include <video/atmel_lcdc.h>
  24. #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
  25. #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
  26. /* configurable parameters */
  27. #define ATMEL_LCDC_CVAL_DEFAULT 0xc8
  28. #define ATMEL_LCDC_DMA_BURST_LEN 8 /* words */
  29. #define ATMEL_LCDC_FIFO_SIZE 512 /* words */
  30. #if defined(CONFIG_ARCH_AT91)
  31. #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \
  32. | FBINFO_PARTIAL_PAN_OK \
  33. | FBINFO_HWACCEL_YPAN)
  34. static inline void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
  35. struct fb_var_screeninfo *var)
  36. {
  37. }
  38. #elif defined(CONFIG_AVR32)
  39. #define ATMEL_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \
  40. | FBINFO_PARTIAL_PAN_OK \
  41. | FBINFO_HWACCEL_XPAN \
  42. | FBINFO_HWACCEL_YPAN)
  43. static void atmel_lcdfb_update_dma2d(struct atmel_lcdfb_info *sinfo,
  44. struct fb_var_screeninfo *var)
  45. {
  46. u32 dma2dcfg;
  47. u32 pixeloff;
  48. pixeloff = (var->xoffset * var->bits_per_pixel) & 0x1f;
  49. dma2dcfg = ((var->xres_virtual - var->xres) * var->bits_per_pixel) / 8;
  50. dma2dcfg |= pixeloff << ATMEL_LCDC_PIXELOFF_OFFSET;
  51. lcdc_writel(sinfo, ATMEL_LCDC_DMA2DCFG, dma2dcfg);
  52. /* Update configuration */
  53. lcdc_writel(sinfo, ATMEL_LCDC_DMACON,
  54. lcdc_readl(sinfo, ATMEL_LCDC_DMACON)
  55. | ATMEL_LCDC_DMAUPDT);
  56. }
  57. #endif
  58. static u32 contrast_ctr = ATMEL_LCDC_PS_DIV8
  59. | ATMEL_LCDC_POL_POSITIVE
  60. | ATMEL_LCDC_ENA_PWMENABLE;
  61. #ifdef CONFIG_BACKLIGHT_ATMEL_LCDC
  62. /* some bl->props field just changed */
  63. static int atmel_bl_update_status(struct backlight_device *bl)
  64. {
  65. struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
  66. int power = sinfo->bl_power;
  67. int brightness = bl->props.brightness;
  68. /* REVISIT there may be a meaningful difference between
  69. * fb_blank and power ... there seem to be some cases
  70. * this doesn't handle correctly.
  71. */
  72. if (bl->props.fb_blank != sinfo->bl_power)
  73. power = bl->props.fb_blank;
  74. else if (bl->props.power != sinfo->bl_power)
  75. power = bl->props.power;
  76. if (brightness < 0 && power == FB_BLANK_UNBLANK)
  77. brightness = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
  78. else if (power != FB_BLANK_UNBLANK)
  79. brightness = 0;
  80. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
  81. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
  82. brightness ? contrast_ctr : 0);
  83. bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
  84. return 0;
  85. }
  86. static int atmel_bl_get_brightness(struct backlight_device *bl)
  87. {
  88. struct atmel_lcdfb_info *sinfo = bl_get_data(bl);
  89. return lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
  90. }
  91. static const struct backlight_ops atmel_lcdc_bl_ops = {
  92. .update_status = atmel_bl_update_status,
  93. .get_brightness = atmel_bl_get_brightness,
  94. };
  95. static void init_backlight(struct atmel_lcdfb_info *sinfo)
  96. {
  97. struct backlight_properties props;
  98. struct backlight_device *bl;
  99. sinfo->bl_power = FB_BLANK_UNBLANK;
  100. if (sinfo->backlight)
  101. return;
  102. memset(&props, 0, sizeof(struct backlight_properties));
  103. props.max_brightness = 0xff;
  104. bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
  105. &atmel_lcdc_bl_ops, &props);
  106. if (IS_ERR(bl)) {
  107. dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
  108. PTR_ERR(bl));
  109. return;
  110. }
  111. sinfo->backlight = bl;
  112. bl->props.power = FB_BLANK_UNBLANK;
  113. bl->props.fb_blank = FB_BLANK_UNBLANK;
  114. bl->props.brightness = atmel_bl_get_brightness(bl);
  115. }
  116. static void exit_backlight(struct atmel_lcdfb_info *sinfo)
  117. {
  118. if (sinfo->backlight)
  119. backlight_device_unregister(sinfo->backlight);
  120. }
  121. #else
  122. static void init_backlight(struct atmel_lcdfb_info *sinfo)
  123. {
  124. dev_warn(&sinfo->pdev->dev, "backlight control is not available\n");
  125. }
  126. static void exit_backlight(struct atmel_lcdfb_info *sinfo)
  127. {
  128. }
  129. #endif
  130. static void init_contrast(struct atmel_lcdfb_info *sinfo)
  131. {
  132. /* contrast pwm can be 'inverted' */
  133. if (sinfo->lcdcon_pol_negative)
  134. contrast_ctr &= ~(ATMEL_LCDC_POL_POSITIVE);
  135. /* have some default contrast/backlight settings */
  136. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
  137. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, ATMEL_LCDC_CVAL_DEFAULT);
  138. if (sinfo->lcdcon_is_backlight)
  139. init_backlight(sinfo);
  140. }
  141. static struct fb_fix_screeninfo atmel_lcdfb_fix __initdata = {
  142. .type = FB_TYPE_PACKED_PIXELS,
  143. .visual = FB_VISUAL_TRUECOLOR,
  144. .xpanstep = 0,
  145. .ypanstep = 1,
  146. .ywrapstep = 0,
  147. .accel = FB_ACCEL_NONE,
  148. };
  149. static unsigned long compute_hozval(unsigned long xres, unsigned long lcdcon2)
  150. {
  151. unsigned long value;
  152. if (!(cpu_is_at91sam9261() || cpu_is_at91sam9g10()
  153. || cpu_is_at32ap7000()))
  154. return xres;
  155. value = xres;
  156. if ((lcdcon2 & ATMEL_LCDC_DISTYPE) != ATMEL_LCDC_DISTYPE_TFT) {
  157. /* STN display */
  158. if ((lcdcon2 & ATMEL_LCDC_DISTYPE) == ATMEL_LCDC_DISTYPE_STNCOLOR) {
  159. value *= 3;
  160. }
  161. if ( (lcdcon2 & ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_4
  162. || ( (lcdcon2 & ATMEL_LCDC_IFWIDTH) == ATMEL_LCDC_IFWIDTH_8
  163. && (lcdcon2 & ATMEL_LCDC_SCANMOD) == ATMEL_LCDC_SCANMOD_DUAL ))
  164. value = DIV_ROUND_UP(value, 4);
  165. else
  166. value = DIV_ROUND_UP(value, 8);
  167. }
  168. return value;
  169. }
  170. static void atmel_lcdfb_stop_nowait(struct atmel_lcdfb_info *sinfo)
  171. {
  172. /* Turn off the LCD controller and the DMA controller */
  173. lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
  174. sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET);
  175. /* Wait for the LCDC core to become idle */
  176. while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY)
  177. msleep(10);
  178. lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0);
  179. }
  180. static void atmel_lcdfb_stop(struct atmel_lcdfb_info *sinfo)
  181. {
  182. atmel_lcdfb_stop_nowait(sinfo);
  183. /* Wait for DMA engine to become idle... */
  184. while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
  185. msleep(10);
  186. }
  187. static void atmel_lcdfb_start(struct atmel_lcdfb_info *sinfo)
  188. {
  189. lcdc_writel(sinfo, ATMEL_LCDC_DMACON, sinfo->default_dmacon);
  190. lcdc_writel(sinfo, ATMEL_LCDC_PWRCON,
  191. (sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET)
  192. | ATMEL_LCDC_PWR);
  193. }
  194. static void atmel_lcdfb_update_dma(struct fb_info *info,
  195. struct fb_var_screeninfo *var)
  196. {
  197. struct atmel_lcdfb_info *sinfo = info->par;
  198. struct fb_fix_screeninfo *fix = &info->fix;
  199. unsigned long dma_addr;
  200. dma_addr = (fix->smem_start + var->yoffset * fix->line_length
  201. + var->xoffset * var->bits_per_pixel / 8);
  202. dma_addr &= ~3UL;
  203. /* Set framebuffer DMA base address and pixel offset */
  204. lcdc_writel(sinfo, ATMEL_LCDC_DMABADDR1, dma_addr);
  205. atmel_lcdfb_update_dma2d(sinfo, var);
  206. }
  207. static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo)
  208. {
  209. struct fb_info *info = sinfo->info;
  210. dma_free_writecombine(info->device, info->fix.smem_len,
  211. info->screen_base, info->fix.smem_start);
  212. }
  213. /**
  214. * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory
  215. * @sinfo: the frame buffer to allocate memory for
  216. *
  217. * This function is called only from the atmel_lcdfb_probe()
  218. * so no locking by fb_info->mm_lock around smem_len setting is needed.
  219. */
  220. static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo)
  221. {
  222. struct fb_info *info = sinfo->info;
  223. struct fb_var_screeninfo *var = &info->var;
  224. unsigned int smem_len;
  225. smem_len = (var->xres_virtual * var->yres_virtual
  226. * ((var->bits_per_pixel + 7) / 8));
  227. info->fix.smem_len = max(smem_len, sinfo->smem_len);
  228. info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len,
  229. (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL);
  230. if (!info->screen_base) {
  231. return -ENOMEM;
  232. }
  233. memset(info->screen_base, 0, info->fix.smem_len);
  234. return 0;
  235. }
  236. static const struct fb_videomode *atmel_lcdfb_choose_mode(struct fb_var_screeninfo *var,
  237. struct fb_info *info)
  238. {
  239. struct fb_videomode varfbmode;
  240. const struct fb_videomode *fbmode = NULL;
  241. fb_var_to_videomode(&varfbmode, var);
  242. fbmode = fb_find_nearest_mode(&varfbmode, &info->modelist);
  243. if (fbmode)
  244. fb_videomode_to_var(var, fbmode);
  245. return fbmode;
  246. }
  247. /**
  248. * atmel_lcdfb_check_var - Validates a var passed in.
  249. * @var: frame buffer variable screen structure
  250. * @info: frame buffer structure that represents a single frame buffer
  251. *
  252. * Checks to see if the hardware supports the state requested by
  253. * var passed in. This function does not alter the hardware
  254. * state!!! This means the data stored in struct fb_info and
  255. * struct atmel_lcdfb_info do not change. This includes the var
  256. * inside of struct fb_info. Do NOT change these. This function
  257. * can be called on its own if we intent to only test a mode and
  258. * not actually set it. The stuff in modedb.c is a example of
  259. * this. If the var passed in is slightly off by what the
  260. * hardware can support then we alter the var PASSED in to what
  261. * we can do. If the hardware doesn't support mode change a
  262. * -EINVAL will be returned by the upper layers. You don't need
  263. * to implement this function then. If you hardware doesn't
  264. * support changing the resolution then this function is not
  265. * needed. In this case the driver would just provide a var that
  266. * represents the static state the screen is in.
  267. *
  268. * Returns negative errno on error, or zero on success.
  269. */
  270. static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
  271. struct fb_info *info)
  272. {
  273. struct device *dev = info->device;
  274. struct atmel_lcdfb_info *sinfo = info->par;
  275. unsigned long clk_value_khz;
  276. clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
  277. dev_dbg(dev, "%s:\n", __func__);
  278. if (!(var->pixclock && var->bits_per_pixel)) {
  279. /* choose a suitable mode if possible */
  280. if (!atmel_lcdfb_choose_mode(var, info)) {
  281. dev_err(dev, "needed value not specified\n");
  282. return -EINVAL;
  283. }
  284. }
  285. dev_dbg(dev, " resolution: %ux%u\n", var->xres, var->yres);
  286. dev_dbg(dev, " pixclk: %lu KHz\n", PICOS2KHZ(var->pixclock));
  287. dev_dbg(dev, " bpp: %u\n", var->bits_per_pixel);
  288. dev_dbg(dev, " clk: %lu KHz\n", clk_value_khz);
  289. if (PICOS2KHZ(var->pixclock) > clk_value_khz) {
  290. dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock));
  291. return -EINVAL;
  292. }
  293. /* Do not allow to have real resoulution larger than virtual */
  294. if (var->xres > var->xres_virtual)
  295. var->xres_virtual = var->xres;
  296. if (var->yres > var->yres_virtual)
  297. var->yres_virtual = var->yres;
  298. /* Force same alignment for each line */
  299. var->xres = (var->xres + 3) & ~3UL;
  300. var->xres_virtual = (var->xres_virtual + 3) & ~3UL;
  301. var->red.msb_right = var->green.msb_right = var->blue.msb_right = 0;
  302. var->transp.msb_right = 0;
  303. var->transp.offset = var->transp.length = 0;
  304. var->xoffset = var->yoffset = 0;
  305. if (info->fix.smem_len) {
  306. unsigned int smem_len = (var->xres_virtual * var->yres_virtual
  307. * ((var->bits_per_pixel + 7) / 8));
  308. if (smem_len > info->fix.smem_len)
  309. return -EINVAL;
  310. }
  311. /* Saturate vertical and horizontal timings at maximum values */
  312. var->vsync_len = min_t(u32, var->vsync_len,
  313. (ATMEL_LCDC_VPW >> ATMEL_LCDC_VPW_OFFSET) + 1);
  314. var->upper_margin = min_t(u32, var->upper_margin,
  315. ATMEL_LCDC_VBP >> ATMEL_LCDC_VBP_OFFSET);
  316. var->lower_margin = min_t(u32, var->lower_margin,
  317. ATMEL_LCDC_VFP);
  318. var->right_margin = min_t(u32, var->right_margin,
  319. (ATMEL_LCDC_HFP >> ATMEL_LCDC_HFP_OFFSET) + 1);
  320. var->hsync_len = min_t(u32, var->hsync_len,
  321. (ATMEL_LCDC_HPW >> ATMEL_LCDC_HPW_OFFSET) + 1);
  322. var->left_margin = min_t(u32, var->left_margin,
  323. ATMEL_LCDC_HBP + 1);
  324. /* Some parameters can't be zero */
  325. var->vsync_len = max_t(u32, var->vsync_len, 1);
  326. var->right_margin = max_t(u32, var->right_margin, 1);
  327. var->hsync_len = max_t(u32, var->hsync_len, 1);
  328. var->left_margin = max_t(u32, var->left_margin, 1);
  329. switch (var->bits_per_pixel) {
  330. case 1:
  331. case 2:
  332. case 4:
  333. case 8:
  334. var->red.offset = var->green.offset = var->blue.offset = 0;
  335. var->red.length = var->green.length = var->blue.length
  336. = var->bits_per_pixel;
  337. break;
  338. case 15:
  339. case 16:
  340. if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
  341. /* RGB:565 mode */
  342. var->red.offset = 11;
  343. var->blue.offset = 0;
  344. var->green.length = 6;
  345. } else if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB555) {
  346. var->red.offset = 10;
  347. var->blue.offset = 0;
  348. var->green.length = 5;
  349. } else {
  350. /* BGR:555 mode */
  351. var->red.offset = 0;
  352. var->blue.offset = 10;
  353. var->green.length = 5;
  354. }
  355. var->green.offset = 5;
  356. var->red.length = var->blue.length = 5;
  357. break;
  358. case 32:
  359. var->transp.offset = 24;
  360. var->transp.length = 8;
  361. /* fall through */
  362. case 24:
  363. if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
  364. /* RGB:888 mode */
  365. var->red.offset = 16;
  366. var->blue.offset = 0;
  367. } else {
  368. /* BGR:888 mode */
  369. var->red.offset = 0;
  370. var->blue.offset = 16;
  371. }
  372. var->green.offset = 8;
  373. var->red.length = var->green.length = var->blue.length = 8;
  374. break;
  375. default:
  376. dev_err(dev, "color depth %d not supported\n",
  377. var->bits_per_pixel);
  378. return -EINVAL;
  379. }
  380. return 0;
  381. }
  382. /*
  383. * LCD reset sequence
  384. */
  385. static void atmel_lcdfb_reset(struct atmel_lcdfb_info *sinfo)
  386. {
  387. might_sleep();
  388. atmel_lcdfb_stop(sinfo);
  389. atmel_lcdfb_start(sinfo);
  390. }
  391. /**
  392. * atmel_lcdfb_set_par - Alters the hardware state.
  393. * @info: frame buffer structure that represents a single frame buffer
  394. *
  395. * Using the fb_var_screeninfo in fb_info we set the resolution
  396. * of the this particular framebuffer. This function alters the
  397. * par AND the fb_fix_screeninfo stored in fb_info. It doesn't
  398. * not alter var in fb_info since we are using that data. This
  399. * means we depend on the data in var inside fb_info to be
  400. * supported by the hardware. atmel_lcdfb_check_var is always called
  401. * before atmel_lcdfb_set_par to ensure this. Again if you can't
  402. * change the resolution you don't need this function.
  403. *
  404. */
  405. static int atmel_lcdfb_set_par(struct fb_info *info)
  406. {
  407. struct atmel_lcdfb_info *sinfo = info->par;
  408. unsigned long hozval_linesz;
  409. unsigned long value;
  410. unsigned long clk_value_khz;
  411. unsigned long bits_per_line;
  412. unsigned long pix_factor = 2;
  413. might_sleep();
  414. dev_dbg(info->device, "%s:\n", __func__);
  415. dev_dbg(info->device, " * resolution: %ux%u (%ux%u virtual)\n",
  416. info->var.xres, info->var.yres,
  417. info->var.xres_virtual, info->var.yres_virtual);
  418. atmel_lcdfb_stop_nowait(sinfo);
  419. if (info->var.bits_per_pixel == 1)
  420. info->fix.visual = FB_VISUAL_MONO01;
  421. else if (info->var.bits_per_pixel <= 8)
  422. info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
  423. else
  424. info->fix.visual = FB_VISUAL_TRUECOLOR;
  425. bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel;
  426. info->fix.line_length = DIV_ROUND_UP(bits_per_line, 8);
  427. /* Re-initialize the DMA engine... */
  428. dev_dbg(info->device, " * update DMA engine\n");
  429. atmel_lcdfb_update_dma(info, &info->var);
  430. /* ...set frame size and burst length = 8 words (?) */
  431. value = (info->var.yres * info->var.xres * info->var.bits_per_pixel) / 32;
  432. value |= ((ATMEL_LCDC_DMA_BURST_LEN - 1) << ATMEL_LCDC_BLENGTH_OFFSET);
  433. lcdc_writel(sinfo, ATMEL_LCDC_DMAFRMCFG, value);
  434. /* Now, the LCDC core... */
  435. /* Set pixel clock */
  436. if (cpu_is_at91sam9g45() && !cpu_is_at91sam9g45es())
  437. pix_factor = 1;
  438. clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
  439. value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock));
  440. if (value < pix_factor) {
  441. dev_notice(info->device, "Bypassing pixel clock divider\n");
  442. lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
  443. } else {
  444. value = (value / pix_factor) - 1;
  445. dev_dbg(info->device, " * programming CLKVAL = 0x%08lx\n",
  446. value);
  447. lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1,
  448. value << ATMEL_LCDC_CLKVAL_OFFSET);
  449. info->var.pixclock =
  450. KHZ2PICOS(clk_value_khz / (pix_factor * (value + 1)));
  451. dev_dbg(info->device, " updated pixclk: %lu KHz\n",
  452. PICOS2KHZ(info->var.pixclock));
  453. }
  454. /* Initialize control register 2 */
  455. value = sinfo->default_lcdcon2;
  456. if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
  457. value |= ATMEL_LCDC_INVLINE_INVERTED;
  458. if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT))
  459. value |= ATMEL_LCDC_INVFRAME_INVERTED;
  460. switch (info->var.bits_per_pixel) {
  461. case 1: value |= ATMEL_LCDC_PIXELSIZE_1; break;
  462. case 2: value |= ATMEL_LCDC_PIXELSIZE_2; break;
  463. case 4: value |= ATMEL_LCDC_PIXELSIZE_4; break;
  464. case 8: value |= ATMEL_LCDC_PIXELSIZE_8; break;
  465. case 15: /* fall through */
  466. case 16: value |= ATMEL_LCDC_PIXELSIZE_16; break;
  467. case 24: value |= ATMEL_LCDC_PIXELSIZE_24; break;
  468. case 32: value |= ATMEL_LCDC_PIXELSIZE_32; break;
  469. default: BUG(); break;
  470. }
  471. dev_dbg(info->device, " * LCDCON2 = %08lx\n", value);
  472. lcdc_writel(sinfo, ATMEL_LCDC_LCDCON2, value);
  473. /* Vertical timing */
  474. value = (info->var.vsync_len - 1) << ATMEL_LCDC_VPW_OFFSET;
  475. value |= info->var.upper_margin << ATMEL_LCDC_VBP_OFFSET;
  476. value |= info->var.lower_margin;
  477. dev_dbg(info->device, " * LCDTIM1 = %08lx\n", value);
  478. lcdc_writel(sinfo, ATMEL_LCDC_TIM1, value);
  479. /* Horizontal timing */
  480. value = (info->var.right_margin - 1) << ATMEL_LCDC_HFP_OFFSET;
  481. value |= (info->var.hsync_len - 1) << ATMEL_LCDC_HPW_OFFSET;
  482. value |= (info->var.left_margin - 1);
  483. dev_dbg(info->device, " * LCDTIM2 = %08lx\n", value);
  484. lcdc_writel(sinfo, ATMEL_LCDC_TIM2, value);
  485. /* Horizontal value (aka line size) */
  486. hozval_linesz = compute_hozval(info->var.xres,
  487. lcdc_readl(sinfo, ATMEL_LCDC_LCDCON2));
  488. /* Display size */
  489. value = (hozval_linesz - 1) << ATMEL_LCDC_HOZVAL_OFFSET;
  490. value |= info->var.yres - 1;
  491. dev_dbg(info->device, " * LCDFRMCFG = %08lx\n", value);
  492. lcdc_writel(sinfo, ATMEL_LCDC_LCDFRMCFG, value);
  493. /* FIFO Threshold: Use formula from data sheet */
  494. value = ATMEL_LCDC_FIFO_SIZE - (2 * ATMEL_LCDC_DMA_BURST_LEN + 3);
  495. lcdc_writel(sinfo, ATMEL_LCDC_FIFO, value);
  496. /* Toggle LCD_MODE every frame */
  497. lcdc_writel(sinfo, ATMEL_LCDC_MVAL, 0);
  498. /* Disable all interrupts */
  499. lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
  500. /* Enable FIFO & DMA errors */
  501. lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
  502. /* ...wait for DMA engine to become idle... */
  503. while (lcdc_readl(sinfo, ATMEL_LCDC_DMACON) & ATMEL_LCDC_DMABUSY)
  504. msleep(10);
  505. atmel_lcdfb_start(sinfo);
  506. dev_dbg(info->device, " * DONE\n");
  507. return 0;
  508. }
  509. static inline unsigned int chan_to_field(unsigned int chan, const struct fb_bitfield *bf)
  510. {
  511. chan &= 0xffff;
  512. chan >>= 16 - bf->length;
  513. return chan << bf->offset;
  514. }
  515. /**
  516. * atmel_lcdfb_setcolreg - Optional function. Sets a color register.
  517. * @regno: Which register in the CLUT we are programming
  518. * @red: The red value which can be up to 16 bits wide
  519. * @green: The green value which can be up to 16 bits wide
  520. * @blue: The blue value which can be up to 16 bits wide.
  521. * @transp: If supported the alpha value which can be up to 16 bits wide.
  522. * @info: frame buffer info structure
  523. *
  524. * Set a single color register. The values supplied have a 16 bit
  525. * magnitude which needs to be scaled in this function for the hardware.
  526. * Things to take into consideration are how many color registers, if
  527. * any, are supported with the current color visual. With truecolor mode
  528. * no color palettes are supported. Here a psuedo palette is created
  529. * which we store the value in pseudo_palette in struct fb_info. For
  530. * pseudocolor mode we have a limited color palette. To deal with this
  531. * we can program what color is displayed for a particular pixel value.
  532. * DirectColor is similar in that we can program each color field. If
  533. * we have a static colormap we don't need to implement this function.
  534. *
  535. * Returns negative errno on error, or zero on success. In an
  536. * ideal world, this would have been the case, but as it turns
  537. * out, the other drivers return 1 on failure, so that's what
  538. * we're going to do.
  539. */
  540. static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
  541. unsigned int green, unsigned int blue,
  542. unsigned int transp, struct fb_info *info)
  543. {
  544. struct atmel_lcdfb_info *sinfo = info->par;
  545. unsigned int val;
  546. u32 *pal;
  547. int ret = 1;
  548. if (info->var.grayscale)
  549. red = green = blue = (19595 * red + 38470 * green
  550. + 7471 * blue) >> 16;
  551. switch (info->fix.visual) {
  552. case FB_VISUAL_TRUECOLOR:
  553. if (regno < 16) {
  554. pal = info->pseudo_palette;
  555. val = chan_to_field(red, &info->var.red);
  556. val |= chan_to_field(green, &info->var.green);
  557. val |= chan_to_field(blue, &info->var.blue);
  558. pal[regno] = val;
  559. ret = 0;
  560. }
  561. break;
  562. case FB_VISUAL_PSEUDOCOLOR:
  563. if (regno < 256) {
  564. val = ((red >> 11) & 0x001f);
  565. val |= ((green >> 6) & 0x03e0);
  566. val |= ((blue >> 1) & 0x7c00);
  567. /*
  568. * TODO: intensity bit. Maybe something like
  569. * ~(red[10] ^ green[10] ^ blue[10]) & 1
  570. */
  571. lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
  572. ret = 0;
  573. }
  574. break;
  575. case FB_VISUAL_MONO01:
  576. if (regno < 2) {
  577. val = (regno == 0) ? 0x00 : 0x1F;
  578. lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
  579. ret = 0;
  580. }
  581. break;
  582. }
  583. return ret;
  584. }
  585. static int atmel_lcdfb_pan_display(struct fb_var_screeninfo *var,
  586. struct fb_info *info)
  587. {
  588. dev_dbg(info->device, "%s\n", __func__);
  589. atmel_lcdfb_update_dma(info, var);
  590. return 0;
  591. }
  592. static struct fb_ops atmel_lcdfb_ops = {
  593. .owner = THIS_MODULE,
  594. .fb_check_var = atmel_lcdfb_check_var,
  595. .fb_set_par = atmel_lcdfb_set_par,
  596. .fb_setcolreg = atmel_lcdfb_setcolreg,
  597. .fb_pan_display = atmel_lcdfb_pan_display,
  598. .fb_fillrect = cfb_fillrect,
  599. .fb_copyarea = cfb_copyarea,
  600. .fb_imageblit = cfb_imageblit,
  601. };
  602. static irqreturn_t atmel_lcdfb_interrupt(int irq, void *dev_id)
  603. {
  604. struct fb_info *info = dev_id;
  605. struct atmel_lcdfb_info *sinfo = info->par;
  606. u32 status;
  607. status = lcdc_readl(sinfo, ATMEL_LCDC_ISR);
  608. if (status & ATMEL_LCDC_UFLWI) {
  609. dev_warn(info->device, "FIFO underflow %#x\n", status);
  610. /* reset DMA and FIFO to avoid screen shifting */
  611. schedule_work(&sinfo->task);
  612. }
  613. lcdc_writel(sinfo, ATMEL_LCDC_ICR, status);
  614. return IRQ_HANDLED;
  615. }
  616. /*
  617. * LCD controller task (to reset the LCD)
  618. */
  619. static void atmel_lcdfb_task(struct work_struct *work)
  620. {
  621. struct atmel_lcdfb_info *sinfo =
  622. container_of(work, struct atmel_lcdfb_info, task);
  623. atmel_lcdfb_reset(sinfo);
  624. }
  625. static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo)
  626. {
  627. struct fb_info *info = sinfo->info;
  628. int ret = 0;
  629. info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
  630. dev_info(info->device,
  631. "%luKiB frame buffer at %08lx (mapped at %p)\n",
  632. (unsigned long)info->fix.smem_len / 1024,
  633. (unsigned long)info->fix.smem_start,
  634. info->screen_base);
  635. /* Allocate colormap */
  636. ret = fb_alloc_cmap(&info->cmap, 256, 0);
  637. if (ret < 0)
  638. dev_err(info->device, "Alloc color map failed\n");
  639. return ret;
  640. }
  641. static void atmel_lcdfb_start_clock(struct atmel_lcdfb_info *sinfo)
  642. {
  643. if (sinfo->bus_clk)
  644. clk_enable(sinfo->bus_clk);
  645. clk_enable(sinfo->lcdc_clk);
  646. }
  647. static void atmel_lcdfb_stop_clock(struct atmel_lcdfb_info *sinfo)
  648. {
  649. if (sinfo->bus_clk)
  650. clk_disable(sinfo->bus_clk);
  651. clk_disable(sinfo->lcdc_clk);
  652. }
  653. static int __init atmel_lcdfb_probe(struct platform_device *pdev)
  654. {
  655. struct device *dev = &pdev->dev;
  656. struct fb_info *info;
  657. struct atmel_lcdfb_info *sinfo;
  658. struct atmel_lcdfb_info *pdata_sinfo;
  659. struct fb_videomode fbmode;
  660. struct resource *regs = NULL;
  661. struct resource *map = NULL;
  662. int ret;
  663. dev_dbg(dev, "%s BEGIN\n", __func__);
  664. ret = -ENOMEM;
  665. info = framebuffer_alloc(sizeof(struct atmel_lcdfb_info), dev);
  666. if (!info) {
  667. dev_err(dev, "cannot allocate memory\n");
  668. goto out;
  669. }
  670. sinfo = info->par;
  671. if (dev->platform_data) {
  672. pdata_sinfo = (struct atmel_lcdfb_info *)dev->platform_data;
  673. sinfo->default_bpp = pdata_sinfo->default_bpp;
  674. sinfo->default_dmacon = pdata_sinfo->default_dmacon;
  675. sinfo->default_lcdcon2 = pdata_sinfo->default_lcdcon2;
  676. sinfo->default_monspecs = pdata_sinfo->default_monspecs;
  677. sinfo->atmel_lcdfb_power_control = pdata_sinfo->atmel_lcdfb_power_control;
  678. sinfo->guard_time = pdata_sinfo->guard_time;
  679. sinfo->smem_len = pdata_sinfo->smem_len;
  680. sinfo->lcdcon_is_backlight = pdata_sinfo->lcdcon_is_backlight;
  681. sinfo->lcdcon_pol_negative = pdata_sinfo->lcdcon_pol_negative;
  682. sinfo->lcd_wiring_mode = pdata_sinfo->lcd_wiring_mode;
  683. } else {
  684. dev_err(dev, "cannot get default configuration\n");
  685. goto free_info;
  686. }
  687. sinfo->info = info;
  688. sinfo->pdev = pdev;
  689. strcpy(info->fix.id, sinfo->pdev->name);
  690. info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;
  691. info->pseudo_palette = sinfo->pseudo_palette;
  692. info->fbops = &atmel_lcdfb_ops;
  693. memcpy(&info->monspecs, sinfo->default_monspecs, sizeof(info->monspecs));
  694. info->fix = atmel_lcdfb_fix;
  695. /* Enable LCDC Clocks */
  696. if (cpu_is_at91sam9261() || cpu_is_at91sam9g10()
  697. || cpu_is_at32ap7000()) {
  698. sinfo->bus_clk = clk_get(dev, "hck1");
  699. if (IS_ERR(sinfo->bus_clk)) {
  700. ret = PTR_ERR(sinfo->bus_clk);
  701. goto free_info;
  702. }
  703. }
  704. sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
  705. if (IS_ERR(sinfo->lcdc_clk)) {
  706. ret = PTR_ERR(sinfo->lcdc_clk);
  707. goto put_bus_clk;
  708. }
  709. atmel_lcdfb_start_clock(sinfo);
  710. ret = fb_find_mode(&info->var, info, NULL, info->monspecs.modedb,
  711. info->monspecs.modedb_len, info->monspecs.modedb,
  712. sinfo->default_bpp);
  713. if (!ret) {
  714. dev_err(dev, "no suitable video mode found\n");
  715. goto stop_clk;
  716. }
  717. regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  718. if (!regs) {
  719. dev_err(dev, "resources unusable\n");
  720. ret = -ENXIO;
  721. goto stop_clk;
  722. }
  723. sinfo->irq_base = platform_get_irq(pdev, 0);
  724. if (sinfo->irq_base < 0) {
  725. dev_err(dev, "unable to get irq\n");
  726. ret = sinfo->irq_base;
  727. goto stop_clk;
  728. }
  729. /* Initialize video memory */
  730. map = platform_get_resource(pdev, IORESOURCE_MEM, 1);
  731. if (map) {
  732. /* use a pre-allocated memory buffer */
  733. info->fix.smem_start = map->start;
  734. info->fix.smem_len = map->end - map->start + 1;
  735. if (!request_mem_region(info->fix.smem_start,
  736. info->fix.smem_len, pdev->name)) {
  737. ret = -EBUSY;
  738. goto stop_clk;
  739. }
  740. info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
  741. if (!info->screen_base)
  742. goto release_intmem;
  743. /*
  744. * Don't clear the framebuffer -- someone may have set
  745. * up a splash image.
  746. */
  747. } else {
  748. /* alocate memory buffer */
  749. ret = atmel_lcdfb_alloc_video_memory(sinfo);
  750. if (ret < 0) {
  751. dev_err(dev, "cannot allocate framebuffer: %d\n", ret);
  752. goto stop_clk;
  753. }
  754. }
  755. /* LCDC registers */
  756. info->fix.mmio_start = regs->start;
  757. info->fix.mmio_len = regs->end - regs->start + 1;
  758. if (!request_mem_region(info->fix.mmio_start,
  759. info->fix.mmio_len, pdev->name)) {
  760. ret = -EBUSY;
  761. goto free_fb;
  762. }
  763. sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
  764. if (!sinfo->mmio) {
  765. dev_err(dev, "cannot map LCDC registers\n");
  766. goto release_mem;
  767. }
  768. /* Initialize PWM for contrast or backlight ("off") */
  769. init_contrast(sinfo);
  770. /* interrupt */
  771. ret = request_irq(sinfo->irq_base, atmel_lcdfb_interrupt, 0, pdev->name, info);
  772. if (ret) {
  773. dev_err(dev, "request_irq failed: %d\n", ret);
  774. goto unmap_mmio;
  775. }
  776. /* Some operations on the LCDC might sleep and
  777. * require a preemptible task context */
  778. INIT_WORK(&sinfo->task, atmel_lcdfb_task);
  779. ret = atmel_lcdfb_init_fbinfo(sinfo);
  780. if (ret < 0) {
  781. dev_err(dev, "init fbinfo failed: %d\n", ret);
  782. goto unregister_irqs;
  783. }
  784. /*
  785. * This makes sure that our colour bitfield
  786. * descriptors are correctly initialised.
  787. */
  788. atmel_lcdfb_check_var(&info->var, info);
  789. ret = fb_set_var(info, &info->var);
  790. if (ret) {
  791. dev_warn(dev, "unable to set display parameters\n");
  792. goto free_cmap;
  793. }
  794. dev_set_drvdata(dev, info);
  795. /*
  796. * Tell the world that we're ready to go
  797. */
  798. ret = register_framebuffer(info);
  799. if (ret < 0) {
  800. dev_err(dev, "failed to register framebuffer device: %d\n", ret);
  801. goto reset_drvdata;
  802. }
  803. /* add selected videomode to modelist */
  804. fb_var_to_videomode(&fbmode, &info->var);
  805. fb_add_videomode(&fbmode, &info->modelist);
  806. /* Power up the LCDC screen */
  807. if (sinfo->atmel_lcdfb_power_control)
  808. sinfo->atmel_lcdfb_power_control(1);
  809. dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
  810. info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
  811. return 0;
  812. reset_drvdata:
  813. dev_set_drvdata(dev, NULL);
  814. free_cmap:
  815. fb_dealloc_cmap(&info->cmap);
  816. unregister_irqs:
  817. cancel_work_sync(&sinfo->task);
  818. free_irq(sinfo->irq_base, info);
  819. unmap_mmio:
  820. exit_backlight(sinfo);
  821. iounmap(sinfo->mmio);
  822. release_mem:
  823. release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
  824. free_fb:
  825. if (map)
  826. iounmap(info->screen_base);
  827. else
  828. atmel_lcdfb_free_video_memory(sinfo);
  829. release_intmem:
  830. if (map)
  831. release_mem_region(info->fix.smem_start, info->fix.smem_len);
  832. stop_clk:
  833. atmel_lcdfb_stop_clock(sinfo);
  834. clk_put(sinfo->lcdc_clk);
  835. put_bus_clk:
  836. if (sinfo->bus_clk)
  837. clk_put(sinfo->bus_clk);
  838. free_info:
  839. framebuffer_release(info);
  840. out:
  841. dev_dbg(dev, "%s FAILED\n", __func__);
  842. return ret;
  843. }
  844. static int __exit atmel_lcdfb_remove(struct platform_device *pdev)
  845. {
  846. struct device *dev = &pdev->dev;
  847. struct fb_info *info = dev_get_drvdata(dev);
  848. struct atmel_lcdfb_info *sinfo;
  849. if (!info || !info->par)
  850. return 0;
  851. sinfo = info->par;
  852. cancel_work_sync(&sinfo->task);
  853. exit_backlight(sinfo);
  854. if (sinfo->atmel_lcdfb_power_control)
  855. sinfo->atmel_lcdfb_power_control(0);
  856. unregister_framebuffer(info);
  857. atmel_lcdfb_stop_clock(sinfo);
  858. clk_put(sinfo->lcdc_clk);
  859. if (sinfo->bus_clk)
  860. clk_put(sinfo->bus_clk);
  861. fb_dealloc_cmap(&info->cmap);
  862. free_irq(sinfo->irq_base, info);
  863. iounmap(sinfo->mmio);
  864. release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
  865. if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) {
  866. iounmap(info->screen_base);
  867. release_mem_region(info->fix.smem_start, info->fix.smem_len);
  868. } else {
  869. atmel_lcdfb_free_video_memory(sinfo);
  870. }
  871. dev_set_drvdata(dev, NULL);
  872. framebuffer_release(info);
  873. return 0;
  874. }
  875. #ifdef CONFIG_PM
  876. static int atmel_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
  877. {
  878. struct fb_info *info = platform_get_drvdata(pdev);
  879. struct atmel_lcdfb_info *sinfo = info->par;
  880. /*
  881. * We don't want to handle interrupts while the clock is
  882. * stopped. It may take forever.
  883. */
  884. lcdc_writel(sinfo, ATMEL_LCDC_IDR, ~0UL);
  885. sinfo->saved_lcdcon = lcdc_readl(sinfo, ATMEL_LCDC_CONTRAST_VAL);
  886. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, 0);
  887. if (sinfo->atmel_lcdfb_power_control)
  888. sinfo->atmel_lcdfb_power_control(0);
  889. atmel_lcdfb_stop(sinfo);
  890. atmel_lcdfb_stop_clock(sinfo);
  891. return 0;
  892. }
  893. static int atmel_lcdfb_resume(struct platform_device *pdev)
  894. {
  895. struct fb_info *info = platform_get_drvdata(pdev);
  896. struct atmel_lcdfb_info *sinfo = info->par;
  897. atmel_lcdfb_start_clock(sinfo);
  898. atmel_lcdfb_start(sinfo);
  899. if (sinfo->atmel_lcdfb_power_control)
  900. sinfo->atmel_lcdfb_power_control(1);
  901. lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, sinfo->saved_lcdcon);
  902. /* Enable FIFO & DMA errors */
  903. lcdc_writel(sinfo, ATMEL_LCDC_IER, ATMEL_LCDC_UFLWI
  904. | ATMEL_LCDC_OWRI | ATMEL_LCDC_MERI);
  905. return 0;
  906. }
  907. #else
  908. #define atmel_lcdfb_suspend NULL
  909. #define atmel_lcdfb_resume NULL
  910. #endif
  911. static struct platform_driver atmel_lcdfb_driver = {
  912. .remove = __exit_p(atmel_lcdfb_remove),
  913. .suspend = atmel_lcdfb_suspend,
  914. .resume = atmel_lcdfb_resume,
  915. .driver = {
  916. .name = "atmel_lcdfb",
  917. .owner = THIS_MODULE,
  918. },
  919. };
  920. static int __init atmel_lcdfb_init(void)
  921. {
  922. return platform_driver_probe(&atmel_lcdfb_driver, atmel_lcdfb_probe);
  923. }
  924. static void __exit atmel_lcdfb_exit(void)
  925. {
  926. platform_driver_unregister(&atmel_lcdfb_driver);
  927. }
  928. module_init(atmel_lcdfb_init);
  929. module_exit(atmel_lcdfb_exit);
  930. MODULE_DESCRIPTION("AT91/AT32 LCD Controller framebuffer driver");
  931. MODULE_AUTHOR("Nicolas Ferre <nicolas.ferre@atmel.com>");
  932. MODULE_LICENSE("GPL");