18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _DP_DEBUG_H_
78c2ecf20Sopenharmony_ci#define _DP_DEBUG_H_
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include "dp_panel.h"
108c2ecf20Sopenharmony_ci#include "dp_link.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/**
138c2ecf20Sopenharmony_ci * struct dp_debug
148c2ecf20Sopenharmony_ci * @debug_en: specifies whether debug mode enabled
158c2ecf20Sopenharmony_ci * @vdisplay: used to filter out vdisplay value
168c2ecf20Sopenharmony_ci * @hdisplay: used to filter out hdisplay value
178c2ecf20Sopenharmony_ci * @vrefresh: used to filter out vrefresh value
188c2ecf20Sopenharmony_ci * @tpg_state: specifies whether tpg feature is enabled
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_cistruct dp_debug {
218c2ecf20Sopenharmony_ci	bool debug_en;
228c2ecf20Sopenharmony_ci	int aspect_ratio;
238c2ecf20Sopenharmony_ci	int vdisplay;
248c2ecf20Sopenharmony_ci	int hdisplay;
258c2ecf20Sopenharmony_ci	int vrefresh;
268c2ecf20Sopenharmony_ci};
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#if defined(CONFIG_DEBUG_FS)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/**
318c2ecf20Sopenharmony_ci * dp_debug_get() - configure and get the DisplayPlot debug module data
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci * @dev: device instance of the caller
348c2ecf20Sopenharmony_ci * @panel: instance of panel module
358c2ecf20Sopenharmony_ci * @usbpd: instance of usbpd module
368c2ecf20Sopenharmony_ci * @link: instance of link module
378c2ecf20Sopenharmony_ci * @connector: double pointer to display connector
388c2ecf20Sopenharmony_ci * @minor: pointer to drm minor number after device registration
398c2ecf20Sopenharmony_ci * return: pointer to allocated debug module data
408c2ecf20Sopenharmony_ci *
418c2ecf20Sopenharmony_ci * This function sets up the debug module and provides a way
428c2ecf20Sopenharmony_ci * for debugfs input to be communicated with existing modules
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_cistruct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
458c2ecf20Sopenharmony_ci		struct dp_usbpd *usbpd, struct dp_link *link,
468c2ecf20Sopenharmony_ci		struct drm_connector **connector,
478c2ecf20Sopenharmony_ci		struct drm_minor *minor);
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/**
508c2ecf20Sopenharmony_ci * dp_debug_put()
518c2ecf20Sopenharmony_ci *
528c2ecf20Sopenharmony_ci * Cleans up dp_debug instance
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci * @dp_debug: instance of dp_debug
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_civoid dp_debug_put(struct dp_debug *dp_debug);
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci#else
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_cistatic inline
618c2ecf20Sopenharmony_cistruct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel,
628c2ecf20Sopenharmony_ci		struct dp_usbpd *usbpd, struct dp_link *link,
638c2ecf20Sopenharmony_ci		struct drm_connector **connector, struct drm_minor *minor)
648c2ecf20Sopenharmony_ci{
658c2ecf20Sopenharmony_ci	return ERR_PTR(-EINVAL);
668c2ecf20Sopenharmony_ci}
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistatic inline void dp_debug_put(struct dp_debug *dp_debug)
698c2ecf20Sopenharmony_ci{
708c2ecf20Sopenharmony_ci}
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#endif /* defined(CONFIG_DEBUG_FS) */
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#endif /* _DP_DEBUG_H_ */
75