File Index
Files and directories
Sign in
FILE

dc-drv.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/imx/dc/dc-drv.h C
  1/* SPDX-License-Identifier: GPL-2.0+ */
  2/*
  3 * Copyright 2024 NXP
  4 */
  5
  6#ifndef __DC_DRV_H__
  7#define __DC_DRV_H__
  8
  9#include <linux/container_of.h>
 10#include <linux/ioport.h>
 11#include <linux/platform_device.h>
 12#include <linux/types.h>
 13
 14#include <drm/drm_device.h>
 15#include <drm/drm_encoder.h>
 16
 17#include "dc-de.h"
 18#include "dc-kms.h"
 19#include "dc-pe.h"
 20
 21/**
 22 * struct dc_drm_device - DC specific drm_device
 23 */
 24struct dc_drm_device {
 25	/** @base: base drm_device structure */
 26	struct drm_device base;
 27	/** @dc_crtc: DC specific CRTC list */
 28	struct dc_crtc dc_crtc[DC_DISPLAYS];
 29	/** @dc_primary: DC specific primary plane list */
 30	struct dc_plane dc_primary[DC_DISPLAYS];
 31	/** @encoder: encoder list */
 32	struct drm_encoder encoder[DC_DISPLAYS];
 33	/** @cf_safe: constframe list(safety stream) */
 34	struct dc_cf *cf_safe[DC_DISPLAYS];
 35	/** @cf_cont: constframe list(content stream) */
 36	struct dc_cf *cf_cont[DC_DISPLAYS];
 37	/** @de: display engine list */
 38	struct dc_de *de[DC_DISPLAYS];
 39	/** @ed_safe: extdst list(safety stream) */
 40	struct dc_ed *ed_safe[DC_DISPLAYS];
 41	/** @ed_cont: extdst list(content stream) */
 42	struct dc_ed *ed_cont[DC_DISPLAYS];
 43	/** @fg: framegen list */
 44	struct dc_fg *fg[DC_DISPLAYS];
 45	/** @fu_disp: fetchunit list(used by display engine) */
 46	struct dc_fu *fu_disp[DC_DISP_FU_CNT];
 47	/** @lb: layerblend list */
 48	struct dc_lb *lb[DC_LB_CNT];
 49	/** @pe: pixel engine */
 50	struct dc_pe *pe;
 51	/** @tc: tcon list */
 52	struct dc_tc *tc[DC_DISPLAYS];
 53};
 54
 55struct dc_subdev_info {
 56	resource_size_t reg_start;
 57	int id;
 58};
 59
 60static inline struct dc_drm_device *to_dc_drm_device(struct drm_device *drm)
 61{
 62	return container_of(drm, struct dc_drm_device, base);
 63}
 64
 65int dc_crtc_init(struct dc_drm_device *dc_drm, int crtc_index);
 66int dc_crtc_post_init(struct dc_drm_device *dc_drm, int crtc_index);
 67
 68int dc_kms_init(struct dc_drm_device *dc_drm);
 69void dc_kms_uninit(struct dc_drm_device *dc_drm);
 70
 71int dc_plane_init(struct dc_drm_device *dc_drm, struct dc_plane *dc_plane);
 72
 73extern struct platform_driver dc_cf_driver;
 74extern struct platform_driver dc_de_driver;
 75extern struct platform_driver dc_ed_driver;
 76extern struct platform_driver dc_fg_driver;
 77extern struct platform_driver dc_fl_driver;
 78extern struct platform_driver dc_fw_driver;
 79extern struct platform_driver dc_ic_driver;
 80extern struct platform_driver dc_lb_driver;
 81extern struct platform_driver dc_pe_driver;
 82extern struct platform_driver dc_tc_driver;
 83
 84static inline int dc_subdev_get_id(const struct dc_subdev_info *info,
 85				   int info_cnt, struct resource *res)
 86{
 87	int i;
 88
 89	if (!res)
 90		return -EINVAL;
 91
 92	for (i = 0; i < info_cnt; i++)
 93		if (info[i].reg_start == res->start)
 94			return info[i].id;
 95
 96	return -EINVAL;
 97}
 98
 99void dc_de_post_bind(struct dc_drm_device *dc_drm);
100void dc_pe_post_bind(struct dc_drm_device *dc_drm);
101
102#endif /* __DC_DRV_H__ */
~/ Read-only file preview.