ENGR00305067-3 video: mxsfb: Add DT alias index info to fb id
authorLiu Ying <Ying.Liu@freescale.com>
Tue, 25 Mar 2014 06:06:17 +0000 (14:06 +0800)
committerNitin Garg <nitin.garg@freescale.com>
Wed, 16 Apr 2014 13:58:07 +0000 (08:58 -0500)
Multiple LCDIFs may be embedded in a SoC.  A real example is the
i.MX6sx SoC.  There are two LCDIFs embedded in it.  In order to
distinguish bewteen multiple framebuffers based on different
LCDIFs, this patch adds devicetree alias index information to a
certain framebuffer's fix id.  The fix id is in the 'mxs-lcdifx'
fashion.  If there is no alias node defined for a lcdif node, the
fix id will be 'mxs-lcdif'.

Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
drivers/video/mxsfb.c

index e4d08e3fb4ade0cb6245f290ca00562d11558f6f..cc31ec702ac9166ba877b53a81fe17b9baed448e 100644 (file)
@@ -208,6 +208,7 @@ struct mxsfb_info {
        int restore_blank;
        char disp_dev[32];
        struct mxc_dispdrv_handle *dispdrv;
+       int id;
 };
 
 #define mxsfb_is_v3(host) (host->devdata->ipversion == 3)
@@ -982,6 +983,8 @@ static int mxsfb_init_fbinfo_dt(struct mxsfb_info *host)
        int i;
        int ret = 0;
 
+       host->id = of_alias_get_id(np, "lcdif");
+
        display_np = of_parse_phandle(np, "display", 0);
        if (!display_np) {
                dev_err(dev, "failed to find display phandle\n");
@@ -1076,7 +1079,6 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host)
 
        fb_info->fbops = &mxsfb_ops;
        fb_info->flags = FBINFO_FLAG_DEFAULT | FBINFO_READS_FAST;
-       strlcpy(fb_info->fix.id, "mxs", sizeof(fb_info->fix.id));
        fb_info->fix.type = FB_TYPE_PACKED_PIXELS;
        fb_info->fix.ypanstep = 1;
        fb_info->fix.visual = FB_VISUAL_TRUECOLOR,
@@ -1086,6 +1088,11 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host)
        if (ret)
                return ret;
 
+       if (host->id < 0)
+               sprintf(fb_info->fix.id, "mxs-lcdif");
+       else
+               sprintf(fb_info->fix.id, "mxs-lcdif%d", host->id);
+
        /* first video mode in the modelist as default video mode  */
        modelist = list_first_entry(&fb_info->modelist,
                        struct fb_modelist, list);