aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sh_mobile_lcdcfb.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-12-12 10:36:13 -0500
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-03-12 17:41:11 -0400
commit481100506b34d666243832c3f2aee905c03cb8e7 (patch)
treecee1b897a4c87c5c211d75d70ecb73095001576b /drivers/video/sh_mobile_lcdcfb.c
parent974d250be2c70c7bf899275b23b241685d4ed7f8 (diff)
fbdev: sh_mobile_meram: Allocate ICBs automatically
Instead of manually specifying the ICBs to use in platform data, allocate them automatically at runtime. The range of reserved ICBs (for instance to be used through UIO), if any, is passed in the platform data reserved_icbs field as a bitmask. The MERAM registration function now returns a pointer to an opaque MERAM object, which is passed to the update and unregistration functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/video/sh_mobile_lcdcfb.c')
-rw-r--r--drivers/video/sh_mobile_lcdcfb.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index adc911f20033..d0c902699222 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -840,6 +840,7 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
840 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { 840 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
841 struct sh_mobile_meram_cfg *cfg; 841 struct sh_mobile_meram_cfg *cfg;
842 int pixelformat; 842 int pixelformat;
843 void *meram;
843 844
844 ch = &priv->ch[k]; 845 ch = &priv->ch[k];
845 if (!ch->enabled) 846 if (!ch->enabled)
@@ -856,9 +857,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
856 /* we need to de-init configured ICBs before we can 857 /* we need to de-init configured ICBs before we can
857 * re-initialize them. 858 * re-initialize them.
858 */ 859 */
859 if (ch->meram_enabled) { 860 if (ch->meram) {
860 mdev->ops->meram_unregister(mdev, cfg); 861 mdev->ops->meram_unregister(mdev, ch->meram);
861 ch->meram_enabled = 0; 862 ch->meram = NULL;
862 } 863 }
863 864
864 switch (ch->format->fourcc) { 865 switch (ch->format->fourcc) {
@@ -880,13 +881,13 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
880 break; 881 break;
881 } 882 }
882 883
883 ret = mdev->ops->meram_register(mdev, cfg, ch->pitch, 884 meram = mdev->ops->meram_register(mdev, cfg, ch->pitch,
884 ch->yres, pixelformat, 885 ch->yres, pixelformat,
885 ch->base_addr_y, ch->base_addr_c, 886 ch->base_addr_y, ch->base_addr_c,
886 &ch->base_addr_y, &ch->base_addr_c, 887 &ch->base_addr_y, &ch->base_addr_c,
887 &ch->pitch); 888 &ch->pitch);
888 if (!ret) 889 if (!IS_ERR(meram))
889 ch->meram_enabled = 1; 890 ch->meram = meram;
890 } 891 }
891 892
892 /* Start the LCDC. */ 893 /* Start the LCDC. */
@@ -951,13 +952,11 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
951 sh_mobile_lcdc_display_off(ch); 952 sh_mobile_lcdc_display_off(ch);
952 953
953 /* disable the meram */ 954 /* disable the meram */
954 if (ch->meram_enabled) { 955 if (ch->meram) {
955 struct sh_mobile_meram_cfg *cfg;
956 struct sh_mobile_meram_info *mdev; 956 struct sh_mobile_meram_info *mdev;
957 cfg = ch->cfg.meram_cfg;
958 mdev = priv->meram_dev; 957 mdev = priv->meram_dev;
959 mdev->ops->meram_unregister(mdev, cfg); 958 mdev->ops->meram_unregister(mdev, ch->meram);
960 ch->meram_enabled = 0; 959 ch->meram = 0;
961 } 960 }
962 961
963 } 962 }
@@ -1070,14 +1069,12 @@ static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
1070 base_addr_c += var->xoffset; 1069 base_addr_c += var->xoffset;
1071 } 1070 }
1072 1071
1073 if (ch->meram_enabled) { 1072 if (ch->meram) {
1074 struct sh_mobile_meram_cfg *cfg;
1075 struct sh_mobile_meram_info *mdev; 1073 struct sh_mobile_meram_info *mdev;
1076 int ret; 1074 int ret;
1077 1075
1078 cfg = ch->cfg.meram_cfg;
1079 mdev = priv->meram_dev; 1076 mdev = priv->meram_dev;
1080 ret = mdev->ops->meram_update(mdev, cfg, 1077 ret = mdev->ops->meram_update(mdev, ch->meram,
1081 base_addr_y, base_addr_c, 1078 base_addr_y, base_addr_c,
1082 &base_addr_y, &base_addr_c); 1079 &base_addr_y, &base_addr_c);
1083 if (ret) 1080 if (ret)