xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_hist256.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 HIST256_VERSION_REG			0x0000
11 #define HIST256_MODE_REG			0x0004
12 #define HIST256_MODE_HIST256_MODE		BIT(0)
13 
14 #define HIST256_CHANNEL_SEL_REG			0x0008
15 #define HIST256_CHANNEL_SEL_CHANNEL_SELECT	GENMASK(2, 0)
16 
17 #define HIST256_H_OFFS_REG			0x000c
18 #define HIST256_V_OFFS_REG			0x0010
19 #define HIST256_H_SIZE_REG			0x0014
20 #define HIST256_V_SIZE_REG			0x0018
21 #define HIST256_SAMPLE_OFFSET_REG		0x001c
22 #define HIST256_SAMPLE_SCALE_REG		0x0020
23 #define HIST256_MEAS_RESULT_ADDR_AUTOINCR_REG	0x0024
24 #define HIST256_MEAS_RESULT_ADDR_REG		0x0028
25 #define HIST256_MEAS_RESULT_DATA_REG		0x002c
26 
27 #define HIST256_LOG_ENABLE_REG			0x0030
28 #define HIST256_LOG_ENABLE_HIST256_LOG_EN	BIT(0)
29 
30 #define HIST256_LOG_DX_LO_REG			0x0034
31 #define HIST256_LOG_DX_HI_REG			0x0038
32 
33 #define HIST256_Y_REG_NUM			17
34 #define HIST256_Y_REG(n)			(0x0040 + (4 * (n)))
35 
36 static int rppx1_hist256_probe(struct rpp_module *mod)
37 {
38 	/* Version check. */
39 	if (rpp_module_read(mod, HIST256_VERSION_REG) != 2)
40 		return -EINVAL;
41 
42 	return 0;
43 }
44 
45 const struct rpp_module_ops rppx1_hist256_ops = {
46 	.probe = rppx1_hist256_probe,
47 };
48