forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
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 */
....@@ -1232,10 +1233,8 @@
12321233 {
12331234 struct au1200fb_device *fbdev = info->par;
12341235
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);
1236
+ return dma_mmap_attrs(fbdev->dev, vma, fbdev->fb_mem, fbdev->fb_phys,
1237
+ fbdev->fb_len, 0);
12391238 }
12401239
12411240 static void set_global(u_int cmd, struct au1200_lcd_global_regs_t *pdata)
....@@ -1484,7 +1483,7 @@
14841483 }
14851484
14861485
1487
-static struct fb_ops au1200fb_fb_ops = {
1486
+static const struct fb_ops au1200fb_fb_ops = {
14881487 .owner = THIS_MODULE,
14891488 .fb_check_var = au1200fb_fb_check_var,
14901489 .fb_set_par = au1200fb_fb_set_par,
....@@ -1647,7 +1646,6 @@
16471646 struct au1200fb_device *fbdev;
16481647 struct au1200fb_platdata *pd;
16491648 struct fb_info *fbi = NULL;
1650
- unsigned long page;
16511649 int bpp, plane, ret, irq;
16521650
16531651 print_info("" DRIVER_DESC "");
....@@ -1685,6 +1683,7 @@
16851683 fbdev = fbi->par;
16861684 fbdev->fb_info = fbi;
16871685 fbdev->pd = pd;
1686
+ fbdev->dev = &dev->dev;
16881687
16891688 fbdev->plane = plane;
16901689
....@@ -1693,8 +1692,7 @@
16931692
16941693 fbdev->fb_mem = dmam_alloc_attrs(&dev->dev,
16951694 PAGE_ALIGN(fbdev->fb_len),
1696
- &fbdev->fb_phys, GFP_KERNEL,
1697
- DMA_ATTR_NON_CONSISTENT);
1695
+ &fbdev->fb_phys, GFP_KERNEL, 0);
16981696 if (!fbdev->fb_mem) {
16991697 print_err("fail to allocate framebuffer (size: %dK))",
17001698 fbdev->fb_len / 1024);
....@@ -1702,16 +1700,6 @@
17021700 goto failed;
17031701 }
17041702
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
- }
17151703 print_dbg("Framebuffer memory map at %p", fbdev->fb_mem);
17161704 print_dbg("phys=0x%08x, size=%dK", fbdev->fb_phys, fbdev->fb_len / 1024);
17171705