xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_rmapmeas.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 RMAP_MEAS_VERSION_REG			0x0000
11 #define RMAP_MEAS_MODE_REG			0x0004
12 #define RMAP_MEAS_SUBSAMPLING_REG		0x0008
13 #define RMAP_MEAS_RESERVED_1_REG		0x000c
14 #define RMAP_MEAS_MIN_THRES_SHORT_REG		0x0010
15 #define RMAP_MEAS_MAX_THRES_SHORT_REG		0x0014
16 #define RMAP_MEAS_MAX_THRES_LONG_REG		0x0018
17 #define RMAP_MEAS_H_OFFS_REG			0x001c
18 #define RMAP_MEAS_V_OFFS_REG			0x0020
19 #define RMAP_MEAS_H_SIZE_REG			0x0024
20 #define RMAP_MEAS_V_SIZE_REG			0x0028
21 #define RMAP_MEAS_LAST_MEAS_LINE_REG		0x002c
22 #define RMAP_MEAS_LS_RESULTSHORT0_REG		0x0030
23 #define RMAP_MEAS_LS_RESULTLONG0_REG		0x0034
24 #define RMAP_MEAS_RESERVED_2_REG		0x0038
25 #define RMAP_MEAS_RESERVED_3_REG		0x003c
26 #define RMAP_MEAS_LS_RESULTSHORT1_REG		0x0040
27 #define RMAP_MEAS_LS_RESULTLONG1_REG		0x0044
28 #define RMAP_MEAS_RESERVED_4_REG		0x0048
29 #define RMAP_MEAS_RESERVED_5_REG		0x004c
30 
31 static int rppx1_rmapmeas_probe(struct rpp_module *mod)
32 {
33 	/* Version check. */
34 	switch (rpp_module_read(mod, RMAP_MEAS_VERSION_REG)) {
35 	case 3:
36 		/* low: 12-bit, high: 24-bit. */
37 		break;
38 	default:
39 		return -EINVAL;
40 	}
41 
42 	return 0;
43 }
44 
45 const struct rpp_module_ops rppx1_rmapmeas_ops = {
46 	.probe = rppx1_rmapmeas_probe,
47 };
48