/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2020 MediaTek Inc.
 */
#ifndef _mtk_tv_drm_pq_gamma_H_
#define _mtk_tv_drm_pq_gamma_H_

#include <linux/module.h>
#include <drm/mtk_tv_drm.h>
#include "mtk_tv_drm_kms.h"

//--------------------------------------------------------------------------------------------------
//  Defines
//--------------------------------------------------------------------------------------------------
#define PQGAMMA_HW_VER_0	0 // mt5896
#define PQGAMMA_HW_VER_1	1 // mt5897,mt5876,mt5879
#define PQGAMMA_HW_VER_2	2 // mt5873
#define PQGAMMA_HW_VER_3	3 // mt5877

//--------------------------------------------------------------------------------------------------
//  Enum
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
//  Structures
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
//  Global Variables
//--------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------
//  Global Functions
//--------------------------------------------------------------------------------------------------
int mtk_video_pq_gamma_init(struct mtk_tv_kms_context *kms);

int mtk_video_pq_gamma_deinit(struct mtk_tv_kms_context *kms);

int mtk_video_pq_gamma_resume(struct mtk_tv_kms_context *kms);

// control
int mtk_video_pq_gamma_set_curve(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_curve *curve);

int mtk_video_pq_gamma_set_curve_enable(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_enable *pnlgamma_enable);

int mtk_video_pq_gamma_set_gainoffset(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_gainoffset *gainoffset);

int mtk_video_pq_gamma_set_gainoffset_enable(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_gainoffset_enable *pnl_gainoffsetenable);

int mtk_video_pq_gamma_set_maxvalue(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_maxvalue *maxvalue);

int mtk_video_pq_gamma_set_maxvalue_enable(struct mtk_tv_kms_context *kms,
	struct drm_mtk_tv_pqgamma_maxvalue_enable *maxvalue_enable);

// sysfs
ssize_t pq_gamma_show(struct device *dev,
	struct device_attribute *attr, char *buf);

ssize_t pq_gamma_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count);

ssize_t pq_gamma_curve_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count);

ssize_t pq_gamma_pregainoffset_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count);

ssize_t pq_gamma_postgainoffset_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count);

ssize_t pq_gamma_maxvalue_store(struct device *dev,
	struct device_attribute *attr, const char *buf, size_t count);

// ioctl
int mtk_tv_drm_pq_gamma_set_curve_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_curve_enable_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_gainoffset_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_gainoffset_enable_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_maxvalue_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_maxvalue_enable_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

int mtk_tv_drm_pq_gamma_set_iq_data_ioctl(struct drm_device *drm_dev,
	void *data, struct drm_file *file_priv);

#endif
