forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-09 244b2c5ca8b14627e4a17755e5922221e121c771
kernel/drivers/video/fbdev/au1200fb.c
....@@ -147,6 +147,7 @@
147147 struct au1200fb_device {
148148 struct fb_info *fb_info; /* FB driver info record */
149149 struct au1200fb_platdata *pd;
150
+ struct device *dev;
150151
151152 int plane;
152153 unsigned char* fb_mem; /* FrameBuffer memory map */
....@@ -1039,6 +1040,9 @@
10391040 u32 pixclock;
10401041 int screen_size, plane;
10411042
1043
+ if (!var->pixclock)
1044
+ return -EINVAL;
1045
+
10421046 plane = fbdev->plane;
10431047
10441048 /* Make sure that the mode respect all LCD controller and
....@@ -1232,10 +1236,8 @@
12321236 {
12331237 struct au1200fb_device *fbdev = info->par;
12341238
1235
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1236
- pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */
1237
-
1238
- return vm_iomap_memory(vma, fbdev->fb_phys, fbdev->fb_len);
1239
+ return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
1240
+ fbdev->fb_len, 0);
12391241 }
12401242
12411243 static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
....@@ -1484,7 +1486,7 @@
14841486 }
14851487
14861488
1487
-static struct fb_ops au1200fb_fb_ops = {
1489
+static const struct fb_ops au1200fb_fb_ops = {
14881490 .owner = THIS_MODULE,
14891491 .fb_check_var = au1200fb_fb_check_var,
14901492 .fb_set_par = au1200fb_fb_set_par,
....@@ -1647,7 +1649,6 @@
16471649 struct au1200fb_device *fbdev;
16481650 struct au1200fb_platdata *pd;
16491651 struct fb_info *fbi = NULL;
1650
- unsigned long page;
16511652 int bpp, plane, ret, irq;
16521653
16531654 print_info("" DRIVER_DESC "");
....@@ -1685,6 +1686,7 @@
16851686 fbdev = fbi->par;
16861687 fbdev->fb_info = fbi;
16871688 fbdev->pd = pd;
1689
+ fbdev->dev = &dev->dev;
16881690
16891691 fbdev->plane = plane;
16901692
....@@ -1693,8 +1695,7 @@
16931695
16941696 fbdev->fb_mem = dmam_alloc_attrs(&dev->dev,
16951697 PAGE_ALIGN(fbdev->fb_len),
1696
- &fbdev->fb_phys, GFP_KERNEL,
1697
- DMA_ATTR_NON_CONSISTENT);
1698
+ &fbdev->fb_phys, GFP_KERNEL, 0);
16981699 if (!fbdev->fb_mem) {
16991700 print_err("fail to allocate framebuffer (size: %dK))",
17001701 fbdev->fb_len / 1024);
....@@ -1702,16 +1703,6 @@
17021703 goto failed;
17031704 }
17041705
1705
- /*
1706
- * Set page reserved so that mmap will work. This is necessary
1707
- * since we'll be remapping normal memory.
1708
- */
1709
- for (page = (unsigned long)fbdev->fb_phys;
1710
- page < PAGE_ALIGN((unsigned long)fbdev->fb_phys +
1711
- fbdev->fb_len);
1712
- page += PAGE_SIZE) {
1713
- SetPageReserved(pfn_to_page(page >> PAGE_SHIFT)); /* LCD DMA is NOT coherent on Au1200 */
1714
- }
17151706 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
17161707 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
17171708
....@@ -1741,6 +1732,9 @@
17411732
17421733 /* Now hook interrupt too */
17431734 irq = platform_get_irq(dev, 0);
1735
+ if (irq < 0)
1736
+ return irq;
1737
+
17441738 ret = request_irq(irq, au1200fb_handle_irq,
17451739 IRQF_SHARED, "lcd", (void *)dev);
17461740 if (ret) {