#include <linux/clk.h>
#include <linux/component.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_uapi.h>
#include <drm/drm_fb_dma_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_drv.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
#include "vc4_drv.h"
#include "vc4_hdmi.h"
#include "vc4_regs.h"
#define HVS_FIFO_LATENCY_PIX …
#define CRTC_WRITE(offset, val) …
#define CRTC_READ(offset) …
static const struct debugfs_reg32 crtc_regs[] = …;
static unsigned int
vc4_crtc_get_cob_allocation(struct vc4_dev *vc4, unsigned int channel)
{ … }
static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc,
bool in_vblank_irq,
int *vpos, int *hpos,
ktime_t *stime, ktime_t *etime,
const struct drm_display_mode *mode)
{ … }
static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format)
{ … }
static u32 vc4_crtc_get_fifo_full_level_bits(struct vc4_crtc *vc4_crtc,
u32 format)
{ … }
struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{ … }
static void vc4_crtc_pixelvalve_reset(struct drm_crtc *crtc)
{ … }
static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encoder,
struct drm_atomic_state *state)
{ … }
static void require_hvs_enabled(struct drm_device *dev)
{ … }
static int vc4_crtc_disable(struct drm_crtc *crtc,
struct drm_encoder *encoder,
struct drm_atomic_state *state,
unsigned int channel)
{ … }
int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
{ … }
void vc4_crtc_send_vblank(struct drm_crtc *crtc)
{ … }
static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,
struct drm_atomic_state *state)
{ … }
static void vc4_crtc_atomic_enable(struct drm_crtc *crtc,
struct drm_atomic_state *state)
{ … }
static enum drm_mode_status vc4_crtc_mode_valid(struct drm_crtc *crtc,
const struct drm_display_mode *mode)
{ … }
void vc4_crtc_get_margins(struct drm_crtc_state *state,
unsigned int *left, unsigned int *right,
unsigned int *top, unsigned int *bottom)
{ … }
int vc4_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_atomic_state *state)
{ … }
static int vc4_enable_vblank(struct drm_crtc *crtc)
{ … }
static void vc4_disable_vblank(struct drm_crtc *crtc)
{ … }
static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
{ … }
void vc4_crtc_handle_vblank(struct vc4_crtc *crtc)
{ … }
static irqreturn_t vc4_crtc_irq_handler(int irq, void *data)
{ … }
struct vc4_async_flip_state { … };
static void
vc4_async_page_flip_complete(struct vc4_async_flip_state *flip_state)
{ … }
static void vc4_async_page_flip_seqno_complete(struct vc4_seqno_cb *cb)
{ … }
static void vc4_async_page_flip_fence_complete(struct dma_fence *fence,
struct dma_fence_cb *cb)
{ … }
static int vc4_async_set_fence_cb(struct drm_device *dev,
struct vc4_async_flip_state *flip_state)
{ … }
static int
vc4_async_page_flip_common(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t flags)
{ … }
static int vc4_async_page_flip(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t flags)
{ … }
static int vc5_async_page_flip(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t flags)
{ … }
int vc4_page_flip(struct drm_crtc *crtc,
struct drm_framebuffer *fb,
struct drm_pending_vblank_event *event,
uint32_t flags,
struct drm_modeset_acquire_ctx *ctx)
{ … }
struct drm_crtc_state *vc4_crtc_duplicate_state(struct drm_crtc *crtc)
{ … }
void vc4_crtc_destroy_state(struct drm_crtc *crtc,
struct drm_crtc_state *state)
{ … }
void vc4_crtc_reset(struct drm_crtc *crtc)
{ … }
int vc4_crtc_late_register(struct drm_crtc *crtc)
{ … }
static const struct drm_crtc_funcs vc4_crtc_funcs = …;
static const struct drm_crtc_helper_funcs vc4_crtc_helper_funcs = …;
const struct vc4_pv_data bcm2835_pv0_data = …;
const struct vc4_pv_data bcm2835_pv1_data = …;
const struct vc4_pv_data bcm2835_pv2_data = …;
const struct vc4_pv_data bcm2711_pv0_data = …;
const struct vc4_pv_data bcm2711_pv1_data = …;
const struct vc4_pv_data bcm2711_pv2_data = …;
const struct vc4_pv_data bcm2711_pv3_data = …;
const struct vc4_pv_data bcm2711_pv4_data = …;
static const struct of_device_id vc4_crtc_dt_match[] = …;
static void vc4_set_crtc_possible_masks(struct drm_device *drm,
struct drm_crtc *crtc)
{ … }
int __vc4_crtc_init(struct drm_device *drm,
struct platform_device *pdev,
struct vc4_crtc *vc4_crtc,
const struct vc4_crtc_data *data,
struct drm_plane *primary_plane,
const struct drm_crtc_funcs *crtc_funcs,
const struct drm_crtc_helper_funcs *crtc_helper_funcs,
bool feeds_txp)
{ … }
int vc4_crtc_init(struct drm_device *drm, struct platform_device *pdev,
struct vc4_crtc *vc4_crtc,
const struct vc4_crtc_data *data,
const struct drm_crtc_funcs *crtc_funcs,
const struct drm_crtc_helper_funcs *crtc_helper_funcs,
bool feeds_txp)
{ … }
static int vc4_crtc_bind(struct device *dev, struct device *master, void *data)
{ … }
static void vc4_crtc_unbind(struct device *dev, struct device *master,
void *data)
{ … }
static const struct component_ops vc4_crtc_ops = …;
static int vc4_crtc_dev_probe(struct platform_device *pdev)
{ … }
static void vc4_crtc_dev_remove(struct platform_device *pdev)
{ … }
struct platform_driver vc4_crtc_driver = …;