xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_ltm.c (revision f4cdf7ca9a1fdcca413157df19753f388a5a224e)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2026 Renesas Electronics Corp.
4  * Copyright (C) 2026 Ideas on Board Oy
5  * Copyright (C) 2026 Ragnatech AB
6  */
7 
8 #include "rpp_module.h"
9 
10 #define LTM_VERSION_REG				0x0000
11 
12 #define LTM_CTRL_REG				0x0004
13 #define LTM_CTRL_LTM_ENABLE			BIT(0)
14 
15 #define LTM_RGB_WEIGHTS_REG			0x0008
16 #define LTM_CLB_LINESIZE_REG			0x000c
17 #define LTM_TONECURVE_1_REG			0x0010
18 #define LTM_TONECURVE_2_REG			0x0014
19 #define LTM_TONECURVE_3_REG			0x0018
20 #define LTM_TONECURVE_4_REG			0x001c
21 #define LTM_TONECURVE_5_REG			0x0020
22 #define LTM_TONECURVE_6_REG			0x0024
23 #define LTM_TONECURVE_YM_REG(n)			(0x0028 + (4 * (n)))
24 #define LTM_L0W_REG				0x00ec
25 #define LTM_L0W_R_REG				0x00f0
26 #define LTM_L0D_REG				0x00f4
27 #define LTM_L0D_R_REG				0x00f8
28 #define LTM_KMIND_REG				0x00fc
29 #define LTM_KMAXD_REG				0x0100
30 #define LTM_KDIFFD_REG				0x0104
31 #define LTM_KDIFFD_R_REG			0x0108
32 #define LTM_KW_REG				0x010c
33 #define LTM_KW_R_REG				0x0110
34 #define LTM_CGAIN_REG				0x0114
35 #define LTM_LPRCH_R_HIGH_REG			0x0118
36 #define LTM_LPRCH_R_LOW_REG			0x011c
37 
38 static int rppx1_ltm_probe(struct rpp_module *mod)
39 {
40 	/* Version check. */
41 	if (rpp_module_read(mod, LTM_VERSION_REG) != 8)
42 		return -EINVAL;
43 
44 	return 0;
45 }
46 
47 const struct rpp_module_ops rppx1_ltm_ops = {
48 	.probe = rppx1_ltm_probe,
49 };
50