aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/mxsfb.c41
-rw-r--r--include/linux/mxsfb.h42
2 files changed, 17 insertions, 66 deletions
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index e5ceba54d22f..eac7c1ace7a5 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -49,7 +49,7 @@
49#include <linux/dma-mapping.h> 49#include <linux/dma-mapping.h>
50#include <linux/io.h> 50#include <linux/io.h>
51#include <linux/pinctrl/consumer.h> 51#include <linux/pinctrl/consumer.h>
52#include <linux/mxsfb.h> 52#include <linux/fb.h>
53#include <video/videomode.h> 53#include <video/videomode.h>
54 54
55#define REG_SET 4 55#define REG_SET 4
@@ -109,7 +109,7 @@
109#define VDCTRL0_ENABLE_PRESENT (1 << 28) 109#define VDCTRL0_ENABLE_PRESENT (1 << 28)
110#define VDCTRL0_VSYNC_ACT_HIGH (1 << 27) 110#define VDCTRL0_VSYNC_ACT_HIGH (1 << 27)
111#define VDCTRL0_HSYNC_ACT_HIGH (1 << 26) 111#define VDCTRL0_HSYNC_ACT_HIGH (1 << 26)
112#define VDCTRL0_DOTCLK_ACT_FAILING (1 << 25) 112#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25)
113#define VDCTRL0_ENABLE_ACT_HIGH (1 << 24) 113#define VDCTRL0_ENABLE_ACT_HIGH (1 << 24)
114#define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) 114#define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21)
115#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) 115#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20)
@@ -144,6 +144,14 @@
144#define BLUE 2 144#define BLUE 2
145#define TRANSP 3 145#define TRANSP 3
146 146
147#define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */
148#define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */
149#define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */
150#define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */
151
152#define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6)
153#define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7) /* negtive edge sampling */
154
147enum mxsfb_devtype { 155enum mxsfb_devtype {
148 MXSFB_V3, 156 MXSFB_V3,
149 MXSFB_V4, 157 MXSFB_V4,
@@ -460,8 +468,8 @@ static int mxsfb_set_par(struct fb_info *fb_info)
460 vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH; 468 vdctrl0 |= VDCTRL0_VSYNC_ACT_HIGH;
461 if (host->sync & MXSFB_SYNC_DATA_ENABLE_HIGH_ACT) 469 if (host->sync & MXSFB_SYNC_DATA_ENABLE_HIGH_ACT)
462 vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH; 470 vdctrl0 |= VDCTRL0_ENABLE_ACT_HIGH;
463 if (host->sync & MXSFB_SYNC_DOTCLK_FAILING_ACT) 471 if (host->sync & MXSFB_SYNC_DOTCLK_FALLING_ACT)
464 vdctrl0 |= VDCTRL0_DOTCLK_ACT_FAILING; 472 vdctrl0 |= VDCTRL0_DOTCLK_ACT_FALLING;
465 473
466 writel(vdctrl0, host->base + LCDC_VDCTRL0); 474 writel(vdctrl0, host->base + LCDC_VDCTRL0);
467 475
@@ -760,7 +768,7 @@ static int mxsfb_init_fbinfo_dt(struct mxsfb_info *host)
760 if (vm.data_flags & DISPLAY_FLAGS_DE_HIGH) 768 if (vm.data_flags & DISPLAY_FLAGS_DE_HIGH)
761 host->sync |= MXSFB_SYNC_DATA_ENABLE_HIGH_ACT; 769 host->sync |= MXSFB_SYNC_DATA_ENABLE_HIGH_ACT;
762 if (vm.data_flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) 770 if (vm.data_flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE)
763 host->sync |= MXSFB_SYNC_DOTCLK_FAILING_ACT; 771 host->sync |= MXSFB_SYNC_DOTCLK_FALLING_ACT;
764 fb_add_videomode(&fb_vm, &fb_info->modelist); 772 fb_add_videomode(&fb_vm, &fb_info->modelist);
765 } 773 }
766 774
@@ -775,7 +783,6 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host)
775{ 783{
776 struct fb_info *fb_info = &host->fb_info; 784 struct fb_info *fb_info = &host->fb_info;
777 struct fb_var_screeninfo *var = &fb_info->var; 785 struct fb_var_screeninfo *var = &fb_info->var;
778 struct mxsfb_platform_data *pdata = host->pdev->dev.platform_data;
779 dma_addr_t fb_phys; 786 dma_addr_t fb_phys;
780 void *fb_virt; 787 void *fb_virt;
781 unsigned fb_size; 788 unsigned fb_size;
@@ -789,15 +796,9 @@ static int mxsfb_init_fbinfo(struct mxsfb_info *host)
789 fb_info->fix.visual = FB_VISUAL_TRUECOLOR, 796 fb_info->fix.visual = FB_VISUAL_TRUECOLOR,
790 fb_info->fix.accel = FB_ACCEL_NONE; 797 fb_info->fix.accel = FB_ACCEL_NONE;
791 798
792 if (pdata) { 799 ret = mxsfb_init_fbinfo_dt(host);
793 host->ld_intf_width = pdata->ld_intf_width; 800 if (ret)
794 var->bits_per_pixel = 801 return ret;
795 pdata->default_bpp ? pdata->default_bpp : 16;
796 } else {
797 ret = mxsfb_init_fbinfo_dt(host);
798 if (ret)
799 return ret;
800 }
801 802
802 var->nonstd = 0; 803 var->nonstd = 0;
803 var->activate = FB_ACTIVATE_NOW; 804 var->activate = FB_ACTIVATE_NOW;
@@ -853,7 +854,6 @@ static int mxsfb_probe(struct platform_device *pdev)
853{ 854{
854 const struct of_device_id *of_id = 855 const struct of_device_id *of_id =
855 of_match_device(mxsfb_dt_ids, &pdev->dev); 856 of_match_device(mxsfb_dt_ids, &pdev->dev);
856 struct mxsfb_platform_data *pdata = pdev->dev.platform_data;
857 struct resource *res; 857 struct resource *res;
858 struct mxsfb_info *host; 858 struct mxsfb_info *host;
859 struct fb_info *fb_info; 859 struct fb_info *fb_info;
@@ -861,7 +861,7 @@ static int mxsfb_probe(struct platform_device *pdev)
861 struct pinctrl *pinctrl; 861 struct pinctrl *pinctrl;
862 int panel_enable; 862 int panel_enable;
863 enum of_gpio_flags flags; 863 enum of_gpio_flags flags;
864 int i, ret; 864 int ret;
865 865
866 if (of_id) 866 if (of_id)
867 pdev->id_entry = of_id->data; 867 pdev->id_entry = of_id->data;
@@ -933,13 +933,6 @@ static int mxsfb_probe(struct platform_device *pdev)
933 if (ret != 0) 933 if (ret != 0)
934 goto fb_release; 934 goto fb_release;
935 935
936 if (pdata) {
937 host->sync = pdata->sync;
938 for (i = 0; i < pdata->mode_count; i++)
939 fb_add_videomode(&pdata->mode_list[i],
940 &fb_info->modelist);
941 }
942
943 modelist = list_first_entry(&fb_info->modelist, 936 modelist = list_first_entry(&fb_info->modelist,
944 struct fb_modelist, list); 937 struct fb_modelist, list);
945 fb_videomode_to_var(&fb_info->var, &modelist->mode); 938 fb_videomode_to_var(&fb_info->var, &modelist->mode);
diff --git a/include/linux/mxsfb.h b/include/linux/mxsfb.h
deleted file mode 100644
index b78465cdb26e..000000000000
--- a/include/linux/mxsfb.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public License
4 * as published by the Free Software Foundation; either version 2
5 * of the License, or (at your option) any later version.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
14 * MA 02110-1301, USA.
15 */
16
17#ifndef __LINUX_MXSFB_H
18#define __LINUX_MXSFB_H
19
20#include <linux/fb.h>
21
22#define STMLCDIF_8BIT 1 /** pixel data bus to the display is of 8 bit width */
23#define STMLCDIF_16BIT 0 /** pixel data bus to the display is of 16 bit width */
24#define STMLCDIF_18BIT 2 /** pixel data bus to the display is of 18 bit width */
25#define STMLCDIF_24BIT 3 /** pixel data bus to the display is of 24 bit width */
26
27#define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6)
28#define MXSFB_SYNC_DOTCLK_FAILING_ACT (1 << 7) /* failing/negtive edge sampling */
29
30struct mxsfb_platform_data {
31 struct fb_videomode *mode_list;
32 unsigned mode_count;
33
34 unsigned default_bpp;
35
36 unsigned ld_intf_width; /* refer STMLCDIF_* macros */
37 u32 sync; /* sync mask, contains MXSFB specifics not
38 * carried in fb_info->var.sync
39 */
40};
41
42#endif /* __LINUX_MXSFB_H */