cg14.c (fdebffeba8b877368ddcc139c26278c1c97931a4) cg14.c (1d3bba30ded24c8916fc65cacf5ff16c3d642f81)
1// SPDX-License-Identifier: GPL-2.0-only
2/* cg14.c: CGFOURTEEN frame buffer driver
3 *
4 * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
6 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 *
8 * Driver layout based loosely on tgafb.c, see that file for credits.
9 */
10
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15#include <linux/delay.h>
16#include <linux/init.h>
17#include <linux/fb.h>
18#include <linux/mm.h>
19#include <linux/uaccess.h>
1// SPDX-License-Identifier: GPL-2.0-only
2/* cg14.c: CGFOURTEEN frame buffer driver
3 *
4 * Copyright (C) 2003, 2006 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996,1998 Jakub Jelinek (jj@ultra.linux.cz)
6 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
7 *
8 * Driver layout based loosely on tgafb.c, see that file for credits.
9 */
10
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15#include <linux/delay.h>
16#include <linux/init.h>
17#include <linux/fb.h>
18#include <linux/mm.h>
19#include <linux/uaccess.h>
20#include <linux/of.h>
21#include <linux/platform_device.h>
20#include <linux/of_device.h>
22
23#include <asm/io.h>
24#include <asm/fbio.h>
25
26#include "sbuslib.h"
27
28/*
29 * Local functions.
30 */
31
32static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned,
33 unsigned, struct fb_info *);
21
22#include <asm/io.h>
23#include <asm/fbio.h>
24
25#include "sbuslib.h"
26
27/*
28 * Local functions.
29 */
30
31static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned,
32 unsigned, struct fb_info *);
34
35static int cg14_mmap(struct fb_info *, struct vm_area_struct *);
36static int cg14_ioctl(struct fb_info *, unsigned int, unsigned long);
37static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *);
38
33static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *);
34
35static int cg14_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma);
36static int cg14_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg);
37
39/*
40 * Frame buffer operations
41 */
42
43static const struct fb_ops cg14_ops = {
44 .owner = THIS_MODULE,
38/*
39 * Frame buffer operations
40 */
41
42static const struct fb_ops cg14_ops = {
43 .owner = THIS_MODULE,
44 FB_DEFAULT_SBUS_OPS(cg14),
45 .fb_setcolreg = cg14_setcolreg,
46 .fb_pan_display = cg14_pan_display,
45 .fb_setcolreg = cg14_setcolreg,
46 .fb_pan_display = cg14_pan_display,
47 .fb_fillrect = cfb_fillrect,
48 .fb_copyarea = cfb_copyarea,
49 .fb_imageblit = cfb_imageblit,
50 .fb_mmap = cg14_mmap,
51 .fb_ioctl = cg14_ioctl,
52#ifdef CONFIG_COMPAT
53 .fb_compat_ioctl = sbusfb_compat_ioctl,
54#endif
55};
56
57#define CG14_MCR_INTENABLE_SHIFT 7
58#define CG14_MCR_INTENABLE_MASK 0x80
59#define CG14_MCR_VIDENABLE_SHIFT 6
60#define CG14_MCR_VIDENABLE_MASK 0x40
61#define CG14_MCR_PIXMODE_SHIFT 4
62#define CG14_MCR_PIXMODE_MASK 0x30

--- 197 unchanged lines hidden (view full) ---

260
261 spin_lock_irqsave(&par->lock, flags);
262 sbus_writel(val, &clut->c_clut[regno]);
263 spin_unlock_irqrestore(&par->lock, flags);
264
265 return 0;
266}
267
47};
48
49#define CG14_MCR_INTENABLE_SHIFT 7
50#define CG14_MCR_INTENABLE_MASK 0x80
51#define CG14_MCR_VIDENABLE_SHIFT 6
52#define CG14_MCR_VIDENABLE_MASK 0x40
53#define CG14_MCR_PIXMODE_SHIFT 4
54#define CG14_MCR_PIXMODE_MASK 0x30

--- 197 unchanged lines hidden (view full) ---

252
253 spin_lock_irqsave(&par->lock, flags);
254 sbus_writel(val, &clut->c_clut[regno]);
255 spin_unlock_irqrestore(&par->lock, flags);
256
257 return 0;
258}
259
268static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma)
260static int cg14_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
269{
270 struct cg14_par *par = (struct cg14_par *) info->par;
271
272 return sbusfb_mmap_helper(par->mmap_map,
273 info->fix.smem_start, info->fix.smem_len,
274 par->iospace, vma);
275}
276
261{
262 struct cg14_par *par = (struct cg14_par *) info->par;
263
264 return sbusfb_mmap_helper(par->mmap_map,
265 info->fix.smem_start, info->fix.smem_len,
266 par->iospace, vma);
267}
268
277static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
269static int cg14_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
278{
279 struct cg14_par *par = (struct cg14_par *) info->par;
280 struct cg14_regs __iomem *regs = par->regs;
281 struct mdi_cfginfo kmdi, __user *mdii;
282 unsigned long flags;
283 int cur_mode, mode, ret = 0;
284
285 switch (cmd) {

--- 337 unchanged lines hidden ---
270{
271 struct cg14_par *par = (struct cg14_par *) info->par;
272 struct cg14_regs __iomem *regs = par->regs;
273 struct mdi_cfginfo kmdi, __user *mdii;
274 unsigned long flags;
275 int cur_mode, mode, ret = 0;
276
277 switch (cmd) {

--- 337 unchanged lines hidden ---