| /* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */ |
| /* |
| * Copyright (c) 2019 Amlogic, Inc. All rights reserved. |
| */ |
| |
| #ifndef __AM_MESON_DRV_H |
| #define __AM_MESON_DRV_H |
| |
| #include <linux/platform_device.h> |
| #include <linux/of.h> |
| #include <drm/drmP.h> |
| #ifdef CONFIG_DRM_MESON_USE_ION |
| #include <ion/ion.h> |
| #endif |
| #include "../../gpu/drm/drm_internal.h" |
| |
| #define MESON_MAX_CRTC 2 |
| #define MESON_MAX_OSD 4 |
| |
| /* |
| * Amlogic drm private crtc funcs. |
| * @loader_protect: protect loader logo crtc's power |
| * @enable_vblank: enable crtc vblank irq. |
| * @disable_vblank: disable crtc vblank irq. |
| */ |
| struct meson_crtc_funcs { |
| int (*loader_protect)(struct drm_crtc *crtc, bool on); |
| int (*enable_vblank)(struct drm_crtc *crtc); |
| void (*disable_vblank)(struct drm_crtc *crtc); |
| }; |
| |
| struct meson_drm { |
| struct device *dev; |
| |
| struct drm_device *drm; |
| struct drm_crtc *crtc; |
| const struct meson_crtc_funcs *crtc_funcs[MESON_MAX_CRTC]; |
| struct drm_fbdev_cma *fbdev; |
| struct drm_fb_helper *fbdev_helper; |
| struct drm_gem_object *fbdev_bo; |
| struct drm_plane *primary_plane; |
| struct drm_plane *cursor_plane; |
| struct meson_vpu_pipeline *pipeline; |
| struct meson_vpu_funcs *funcs; |
| struct am_meson_logo *logo; |
| |
| u32 num_crtcs; |
| struct am_meson_crtc *crtcs[MESON_MAX_CRTC]; |
| |
| u32 num_planes; |
| struct am_osd_plane *planes[MESON_MAX_OSD]; |
| }; |
| |
| static inline int meson_vpu_is_compatible(struct meson_drm *priv, |
| const char *compat) |
| { |
| return of_device_is_compatible(priv->dev->of_node, compat); |
| } |
| |
| int am_meson_register_crtc_funcs(struct drm_crtc *crtc, |
| const struct meson_crtc_funcs *crtc_funcs); |
| void am_meson_unregister_crtc_funcs(struct drm_crtc *crtc); |
| struct drm_connector *am_meson_hdmi_connector(void); |
| |
| #endif /* __AM_MESON_DRV_H */ |