diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2011-11-29 10:05:36 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-03-12 17:40:56 -0400 |
commit | fc9e78e6b3d2ba2e96426527b8231f6b7c7b7b96 (patch) | |
tree | a846f4f8dba95e2d7c08784bf213cb5fd59059be /drivers | |
parent | 105784bbb47cd76f0fc32954b047a13b704fa840 (diff) |
fbdev: sh_mobile_lcdc: Store the format in struct sh_mobile_lcdc_chan
Store the active format in the channel structure, and use it instead of
parsing info->var all over the place when the format is needed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 21 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.h | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index c66f0f4fe3d9..6d8c30bf425a 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -728,20 +728,15 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
728 | 728 | ||
729 | /* Setup geometry, format, frame buffer memory and operation mode. */ | 729 | /* Setup geometry, format, frame buffer memory and operation mode. */ |
730 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 730 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
731 | const struct sh_mobile_lcdc_format_info *format; | ||
732 | u32 fourcc; | ||
733 | |||
734 | ch = &priv->ch[k]; | 731 | ch = &priv->ch[k]; |
735 | if (!ch->enabled) | 732 | if (!ch->enabled) |
736 | continue; | 733 | continue; |
737 | 734 | ||
738 | sh_mobile_lcdc_geometry(ch); | 735 | sh_mobile_lcdc_geometry(ch); |
739 | 736 | ||
740 | fourcc = sh_mobile_format_fourcc(&ch->info->var); | 737 | tmp = ch->format->lddfr; |
741 | format = sh_mobile_format_info(fourcc); | ||
742 | tmp = format->lddfr; | ||
743 | 738 | ||
744 | if (format->yuv) { | 739 | if (ch->format->yuv) { |
745 | switch (ch->info->var.colorspace) { | 740 | switch (ch->info->var.colorspace) { |
746 | case V4L2_COLORSPACE_REC709: | 741 | case V4L2_COLORSPACE_REC709: |
747 | tmp |= LDDFR_CF1; | 742 | tmp |= LDDFR_CF1; |
@@ -755,7 +750,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
755 | lcdc_write_chan(ch, LDDFR, tmp); | 750 | lcdc_write_chan(ch, LDDFR, tmp); |
756 | lcdc_write_chan(ch, LDMLSR, ch->pitch); | 751 | lcdc_write_chan(ch, LDMLSR, ch->pitch); |
757 | lcdc_write_chan(ch, LDSA1R, ch->base_addr_y); | 752 | lcdc_write_chan(ch, LDSA1R, ch->base_addr_y); |
758 | if (format->yuv) | 753 | if (ch->format->yuv) |
759 | lcdc_write_chan(ch, LDSA2R, ch->base_addr_c); | 754 | lcdc_write_chan(ch, LDSA2R, ch->base_addr_c); |
760 | 755 | ||
761 | /* When using deferred I/O mode, configure the LCDC for one-shot | 756 | /* When using deferred I/O mode, configure the LCDC for one-shot |
@@ -772,7 +767,7 @@ static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
772 | } | 767 | } |
773 | 768 | ||
774 | /* Word and long word swap. */ | 769 | /* Word and long word swap. */ |
775 | switch (sh_mobile_format_fourcc(&priv->ch[0].info->var)) { | 770 | switch (priv->ch[0].format->fourcc) { |
776 | case V4L2_PIX_FMT_RGB565: | 771 | case V4L2_PIX_FMT_RGB565: |
777 | case V4L2_PIX_FMT_NV21: | 772 | case V4L2_PIX_FMT_NV21: |
778 | case V4L2_PIX_FMT_NV61: | 773 | case V4L2_PIX_FMT_NV61: |
@@ -859,7 +854,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
859 | ch->meram_enabled = 0; | 854 | ch->meram_enabled = 0; |
860 | } | 855 | } |
861 | 856 | ||
862 | switch (sh_mobile_format_fourcc(&ch->info->var)) { | 857 | switch (ch->format->fourcc) { |
863 | case V4L2_PIX_FMT_NV12: | 858 | case V4L2_PIX_FMT_NV12: |
864 | case V4L2_PIX_FMT_NV21: | 859 | case V4L2_PIX_FMT_NV21: |
865 | case V4L2_PIX_FMT_NV16: | 860 | case V4L2_PIX_FMT_NV16: |
@@ -1065,7 +1060,7 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var, | |||
1065 | + info->var.xres * info->var.yres_virtual | 1060 | + info->var.xres * info->var.yres_virtual |
1066 | + c_offset; | 1061 | + c_offset; |
1067 | /* Set x offset */ | 1062 | /* Set x offset */ |
1068 | if (sh_mobile_format_fourcc(&info->var) == V4L2_PIX_FMT_NV24) | 1063 | if (ch->format->fourcc == V4L2_PIX_FMT_NV24) |
1069 | base_addr_c += 2 * var->xoffset; | 1064 | base_addr_c += 2 * var->xoffset; |
1070 | else | 1065 | else |
1071 | base_addr_c += var->xoffset; | 1066 | base_addr_c += var->xoffset; |
@@ -1353,6 +1348,8 @@ static int sh_mobile_set_par(struct fb_info *info) | |||
1353 | info->fix.line_length = info->var.xres | 1348 | info->fix.line_length = info->var.xres |
1354 | * info->var.bits_per_pixel / 8; | 1349 | * info->var.bits_per_pixel / 8; |
1355 | 1350 | ||
1351 | ch->format = sh_mobile_format_info(sh_mobile_format_fourcc(&info->var)); | ||
1352 | |||
1356 | ret = sh_mobile_lcdc_start(ch->lcdc); | 1353 | ret = sh_mobile_lcdc_start(ch->lcdc); |
1357 | if (ret < 0) { | 1354 | if (ret < 0) { |
1358 | dev_err(info->dev, "%s: unable to restart LCDC\n", __func__); | 1355 | dev_err(info->dev, "%s: unable to restart LCDC\n", __func__); |
@@ -1716,6 +1713,8 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv, | |||
1716 | return -EINVAL; | 1713 | return -EINVAL; |
1717 | } | 1714 | } |
1718 | 1715 | ||
1716 | ch->format = format; | ||
1717 | |||
1719 | /* Allocate the frame buffer device. */ | 1718 | /* Allocate the frame buffer device. */ |
1720 | ch->info = framebuffer_alloc(0, priv->dev); | 1719 | ch->info = framebuffer_alloc(0, priv->dev); |
1721 | if (!ch->info) { | 1720 | if (!ch->info) { |
diff --git a/drivers/video/sh_mobile_lcdcfb.h b/drivers/video/sh_mobile_lcdcfb.h index 8e0d0099940b..5ef7559b88c1 100644 --- a/drivers/video/sh_mobile_lcdcfb.h +++ b/drivers/video/sh_mobile_lcdcfb.h | |||
@@ -17,9 +17,10 @@ enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R, | |||
17 | struct backlight_device; | 17 | struct backlight_device; |
18 | struct fb_info; | 18 | struct fb_info; |
19 | struct module; | 19 | struct module; |
20 | struct sh_mobile_lcdc_chan; | ||
20 | struct sh_mobile_lcdc_entity; | 21 | struct sh_mobile_lcdc_entity; |
22 | struct sh_mobile_lcdc_format_info; | ||
21 | struct sh_mobile_lcdc_priv; | 23 | struct sh_mobile_lcdc_priv; |
22 | struct sh_mobile_lcdc_chan; | ||
23 | 24 | ||
24 | #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0 | 25 | #define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 0 |
25 | #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1 | 26 | #define SH_MOBILE_LCDC_DISPLAY_CONNECTED 1 |
@@ -70,6 +71,7 @@ struct sh_mobile_lcdc_chan { | |||
70 | wait_queue_head_t frame_end_wait; | 71 | wait_queue_head_t frame_end_wait; |
71 | struct completion vsync_completion; | 72 | struct completion vsync_completion; |
72 | 73 | ||
74 | const struct sh_mobile_lcdc_format_info *format; | ||
73 | unsigned long base_addr_y; | 75 | unsigned long base_addr_y; |
74 | unsigned long base_addr_c; | 76 | unsigned long base_addr_c; |
75 | unsigned int pitch; | 77 | unsigned int pitch; |