arkn141s_lcdfb.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. /*
  2. * Arkmicro arkn141s lcd driver
  3. *
  4. * Licensed under GPLv2 or later.
  5. */
  6. #include <linux/kernel.h>
  7. #include <linux/platform_device.h>
  8. #include <linux/dma-mapping.h>
  9. #include <linux/interrupt.h>
  10. #include <linux/clk.h>
  11. #include <linux/fb.h>
  12. #include <linux/init.h>
  13. #include <linux/delay.h>
  14. #include <linux/backlight.h>
  15. #include <linux/gfp.h>
  16. #include <linux/module.h>
  17. #include <linux/of.h>
  18. #include <linux/of_device.h>
  19. #include <linux/of_gpio.h>
  20. #include <video/of_display_timing.h>
  21. #include <video/display_timing.h>
  22. #include <video/videomode.h>
  23. #include "arkn141s_lcdc.h"
  24. #define BACKLIGHT_PWM_PERIOD 50000
  25. #define BACKLIGHT_MAX_BRIGHTNESS 100
  26. #define SYS_REG_BASE 0x70050000//0xe4900000
  27. #define SYS_CLK_DELAY 0x70
  28. #define SYS_PIXEL_CLK_INV_OFFSET 16
  29. #define SYS_ANALOG_REG1 0x144
  30. #define SYS_LVDS_CTRL_CFG 0x190
  31. #define BALCK_BACKCOLOR 0x000000
  32. #define RED_BACKCOLOR 0xFF0000
  33. struct arkn141s_lcdfb_power_ctrl_gpio {
  34. int gpio;
  35. int active_low;
  36. struct list_head list;
  37. };
  38. #define lcdc_readl(sinfo, reg) __raw_readl((sinfo)->mmio+(reg))
  39. #define lcdc_writel(sinfo, reg, val) __raw_writel((val), (sinfo)->mmio+(reg))
  40. #define lcdc_readl_sys(sinfo, reg) __raw_readl((sinfo)->sysreg+(reg))
  41. #define lcdc_writel_sys(_syssinfo, reg, val) __raw_writel((val), (sinfo)->sysreg+(reg))
  42. #define ARKn141s_LCDFB_FBINFO_DEFAULT (FBINFO_DEFAULT \
  43. | FBINFO_HWACCEL_NONE)
  44. static int arkn141s_set_backlight(struct arkn141s_lcdfb_pdata *pdata,
  45. int brightness)
  46. {
  47. int duty = brightness * BACKLIGHT_PWM_PERIOD / BACKLIGHT_MAX_BRIGHTNESS;
  48. pwm_enable(pdata->pwm);
  49. pwm_config(pdata->pwm, duty, BACKLIGHT_PWM_PERIOD);
  50. pdata->backlight_value = brightness;
  51. return 0;
  52. }
  53. /* some bl->props field just changed */
  54. static int arkn141s_bl_update_status(struct backlight_device *bl)
  55. {
  56. struct arkn141s_lcdfb_info *sinfo = bl_get_data(bl);
  57. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  58. int power = sinfo->bl_power;
  59. int brightness = bl->props.brightness;
  60. /* REVISIT there may be a meaningful difference between
  61. * fb_blank and power ... there seem to be some cases
  62. * this doesn't handle correctly.
  63. */
  64. if (bl->props.fb_blank != sinfo->bl_power)
  65. power = bl->props.fb_blank;
  66. else if (bl->props.power != sinfo->bl_power)
  67. power = bl->props.power;
  68. if (brightness < 0 && power == FB_BLANK_UNBLANK)
  69. brightness = pdata->backlight_value;
  70. else if (power != FB_BLANK_UNBLANK)
  71. brightness = 0;
  72. arkn141s_set_backlight(pdata, brightness);
  73. bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
  74. return 0;
  75. }
  76. static int arkn141s_bl_get_brightness(struct backlight_device *bl)
  77. {
  78. struct arkn141s_lcdfb_info *sinfo = bl_get_data(bl);
  79. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  80. return pdata->backlight_value;
  81. }
  82. static const struct backlight_ops arkn141s_lcdc_bl_ops = {
  83. .update_status = arkn141s_bl_update_status,
  84. .get_brightness = arkn141s_bl_get_brightness,
  85. };
  86. static void init_backlight(struct arkn141s_lcdfb_info *sinfo)
  87. {
  88. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  89. struct backlight_properties props;
  90. struct backlight_device *bl;
  91. sinfo->bl_power = FB_BLANK_UNBLANK;
  92. if (sinfo->backlight)
  93. return;
  94. memset(&props, 0, sizeof(struct backlight_properties));
  95. props.type = BACKLIGHT_RAW;
  96. props.max_brightness = BACKLIGHT_MAX_BRIGHTNESS;
  97. bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
  98. &arkn141s_lcdc_bl_ops, &props);
  99. if (IS_ERR(bl)) {
  100. dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
  101. PTR_ERR(bl));
  102. return;
  103. }
  104. sinfo->backlight = bl;
  105. bl->props.power = FB_BLANK_UNBLANK;
  106. bl->props.fb_blank = FB_BLANK_UNBLANK;
  107. bl->props.brightness = arkn141s_bl_get_brightness(bl);
  108. arkn141s_set_backlight(pdata, pdata->backlight_value);
  109. }
  110. static void exit_backlight(struct arkn141s_lcdfb_info *sinfo)
  111. {
  112. if (!sinfo->backlight)
  113. return;
  114. if (sinfo->backlight->ops) {
  115. sinfo->backlight->props.power = FB_BLANK_POWERDOWN;
  116. sinfo->backlight->ops->update_status(sinfo->backlight);
  117. }
  118. backlight_device_unregister(sinfo->backlight);
  119. }
  120. static inline void arkn141s_lcdfb_power_control(struct arkn141s_lcdfb_info *sinfo, int on)
  121. {
  122. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  123. if (pdata->arkn141s_lcdfb_power_control)
  124. pdata->arkn141s_lcdfb_power_control(pdata, on);
  125. }
  126. static const struct fb_fix_screeninfo arkn141s_lcdfb_fix __initconst = {
  127. .type = FB_TYPE_PACKED_PIXELS,
  128. .visual = FB_VISUAL_TRUECOLOR,
  129. .xpanstep = 0,
  130. .ypanstep = 1,
  131. .ywrapstep = 0,
  132. .accel = FB_ACCEL_NONE,
  133. };
  134. /* static void arkn141s_lcdfb_stop(struct arkn141s_lcdfb_info *sinfo)
  135. {
  136. lcdc_writel(sinfo, ARKN141S_LCDC_EANBLE, 0);
  137. } */
  138. static void arkn141s_lcdfb_start(struct arkn141s_lcdfb_info *sinfo)
  139. {
  140. lcdc_writel(sinfo, ARKN141S_LCDC_EANBLE, 1);
  141. }
  142. static inline void arkn141s_lcdfb_free_video_memory(struct arkn141s_lcdfb_info *sinfo)
  143. {
  144. struct fb_info *info = sinfo->info;
  145. dma_free_wc(info->device, info->fix.smem_len, info->screen_base,
  146. info->fix.smem_start);
  147. }
  148. /**
  149. * arkn141s_lcdfb_alloc_video_memory - Allocate framebuffer memory
  150. * @sinfo: the frame buffer to allocate memory for
  151. *
  152. * This function is called only from the arkn141s_lcdfb_probe()
  153. * so no locking by fb_info->mm_lock around smem_len setting is needed.
  154. */
  155. static int arkn141s_lcdfb_alloc_video_memory(struct arkn141s_lcdfb_info *sinfo)
  156. {
  157. struct fb_info *info = sinfo->info;
  158. struct fb_var_screeninfo *var = &info->var;
  159. unsigned int smem_len;
  160. smem_len = (var->xres_virtual * var->yres_virtual
  161. * ((var->bits_per_pixel + 7) / 8));
  162. info->fix.smem_len = max(smem_len, sinfo->smem_len);
  163. info->screen_base = dma_alloc_wc(info->device, info->fix.smem_len,
  164. (dma_addr_t *)&info->fix.smem_start,
  165. GFP_KERNEL);
  166. if (!info->screen_base) {
  167. return -ENOMEM;
  168. }
  169. memset(info->screen_base, 0, info->fix.smem_len);
  170. return 0;
  171. }
  172. static const struct fb_videomode *arkn141s_lcdfb_choose_mode(struct fb_var_screeninfo *var,
  173. struct fb_info *info)
  174. {
  175. struct fb_videomode varfbmode;
  176. const struct fb_videomode *fbmode = NULL;
  177. fb_var_to_videomode(&varfbmode, var);
  178. fbmode = fb_find_nearest_mode(&varfbmode, &info->modelist);
  179. if (fbmode)
  180. fb_videomode_to_var(var, fbmode);
  181. return fbmode;
  182. }
  183. /**
  184. * arkn141s_lcdfb_check_var - Validates a var passed in.
  185. * @var: frame buffer variable screen structure
  186. * @info: frame buffer structure that represents a single frame buffer
  187. *
  188. * Checks to see if the hardware supports the state requested by
  189. * var passed in. This function does not alter the hardware
  190. * state!!! This means the data stored in struct fb_info and
  191. * struct arkn141s_lcdfb_info do not change. This includes the var
  192. * inside of struct fb_info. Do NOT change these. This function
  193. * can be called on its own if we intent to only test a mode and
  194. * not actually set it. The stuff in modedb.c is a example of
  195. * this. If the var passed in is slightly off by what the
  196. * hardware can support then we alter the var PASSED in to what
  197. * we can do. If the hardware doesn't support mode change a
  198. * -EINVAL will be returned by the upper layers. You don't need
  199. * to implement this function then. If you hardware doesn't
  200. * support changing the resolution then this function is not
  201. * needed. In this case the driver would just provide a var that
  202. * represents the static state the screen is in.
  203. *
  204. * Returns negative errno on error, or zero on success.
  205. */
  206. static int arkn141s_lcdfb_check_var(struct fb_var_screeninfo *var,
  207. struct fb_info *info)
  208. {
  209. struct device *dev = info->device;
  210. struct arkn141s_lcdfb_info *sinfo = info->par;
  211. //struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  212. unsigned long clk_value_khz;
  213. clk_value_khz = clk_get_rate(sinfo->lcdc_clk) / 1000;
  214. dev_dbg(dev, "%s:\n", __func__);
  215. if (!(var->pixclock && var->bits_per_pixel)) {
  216. /* choose a suitable mode if possible */
  217. if (!arkn141s_lcdfb_choose_mode(var, info)) {
  218. dev_err(dev, "needed value not specified\n");
  219. return -EINVAL;
  220. }
  221. }
  222. dev_dbg(dev, " resolution: %ux%u\n", var->xres, var->yres);
  223. dev_dbg(dev, " pixclk: %lu KHz\n", PICOS2KHZ(var->pixclock));
  224. dev_dbg(dev, " bpp: %u\n", var->bits_per_pixel);
  225. dev_dbg(dev, " clk: %lu KHz\n", clk_value_khz);
  226. if (PICOS2KHZ(var->pixclock) > clk_value_khz + 1) {
  227. dev_err(dev, "%lu KHz pixel clock is too fast\n", PICOS2KHZ(var->pixclock));
  228. return -EINVAL;
  229. }
  230. /* Do not allow to have real resoulution larger than virtual */
  231. if (var->xres >= var->xres_virtual)
  232. var->xres_virtual = var->xres;
  233. if (var->yres >= var->yres_virtual)
  234. var->yres_virtual = var->yres * 2;
  235. /* Force same alignment for each line */
  236. var->xres = (var->xres + 3) & ~3UL;
  237. var->xres_virtual = (var->xres_virtual + 3) & ~3UL;
  238. var->red.msb_right = var->green.msb_right = var->blue.msb_right = 0;
  239. var->transp.msb_right = 0;
  240. var->transp.offset = var->transp.length = 0;
  241. var->xoffset = var->yoffset = 0;
  242. if (info->fix.smem_len) {
  243. unsigned int smem_len = (var->xres_virtual * var->yres_virtual
  244. * ((var->bits_per_pixel + 7) / 8));
  245. if (smem_len > info->fix.smem_len) {
  246. dev_err(dev, "Frame buffer is too small (%u) for screen size (need at least %u)\n",
  247. info->fix.smem_len, smem_len);
  248. return -EINVAL;
  249. }
  250. }
  251. /* Saturate vertical and horizontal timings at maximum values */
  252. var->vsync_len = min_t(u32, var->vsync_len,
  253. (ARKN141S_LCDC_VPW >> ARKN141S_LCDC_VPW_OFFSET) + 1);
  254. var->upper_margin = min_t(u32, var->upper_margin,
  255. ARKN141S_LCDC_VBP);
  256. var->lower_margin = min_t(u32, var->lower_margin,
  257. ARKN141S_LCDC_VFP >> ARKN141S_LCDC_VFP_OFFSET);
  258. var->right_margin = min_t(u32, var->right_margin,
  259. ARKN141S_LCDC_HFP + 1);
  260. var->hsync_len = min_t(u32, var->hsync_len,
  261. (ARKN141S_LCDC_HPW >> ARKN141S_LCDC_HPW_OFFSET) + 1);
  262. var->left_margin = min_t(u32, var->left_margin,
  263. (ARKN141S_LCDC_HBP >> ARKN141S_LCDC_HBP_OFFSET) + 1);
  264. /* Some parameters can't be zero */
  265. var->vsync_len = max_t(u32, var->vsync_len, 1);
  266. var->right_margin = max_t(u32, var->right_margin, 1);
  267. var->hsync_len = max_t(u32, var->hsync_len, 1);
  268. var->left_margin = max_t(u32, var->left_margin, 1);
  269. switch (var->bits_per_pixel) {
  270. case 1:
  271. case 2:
  272. case 4:
  273. case 8:
  274. var->red.offset = var->green.offset = var->blue.offset = 0;
  275. var->red.length = var->green.length = var->blue.length
  276. = var->bits_per_pixel;
  277. break;
  278. case 16:
  279. var->green.length = 6;
  280. var->red.offset = var->green.length + 5;
  281. var->blue.offset = 0;
  282. var->green.offset = 5;
  283. var->red.length = var->blue.length = 5;
  284. break;
  285. case 32:
  286. var->transp.offset = 24;
  287. var->transp.length = 8;
  288. /* fall through */
  289. case 24:
  290. var->red.offset = 16;
  291. var->blue.offset = 0;
  292. var->green.offset = 8;
  293. var->red.length = var->green.length = var->blue.length = 8;
  294. break;
  295. default:
  296. dev_err(dev, "color depth %d not supported\n",
  297. var->bits_per_pixel);
  298. return -EINVAL;
  299. }
  300. return 0;
  301. }
  302. /*
  303. * LCD reset sequence
  304. */
  305. /* static void arkn141s_lcdfb_reset(struct arkn141s_lcdfb_info *sinfo)
  306. {
  307. might_sleep();
  308. arkn141s_lcdfb_stop(sinfo);
  309. arkn141s_lcdfb_start(sinfo);
  310. } */
  311. static int arkn141s_lcdfb_pan_display(struct fb_var_screeninfo *var,
  312. struct fb_info *info)
  313. {
  314. struct arkn141s_lcdfb_info *sinfo = info->par;
  315. struct fb_fix_screeninfo *fix = &info->fix;
  316. unsigned long addr;
  317. addr = fix->smem_start + var->yoffset * fix->line_length
  318. + var->xoffset * info->var.bits_per_pixel / 8;
  319. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_ADDR, addr);
  320. return 0;
  321. }
  322. /**
  323. * arkn141s_lcdfb_set_par - Alters the hardware state.
  324. * @info: frame buffer structure that represents a single frame buffer
  325. *
  326. * Using the fb_var_screeninfo in fb_info we set the resolution
  327. * of the this particular framebuffer. This function alters the
  328. * par AND the fb_fix_screeninfo stored in fb_info. It doesn't
  329. * not alter var in fb_info since we are using that data. This
  330. * means we depend on the data in var inside fb_info to be
  331. * supported by the hardware. arkn141s_lcdfb_check_var is always called
  332. * before arkn141s_lcdfb_set_par to ensure this. Again if you can't
  333. * change the resolution you don't need this function.
  334. *
  335. */
  336. static int arkn141s_lcdfb_set_par(struct fb_info *info)
  337. {
  338. struct arkn141s_lcdfb_info *sinfo = info->par;
  339. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  340. unsigned long value;
  341. unsigned long bits_per_line;
  342. might_sleep();
  343. dev_dbg(info->device, "%s:\n", __func__);
  344. dev_dbg(info->device, " * resolution: %ux%u (%ux%u virtual)\n",
  345. info->var.xres, info->var.yres,
  346. info->var.xres_virtual, info->var.yres_virtual);
  347. if (info->var.bits_per_pixel == 1)
  348. info->fix.visual = FB_VISUAL_MONO01;
  349. else if (info->var.bits_per_pixel <= 8)
  350. info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
  351. else
  352. info->fix.visual = FB_VISUAL_TRUECOLOR;
  353. bits_per_line = info->var.xres_virtual * info->var.bits_per_pixel;
  354. info->fix.line_length = DIV_ROUND_UP(bits_per_line, 8);
  355. /* Now, the LCDC core... */
  356. value = lcdc_readl_sys(sinfo, SYS_CLK_DELAY);
  357. if (pdata->pixelclk_active_high)
  358. value |= (1 << SYS_PIXEL_CLK_INV_OFFSET);
  359. else
  360. value &= ~(1 << SYS_PIXEL_CLK_INV_OFFSET);
  361. lcdc_writel_sys(sinfo, SYS_CLK_DELAY, value);
  362. /* Initialize control register */
  363. value = (6 << 23) | (3 << 21) | (1 << 0);
  364. value |= pdata->lcd_wiring_mode << 18;
  365. lcdc_writel(sinfo, ARKN141S_LCDC_CONTROL, value);
  366. /* timing */
  367. value = (info->var.hsync_len - 1) << ARKN141S_LCDC_HPW_OFFSET;
  368. value |= (info->var.left_margin - 1) << ARKN141S_LCDC_HBP_OFFSET;
  369. value |= (info->var.right_margin - 1);
  370. lcdc_writel(sinfo, ARKN141S_LCDC_TIMING0, value);
  371. value = info->var.lower_margin << ARKN141S_LCDC_VFP_OFFSET;
  372. value |= (info->var.vsync_len - 1) << ARKN141S_LCDC_VPW_OFFSET;
  373. value |= (info->var.xres - 1);
  374. lcdc_writel(sinfo, ARKN141S_LCDC_TIMING1, value);
  375. value = pdata->de_active_high << ARKN141S_LCDC_IOE_OFFSET;
  376. value |= !!(info->var.sync & FB_SYNC_HOR_HIGH_ACT) << ARKN141S_LCDC_IHS_OFFSET;
  377. value |= !!(info->var.sync & FB_SYNC_VERT_HIGH_ACT) << ARKN141S_LCDC_IVS_OFFSET;
  378. value |= (info->var.yres - 1) << ARKN141S_LCDC_LPS_OFFSET;
  379. value |= info->var.upper_margin;
  380. lcdc_writel(sinfo, ARKN141S_LCDC_TIMING2, value);
  381. /* Initialize specific screen type */
  382. if (pdata->interface_type == ARKN141S_LCDC_INTERFACE_LVDS) {
  383. /* value = lcdc_readl_sys(sinfo, SYS_ANALOG_REG1);
  384. value |= (1 << 26);
  385. lcdc_writel_sys(sinfo, SYS_ANALOG_REG1, value);
  386. lcdc_writel_sys(sinfo, SYS_LVDS_CTRL_CFG, pdata->lvds_con); */
  387. }
  388. /* sync always on */
  389. lcdc_writel(sinfo, ARKN141S_LCDC_PARAMTERS_SYNC_SWITCH, 0x7f);
  390. /* Display osd layer1(fb0) size,pos,format,addr... */
  391. arkn141s_lcdfb_pan_display(&info->var, info);
  392. value = (info->var.yres << ARKN141S_LCDC_HEIGHT_OFFSET) | info->var.xres;
  393. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_SIZE, value);
  394. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_SOURCE_SIZE, value);
  395. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_POSITION, 0);
  396. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_WIN_POINT, 0);
  397. value = (1 << 17) | (ARKN141S_LCDC_FORMAT_RGBA888 << 12) | 0xff;
  398. lcdc_writel(sinfo, ARKN141S_LCDC_OSD1_CTL, value);
  399. /* open osd layer1 */
  400. value = lcdc_readl(sinfo, ARKN141S_LCDC_CONTROL);
  401. value |= (1 << ARKN141S_LCDC_OSD1_EN_OFFSET);
  402. lcdc_writel(sinfo, ARKN141S_LCDC_CONTROL, value);
  403. /* Clear all interrupts */
  404. lcdc_writel(sinfo, ARKN141S_LCDC_INTERRUPT_STATUS, 0);
  405. /* Enable frame interrupt */
  406. lcdc_writel(sinfo, ARKN141S_LCDC_INTERRUPT_CTL, ARKN141S_LCDC_INT_LCD_FRAME);
  407. arkn141s_lcdfb_start(sinfo);
  408. dev_dbg(info->device, " * DONE\n");
  409. return 0;
  410. }
  411. /* static int arkn141s_lcdfb_blank(int blank_mode, struct fb_info *info)
  412. {
  413. struct arkn141s_lcdfb_info *sinfo = info->par;
  414. switch (blank_mode) {
  415. case FB_BLANK_UNBLANK:
  416. case FB_BLANK_NORMAL:
  417. arkn141s_lcdfb_start(sinfo);
  418. break;
  419. case FB_BLANK_VSYNC_SUSPEND:
  420. case FB_BLANK_HSYNC_SUSPEND:
  421. break;
  422. case FB_BLANK_POWERDOWN:
  423. arkn141s_lcdfb_stop(sinfo);
  424. break;
  425. default:
  426. return -EINVAL;
  427. }
  428. return ((blank_mode == FB_BLANK_NORMAL) ? 1 : 0);
  429. } */
  430. static struct fb_ops arkn141s_lcdfb_ops = {
  431. .owner = THIS_MODULE,
  432. .fb_check_var = arkn141s_lcdfb_check_var,
  433. .fb_set_par = arkn141s_lcdfb_set_par,
  434. //.fb_blank = arkn141s_lcdfb_blank,
  435. .fb_pan_display = arkn141s_lcdfb_pan_display,
  436. .fb_fillrect = cfb_fillrect,
  437. .fb_copyarea = cfb_copyarea,
  438. .fb_imageblit = cfb_imageblit,
  439. //.fb_ioctl = arkn141s_lcdfb_ioctl,
  440. };
  441. static irqreturn_t arkn141s_lcdfb_interrupt(int irq, void *dev_id)
  442. {
  443. struct fb_info *info = dev_id;
  444. struct arkn141s_lcdfb_info *sinfo = info->par;
  445. u32 status;
  446. status = lcdc_readl(sinfo, ARKN141S_LCDC_INTERRUPT_STATUS);
  447. /* clear intr */
  448. lcdc_writel(sinfo, ARKN141S_LCDC_INTERRUPT_STATUS, 0);
  449. if (status & ARKN141S_LCDC_INT_LCD_FRAME) {
  450. sinfo->vsync_flag = 1;
  451. wake_up_interruptible(&sinfo->vsync_waitq);
  452. schedule_work(&sinfo->task);
  453. }
  454. return IRQ_HANDLED;
  455. }
  456. /*
  457. * LCD controller task (to reset the LCD)
  458. */
  459. static void arkn141s_lcdfb_task(struct work_struct *work)
  460. {
  461. /* struct arkn141s_lcdfb_info *sinfo =
  462. container_of(work, struct arkn141s_lcdfb_info, task); */
  463. }
  464. static int __init arkn141s_lcdfb_init_fbinfo(struct arkn141s_lcdfb_info *sinfo)
  465. {
  466. struct fb_info *info = sinfo->info;
  467. int ret = 0;
  468. info->var.activate |= FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW;
  469. dev_info(info->device,
  470. "%luKiB frame buffer at %08lx (mapped at %p)\n",
  471. (unsigned long)info->fix.smem_len / 1024,
  472. (unsigned long)info->fix.smem_start,
  473. info->screen_base);
  474. /* Allocate colormap */
  475. ret = fb_alloc_cmap(&info->cmap, 256, 0);
  476. if (ret < 0)
  477. dev_err(info->device, "Alloc color map failed\n");
  478. return ret;
  479. }
  480. /* static void arkn141s_lcdfb_start_clock(struct arkn141s_lcdfb_info *sinfo)
  481. {
  482. clk_prepare_enable(sinfo->lcdc_clk);
  483. }
  484. static void arkn141s_lcdfb_stop_clock(struct arkn141s_lcdfb_info *sinfo)
  485. {
  486. clk_disable_unprepare(sinfo->lcdc_clk);
  487. } */
  488. static const struct of_device_id arkn141s_lcdfb_dt_ids[] = {
  489. { .compatible = "arkmicro,arkn141s-lcdc",},
  490. { /* sentinel */ }
  491. };
  492. MODULE_DEVICE_TABLE(of, arkn141s_lcdfb_dt_ids);
  493. static const char *arkn141s_lcdfb_interface_types[] = {
  494. [ARKN141S_LCDC_INTERFACE_TTL] = "TTL",
  495. [ARKN141S_LCDC_INTERFACE_LVDS] = "LVDS",
  496. };
  497. static int arkn141s_lcdfb_get_of_interface_types(struct device_node *np)
  498. {
  499. const char *type;
  500. int err, i;
  501. err = of_property_read_string(np, "interface-type", &type);
  502. if (err < 0)
  503. return ARKN141S_LCDC_INTERFACE_TTL;
  504. for (i = 0; i < ARRAY_SIZE(arkn141s_lcdfb_interface_types); i++)
  505. if (!strcasecmp(type, arkn141s_lcdfb_interface_types[i]))
  506. return i;
  507. return -ENODEV;
  508. }
  509. static const char *arkn141s_lcdfb_wiring_modes[] = {
  510. [ARKN141S_LCDC_WIRING_BGR] = "BGR",
  511. [ARKN141S_LCDC_WIRING_GBR] = "GBR",
  512. [ARKN141S_LCDC_WIRING_RBG] = "RBG",
  513. [ARKN141S_LCDC_WIRING_BRG] = "BRG",
  514. [ARKN141S_LCDC_WIRING_GRB] = "GRB",
  515. [ARKN141S_LCDC_WIRING_RGB] = "RGB",
  516. };
  517. static int arkn141s_lcdfb_get_of_wiring_modes(struct device_node *np)
  518. {
  519. const char *mode;
  520. int err, i;
  521. err = of_property_read_string(np, "lcd-wiring-mode", &mode);
  522. if (err < 0)
  523. return ARKN141S_LCDC_WIRING_BGR;
  524. for (i = 0; i < ARRAY_SIZE(arkn141s_lcdfb_wiring_modes); i++)
  525. if (!strcasecmp(mode, arkn141s_lcdfb_wiring_modes[i]))
  526. return i;
  527. return -ENODEV;
  528. }
  529. static void arkn141s_lcdfb_power_control_gpio(struct arkn141s_lcdfb_pdata *pdata, int on)
  530. {
  531. struct arkn141s_lcdfb_power_ctrl_gpio *og;
  532. list_for_each_entry(og, &pdata->pwr_gpios, list)
  533. gpio_set_value(og->gpio, on ? !og->active_low : og->active_low);
  534. }
  535. /*
  536. * Timer function for delayed backlight power up/down
  537. */
  538. static void arkn141s_backlight_timer_func(struct timer_list *t)
  539. {
  540. struct arkn141s_lcdfb_info *sinfo = from_timer(sinfo, t, pdata.backlight_timer);
  541. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  542. arkn141s_lcdfb_power_control(sinfo, 1);
  543. del_timer_sync(&pdata->backlight_timer);
  544. }
  545. static int arkn141s_lcdfb_of_init(struct arkn141s_lcdfb_info *sinfo)
  546. {
  547. struct fb_info *info = sinfo->info;
  548. struct arkn141s_lcdfb_pdata *pdata = &sinfo->pdata;
  549. struct fb_var_screeninfo *var = &info->var;
  550. struct device *dev = &sinfo->pdev->dev;
  551. struct device_node *np =dev->of_node;
  552. struct device_node *display_np;
  553. struct device_node *timings_np;
  554. struct display_timings *timings;
  555. enum of_gpio_flags flags;
  556. struct arkn141s_lcdfb_power_ctrl_gpio *og;
  557. bool is_gpio_power = false;
  558. int ret = -ENOENT;
  559. int i, gpio;
  560. display_np = of_parse_phandle(np, "display", 0);
  561. if (!display_np) {
  562. dev_err(dev, "failed to find display phandle\n");
  563. return -ENOENT;
  564. }
  565. ret = of_property_read_u32(display_np, "bits-per-pixel", &var->bits_per_pixel);
  566. if (ret < 0) {
  567. dev_err(dev, "failed to get property bits-per-pixel\n");
  568. goto put_display_node;
  569. }
  570. INIT_LIST_HEAD(&pdata->pwr_gpios);
  571. ret = -ENOMEM;
  572. for (i = 0; i < of_gpio_named_count(display_np, "power-control-gpio"); i++) {
  573. gpio = of_get_named_gpio_flags(display_np, "power-control-gpio",
  574. i, &flags);
  575. if (gpio < 0)
  576. continue;
  577. og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL);
  578. if (!og)
  579. goto put_display_node;
  580. og->gpio = gpio;
  581. og->active_low = flags & OF_GPIO_ACTIVE_LOW;
  582. is_gpio_power = true;
  583. ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio");
  584. if (ret) {
  585. dev_err(dev, "request gpio %d failed\n", gpio);
  586. goto put_display_node;
  587. }
  588. ret = gpio_direction_output(gpio, og->active_low);
  589. if (ret) {
  590. dev_err(dev, "set direction output gpio %d failed\n", gpio);
  591. goto put_display_node;
  592. }
  593. list_add(&og->list, &pdata->pwr_gpios);
  594. }
  595. if (is_gpio_power)
  596. pdata->arkn141s_lcdfb_power_control = arkn141s_lcdfb_power_control_gpio;
  597. ret = arkn141s_lcdfb_get_of_interface_types(display_np);
  598. if (ret < 0) {
  599. dev_err(dev, "invalid interface-type\n");
  600. goto put_display_node;
  601. }
  602. pdata->interface_type = ret;
  603. if (pdata->interface_type == ARKN141S_LCDC_INTERFACE_LVDS) {
  604. ret = of_property_read_u32(display_np, "lvds-con", &pdata->lvds_con);
  605. if (ret < 0) {
  606. dev_err(dev, "failed to get property lvds-con\n");
  607. goto put_display_node;
  608. }
  609. }
  610. ret = arkn141s_lcdfb_get_of_wiring_modes(display_np);
  611. if (ret < 0) {
  612. dev_err(dev, "invalid lcd-wiring-mode\n");
  613. goto put_display_node;
  614. }
  615. pdata->lcd_wiring_mode = ret;
  616. pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "lcdcon-backlight");
  617. if (pdata->lcdcon_is_backlight) {
  618. pdata->pwm = devm_of_pwm_get(dev, display_np, NULL);
  619. if (IS_ERR(pdata->pwm) && PTR_ERR(pdata->pwm) != -EPROBE_DEFER) {
  620. dev_err(dev, "unable to request PWM\n");
  621. goto put_display_node;
  622. }
  623. ret = of_property_read_u32(display_np, "backlight-value", &pdata->backlight_value);
  624. if (ret < 0) {
  625. pdata->backlight_value = 30;
  626. }
  627. ret = of_property_read_u32(display_np, "backlight-delay", &pdata->backlight_delay);
  628. if (ret < 0) {
  629. pdata->backlight_delay = 100;
  630. }
  631. timer_setup(&pdata->backlight_timer, arkn141s_backlight_timer_func, 0);
  632. /* Deferred power up the LCDC screen */
  633. mod_timer(&pdata->backlight_timer,
  634. jiffies +
  635. msecs_to_jiffies(pdata->backlight_delay));
  636. }
  637. timings = of_get_display_timings(display_np);
  638. if (!timings) {
  639. dev_err(dev, "failed to get display timings\n");
  640. ret = -EINVAL;
  641. goto del_timer;
  642. }
  643. timings_np = of_get_child_by_name(display_np, "display-timings");
  644. if (!timings_np) {
  645. dev_err(dev, "failed to find display-timings node\n");
  646. ret = -ENODEV;
  647. goto del_timer;
  648. }
  649. for (i = 0; i < of_get_child_count(timings_np); i++) {
  650. struct videomode vm;
  651. struct fb_videomode fb_vm;
  652. ret = videomode_from_timings(timings, &vm, i);
  653. if (ret < 0)
  654. goto put_timings_node;
  655. ret = fb_videomode_from_videomode(&vm, &fb_vm);
  656. if (ret < 0)
  657. goto put_timings_node;
  658. fb_add_videomode(&fb_vm, &info->modelist);
  659. if (vm.flags & DISPLAY_FLAGS_DE_HIGH)
  660. pdata->de_active_high = true;
  661. if (vm.flags & DISPLAY_FLAGS_PIXDATA_POSEDGE)
  662. pdata->pixelclk_active_high = true;
  663. }
  664. /*
  665. * FIXME: Make sure we are not referencing any fields in display_np
  666. * and timings_np and drop our references to them before returning to
  667. * avoid leaking the nodes on probe deferral and driver unbind.
  668. */
  669. return 0;
  670. put_timings_node:
  671. of_node_put(timings_np);
  672. del_timer:
  673. if (pdata->lcdcon_is_backlight)
  674. del_timer_sync(&pdata->backlight_timer);
  675. put_display_node:
  676. of_node_put(display_np);
  677. return ret;
  678. }
  679. static int arkn141s_lcdc_dev_init(struct arkn141s_lcdfb_info *sinfo)
  680. {
  681. /* set lcd back color */
  682. lcdc_writel(sinfo, ARKN141S_LCDC_BACK_COLOR, BALCK_BACKCOLOR);
  683. /* set layer1(fb0) vp */
  684. /* set layer priority and blend mode */
  685. lcdc_writel(sinfo, ARKN141S_LCDC_BLD_MODE_LCD_REG0, 0x03000204);
  686. lcdc_writel(sinfo, ARKN141S_LCDC_BLD_MODE_LCD_REG1, 0x00003001);
  687. return 0;
  688. }
  689. static int arkn141s_lcdfb_probe(struct platform_device *pdev)
  690. {
  691. struct device *dev = &pdev->dev;
  692. struct fb_info *info;
  693. struct arkn141s_lcdfb_info *sinfo;
  694. struct arkn141s_lcdfb_pdata *pdata = NULL;
  695. struct resource *regs = NULL;
  696. struct resource *map = NULL;
  697. struct fb_modelist *modelist;
  698. int ret;
  699. dev_dbg(dev, "%s BEGIN\n", __func__);
  700. info = framebuffer_alloc(sizeof(struct arkn141s_lcdfb_info), dev);
  701. if (!info) {
  702. dev_err(dev, "cannot allocate memory\n");
  703. ret = -ENOMEM;
  704. goto out;
  705. }
  706. sinfo = info->par;
  707. sinfo->pdev = pdev;
  708. sinfo->info = info;
  709. pdata = &sinfo->pdata;
  710. INIT_LIST_HEAD(&info->modelist);
  711. ret = arkn141s_lcdfb_of_init(sinfo);
  712. if (ret)
  713. goto free_info;
  714. info->flags = ARKn141s_LCDFB_FBINFO_DEFAULT;
  715. info->fbops = &arkn141s_lcdfb_ops;
  716. info->fix = arkn141s_lcdfb_fix;
  717. strcpy(info->fix.id, sinfo->pdev->name);
  718. /* Enable LCDC Clocks */
  719. sinfo->lcdc_clk = clk_get(dev, "lcdc_clk");
  720. if (IS_ERR(sinfo->lcdc_clk)) {
  721. ret = PTR_ERR(sinfo->lcdc_clk);
  722. goto free_info;
  723. }
  724. /* arkn141s_lcdfb_start_clock(sinfo); */
  725. modelist = list_first_entry(&info->modelist,
  726. struct fb_modelist, list);
  727. fb_videomode_to_var(&info->var, &modelist->mode);
  728. /* Set pixel clock */
  729. /* clk_set_rate(sinfo->lcdc_clk, PICOS2KHZ(info->var.pixclock) * 1000); */
  730. info->var.pixclock = KHZ2PICOS(clk_get_rate(sinfo->lcdc_clk) / 1000);
  731. arkn141s_lcdfb_check_var(&info->var, info);
  732. regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  733. if (!regs) {
  734. dev_err(dev, "resources unusable\n");
  735. ret = -ENXIO;
  736. goto stop_clk;
  737. }
  738. /* LCDC registers */
  739. info->fix.mmio_start = regs->start;
  740. info->fix.mmio_len = resource_size(regs);
  741. if (!request_mem_region(info->fix.mmio_start,
  742. info->fix.mmio_len, pdev->name)) {
  743. ret = -EBUSY;
  744. goto free_fb;
  745. }
  746. sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
  747. if (!sinfo->mmio) {
  748. dev_err(dev, "cannot map LCDC registers\n");
  749. ret = -ENOMEM;
  750. goto release_mem;
  751. }
  752. sinfo->sysreg = ioremap(SYS_REG_BASE, 0x400);
  753. if (!sinfo->sysreg) {
  754. dev_err(dev, "cannot map sys registers\n");
  755. ret = -ENOMEM;
  756. goto unmap_mmio;
  757. }
  758. sinfo->irq_base = platform_get_irq(pdev, 0);
  759. if (sinfo->irq_base < 0) {
  760. dev_err(dev, "unable to get irq\n");
  761. ret = sinfo->irq_base;
  762. goto stop_clk;
  763. }
  764. /* Initialize video memory */
  765. map = platform_get_resource(pdev, IORESOURCE_MEM, 1);
  766. if (map) {
  767. /* use a pre-allocated memory buffer */
  768. info->fix.smem_start = map->start;
  769. info->fix.smem_len = resource_size(map);
  770. if (!request_mem_region(info->fix.smem_start,
  771. info->fix.smem_len, pdev->name)) {
  772. ret = -EBUSY;
  773. goto stop_clk;
  774. }
  775. info->screen_base = ioremap_wc(info->fix.smem_start,
  776. info->fix.smem_len);
  777. if (!info->screen_base) {
  778. ret = -ENOMEM;
  779. goto release_intmem;
  780. }
  781. memset(info->screen_base, 0, info->var.xres * info->var.yres * 4);
  782. /*
  783. * Don't clear the framebuffer -- someone may have set
  784. * up a splash image.
  785. */
  786. } else {
  787. /* allocate memory buffer */
  788. ret = arkn141s_lcdfb_alloc_video_memory(sinfo);
  789. if (ret < 0) {
  790. dev_err(dev, "cannot allocate framebuffer: %d\n", ret);
  791. goto stop_clk;
  792. }
  793. }
  794. /* Initialize PWM for contrast or backlight ("off") */
  795. if (pdata->lcdcon_is_backlight)
  796. init_backlight(sinfo);
  797. /* interrupt */
  798. ret = request_irq(sinfo->irq_base, arkn141s_lcdfb_interrupt, 0, pdev->name, info);
  799. if (ret) {
  800. dev_err(dev, "request_irq failed: %d\n", ret);
  801. goto unmap_sysreg;
  802. }
  803. /* Some operations on the LCDC might sleep and
  804. * require a preemptible task context */
  805. INIT_WORK(&sinfo->task, arkn141s_lcdfb_task);
  806. init_waitqueue_head(&sinfo->vsync_waitq);
  807. ret = arkn141s_lcdfb_init_fbinfo(sinfo);
  808. if (ret < 0) {
  809. dev_err(dev, "init fbinfo failed: %d\n", ret);
  810. goto unregister_irqs;
  811. }
  812. //arkn141s_lcdc_funcs_init(sinfo);
  813. ret = arkn141s_lcdc_dev_init(sinfo);
  814. if (ret < 0) {
  815. dev_err(dev, "init lcdc dev failed: %d\n", ret);
  816. goto unregister_irqs;
  817. }
  818. ret = arkn141s_lcdfb_set_par(info);
  819. if (ret < 0) {
  820. dev_err(dev, "set par failed: %d\n", ret);
  821. goto unregister_irqs;
  822. }
  823. dev_set_drvdata(dev, info);
  824. /*
  825. * Tell the world that we're ready to go
  826. */
  827. ret = register_framebuffer(info);
  828. if (ret < 0) {
  829. dev_err(dev, "failed to register framebuffer device: %d\n", ret);
  830. goto reset_drvdata;
  831. }
  832. dev_info(dev, "fb%d: Atmel LCDC at 0x%08lx (mapped at %p), irq %d\n",
  833. info->node, info->fix.mmio_start, sinfo->mmio, sinfo->irq_base);
  834. #if 1////tmp test
  835. {
  836. int i;
  837. struct fb_info *info_tmp;
  838. for(i = 1; i < 5; i++){
  839. info_tmp = framebuffer_alloc(sizeof(struct fb_info), dev);
  840. if (!info_tmp) {
  841. dev_err(dev, "cannot allocate memory\n");
  842. ret = -ENOMEM;
  843. goto out;
  844. }
  845. memcpy(info_tmp, info, sizeof(struct fb_info));
  846. //strcpy(info->fix.id, "ark-fb2");
  847. register_framebuffer(info_tmp);
  848. }
  849. }
  850. #endif
  851. return 0;
  852. reset_drvdata:
  853. dev_set_drvdata(dev, NULL);
  854. fb_dealloc_cmap(&info->cmap);
  855. unregister_irqs:
  856. cancel_work_sync(&sinfo->task);
  857. free_irq(sinfo->irq_base, info);
  858. unmap_sysreg:
  859. iounmap(sinfo->sysreg);
  860. unmap_mmio:
  861. exit_backlight(sinfo);
  862. iounmap(sinfo->mmio);
  863. release_mem:
  864. release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
  865. free_fb:
  866. if (map)
  867. iounmap(info->screen_base);
  868. else
  869. arkn141s_lcdfb_free_video_memory(sinfo);
  870. release_intmem:
  871. if (map)
  872. release_mem_region(info->fix.smem_start, info->fix.smem_len);
  873. stop_clk:
  874. /* arkn141s_lcdfb_stop_clock(sinfo); */
  875. clk_put(sinfo->lcdc_clk);
  876. free_info:
  877. framebuffer_release(info);
  878. out:
  879. dev_dbg(dev, "%s FAILED ret=%d.\n", __func__, ret);
  880. return ret;
  881. }
  882. static int __exit arkn141s_lcdfb_remove(struct platform_device *pdev)
  883. {
  884. struct device *dev = &pdev->dev;
  885. struct fb_info *info = dev_get_drvdata(dev);
  886. struct arkn141s_lcdfb_info *sinfo;
  887. struct arkn141s_lcdfb_pdata *pdata;
  888. if (!info || !info->par)
  889. return 0;
  890. sinfo = info->par;
  891. pdata = &sinfo->pdata;
  892. cancel_work_sync(&sinfo->task);
  893. exit_backlight(sinfo);
  894. arkn141s_lcdfb_power_control(sinfo, 0);
  895. unregister_framebuffer(info);
  896. /* arkn141s_lcdfb_stop_clock(sinfo); */
  897. clk_put(sinfo->lcdc_clk);
  898. fb_dealloc_cmap(&info->cmap);
  899. free_irq(sinfo->irq_base, info);
  900. iounmap(sinfo->sysreg);
  901. iounmap(sinfo->mmio);
  902. release_mem_region(info->fix.mmio_start, info->fix.mmio_len);
  903. if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) {
  904. iounmap(info->screen_base);
  905. release_mem_region(info->fix.smem_start, info->fix.smem_len);
  906. } else {
  907. arkn141s_lcdfb_free_video_memory(sinfo);
  908. }
  909. framebuffer_release(info);
  910. return 0;
  911. }
  912. #ifdef CONFIG_PM
  913. static int arkn141s_lcdfb_suspend(struct platform_device *pdev, pm_message_t mesg)
  914. {
  915. return 0;
  916. }
  917. static int arkn141s_lcdfb_resume(struct platform_device *pdev)
  918. {
  919. return 0;
  920. }
  921. #else
  922. #define arkn141s_lcdfb_suspend NULL
  923. #define arkn141s_lcdfb_resume NULL
  924. #endif
  925. static struct platform_driver arkn141s_lcdfb_driver = {
  926. .probe = arkn141s_lcdfb_probe,
  927. .remove = __exit_p(arkn141s_lcdfb_remove),
  928. .suspend = arkn141s_lcdfb_suspend,
  929. .resume = arkn141s_lcdfb_resume,
  930. .driver = {
  931. .name = "arkn141s_lcdfb",
  932. .of_match_table = of_match_ptr(arkn141s_lcdfb_dt_ids),
  933. },
  934. };
  935. module_platform_driver(arkn141s_lcdfb_driver);
  936. /* static int __init arkn141s_lcdfb_init(void)
  937. {
  938. int ret;
  939. ret = platform_driver_register(&arkn141s_lcdfb_driver);
  940. if (ret != 0) {
  941. printk(KERN_ERR "%s %d: failed to register arkn141s_lcdfb_driver\n",
  942. __FUNCTION__, __LINE__);
  943. }
  944. return ret;
  945. }
  946. arch_initcall(arkn141s_lcdfb_init); */
  947. MODULE_DESCRIPTION("Arkn141s LCD Controller framebuffer driver");
  948. MODULE_AUTHOR("Sim");
  949. MODULE_LICENSE("GPL v2");