Advertisement
Guest User

s3cfb_ops.c

a guest
Nov 20th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 26.72 KB | None | 0 0
  1. diff --git a/drivers/video/samsung/s3cfb_ops.c b/drivers/video/samsung/s3cfb_ops.c
  2. index 3552766..8d5739d 100644
  3. --- a/drivers/video/samsung/s3cfb_ops.c
  4. +++ b/drivers/video/samsung/s3cfb_ops.c
  5. @@ -53,35 +53,6 @@
  6.  #include <plat/s5p-sysmmu.h>
  7.  #endif
  8.  
  9. -#if defined(CONFIG_S6D7AA0_LSL080AL02)
  10. -static unsigned int fb_busfreq_table[S3C_FB_MAX_WIN + 1] = {
  11. -   100100,
  12. -   160160,
  13. -   400200,
  14. -   400200,
  15. -   400200,
  16. -   400200
  17. -};
  18. -#elif defined(CONFIG_BUSFREQ_QOS_1280X800)
  19. -static unsigned int fb_busfreq_table[S3C_FB_MAX_WIN + 1] = {
  20. -   100100,
  21. -   100100,
  22. -   267160,
  23. -   267160,
  24. -   267160,
  25. -   267160
  26. -};
  27. -#else
  28. -static unsigned int fb_busfreq_table[S3C_FB_MAX_WIN + 1] = {
  29. -   100100,
  30. -   100100,
  31. -   133133,
  32. -   267160,
  33. -   400200,
  34. -   400200
  35. -};
  36. -#endif
  37. -
  38.  struct s3c_platform_fb *to_fb_plat(struct device *dev)
  39.  {
  40.     struct platform_device *pdev = to_platform_device(dev);
  41. @@ -90,6 +61,9 @@ struct s3c_platform_fb *to_fb_plat(struct device *dev)
  42.  }
  43.  
  44.  #ifndef CONFIG_FRAMEBUFFER_CONSOLE
  45. +#define LPDDR1_BASE_ADDR       0x50000000
  46. +#define BOOT_FB_BASE_ADDR      (LPDDR1_BASE_ADDR   + 0x0EC00000)   /* 0x5EC00000 from Bootloader */
  47. +
  48.  static unsigned int bootloaderfb;
  49.  module_param_named(bootloaderfb, bootloaderfb, uint, 0444);
  50.  MODULE_PARM_DESC(bootloaderfb, "Address of booting logo image in Bootloader");
  51. @@ -159,7 +133,7 @@ int fb_is_primary_device(struct fb_info *fb)
  52.     struct s3cfb_global *fbdev = get_fimd_global(win->id);
  53.     struct s3c_platform_fb *pdata = to_fb_plat(fbdev->dev);
  54.  
  55. -   dev_dbg(fbdev->dev, "[fb%d] win%d: checking for primary device\n", fb->node, win->id);
  56. +   dev_dbg(fbdev->dev, "[fb%d] checking for primary device\n", win->id);
  57.  
  58.     if (win->id == pdata->default_win)
  59.         return 1;
  60. @@ -341,7 +315,7 @@ int s3cfb_unmap_video_memory(struct s3cfb_global *fbdev, struct fb_info *fb)
  61.  #endif
  62.         fix->smem_start = 0;
  63.         fix->smem_len = 0;
  64. -       dev_info(fbdev->dev, "[fb%d] win%d: video memory released\n", fb->node, win->id);
  65. +       dev_info(fbdev->dev, "[fb%d] video memory released\n", win->id);
  66.     }
  67.     return 0;
  68.  }
  69. @@ -386,8 +360,8 @@ int s3cfb_map_video_memory(struct s3cfb_global *fbdev, struct fb_info *fb)
  70.                          &fix->smem_start, GFP_KERNEL);
  71.  #endif
  72.  
  73. -   dev_info(fbdev->dev, "[fb%d] win%d: Alloc dma: 0x%08x, "
  74. -           "size: 0x%08x\n", fb->node, win->id,
  75. +   dev_info(fbdev->dev, "[fb%d] Alloc dma: 0x%08x, "
  76. +           "size: 0x%08x\n", win->id,
  77.             (unsigned int)fix->smem_start,
  78.             fix->smem_len);
  79.  
  80. @@ -401,7 +375,6 @@ int s3cfb_map_default_video_memory(struct s3cfb_global *fbdev,
  81.  {
  82.     struct fb_fix_screeninfo *fix = &fb->fix;
  83.     struct s3cfb_window *win = fb->par;
  84. -
  85.  #ifdef CONFIG_CMA
  86.     struct cma_info mem_info;
  87.     int err;
  88. @@ -431,8 +404,8 @@ int s3cfb_map_default_video_memory(struct s3cfb_global *fbdev,
  89.     if (!fb->screen_base)
  90.         return -ENOMEM;
  91.     else
  92. -       dev_info(fbdev->dev, "[fb%d] win%d: dma: 0x%08x, cpu: 0x%08x, "
  93. -           "size: 0x%08x\n", fb->node, win->id,
  94. +       dev_info(fbdev->dev, "[fb%d] dma: 0x%08x, cpu: 0x%08x, "
  95. +           "size: 0x%08x\n", win->id,
  96.             (unsigned int)fix->smem_start,
  97.             (unsigned int)fb->screen_base, fix->smem_len);
  98.  
  99. @@ -458,7 +431,7 @@ int s3cfb_unmap_default_video_memory(struct s3cfb_global *fbdev,
  100.  
  101.         fix->smem_start = 0;
  102.         fix->smem_len = 0;
  103. -       dev_info(fbdev->dev, "[fb%d] win%d: video memory released\n", fb->node, win->id);
  104. +       dev_info(fbdev->dev, "[fb%d] video memory released\n", win->id);
  105.     }
  106.  
  107.     return 0;
  108. @@ -550,7 +523,7 @@ int s3cfb_check_var_window(struct s3cfb_global *fbdev,
  109.     struct s3cfb_window *win = fb->par;
  110.     struct s3cfb_lcd *lcd = fbdev->lcd;
  111.  
  112. -   dev_dbg(fbdev->dev, "[fb%d] win%d: check_var\n", fb->node, win->id);
  113. +   dev_dbg(fbdev->dev, "[fb%d] check_var\n", win->id);
  114.  
  115.     if (var->bits_per_pixel != 16 && var->bits_per_pixel != 24 &&
  116.         var->bits_per_pixel != 32) {
  117. @@ -632,7 +605,7 @@ int s3cfb_set_par_window(struct s3cfb_global *fbdev, struct fb_info *fb)
  118.     struct s3cfb_window *win = fb->par;
  119.     int ret;
  120.  
  121. -   dev_dbg(fbdev->dev, "[fb%d] win%d: set_par\n", fb->node, win->id);
  122. +   dev_dbg(fbdev->dev, "[fb%d] set_par\n", win->id);
  123.  
  124.  #if (!defined(CONFIG_CPU_EXYNOS4210))
  125.     if ((win->id != pdata->default_win) && fb->fix.smem_start)
  126. @@ -665,7 +638,7 @@ int s3cfb_set_par(struct fb_info *fb)
  127.  
  128.  #ifdef CONFIG_EXYNOS_DEV_PD
  129.     if (unlikely(fbdev->system_state == POWER_OFF)) {
  130. -       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d, win%d\n", __func__, fb->node, win->id);
  131. +       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d\n", __func__, win->id);
  132.         return 0;
  133.     }
  134.  #endif
  135. @@ -788,18 +761,14 @@ int s3cfb_alloc_framebuffer(struct s3cfb_global *fbdev, int fimd_id)
  136.             goto err_alloc_fb;
  137.         }
  138.  
  139. -       if (i == pdata->default_win) {
  140. +       if (i == pdata->default_win)
  141.             if (s3cfb_map_default_video_memory(fbdev,
  142.                         fbdev->fb[i], fimd_id)) {
  143.                 dev_err(fbdev->dev,
  144. -                       "failed to map video memory "
  145. -                       "for default window (%d)\n", i);
  146. -               ret = -ENOMEM;
  147. -               goto err_alloc_fb;
  148. -           } else {
  149. -               memcpy(&(fbdev->initial_fix), &(fbdev->fb[i]->fix), sizeof(struct fb_fix_screeninfo));
  150. -               memcpy(&(fbdev->initial_var), &(fbdev->fb[i]->var), sizeof(struct fb_var_screeninfo));
  151. -           }
  152. +               "failed to map video memory "
  153. +               "for default window (%d)\n", i);
  154. +           ret = -ENOMEM;
  155. +           goto err_alloc_fb;
  156.         }
  157.         sec_getlog_supply_fbinfo((void *)fbdev->fb[i]->fix.smem_start,
  158.                      fbdev->fb[i]->var.xres,
  159. @@ -857,7 +826,7 @@ int s3cfb_release_window(struct fb_info *fb)
  160.  
  161.  #ifdef CONFIG_EXYNOS_DEV_PD
  162.     if (unlikely(fbdev->system_state == POWER_OFF)) {
  163. -       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d, win%d\n", __func__, fb->node, win->id);
  164. +       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d\n", __func__, win->id);
  165.         return 0;
  166.     }
  167.  #endif
  168. @@ -929,11 +898,11 @@ int s3cfb_blank(int blank_mode, struct fb_info *fb)
  169.     int win_status;
  170.  #endif
  171.  
  172. -   dev_info(fbdev->dev, "change blank mode=%d, fb%d, win%d\n", blank_mode, fb->node, win->id);
  173. +   dev_info(fbdev->dev, "change blank mode=%d, fb%d\n", blank_mode, win->id);
  174.  
  175.  #ifdef CONFIG_EXYNOS_DEV_PD
  176.     if (unlikely(fbdev->system_state == POWER_OFF)) {
  177. -       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d, win%d\n", __func__, fb->node, win->id);
  178. +       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d\n", __func__, win->id);
  179.         win->power_state = blank_mode;
  180.         if (win->id != pdata->default_win)
  181.             return NOT_DEFAULT_WINDOW;
  182. @@ -945,14 +914,14 @@ int s3cfb_blank(int blank_mode, struct fb_info *fb)
  183.     switch (blank_mode) {
  184.     case FB_BLANK_UNBLANK:
  185.         if (!fb->fix.smem_start) {
  186. -           dev_info(fbdev->dev, "[fb%d] win%d: no allocated memory \
  187. -               for unblank\n", fb->node, win->id);
  188. +           dev_info(fbdev->dev, "[fb%d] no allocated memory \
  189. +               for unblank\n", win->id);
  190.             break;
  191.         }
  192.  
  193.         if (win->power_state == FB_BLANK_UNBLANK) {
  194. -           dev_info(fbdev->dev, "[fb%d] win%d: already in \
  195. -               FB_BLANK_UNBLANK\n", fb->node, win->id);
  196. +           dev_info(fbdev->dev, "[fb%d] already in \
  197. +               FB_BLANK_UNBLANK\n", win->id);
  198.             break;
  199.         } else {
  200.             s3cfb_update_power_state(fbdev, win->id,
  201. @@ -973,13 +942,10 @@ int s3cfb_blank(int blank_mode, struct fb_info *fb)
  202.                 }
  203.         }
  204.  
  205. -       if (win->enabled) { /* from FB_BLANK_NORMAL */
  206. +       if (win->enabled)   /* from FB_BLANK_NORMAL */
  207.             s3cfb_win_map_off(fbdev, win->id);
  208. -       } else {        /* from FB_BLANK_POWERDOWN */
  209. +       else            /* from FB_BLANK_POWERDOWN */
  210.             s3cfb_enable_window(fbdev, win->id);
  211. -           if (!s3cfb_get_win_cur_buf_addr(fbdev, win->id))
  212. -               s3cfb_window_off(fbdev, win->id);
  213. -       }
  214.  
  215.         if (enabled_win == 0) {
  216.             s3cfb_display_on(fbdev);
  217. @@ -1004,7 +970,7 @@ int s3cfb_blank(int blank_mode, struct fb_info *fb)
  218.  
  219.     case FB_BLANK_NORMAL:
  220.         if (win->power_state == FB_BLANK_NORMAL) {
  221. -           dev_info(fbdev->dev, "[fb%d] win%d: already in FB_BLANK_NORMAL\n", fb->node, win->id);
  222. +           dev_info(fbdev->dev, "[fb%d] already in FB_BLANK_NORMAL\n", win->id);
  223.             break;
  224.         } else {
  225.             s3cfb_update_power_state(fbdev, win->id,
  226. @@ -1053,7 +1019,7 @@ int s3cfb_blank(int blank_mode, struct fb_info *fb)
  227.  
  228.     case FB_BLANK_POWERDOWN:
  229.         if (win->power_state == FB_BLANK_POWERDOWN) {
  230. -           dev_info(fbdev->dev, "[fb%d] win%d: already in FB_BLANK_POWERDOWN\n", fb->node, win->id);
  231. +           dev_info(fbdev->dev, "[fb%d] already in FB_BLANK_POWERDOWN\n", win->id);
  232.             break;
  233.         } else {
  234.             s3cfb_update_power_state(fbdev, win->id,
  235. @@ -1105,7 +1071,7 @@ int s3cfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fb)
  236.  
  237.  #ifdef CONFIG_EXYNOS_DEV_PD
  238.     if (unlikely(fbdev->system_state == POWER_OFF) || fbdev->regs == 0) {
  239. -       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d, win%d\n", __func__, fb->node, win->id);
  240. +       dev_err(fbdev->dev, "%s::system_state is POWER_OFF, fb%d\n", __func__, win->id);
  241.         if (win->id == pdata->default_win)
  242.             spin_unlock(&fbdev->slock);
  243.         return -EINVAL;
  244. @@ -1131,8 +1097,8 @@ int s3cfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fb)
  245.  
  246.     fb->var.yoffset = var->yoffset;
  247.  
  248. -   dev_dbg(fbdev->dev, "[fb%d] win%d: yoffset for pan display: %d\n",
  249. -       fb->node, win->id, var->yoffset);
  250. +   dev_dbg(fbdev->dev, "[fb%d] yoffset for pan display: %d\n", win->id,
  251. +       var->yoffset);
  252.  
  253.     s3cfb_set_buffer_address(fbdev, win->id);
  254.  
  255. @@ -1161,7 +1127,6 @@ int s3cfb_wait_for_vsync(struct s3cfb_global *fbdev)
  256.  #endif
  257.  
  258.  
  259. -#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
  260.  /**
  261.   * s3c_fb_align_word() - align pixel count to word boundary
  262.   * @bpp: The number of bits per pixel
  263. @@ -1352,24 +1317,6 @@ static u32 s3c_fb_padding(int format)
  264.  
  265.  }
  266.  
  267. -static u32 s3c_fb_rgborder(int format)
  268. -{
  269. -   switch (format) {
  270. -   case S3C_FB_PIXEL_FORMAT_RGBX_8888:
  271. -   case S3C_FB_PIXEL_FORMAT_RGBA_8888:
  272. -   case S3C_FB_PIXEL_FORMAT_RGBA_5551:
  273. -       return WIN_RGB_ORDER_REVERSE;
  274. -
  275. -   case S3C_FB_PIXEL_FORMAT_RGB_565:
  276. -   case S3C_FB_PIXEL_FORMAT_BGRA_8888:
  277. -       return WIN_RGB_ORDER_FORWARD;
  278. -
  279. -   default:
  280. -       pr_warn("s3c-fb: unrecognized pixel format %u\n", format);
  281. -       return 0;
  282. -   }
  283. -}
  284. -
  285.  static inline u32 fb_visual(u32 bits_per_pixel, unsigned short palette_sz)
  286.  {
  287.     switch (bits_per_pixel) {
  288. @@ -1390,6 +1337,7 @@ static inline u32 fb_visual(u32 bits_per_pixel, unsigned short palette_sz)
  289.     }
  290.  }
  291.  
  292. +
  293.  static inline u32 fb_linelength(u32 xres_virtual, u32 bits_per_pixel)
  294.  {
  295.     return (xres_virtual * bits_per_pixel) / 8;
  296. @@ -1427,28 +1375,6 @@ inline u32 vidosd_b(int x, int y, u32 xres, u32 yres, u32 bits_per_pixel)
  297.         VIDOSDxB_BOTRIGHT_Y_E(y + yres - 1);
  298.  }
  299.  
  300. -static inline u32 vidosd_c(u8 r0, u8 g0, u8 b0, u8 r1, u8 g1, u8 b1)
  301. -{
  302. -   return VIDOSDxC_ALPHA0_R_H(r0) |
  303. -       VIDOSDxC_ALPHA0_G_H(g0) |
  304. -       VIDOSDxC_ALPHA0_B_H(b0) |
  305. -       VIDOSDxC_ALPHA1_R_H(r1) |
  306. -       VIDOSDxC_ALPHA1_G_H(g1) |
  307. -       VIDOSDxC_ALPHA1_B_H(b1);
  308. -}
  309. -
  310. -static inline u32 vidw_alpha(bool has_osd_alpha, u8 r, u8 g, u8 b)
  311. -{
  312. -   if (has_osd_alpha)
  313. -       return VIDWxALPHAx_R_L(r) |
  314. -           VIDWxALPHAx_G_L(g) |
  315. -           VIDWxALPHAx_B_L(b);
  316. -   else
  317. -       return VIDWxALPHAx_R(r) |
  318. -           VIDWxALPHAx_G(g) |
  319. -           VIDWxALPHAx_B(b);
  320. -}
  321. -
  322.  static inline u32 wincon(u32 bits_per_pixel, u32 transp_length, u32 red_length)
  323.  {
  324.     u32 data = 0;
  325. @@ -1478,12 +1404,8 @@ static inline u32 wincon(u32 bits_per_pixel, u32 transp_length, u32 red_length)
  326.         data |= WINCONx_BYTSWP;
  327.         break;
  328.     case 16:
  329. -       if (transp_length == 1)
  330. -           data |= WINCON1_BPPMODE_16BPP_A1555
  331. -               | WINCON1_BLD_PIX;
  332. -       else if (transp_length == 4)
  333. -           data |= WINCON1_BPPMODE_16BPP_A4444
  334. -               | WINCON1_BLD_PIX;
  335. +       if (transp_length != 0)
  336. +           data |= WINCON1_BPPMODE_16BPP_A1555;
  337.         else
  338.             data |= WINCON0_BPPMODE_16BPP_565;
  339.         data |= WINCONx_HAWSWP;
  340. @@ -1502,7 +1424,7 @@ static inline u32 wincon(u32 bits_per_pixel, u32 transp_length, u32 red_length)
  341.         else if ((transp_length == 4) ||
  342.             (transp_length == 8))
  343.             data |= WINCON1_BPPMODE_28BPP_A4888
  344. -               | WINCON1_BLD_PIX;
  345. +               | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
  346.         else
  347.             data |= WINCON0_BPPMODE_24BPP_888;
  348.  
  349. @@ -1511,27 +1433,8 @@ static inline u32 wincon(u32 bits_per_pixel, u32 transp_length, u32 red_length)
  350.         break;
  351.     }
  352.  
  353. -   if (transp_length != 1)
  354. -       data |= WINCON1_ALPHA_SEL;
  355. -
  356.     return data;
  357.  }
  358. -#endif
  359. -
  360. -void s3c_fb_set_busfreq(struct s3cfb_global *fbdev, unsigned int num_of_win)
  361. -{
  362. -   if (num_of_win > S3C_FB_MAX_WIN)
  363. -       num_of_win = 0;
  364. -
  365. -   dev_dbg(fbdev->dev, "%s : nWin=%d, busfreq = %d\n", __func__,
  366. -           num_of_win, fb_busfreq_table[num_of_win]);
  367. -
  368. -#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
  369. -#ifdef CONFIG_BUSFREQ_OPP
  370. -   dev_lock(fbdev->bus_dev, fbdev->dev, fb_busfreq_table[num_of_win]);
  371. -#endif
  372. -#endif
  373. -}
  374.  
  375.  void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  376.  {
  377. @@ -1555,8 +1458,27 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  378.         if (shadow_regs & SHADOWCON_CHx_ENABLE(i))
  379.             pre_num_of_win++;
  380.  
  381. -   if (pre_num_of_win < new_num_of_win)
  382. -       s3c_fb_set_busfreq(fbdev, new_num_of_win);
  383. +   if (pre_num_of_win < new_num_of_win) {
  384. +       switch(new_num_of_win) {
  385. +       case 0:
  386. +       case 1:
  387. +           clkval = 100100;
  388. +           break;
  389. +       case 2:
  390. +           clkval = 133133;
  391. +           break;
  392. +       case 3:
  393. +           clkval = 133133;
  394. +           break;
  395. +       case 4:
  396. +           clkval = 133133;
  397. +           break;
  398. +       case 5:
  399. +           clkval = 133133;
  400. +           break;
  401. +       }
  402. +       dev_lock(fbdev->bus_dev, fbdev->dev, clkval);
  403. +   }
  404.  #endif
  405.  #endif
  406.  
  407. @@ -1566,16 +1488,11 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  408.     for (i = 0; i < pdata->nr_wins; i++) {
  409.         win = fbdev->fb[i]->par;
  410.         writel(regs->wincon[i], fbdev->regs + S3C_WINCON(i));
  411. -       writel(regs->win_rgborder[i], fbdev->regs + WIN_RGB_ORDER(i));
  412.         writel(regs->vidosd_a[i], fbdev->regs + S3C_VIDOSD_A(i));
  413.         writel(regs->vidosd_b[i], fbdev->regs + S3C_VIDOSD_B(i));
  414.         writel(regs->vidosd_c[i], fbdev->regs + S3C_VIDOSD_C(i));
  415.         if (i == 1 || i == 2)
  416.             writel(regs->vidosd_d[i], fbdev->regs + S3C_VIDOSD_D(i));
  417. -       writel(regs->vidw_alpha0[i],
  418. -               fbdev->regs + S3C_VIDW_ALPHA0(i));
  419. -       writel(regs->vidw_alpha1[i],
  420. -               fbdev->regs + S3C_VIDW_ALPHA1(i));
  421.         writel(regs->vidw_buf_start[i],
  422.                 fbdev->regs + S3C_VIDADDR_START0(i));
  423.         writel(regs->vidw_buf_end[i],
  424. @@ -1584,8 +1501,6 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  425.                 fbdev->regs + S3C_VIDADDR_SIZE(i));
  426.  
  427.         win->enabled = !!(regs->wincon[i] & WINCONx_ENWIN);
  428. -       if (i)
  429. -           writel(regs->blendeq[i - 1], fbdev->regs + BLENDEQ(i));
  430.     }
  431.  
  432.     writel(regs->shadowcon, fbdev->regs + S3C_WINSHMAP);
  433. @@ -1593,16 +1508,12 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  434.     for (i = 0; i < pdata->nr_wins; i++)
  435.         s3cfb_set_window_protect(fbdev, i, 0);
  436.  
  437. -   if (fbdev->support_fence == FENCE_SUPPORT) {
  438.     do {
  439.  #if defined(CONFIG_FB_S5P_VSYNC_THREAD)
  440. -       s3cfb_wait_for_vsync(fbdev, HZ/10);
  441. +       s3cfb_wait_for_vsync(fbdev, 0);
  442.  #else
  443.         s3cfb_wait_for_vsync(fbdev);
  444.  #endif
  445. -       if (!fbdev->regs)
  446. -           break;
  447. -
  448.         wait_for_vsync = false;
  449.  
  450.         for (i = 0; i < pdata->nr_wins; i++) {
  451. @@ -1615,8 +1526,7 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  452.         }
  453.     } while (wait_for_vsync);
  454.  
  455. -       sw_sync_timeline_inc(fbdev->timeline, 1);
  456. -   }
  457. +   sw_sync_timeline_inc(fbdev->timeline, 1);
  458.  
  459.  #ifdef CONFIG_FB_S5P_SYSMMU
  460.         if ((fbdev->sysmmu.enabled == false) &&
  461. @@ -1629,75 +1539,42 @@ void s3c_fb_update_regs(struct s3cfb_global *fbdev, struct s3c_reg_data *regs)
  462.  
  463.  #if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
  464.  #ifdef CONFIG_BUSFREQ_OPP
  465. -   if (pre_num_of_win > new_num_of_win)
  466. -       s3c_fb_set_busfreq(fbdev, new_num_of_win);
  467. +   if (pre_num_of_win > new_num_of_win) {
  468. +       switch(new_num_of_win) {
  469. +       case 0:
  470. +       case 1:
  471. +           clkval = 100100;
  472. +           break;
  473. +       case 2:
  474. +           clkval = 133133;
  475. +           break;
  476. +       case 3:
  477. +           clkval = 133133;
  478. +           break;
  479. +       case 4:
  480. +           clkval = 133133;
  481. +           break;
  482. +       case 5:
  483. +           clkval = 133133;
  484. +           break;
  485. +       }
  486. +       dev_lock(fbdev->bus_dev, fbdev->dev, clkval);
  487. +   }
  488.  #endif
  489.  #endif
  490.  }
  491.  
  492. -static inline u32 blendeq(enum s3c_fb_blending blending, u8 transp_length)
  493. -{
  494. -   u8 a, b;
  495. -
  496. -   if (transp_length == 1 && blending == S3C_FB_BLENDING_PREMULT)
  497. -       blending = S3C_FB_BLENDING_COVERAGE;
  498. -
  499. -   switch (blending) {
  500. -   case S3C_FB_BLENDING_NONE:
  501. -       a = BLENDEQ_COEF_ONE;
  502. -       b = BLENDEQ_COEF_ZERO;
  503. -       break;
  504. -
  505. -   case S3C_FB_BLENDING_PREMULT:
  506. -       a = BLENDEQ_COEF_ONE;
  507. -       b = BLENDEQ_COEF_ONE_MINUS_ALPHA_A;
  508. -       break;
  509. -
  510. -   case S3C_FB_BLENDING_COVERAGE:
  511. -       a = BLENDEQ_COEF_ALPHA_A;
  512. -       b = BLENDEQ_COEF_ONE_MINUS_ALPHA_A;
  513. -       break;
  514. -
  515. -   default:
  516. -       return 0;
  517. -   }
  518. -
  519. -   return BLENDEQ_A_FUNC(a) |
  520. -           BLENDEQ_B_FUNC(b) |
  521. -           BLENDEQ_P_FUNC(BLENDEQ_COEF_ZERO) |
  522. -           BLENDEQ_Q_FUNC(BLENDEQ_COEF_ZERO);
  523. -}
  524. -
  525. -static bool s3c_fb_validate_x_alignment(struct s3cfb_global *fbdev, int x, u32 w,
  526. -       u32 bits_per_pixel)
  527. -{
  528. -   uint8_t pixel_alignment = 32 / bits_per_pixel;
  529. -
  530. -   if (x % pixel_alignment) {
  531. -       dev_err(fbdev->dev, "left X coordinate not properly aligned to %u-pixel boundary (bpp = %u, x = %u)\n",
  532. -               pixel_alignment, bits_per_pixel, x);
  533. -       return 0;
  534. -   }
  535. -   if ((x + w) % pixel_alignment) {
  536. -       dev_err(fbdev->dev, "right X coordinate not properly aligned to %u-pixel boundary (bpp = %u, x = %u, w = %u)\n",
  537. -               pixel_alignment, bits_per_pixel, x, w);
  538. -       return 0;
  539. -   }
  540. -
  541. -   return 1;
  542. -}
  543. -
  544. -#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
  545.  static int s3c_fb_set_win_buffer(struct s3cfb_global *fbdev,
  546.         struct fb_info *fb, struct s3c_fb_win_config *win_config,
  547.         struct s3c_reg_data *regs)
  548.  {
  549.     struct s3cfb_window *win = fb->par;
  550. +   struct fb_fix_screeninfo prev_fix = fb->fix;
  551.     struct fb_var_screeninfo prev_var = fb->var;
  552.     unsigned short win_no = win->id;
  553.     int ret;
  554.     size_t window_size;
  555. -   u8 alpha0, alpha1;
  556. +   u32 alpha, size;
  557.  
  558.     if (win_config->format >= S3C_FB_PIXEL_FORMAT_MAX) {
  559.         dev_err(fbdev->dev, "unknown pixel format %u\n",
  560. @@ -1705,23 +1582,6 @@ static int s3c_fb_set_win_buffer(struct s3cfb_global *fbdev,
  561.         return -EINVAL;
  562.     }
  563.  
  564. -   if (win_config->blending >= S3C_FB_BLENDING_MAX) {
  565. -       dev_err(fbdev->dev, "unknown blending %u\n",
  566. -               win_config->blending);
  567. -       return -EINVAL;
  568. -   }
  569. -
  570. -   if (win_no == 0 && win_config->blending != S3C_FB_BLENDING_NONE) {
  571. -       dev_err(fbdev->dev, "blending not allowed on window 0\n");
  572. -       return -EINVAL;
  573. -   }
  574. -
  575. -   if (win_config->w == 0 || win_config->h == 0) {
  576. -       dev_err(fbdev->dev, "window is size 0 (w = %u, h = %u)\n",
  577. -               win_config->w, win_config->h);
  578. -       return -EINVAL;
  579. -   }
  580. -
  581.     fb->var.red.length = s3c_fb_red_length(win_config->format);
  582.     fb->var.red.offset = s3c_fb_red_offset(win_config->format);
  583.     fb->var.green.length = s3c_fb_green_length(win_config->format);
  584. @@ -1736,33 +1596,6 @@ static int s3c_fb_set_win_buffer(struct s3cfb_global *fbdev,
  585.             fb->var.transp.length +
  586.             s3c_fb_padding(win_config->format);
  587.  
  588. -   regs->win_rgborder[win_no] = s3c_fb_rgborder(win_config->format);
  589. -
  590. -   if (win_config->w * fb->var.bits_per_pixel / 8 < 128) {
  591. -       dev_err(fbdev->dev, "window must be at least 128 bytes wide "
  592. -               "(width = %u, bpp = %u)\n",
  593. -               win_config->w,
  594. -               fb->var.bits_per_pixel);
  595. -       ret = -EINVAL;
  596. -       goto err_invalid;
  597. -   }
  598. -
  599. -   if (win_config->stride <
  600. -           win_config->w * fb->var.bits_per_pixel / 8) {
  601. -       dev_err(fbdev->dev, "stride shorter than buffer width "
  602. -               "(stride = %u, width = %u, bpp = %u)\n",
  603. -               win_config->stride, win_config->w,
  604. -               fb->var.bits_per_pixel);
  605. -       ret = -EINVAL;
  606. -       goto err_invalid;
  607. -   }
  608. -
  609. -   if (!s3c_fb_validate_x_alignment(fbdev, win_config->x, win_config->w,
  610. -           fb->var.bits_per_pixel)) {
  611. -       ret = -EINVAL;
  612. -       goto err_invalid;
  613. -   }
  614. -
  615.     window_size = win_config->stride * win_config->h;
  616.  
  617.     if (win_config->phys_addr != 0)
  618. @@ -1816,30 +1649,14 @@ static int s3c_fb_set_win_buffer(struct s3cfb_global *fbdev,
  619.             win_config->w, win_config->h,
  620.             fb->var.bits_per_pixel);
  621.  
  622. -   if (fb->var.transp.length == 1 &&
  623. -           win_config->blending == S3C_FB_BLENDING_NONE) {
  624. -       alpha0 = 0xff;
  625. -       alpha1 = 0xff;
  626. -   }
  627. -   else {
  628. -       alpha0 = 0;
  629. -       alpha1 = 0xff;
  630. -   }
  631. +   alpha = VIDISD14C_ALPHA1_R(0xf) |
  632. +       VIDISD14C_ALPHA1_G(0xf) |
  633. +       VIDISD14C_ALPHA1_B(0xf);
  634. +   regs->vidosd_c[win_no] = alpha;
  635.  
  636. -   if (win_no != 0)
  637. -       regs->vidosd_c[win_no] = vidosd_c(alpha0, alpha0, alpha0,
  638. -               alpha1, alpha1, alpha1);
  639. -   regs->vidw_alpha0[win_no] = vidw_alpha((win_no == 0 ? 0:1),
  640. -           alpha0, alpha0, alpha0);
  641. -   regs->vidw_alpha1[win_no] = vidw_alpha((win_no == 0 ? 0:1),
  642. -           alpha1, alpha1, alpha1);
  643. -
  644. -   if (win_no < 3) {
  645. -       u32 size = win_config->w * win_config->h;
  646. -       if (win_no != 0)
  647. -           regs->vidosd_d[win_no] = size;
  648. -       else
  649. -           regs->vidosd_c[win_no] = size;
  650. +   if (win_no <= 2) {
  651. +       size = win_config->w * win_config->h;
  652. +       regs->vidosd_d[win_no] = size;
  653.     }
  654.  
  655.     regs->shadowcon |= SHADOWCON_CHx_ENABLE(win_no);
  656. @@ -1847,15 +1664,8 @@ static int s3c_fb_set_win_buffer(struct s3cfb_global *fbdev,
  657.     regs->wincon[win_no] = wincon(fb->var.bits_per_pixel,
  658.             fb->var.transp.length,
  659.             fb->var.red.length);
  660. -   if (win_no)
  661. -       regs->blendeq[win_no - 1] = blendeq(win_config->blending,
  662. -               fb->var.transp.length);
  663.  
  664.     return 0;
  665. -
  666. -err_invalid:
  667. -   fb->var = prev_var;
  668. -   return ret;
  669.  }
  670.  
  671.  static int s3c_fb_set_win_config(struct s3cfb_global *fbdev,
  672. @@ -1866,44 +1676,19 @@ static int s3c_fb_set_win_config(struct s3cfb_global *fbdev,
  673.     struct s3c_fb_win_config *win_config = win_data->config;
  674.     int ret = 0;
  675.     unsigned short i;
  676. -   struct s3c_reg_data *regs;
  677. +   struct s3c_reg_data *regs = kzalloc(sizeof(struct s3c_reg_data),
  678. +           GFP_KERNEL);
  679.     struct sync_fence *fence;
  680.     struct sync_pt *pt;
  681.     int fd;
  682.  
  683. -   if (fbdev->support_fence == FENCE_SUPPORT)
  684. -   fd = get_unused_fd();
  685. -
  686. -   if (fd < 0) {
  687. -       dev_err(fbdev->dev, "could not get unused_fd.\n");
  688. -       return fd;
  689. -   }
  690. -
  691. -   mutex_lock(&fbdev->output_lock);
  692. -
  693. -   if (unlikely(fbdev->system_state == POWER_OFF)) {
  694. -       if (fbdev->support_fence == FENCE_NOT_SUPPORT) {
  695. -           win_data->fence = -1;
  696. -       } else {
  697. -       fbdev->timeline_max++;
  698. -       pt = sw_sync_pt_create(fbdev->timeline, fbdev->timeline_max);
  699. -       fence = sync_fence_create("display", pt);
  700. -       sync_fence_install(fence, fd);
  701. -       win_data->fence = fd;
  702. -
  703. -           sw_sync_timeline_inc(fbdev->timeline, 1);
  704. -       }
  705. -       mutex_unlock(&fbdev->output_lock);
  706. -       return ret;
  707. -   }
  708. -
  709. -   regs = kzalloc(sizeof(struct s3c_reg_data), GFP_KERNEL);
  710.     if (!regs) {
  711. -       dev_err(fbdev->dev, "could not allocate s3c_reg_data\n");
  712. -       mutex_unlock(&fbdev->output_lock);
  713. +       dev_err(fbdev->dev, "could not allocate s3c_reg_data");
  714.         return -ENOMEM;
  715.     }
  716.  
  717. +   fd = get_unused_fd();
  718. +
  719.     for (i = 0; i < pdata->nr_wins && !ret; i++) {
  720.         struct s3c_fb_win_config *config = &win_config[i];
  721.         bool enabled = 0;
  722. @@ -1939,17 +1724,11 @@ static int s3c_fb_set_win_config(struct s3cfb_global *fbdev,
  723.         regs->winmap[i] = color_map;
  724.     }
  725.  
  726. -   if ((fbdev->support_fence == FENCE_SUPPORT) && ret) {
  727. +   if (ret) {
  728.         put_unused_fd(fd);
  729.         kfree(regs);
  730.     } else {
  731.         mutex_lock(&fbdev->update_regs_list_lock);
  732. -       if (fbdev->support_fence == FENCE_NOT_SUPPORT) {
  733. -           s3c_fb_update_regs(fbdev, regs);
  734. -           mutex_unlock(&fbdev->update_regs_list_lock);
  735. -           kfree(regs);
  736. -           win_data->fence = -1;
  737. -       } else {
  738.         fbdev->timeline_max++;
  739.         pt = sw_sync_pt_create(fbdev->timeline, fbdev->timeline_max);
  740.         fence = sync_fence_create("display", pt);
  741. @@ -1958,31 +1737,25 @@ static int s3c_fb_set_win_config(struct s3cfb_global *fbdev,
  742.  
  743.         list_add_tail(&regs->list, &fbdev->update_regs_list);
  744.         mutex_unlock(&fbdev->update_regs_list_lock);
  745. -       queue_kthread_work(&fbdev->update_regs_worker,
  746. -                   &fbdev->update_regs_work);
  747. -       }
  748. +       queue_kthread_work(&fbdev->update_regs_worker, &fbdev->update_regs_work);
  749.     }
  750. -   mutex_unlock(&fbdev->output_lock);
  751.  
  752.     return ret;
  753.  }
  754. -#endif
  755.  
  756.  int s3cfb_ioctl(struct fb_info *fb, unsigned int cmd, unsigned long arg)
  757.  {
  758. -   struct fb_fix_screeninfo *fix = &fb->fix;
  759.     struct fb_var_screeninfo *var = &fb->var;
  760.     struct s3cfb_window *win = fb->par;
  761.     struct s3cfb_global *fbdev = get_fimd_global(win->id);
  762. -#if defined(CONFIG_CPU_EXYNOS4210)
  763.     struct s3cfb_lcd *lcd = fbdev->lcd;
  764. -   unsigned int addr = 0;
  765. -#endif
  766. -
  767.     void *argp = (void *)arg;
  768.     int ret = 0;
  769. +#if defined(CONFIG_CPU_EXYNOS4210)
  770. +   unsigned int addr = 0;
  771. +#endif
  772.     dma_addr_t start_addr = 0;
  773. -   unsigned int support_fence = 0;
  774. +   struct fb_fix_screeninfo *fix = &fb->fix;
  775.  
  776.     union {
  777.         struct s3cfb_user_window user_window;
  778. @@ -1993,6 +1766,13 @@ int s3cfb_ioctl(struct fb_info *fb, unsigned int cmd, unsigned long arg)
  779.         unsigned int alpha_mode;
  780.     } p;
  781.  
  782. +#ifdef CONFIG_EXYNOS_DEV_PD
  783. +   if (unlikely(fbdev->system_state == POWER_OFF)) {
  784. +       dev_err(fbdev->dev, "%s::system_state is POWER_OFF cmd is 0x%08x, fb%d\n", __func__, cmd, win->id);
  785. +       return -EFAULT;
  786. +   }
  787. +#endif
  788. +
  789.     switch (cmd) {
  790.     case S3CFB_SET_WIN_ADDR:
  791.         fix->smem_start = (unsigned long)argp;
  792. @@ -2124,8 +1904,6 @@ int s3cfb_ioctl(struct fb_info *fb, unsigned int cmd, unsigned long arg)
  793.         break;
  794.  
  795.     case S3CFB_GET_CUR_WIN_BUF_ADDR:
  796. -       if (!fbdev->regs)
  797. -           return -EFAULT;
  798.         start_addr = s3cfb_get_win_cur_buf_addr(fbdev, win->id);
  799.         dev_dbg(fbdev->dev, "win_cur_buf_addr: 0x%08x\n", start_addr);
  800.         if (copy_to_user((void *)arg, &start_addr, sizeof(unsigned int))) {
  801. @@ -2183,27 +1961,6 @@ int s3cfb_ioctl(struct fb_info *fb, unsigned int cmd, unsigned long arg)
  802.         }
  803.         break;
  804.  #endif
  805. -   case S3CFB_SET_INITIAL_CONFIG:
  806. -       fix->smem_start = fbdev->initial_fix.smem_start;
  807. -       fix->smem_len = fbdev->initial_fix.smem_len;
  808. -       fix->line_length = fbdev->initial_fix.line_length;
  809. -       memcpy(var, &(fbdev->initial_var), sizeof(struct fb_var_screeninfo));
  810. -       break;
  811. -   case S3CFB_SUPPORT_FENCE:
  812. -       if (copy_from_user(&support_fence, (unsigned int *)arg, sizeof(unsigned int)))
  813. -           ret = -EFAULT;
  814. -       else {
  815. -           if (support_fence == FENCE_NOT_SUPPORT) {
  816. -               fbdev->support_fence = FENCE_NOT_SUPPORT;
  817. -               if (fbdev->update_regs_thread) {
  818. -                   kthread_stop(fbdev->update_regs_thread);
  819. -                   fbdev->update_regs_thread = NULL;
  820. -               }
  821. -           } else
  822. -               fbdev->support_fence = FENCE_SUPPORT;
  823. -
  824. -           printk("\n\n######support_fence %x \n\n", (unsigned int)fbdev->support_fence);
  825. -       }
  826.     }
  827.  
  828.     return ret;
  829. @@ -2239,9 +1996,8 @@ int s3cfb_open_fifo(int id, int ch, int (*do_priv) (void *), void *param)
  830.  {
  831.     struct s3cfb_global *fbdev = get_fimd_global(id);
  832.     struct s3cfb_window *win = fbdev->fb[id]->par;
  833. -   struct fb_info *fb = fbdev->fb[id];
  834.  
  835. -   dev_dbg(fbdev->dev, "[fb%d] win%d: open fifo\n", fb->node, win->id);
  836. +   dev_dbg(fbdev->dev, "[fb%d] open fifo\n", win->id);
  837.  
  838.     if (win->path == DATA_PATH_DMA) {
  839.         dev_err(fbdev->dev, "WIN%d is busy.\n", id);
  840. @@ -2271,11 +2027,9 @@ int s3cfb_close_fifo(int id, int (*do_priv) (void *), void *param)
  841.  {
  842.     struct s3cfb_global *fbdev = get_fimd_global(id);
  843.     struct s3cfb_window *win = fbdev->fb[id]->par;
  844. -   struct fb_info *fb = fbdev->fb[id];
  845. -
  846.     win->path = DATA_PATH_DMA;
  847.  
  848. -   dev_dbg(fbdev->dev, "[fb%d] win%d: close fifo\n", fb->node, win->id);
  849. +   dev_dbg(fbdev->dev, "[fb%d] close fifo\n", win->id);
  850.  
  851.     if (do_priv) {
  852.         s3cfb_display_off(fbdev);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement