linux/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2013 Red Hat
 * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Author: Rob Clark <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/debugfs.h>
#include <linux/dma-buf.h>
#include <linux/of_irq.h>
#include <linux/pm_opp.h>

#include <drm/drm_crtc.h>
#include <drm/drm_file.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_vblank.h>
#include <drm/drm_writeback.h>

#include "msm_drv.h"
#include "msm_mmu.h"
#include "msm_mdss.h"
#include "msm_gem.h"
#include "disp/msm_disp_snapshot.h"

#include "dpu_core_irq.h"
#include "dpu_crtc.h"
#include "dpu_encoder.h"
#include "dpu_formats.h"
#include "dpu_hw_vbif.h"
#include "dpu_kms.h"
#include "dpu_plane.h"
#include "dpu_vbif.h"
#include "dpu_writeback.h"

#define CREATE_TRACE_POINTS
#include "dpu_trace.h"

/*
 * To enable overall DRM driver logging
 * # echo 0x2 > /sys/module/drm/parameters/debug
 *
 * To enable DRM driver h/w logging
 * # echo <mask> > /sys/kernel/debug/dri/0/debug/hw_log_mask
 *
 * See dpu_hw_mdss.h for h/w logging mask definitions (search for DPU_DBG_MASK_)
 */
#define DPU_DEBUGFS_DIR
#define DPU_DEBUGFS_HWMASKNAME

static int dpu_kms_hw_init(struct msm_kms *kms);
static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms);

#ifdef CONFIG_DEBUG_FS
static int _dpu_danger_signal_status(struct seq_file *s,
		bool danger_status)
{}

static int dpu_debugfs_danger_stats_show(struct seq_file *s, void *v)
{}
DEFINE_SHOW_ATTRIBUTE();

static int dpu_debugfs_safe_stats_show(struct seq_file *s, void *v)
{}
DEFINE_SHOW_ATTRIBUTE();

static ssize_t _dpu_plane_danger_read(struct file *file,
			char __user *buff, size_t count, loff_t *ppos)
{}

static void _dpu_plane_set_danger_state(struct dpu_kms *kms, bool enable)
{}

static ssize_t _dpu_plane_danger_write(struct file *file,
		    const char __user *user_buf, size_t count, loff_t *ppos)
{}

static const struct file_operations dpu_plane_danger_enable =;

static void dpu_debugfs_danger_init(struct dpu_kms *dpu_kms,
		struct dentry *parent)
{}

/*
 * Companion structure for dpu_debugfs_create_regset32.
 */
struct dpu_debugfs_regset32 {};

static int dpu_regset32_show(struct seq_file *s, void *data)
{}
DEFINE_SHOW_ATTRIBUTE();

void dpu_debugfs_create_regset32(const char *name, umode_t mode,
		void *parent,
		uint32_t offset, uint32_t length, struct dpu_kms *dpu_kms)
{}

static void dpu_debugfs_sspp_init(struct dpu_kms *dpu_kms, struct dentry *debugfs_root)
{}

static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
{}
#endif

/* Global/shared object state funcs */

/*
 * This is a helper that returns the private state currently in operation.
 * Note that this would return the "old_state" if called in the atomic check
 * path, and the "new_state" after the atomic swap has been done.
 */
struct dpu_global_state *
dpu_kms_get_existing_global_state(struct dpu_kms *dpu_kms)
{}

/*
 * This acquires the modeset lock set aside for global state, creates
 * a new duplicated private object state.
 */
struct dpu_global_state *dpu_kms_get_global_state(struct drm_atomic_state *s)
{}

static struct drm_private_state *
dpu_kms_global_duplicate_state(struct drm_private_obj *obj)
{}

static void dpu_kms_global_destroy_state(struct drm_private_obj *obj,
				      struct drm_private_state *state)
{}

static void dpu_kms_global_print_state(struct drm_printer *p,
				       const struct drm_private_state *state)
{}

static const struct drm_private_state_funcs dpu_kms_global_state_funcs =;

static int dpu_kms_global_obj_init(struct dpu_kms *dpu_kms)
{}

static void dpu_kms_global_obj_fini(struct dpu_kms *dpu_kms)
{}

static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms)
{}

static int dpu_kms_enable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
{}

static void dpu_kms_disable_vblank(struct msm_kms *kms, struct drm_crtc *crtc)
{}

static void dpu_kms_enable_commit(struct msm_kms *kms)
{}

static void dpu_kms_disable_commit(struct msm_kms *kms)
{}

static void dpu_kms_flush_commit(struct msm_kms *kms, unsigned crtc_mask)
{}

static void dpu_kms_complete_commit(struct msm_kms *kms, unsigned crtc_mask)
{}

static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
		struct drm_crtc *crtc)
{}

static void dpu_kms_wait_flush(struct msm_kms *kms, unsigned crtc_mask)
{}

static const char *dpu_vsync_sources[] =;

static int dpu_kms_dsi_set_te_source(struct msm_display_info *info,
				     struct msm_dsi *dsi)
{}

static int _dpu_kms_initialize_dsi(struct drm_device *dev,
				    struct msm_drm_private *priv,
				    struct dpu_kms *dpu_kms)
{}

static int _dpu_kms_initialize_displayport(struct drm_device *dev,
					    struct msm_drm_private *priv,
					    struct dpu_kms *dpu_kms)
{}

static int _dpu_kms_initialize_hdmi(struct drm_device *dev,
				    struct msm_drm_private *priv,
				    struct dpu_kms *dpu_kms)
{}

static int _dpu_kms_initialize_writeback(struct drm_device *dev,
		struct msm_drm_private *priv, struct dpu_kms *dpu_kms,
		const u32 *wb_formats, int n_formats)
{}

/**
 * _dpu_kms_setup_displays - create encoders, bridges and connectors
 *                           for underlying displays
 * @dev:        Pointer to drm device structure
 * @priv:       Pointer to private drm device data
 * @dpu_kms:    Pointer to dpu kms structure
 * Returns:     Zero on success
 */
static int _dpu_kms_setup_displays(struct drm_device *dev,
				    struct msm_drm_private *priv,
				    struct dpu_kms *dpu_kms)
{}

#define MAX_PLANES
static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
{}

static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms)
{}

static void dpu_kms_destroy(struct msm_kms *kms)
{}

static int dpu_irq_postinstall(struct msm_kms *kms)
{}

static void dpu_kms_mdp_snapshot(struct msm_disp_state *disp_state, struct msm_kms *kms)
{}

static const struct msm_kms_funcs kms_funcs =;

static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms)
{}

static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms)
{}

unsigned long dpu_kms_get_clk_rate(struct dpu_kms *dpu_kms, char *clock_name)
{}

#define DPU_PERF_DEFAULT_MAX_CORE_CLK_RATE

static int dpu_kms_hw_init(struct msm_kms *kms)
{}

static int dpu_kms_init(struct drm_device *ddev)
{}

static int dpu_kms_mmap_mdp5(struct dpu_kms *dpu_kms)
{}

static int dpu_kms_mmap_dpu(struct dpu_kms *dpu_kms)
{}

static int dpu_dev_probe(struct platform_device *pdev)
{}

static void dpu_dev_remove(struct platform_device *pdev)
{}

static int __maybe_unused dpu_runtime_suspend(struct device *dev)
{}

static int __maybe_unused dpu_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops dpu_pm_ops =;

static const struct of_device_id dpu_dt_match[] =;
MODULE_DEVICE_TABLE(of, dpu_dt_match);

static struct platform_driver dpu_driver =;

void __init msm_dpu_register(void)
{}

void __exit msm_dpu_unregister(void)
{}