18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2013 Texas Instruments Inc.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * David Griego, <dagriego@biglakesoftware.com>
68c2ecf20Sopenharmony_ci * Dale Farnsworth, <dale@farnsworth.org>
78c2ecf20Sopenharmony_ci * Archit Taneja, <archit@ti.com>
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef TI_CSC_H
108c2ecf20Sopenharmony_ci#define TI_CSC_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/* VPE color space converter regs */
138c2ecf20Sopenharmony_ci#define CSC_CSC00		0x00
148c2ecf20Sopenharmony_ci#define CSC_A0_MASK		0x1fff
158c2ecf20Sopenharmony_ci#define CSC_A0_SHIFT		0
168c2ecf20Sopenharmony_ci#define CSC_B0_MASK		0x1fff
178c2ecf20Sopenharmony_ci#define CSC_B0_SHIFT		16
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define CSC_CSC01		0x04
208c2ecf20Sopenharmony_ci#define CSC_C0_MASK		0x1fff
218c2ecf20Sopenharmony_ci#define CSC_C0_SHIFT		0
228c2ecf20Sopenharmony_ci#define CSC_A1_MASK		0x1fff
238c2ecf20Sopenharmony_ci#define CSC_A1_SHIFT		16
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define CSC_CSC02		0x08
268c2ecf20Sopenharmony_ci#define CSC_B1_MASK		0x1fff
278c2ecf20Sopenharmony_ci#define CSC_B1_SHIFT		0
288c2ecf20Sopenharmony_ci#define CSC_C1_MASK		0x1fff
298c2ecf20Sopenharmony_ci#define CSC_C1_SHIFT		16
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define CSC_CSC03		0x0c
328c2ecf20Sopenharmony_ci#define CSC_A2_MASK		0x1fff
338c2ecf20Sopenharmony_ci#define CSC_A2_SHIFT		0
348c2ecf20Sopenharmony_ci#define CSC_B2_MASK		0x1fff
358c2ecf20Sopenharmony_ci#define CSC_B2_SHIFT		16
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define CSC_CSC04		0x10
388c2ecf20Sopenharmony_ci#define CSC_C2_MASK		0x1fff
398c2ecf20Sopenharmony_ci#define CSC_C2_SHIFT		0
408c2ecf20Sopenharmony_ci#define CSC_D0_MASK		0x0fff
418c2ecf20Sopenharmony_ci#define CSC_D0_SHIFT		16
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define CSC_CSC05		0x14
448c2ecf20Sopenharmony_ci#define CSC_D1_MASK		0x0fff
458c2ecf20Sopenharmony_ci#define CSC_D1_SHIFT		0
468c2ecf20Sopenharmony_ci#define CSC_D2_MASK		0x0fff
478c2ecf20Sopenharmony_ci#define CSC_D2_SHIFT		16
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define CSC_BYPASS		(1 << 28)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_cistruct csc_data {
528c2ecf20Sopenharmony_ci	void __iomem		*base;
538c2ecf20Sopenharmony_ci	struct resource		*res;
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	struct platform_device	*pdev;
568c2ecf20Sopenharmony_ci};
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_civoid csc_dump_regs(struct csc_data *csc);
598c2ecf20Sopenharmony_civoid csc_set_coeff_bypass(struct csc_data *csc, u32 *csc_reg5);
608c2ecf20Sopenharmony_civoid csc_set_coeff(struct csc_data *csc, u32 *csc_reg0,
618c2ecf20Sopenharmony_ci		   struct v4l2_format *src_fmt, struct v4l2_format *dst_fmt);
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cistruct csc_data *csc_create(struct platform_device *pdev, const char *res_name);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#endif
66