linux/drivers/gpu/drm/loongson/lsdc_drv.h

/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (C) 2023 Loongson Technology Corporation Limited
 */

#ifndef __LSDC_DRV_H__
#define __LSDC_DRV_H__

#include <linux/pci.h>

#include <drm/drm_connector.h>
#include <drm/drm_crtc.h>
#include <drm/drm_device.h>
#include <drm/drm_encoder.h>
#include <drm/drm_file.h>
#include <drm/drm_plane.h>
#include <drm/ttm/ttm_device.h>

#include "lsdc_i2c.h"
#include "lsdc_irq.h"
#include "lsdc_gfxpll.h"
#include "lsdc_output.h"
#include "lsdc_pixpll.h"
#include "lsdc_regs.h"

/* Currently, all Loongson display controllers have two display pipes. */
#define LSDC_NUM_CRTC

/*
 * LS7A1000/LS7A2000 chipsets function as the south & north bridges of the
 * Loongson 3 series processors, they are equipped with on-board video RAM
 * typically. While Loongson LS2K series are low cost SoCs which share the
 * system RAM as video RAM, they don't has a dedicated VRAM.
 *
 * There is only a 1:1 mapping of crtcs, encoders and connectors for the DC
 *
 * display pipe 0 = crtc0 + dvo0 + encoder0 + connector0 + cursor0 + primary0
 * display pipe 1 = crtc1 + dvo1 + encoder1 + connectro1 + cursor1 + primary1
 */

enum loongson_chip_id {};

const struct lsdc_desc *
lsdc_device_probe(struct pci_dev *pdev, enum loongson_chip_id chip);

struct lsdc_kms_funcs;

/* DC specific */

struct lsdc_desc {};

/* GFX related resources wrangler */

struct loongson_gfx_desc {};

static inline const struct loongson_gfx_desc *
to_loongson_gfx(const struct lsdc_desc *dcp)
{
	return container_of_const(dcp, struct loongson_gfx_desc, dc);
};

struct lsdc_reg32 {};

/* crtc hardware related ops */

struct lsdc_crtc;

struct lsdc_crtc_hw_ops {};

struct lsdc_crtc {};

/* primary plane hardware related ops */

struct lsdc_primary;

struct lsdc_primary_plane_ops {};

struct lsdc_primary {};

/* cursor plane hardware related ops */

struct lsdc_cursor;

struct lsdc_cursor_plane_ops {};

struct lsdc_cursor {};

struct lsdc_output {};

static inline struct lsdc_output *
connector_to_lsdc_output(struct drm_connector *connector)
{}

static inline struct lsdc_output *
encoder_to_lsdc_output(struct drm_encoder *encoder)
{}

struct lsdc_display_pipe {};

static inline struct lsdc_display_pipe *
output_to_display_pipe(struct lsdc_output *output)
{}

struct lsdc_kms_funcs {};

static inline struct lsdc_crtc *
to_lsdc_crtc(struct drm_crtc *crtc)
{}

static inline struct lsdc_display_pipe *
crtc_to_display_pipe(struct drm_crtc *crtc)
{}

static inline struct lsdc_primary *
to_lsdc_primary(struct drm_plane *plane)
{}

static inline struct lsdc_cursor *
to_lsdc_cursor(struct drm_plane *plane)
{}

struct lsdc_crtc_state {};

struct lsdc_gem {};

struct lsdc_device {};

static inline struct lsdc_device *tdev_to_ldev(struct ttm_device *bdev)
{}

static inline struct lsdc_device *to_lsdc(struct drm_device *ddev)
{}

static inline struct lsdc_crtc_state *
to_lsdc_crtc_state(struct drm_crtc_state *base)
{}

void lsdc_debugfs_init(struct drm_minor *minor);

int ls7a1000_crtc_init(struct drm_device *ddev,
		       struct drm_crtc *crtc,
		       struct drm_plane *primary,
		       struct drm_plane *cursor,
		       unsigned int index,
		       bool no_vblank);

int ls7a2000_crtc_init(struct drm_device *ddev,
		       struct drm_crtc *crtc,
		       struct drm_plane *primary,
		       struct drm_plane *cursor,
		       unsigned int index,
		       bool no_vblank);

int lsdc_primary_plane_init(struct drm_device *ddev,
			    struct drm_plane *plane,
			    unsigned int index);

int ls7a1000_cursor_plane_init(struct drm_device *ddev,
			       struct drm_plane *plane,
			       unsigned int index);

int ls7a2000_cursor_plane_init(struct drm_device *ddev,
			       struct drm_plane *plane,
			       unsigned int index);

/* Registers access helpers */

static inline u32 lsdc_rreg32(struct lsdc_device *ldev, u32 offset)
{}

static inline void lsdc_wreg32(struct lsdc_device *ldev, u32 offset, u32 val)
{}

static inline void lsdc_ureg32_set(struct lsdc_device *ldev,
				   u32 offset,
				   u32 mask)
{}

static inline void lsdc_ureg32_clr(struct lsdc_device *ldev,
				   u32 offset,
				   u32 mask)
{}

static inline u32 lsdc_pipe_rreg32(struct lsdc_device *ldev,
				   u32 offset, u32 pipe)
{}

static inline void lsdc_pipe_wreg32(struct lsdc_device *ldev,
				    u32 offset, u32 pipe, u32 val)
{}

#endif