Lines Matching +full:ati +full:- +full:base
1 // SPDX-License-Identifier: GPL-2.0-only
64 OFDRM_MODEL_MACH64, /* ATI Mach64 */
65 OFDRM_MODEL_RAGE128, /* ATI Rage128 */
66 OFDRM_MODEL_RAGE_M3A, /* ATI Rage Mobility M3 Head A */
67 OFDRM_MODEL_RAGE_M3B, /* ATI Rage Mobility M3 Head B */
68 OFDRM_MODEL_RADEON, /* ATI Radeon */
70 OFDRM_MODEL_AVIVO, /* ATI R5xx */
82 return -EINVAL; in display_get_validated_int()
91 return -EINVAL; in display_get_validated_int0()
115 return ERR_PTR(-EINVAL); in display_get_validated_format()
119 * DRM formats assume little-endian byte order. Update the format in display_get_validated_format()
120 * if the scanout buffer uses big-endian ordering. in display_get_validated_format()
144 return ERR_PTR(-EINVAL); in display_get_validated_format()
165 big_endian = !of_property_read_bool(of_node, "little-endian"); in display_get_big_endian_of()
167 big_endian = of_property_read_bool(of_node, "big-endian"); in display_get_big_endian_of()
221 * framebuffer base address from the device's memory regions. in display_get_address_of()
256 } else if (of_node_name_prefix(of_node, "vga,Display-")) { in display_get_model_of()
262 vendor_p = of_get_property(of_parent, "vendor-id", NULL); in display_get_model_of()
263 device_p = of_get_property(of_parent, "device-id", NULL); in display_get_model_of()
272 } else if (of_device_is_compatible(of_node, "qemu,std-vga")) { in display_get_model_of()
299 /* firmware-buffer settings */
332 vendor_p = of_get_property(of_node, "vendor-id", NULL); in display_get_pci_dev_of()
334 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
337 device_p = of_get_property(of_node, "device-id", NULL); in display_get_pci_dev_of()
339 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
344 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
358 struct drm_device *dev = &odev->dev; in ofdrm_device_init_pci()
359 struct platform_device *pdev = to_platform_device(dev->dev); in ofdrm_device_init_pci()
360 struct device_node *of_node = pdev->dev.of_node; in ofdrm_device_init_pci()
367 * resource conflicts. PCI-device management has to be tied to in ofdrm_device_init_pci()
378 dev_name(&pcidev->dev), ret); in ofdrm_device_init_pci()
381 ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev); in ofdrm_device_init_pci()
401 struct platform_device *pdev = to_platform_device(odev->dev.dev); in ofdrm_find_fb_resource()
405 for (i = 0; pdev->num_resources; ++i) { in ofdrm_find_fb_resource()
411 if (fb_res->start && resource_contains(res, fb_res)) in ofdrm_find_fb_resource()
427 struct drm_device *dev = &odev->dev; in get_cmap_address_of()
437 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
440 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
443 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
447 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
449 mem = devm_ioremap(dev->dev, address + offset, size); in get_cmap_address_of()
451 return IOMEM_ERR_PTR(-ENOMEM); in get_cmap_address_of()
460 struct drm_device *dev = &odev->dev; in ofdrm_mach64_cmap_ioremap()
467 cmap_base = devm_ioremap(dev->dev, address, 0x1000); in ofdrm_mach64_cmap_ioremap()
469 return IOMEM_ERR_PTR(-ENOMEM); in ofdrm_mach64_cmap_ioremap()
477 void __iomem *addr = odev->cmap_base + 0xcc0; in ofdrm_mach64_cmap_write()
478 void __iomem *data = odev->cmap_base + 0xcc0 + 1; in ofdrm_mach64_cmap_write()
496 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage128_cmap_write()
497 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage128_cmap_write()
514 void __iomem *dac_ctl = odev->cmap_base + 0x58; in ofdrm_rage_m3a_cmap_write()
515 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage_m3a_cmap_write()
516 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage_m3a_cmap_write()
540 void __iomem *dac_ctl = odev->cmap_base + 0x58; in ofdrm_rage_m3b_cmap_write()
541 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage_m3b_cmap_write()
542 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage_m3b_cmap_write()
573 void __iomem *data = ((unsigned int __iomem *)odev->cmap_base) + index; in ofdrm_gxt2000_cmap_write()
596 void __iomem *lutsel = odev->cmap_base + AVIVO_DC_LUT_RW_SELECT; in ofdrm_avivo_cmap_write()
597 void __iomem *addr = odev->cmap_base + AVIVO_DC_LUT_RW_INDEX; in ofdrm_avivo_cmap_write()
598 void __iomem *data = odev->cmap_base + AVIVO_DC_LUT_30_COLOR; in ofdrm_avivo_cmap_write()
622 struct drm_device *dev = &odev->dev; in ofdrm_qemu_cmap_ioremap()
628 return IOMEM_ERR_PTR(-ENODEV); in ofdrm_qemu_cmap_ioremap()
630 cmap_base = devm_ioremap(dev->dev, address + 0x3c8, 2); in ofdrm_qemu_cmap_ioremap()
632 return IOMEM_ERR_PTR(-ENOMEM); in ofdrm_qemu_cmap_ioremap()
640 void __iomem *addr = odev->cmap_base; in ofdrm_qemu_cmap_write()
641 void __iomem *data = odev->cmap_base + 1; in ofdrm_qemu_cmap_write()
652 struct drm_device *dev = &odev->dev; in ofdrm_device_set_gamma_linear()
655 switch (format->format) { in ofdrm_device_set_gamma_linear()
664 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma_linear()
672 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma_linear()
678 odev->funcs->cmap_write(odev, i, i, i, i); in ofdrm_device_set_gamma_linear()
682 &format->format); in ofdrm_device_set_gamma_linear()
691 struct drm_device *dev = &odev->dev; in ofdrm_device_set_gamma()
694 switch (format->format) { in ofdrm_device_set_gamma()
703 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
711 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
721 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
726 &format->format); in ofdrm_device_set_gamma()
736 struct drm_crtc_state base; member
738 /* Primary-plane format; required for color mgmt. */
742 static struct ofdrm_crtc_state *to_ofdrm_crtc_state(struct drm_crtc_state *base) in to_ofdrm_crtc_state() argument
744 return container_of(base, struct ofdrm_crtc_state, base); in to_ofdrm_crtc_state()
749 __drm_atomic_helper_crtc_destroy_state(&ofdrm_crtc_state->base); in ofdrm_crtc_state_destroy()
762 struct drm_framebuffer *new_fb = new_plane_state->fb; in ofdrm_primary_plane_helper_atomic_check()
763 struct drm_crtc *new_crtc = new_plane_state->crtc; in ofdrm_primary_plane_helper_atomic_check()
769 new_crtc_state = drm_atomic_get_new_crtc_state(new_state, new_plane_state->crtc); in ofdrm_primary_plane_helper_atomic_check()
777 else if (!new_plane_state->visible) in ofdrm_primary_plane_helper_atomic_check()
780 new_crtc_state = drm_atomic_get_new_crtc_state(new_state, new_plane_state->crtc); in ofdrm_primary_plane_helper_atomic_check()
783 new_ofdrm_crtc_state->format = new_fb->format; in ofdrm_primary_plane_helper_atomic_check()
791 struct drm_device *dev = plane->dev; in ofdrm_primary_plane_helper_atomic_update()
796 struct drm_framebuffer *fb = plane_state->fb; in ofdrm_primary_plane_helper_atomic_update()
797 unsigned int dst_pitch = odev->pitch; in ofdrm_primary_plane_helper_atomic_update()
798 const struct drm_format_info *dst_format = odev->format; in ofdrm_primary_plane_helper_atomic_update()
812 struct iosys_map dst = odev->screen_base; in ofdrm_primary_plane_helper_atomic_update()
813 struct drm_rect dst_clip = plane_state->dst; in ofdrm_primary_plane_helper_atomic_update()
819 drm_fb_blit(&dst, &dst_pitch, dst_format->format, shadow_plane_state->data, fb, in ofdrm_primary_plane_helper_atomic_update()
831 struct drm_device *dev = plane->dev; in ofdrm_primary_plane_helper_atomic_disable()
833 struct iosys_map dst = odev->screen_base; in ofdrm_primary_plane_helper_atomic_disable()
836 unsigned int dst_pitch = odev->pitch; in ofdrm_primary_plane_helper_atomic_disable()
837 const struct drm_format_info *dst_format = odev->format; in ofdrm_primary_plane_helper_atomic_disable()
843 plane_state->src_x >> 16, plane_state->src_y >> 16, in ofdrm_primary_plane_helper_atomic_disable()
844 plane_state->src_w >> 16, plane_state->src_h >> 16); in ofdrm_primary_plane_helper_atomic_disable()
855 memset_io(dst_vmap, 0, linepixels * dst_format->cpp[0]); in ofdrm_primary_plane_helper_atomic_disable()
879 struct ofdrm_device *odev = ofdrm_device_of_dev(crtc->dev); in ofdrm_crtc_helper_mode_valid()
881 return drm_crtc_helper_mode_valid_fixed(crtc, mode, &odev->mode); in ofdrm_crtc_helper_mode_valid()
889 struct drm_device *dev = crtc->dev; in ofdrm_crtc_helper_atomic_check()
893 if (!new_crtc_state->enable) in ofdrm_crtc_helper_atomic_check()
900 if (new_crtc_state->color_mgmt_changed) { in ofdrm_crtc_helper_atomic_check()
901 struct drm_property_blob *gamma_lut = new_crtc_state->gamma_lut; in ofdrm_crtc_helper_atomic_check()
903 if (gamma_lut && (gamma_lut->length != gamma_lut_length)) { in ofdrm_crtc_helper_atomic_check()
904 drm_dbg(dev, "Incorrect gamma_lut length %zu\n", gamma_lut->length); in ofdrm_crtc_helper_atomic_check()
905 return -EINVAL; in ofdrm_crtc_helper_atomic_check()
914 struct ofdrm_device *odev = ofdrm_device_of_dev(crtc->dev); in ofdrm_crtc_helper_atomic_flush()
918 if (crtc_state->enable && crtc_state->color_mgmt_changed) { in ofdrm_crtc_helper_atomic_flush()
919 const struct drm_format_info *format = ofdrm_crtc_state->format; in ofdrm_crtc_helper_atomic_flush()
921 if (crtc_state->gamma_lut) in ofdrm_crtc_helper_atomic_flush()
922 ofdrm_device_set_gamma(odev, format, crtc_state->gamma_lut->data); in ofdrm_crtc_helper_atomic_flush()
944 if (crtc->state) in ofdrm_crtc_reset()
945 ofdrm_crtc_state_destroy(to_ofdrm_crtc_state(crtc->state)); in ofdrm_crtc_reset()
948 __drm_atomic_helper_crtc_reset(crtc, &ofdrm_crtc_state->base); in ofdrm_crtc_reset()
955 struct drm_device *dev = crtc->dev; in ofdrm_crtc_atomic_duplicate_state()
956 struct drm_crtc_state *crtc_state = crtc->state; in ofdrm_crtc_atomic_duplicate_state()
969 __drm_atomic_helper_crtc_duplicate_state(crtc, &new_ofdrm_crtc_state->base); in ofdrm_crtc_atomic_duplicate_state()
970 new_ofdrm_crtc_state->format = ofdrm_crtc_state->format; in ofdrm_crtc_atomic_duplicate_state()
972 return &new_ofdrm_crtc_state->base; in ofdrm_crtc_atomic_duplicate_state()
992 struct ofdrm_device *odev = ofdrm_device_of_dev(connector->dev); in ofdrm_connector_helper_get_modes()
994 return drm_connector_helper_get_modes_fixed(connector, &odev->mode); in ofdrm_connector_helper_get_modes()
1080 struct device_node *of_node = pdev->dev.of_node; in ofdrm_device_create()
1099 odev = devm_drm_dev_alloc(&pdev->dev, drv, struct ofdrm_device, dev); in ofdrm_device_create()
1102 dev = &odev->dev; in ofdrm_device_create()
1110 * OF display-node settings in ofdrm_device_create()
1118 odev->funcs = &ofdrm_unknown_device_funcs; in ofdrm_device_create()
1121 odev->funcs = &ofdrm_mach64_device_funcs; in ofdrm_device_create()
1124 odev->funcs = &ofdrm_rage128_device_funcs; in ofdrm_device_create()
1127 odev->funcs = &ofdrm_rage_m3a_device_funcs; in ofdrm_device_create()
1130 odev->funcs = &ofdrm_rage_m3b_device_funcs; in ofdrm_device_create()
1133 odev->funcs = &ofdrm_radeon_device_funcs; in ofdrm_device_create()
1136 odev->funcs = &ofdrm_gxt2000_device_funcs; in ofdrm_device_create()
1139 odev->funcs = &ofdrm_avivo_device_funcs; in ofdrm_device_create()
1142 odev->funcs = &ofdrm_qemu_device_funcs; in ofdrm_device_create()
1167 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1188 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1192 fb_base = res->start; in ofdrm_device_create()
1198 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1199 fb_base = res->start; in ofdrm_device_create()
1207 fb_pgsize = fb_base - fb_pgbase + round_up(fb_size, PAGE_SIZE); in ofdrm_device_create()
1215 mem = devm_request_mem_region(&pdev->dev, fb_pgbase, fb_pgsize, drv->name); in ofdrm_device_create()
1218 return ERR_PTR(-ENOMEM); in ofdrm_device_create()
1221 screen_base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); in ofdrm_device_create()
1223 return ERR_PTR(-ENOMEM); in ofdrm_device_create()
1225 if (odev->funcs->cmap_ioremap) { in ofdrm_device_create()
1226 void __iomem *cmap_base = odev->funcs->cmap_ioremap(odev, of_node, fb_base); in ofdrm_device_create()
1232 odev->cmap_base = cmap_base; in ofdrm_device_create()
1240 iosys_map_set_vaddr_iomem(&odev->screen_base, screen_base); in ofdrm_device_create()
1241 odev->mode = ofdrm_mode(width, height); in ofdrm_device_create()
1242 odev->format = format; in ofdrm_device_create()
1243 odev->pitch = linebytes; in ofdrm_device_create()
1245 drm_dbg(dev, "display mode={" DRM_MODE_FMT "}\n", DRM_MODE_ARG(&odev->mode)); in ofdrm_device_create()
1247 &format->format, width, height, linebytes); in ofdrm_device_create()
1250 * Mode-setting pipeline in ofdrm_device_create()
1260 dev->mode_config.min_width = width; in ofdrm_device_create()
1261 dev->mode_config.max_width = max_width; in ofdrm_device_create()
1262 dev->mode_config.min_height = height; in ofdrm_device_create()
1263 dev->mode_config.max_height = max_height; in ofdrm_device_create()
1264 dev->mode_config.funcs = &ofdrm_mode_config_funcs; in ofdrm_device_create()
1265 dev->mode_config.preferred_depth = format->depth; in ofdrm_device_create()
1266 dev->mode_config.quirk_addfb_prefer_host_byte_order = true; in ofdrm_device_create()
1270 nformats = drm_fb_build_fourcc_list(dev, &format->format, 1, in ofdrm_device_create()
1271 odev->formats, ARRAY_SIZE(odev->formats)); in ofdrm_device_create()
1273 primary_plane = &odev->primary_plane; in ofdrm_device_create()
1275 odev->formats, nformats, in ofdrm_device_create()
1285 crtc = &odev->crtc; in ofdrm_device_create()
1292 if (odev->cmap_base) { in ofdrm_device_create()
1299 encoder = &odev->encoder; in ofdrm_device_create()
1303 encoder->possible_crtcs = drm_crtc_mask(crtc); in ofdrm_device_create()
1307 connector = &odev->connector; in ofdrm_device_create()
1357 dev = &odev->dev; in ofdrm_probe()
1363 color_mode = drm_format_info_bpp(odev->format, 0); in ofdrm_probe()
1365 color_mode = odev->format->depth; // can be 15 or 16 in ofdrm_probe()
1387 .name = "of-display",