xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_ltmmeas.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_MEAS_VERSION_REG		0x0000
11 
12 #define LTM_MEAS_CTRL_REG		0x0004
13 #define LTM_MEAS_CTRL_LTM_MEAS_ENABLE	BIT(0)
14 
15 #define LTM_MEAS_RGB_WEIGHTS_REG	0x0008
16 #define LTM_MEAS_H_OFFS_REG		0x000c
17 #define LTM_MEAS_V_OFFS_REG		0x0010
18 #define LTM_MEAS_H_SIZE_REG		0x0014
19 #define LTM_MEAS_V_SIZE_REG		0x0018
20 
21 #define LTM_MEAS_PRC_THRESH_NUM		8
22 #define LTM_MEAS_PRC_THRESH_REG(n)	(0x001c + (4 * (n)))
23 
24 #define LTM_MEAS_PRC_REG_NUM		8
25 #define LTM_MEAS_PRC_REG(n)		(0x003c + (4 * (n)))
26 
27 #define LTM_MEAS_L_MIN_REG		0x005c
28 #define LTM_MEAS_L_MAX_REG		0x0060
29 #define LTM_MEAS_L_GMEAN_REG		0x0064
30 
31 static int rppx1_ltmmeas_probe(struct rpp_module *mod)
32 {
33 	/* Version check. */
34 	if (rpp_module_read(mod, LTM_MEAS_VERSION_REG) != 1)
35 		return -EINVAL;
36 
37 	return 0;
38 }
39 
40 const struct rpp_module_ops rppx1_ltmmeas_ops = {
41 	.probe = rppx1_ltmmeas_probe,
42 };
43