Lines Matching full:cirrus
14 * drivers/video/cirrusfb.c - driver for Cirrus Logic chipsets
23 #include <video/cirrus.h>
48 #define DRIVER_NAME "cirrus"
49 #define DRIVER_DESC "qemu cirrus vga"
100 static u8 rreg_seq(struct cirrus_device *cirrus, u8 reg) in rreg_seq() argument
102 iowrite8(reg, cirrus->mmio + SEQ_INDEX); in rreg_seq()
103 return ioread8(cirrus->mmio + SEQ_DATA); in rreg_seq()
106 static void wreg_seq(struct cirrus_device *cirrus, u8 reg, u8 val) in wreg_seq() argument
108 iowrite8(reg, cirrus->mmio + SEQ_INDEX); in wreg_seq()
109 iowrite8(val, cirrus->mmio + SEQ_DATA); in wreg_seq()
115 static u8 rreg_crt(struct cirrus_device *cirrus, u8 reg) in rreg_crt() argument
117 iowrite8(reg, cirrus->mmio + CRT_INDEX); in rreg_crt()
118 return ioread8(cirrus->mmio + CRT_DATA); in rreg_crt()
121 static void wreg_crt(struct cirrus_device *cirrus, u8 reg, u8 val) in wreg_crt() argument
123 iowrite8(reg, cirrus->mmio + CRT_INDEX); in wreg_crt()
124 iowrite8(val, cirrus->mmio + CRT_DATA); in wreg_crt()
130 static void wreg_gfx(struct cirrus_device *cirrus, u8 reg, u8 val) in wreg_gfx() argument
132 iowrite8(reg, cirrus->mmio + GFX_INDEX); in wreg_gfx()
133 iowrite8(val, cirrus->mmio + GFX_DATA); in wreg_gfx()
138 static void wreg_hdr(struct cirrus_device *cirrus, u8 val) in wreg_hdr() argument
140 ioread8(cirrus->mmio + VGA_DAC_MASK); in wreg_hdr()
141 ioread8(cirrus->mmio + VGA_DAC_MASK); in wreg_hdr()
142 ioread8(cirrus->mmio + VGA_DAC_MASK); in wreg_hdr()
143 ioread8(cirrus->mmio + VGA_DAC_MASK); in wreg_hdr()
144 iowrite8(val, cirrus->mmio + VGA_DAC_MASK); in wreg_hdr()
178 static void cirrus_set_start_address(struct cirrus_device *cirrus, u32 offset) in cirrus_set_start_address() argument
184 wreg_crt(cirrus, 0x0c, (u8)((addr >> 8) & 0xff)); in cirrus_set_start_address()
185 wreg_crt(cirrus, 0x0d, (u8)(addr & 0xff)); in cirrus_set_start_address()
187 tmp = rreg_crt(cirrus, 0x1b); in cirrus_set_start_address()
191 wreg_crt(cirrus, 0x1b, tmp); in cirrus_set_start_address()
193 tmp = rreg_crt(cirrus, 0x1d); in cirrus_set_start_address()
196 wreg_crt(cirrus, 0x1d, tmp); in cirrus_set_start_address()
199 static void cirrus_mode_set(struct cirrus_device *cirrus, in cirrus_mode_set() argument
222 wreg_crt(cirrus, VGA_CRTC_V_SYNC_END, 0x20); in cirrus_mode_set()
223 wreg_crt(cirrus, VGA_CRTC_H_TOTAL, htotal); in cirrus_mode_set()
224 wreg_crt(cirrus, VGA_CRTC_H_DISP, hdispend); in cirrus_mode_set()
225 wreg_crt(cirrus, VGA_CRTC_H_SYNC_START, hsyncstart); in cirrus_mode_set()
226 wreg_crt(cirrus, VGA_CRTC_H_SYNC_END, hsyncend); in cirrus_mode_set()
227 wreg_crt(cirrus, VGA_CRTC_V_TOTAL, vtotal & 0xff); in cirrus_mode_set()
228 wreg_crt(cirrus, VGA_CRTC_V_DISP_END, vdispend & 0xff); in cirrus_mode_set()
233 wreg_crt(cirrus, VGA_CRTC_MAX_SCAN, tmp); in cirrus_mode_set()
249 wreg_crt(cirrus, VGA_CRTC_OVERFLOW, tmp); in cirrus_mode_set()
264 wreg_crt(cirrus, CL_CRT1A, tmp); in cirrus_mode_set()
267 wreg_crt(cirrus, VGA_CRTC_MODE, 0x03); in cirrus_mode_set()
270 static void cirrus_format_set(struct cirrus_device *cirrus, in cirrus_format_set() argument
275 sr07 = rreg_seq(cirrus, 0x07); in cirrus_format_set()
299 wreg_seq(cirrus, 0x7, sr07); in cirrus_format_set()
302 wreg_gfx(cirrus, VGA_GFX_MODE, 0x40); in cirrus_format_set()
305 wreg_gfx(cirrus, VGA_GFX_MISC, 0x01); in cirrus_format_set()
307 wreg_hdr(cirrus, hdr); in cirrus_format_set()
310 static void cirrus_pitch_set(struct cirrus_device *cirrus, unsigned int pitch) in cirrus_pitch_set() argument
316 wreg_crt(cirrus, VGA_CRTC_OFFSET, cr13); in cirrus_pitch_set()
322 wreg_crt(cirrus, 0x1b, cr1b); in cirrus_pitch_set()
324 cirrus_set_start_address(cirrus, 0); in cirrus_pitch_set()
328 /* cirrus display pipe */
382 struct cirrus_device *cirrus = to_cirrus(plane->dev); in cirrus_primary_plane_helper_atomic_update() local
393 struct iosys_map vaddr = IOSYS_MAP_INIT_VADDR_IOMEM(cirrus->vram); in cirrus_primary_plane_helper_atomic_update()
401 if (!drm_dev_enter(&cirrus->dev, &idx)) in cirrus_primary_plane_helper_atomic_update()
405 cirrus_format_set(cirrus, format); in cirrus_primary_plane_helper_atomic_update()
407 cirrus_pitch_set(cirrus, pitch); in cirrus_primary_plane_helper_atomic_update()
503 struct cirrus_device *cirrus = to_cirrus(crtc->dev); in cirrus_crtc_helper_atomic_enable() local
507 if (!drm_dev_enter(&cirrus->dev, &idx)) in cirrus_crtc_helper_atomic_enable()
510 cirrus_mode_set(cirrus, &crtc_state->mode); in cirrus_crtc_helper_atomic_enable()
559 static int cirrus_pipe_init(struct cirrus_device *cirrus) in cirrus_pipe_init() argument
561 struct drm_device *dev = &cirrus->dev; in cirrus_pipe_init()
568 primary_plane = &cirrus->primary_plane; in cirrus_pipe_init()
580 crtc = &cirrus->crtc; in cirrus_pipe_init()
587 encoder = &cirrus->encoder; in cirrus_pipe_init()
594 connector = &cirrus->connector; in cirrus_pipe_init()
609 /* cirrus framebuffers & mode config */
630 static int cirrus_mode_config_init(struct cirrus_device *cirrus) in cirrus_mode_config_init() argument
632 struct drm_device *dev = &cirrus->dev; in cirrus_mode_config_init()
671 struct cirrus_device *cirrus; in cirrus_pci_probe() local
687 cirrus = devm_drm_dev_alloc(&pdev->dev, &cirrus_driver, in cirrus_pci_probe()
689 if (IS_ERR(cirrus)) in cirrus_pci_probe()
690 return PTR_ERR(cirrus); in cirrus_pci_probe()
692 dev = &cirrus->dev; in cirrus_pci_probe()
694 cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0), in cirrus_pci_probe()
696 if (cirrus->vram == NULL) in cirrus_pci_probe()
699 cirrus->mmio = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 1), in cirrus_pci_probe()
701 if (cirrus->mmio == NULL) in cirrus_pci_probe()
704 ret = cirrus_mode_config_init(cirrus); in cirrus_pci_probe()
708 ret = cirrus_pipe_init(cirrus); in cirrus_pci_probe()
740 /* only bind to the cirrus chip in qemu */
763 MODULE_DESCRIPTION("Cirrus driver for QEMU emulated device");