/* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * Copyright (C) 2013 Red Hat * Author: Rob Clark <[email protected]> */ #ifndef __DPU_KMS_H__ #define __DPU_KMS_H__ #include <linux/interconnect.h> #include <drm/drm_drv.h> #include "msm_drv.h" #include "msm_kms.h" #include "msm_mmu.h" #include "msm_gem.h" #include "dpu_hw_catalog.h" #include "dpu_hw_ctl.h" #include "dpu_hw_lm.h" #include "dpu_hw_interrupts.h" #include "dpu_hw_top.h" #include "dpu_rm.h" #include "dpu_core_perf.h" #define DRMID(x) … /** * DPU_DEBUG - macro for kms/plane/crtc/encoder/connector logs * @fmt: Pointer to format string */ #define DPU_DEBUG(fmt, ...) … /** * DPU_DEBUG_DRIVER - macro for hardware driver logging * @fmt: Pointer to format string */ #define DPU_DEBUG_DRIVER(fmt, ...) … #define DPU_ERROR(fmt, ...) … #define DPU_ERROR_RATELIMITED(fmt, ...) … /** * ktime_compare_safe - compare two ktime structures * This macro is similar to the standard ktime_compare() function, but * attempts to also handle ktime overflows. * @A: First ktime value * @B: Second ktime value * Returns: -1 if A < B, 0 if A == B, 1 if A > B */ #define ktime_compare_safe(A, B) … struct dpu_kms { … }; struct vsync_info { … }; #define DPU_ENC_WR_PTR_START_TIMEOUT_US … #define DPU_ENC_MAX_POLL_TIMEOUT_US … #define to_dpu_kms(x) … #define to_dpu_global_state(x) … /* Global private object state for tracking resources that are shared across * multiple kms objects (planes/crtcs/etc). */ struct dpu_global_state { … }; struct dpu_global_state *dpu_kms_get_existing_global_state(struct dpu_kms *dpu_kms); struct dpu_global_state *__must_check dpu_kms_get_global_state(struct drm_atomic_state *s); /** * Debugfs functions - extra helper functions for debugfs support * * Main debugfs documentation is located at, * * Documentation/filesystems/debugfs.rst * * @dpu_debugfs_create_regset32: Create 32-bit register dump file */ /** * dpu_debugfs_create_regset32 - Create register read back file for debugfs * * This function is almost identical to the standard debugfs_create_regset32() * function, with the main difference being that a list of register * names/offsets do not need to be provided. The 'read' function simply outputs * sequential register values over a specified range. * * @name: File name within debugfs * @mode: File mode within debugfs * @parent: Parent directory entry within debugfs, can be NULL * @offset: sub-block offset * @length: sub-block length, in bytes * @dpu_kms: pointer to dpu kms structure */ void dpu_debugfs_create_regset32(const char *name, umode_t mode, void *parent, uint32_t offset, uint32_t length, struct dpu_kms *dpu_kms); /** * dpu_debugfs_get_root - Return root directory entry for KMS's debugfs * * The return value should be passed as the 'parent' argument to subsequent * debugfs create calls. * * @dpu_kms: Pointer to DPU's KMS structure * * Return: dentry pointer for DPU's debugfs location */ void *dpu_debugfs_get_root(struct dpu_kms *dpu_kms); /** * DPU info management functions * These functions/definitions allow for building up a 'dpu_info' structure * containing one or more "key=value\n" entries. */ #define DPU_KMS_INFO_MAX_SIZE … /** * Vblank enable/disable functions */ int dpu_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); void dpu_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc); /** * dpu_kms_get_clk_rate() - get the clock rate * @dpu_kms: pointer to dpu_kms structure * @clock_name: clock name to get the rate * * Return: current clock rate */ unsigned long dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name); #endif /* __dpu_kms_H__ */