xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_bd.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 DPF_VERSION_REG			0x0000
11 
12 #define DPF_MODE_REG			0x0004
13 #define DPF_MODE_USE_NF_GAIN		BIT(9)
14 #define DPF_MODE_LSC_GAIN_COMP		BIT(8)
15 #define DPF_MODE_NLL_SEGMENTATION	BIT(6)
16 #define DPF_MODE_RB_FILTER_SIZE		BIT(5)
17 #define DPF_MODE_R_FILTER_OFF		BIT(4)
18 #define DPF_MODE_GR_FILTER_OFF		BIT(3)
19 #define DPF_MODE_GB_FILTER_OFF		BIT(2)
20 #define DPF_MODE_B_FILTER_OFF		BIT(1)
21 #define DPF_MODE_DPF_ENABLE		BIT(0)
22 
23 #define DPF_STRENGTH_R_REG		0x0008
24 #define DPF_STRENGTH_G_REG		0x000c
25 #define DPF_STRENGTH_B_REG		0x0010
26 #define DPF_S_WEIGHT_G_1_4_REG		0x0014
27 #define DPF_S_WEIGHT_G_5_6_REG		0x0018
28 #define DPF_S_WEIGHT_RB_1_4_REG		0x001c
29 #define DPF_S_WEIGHT_RB_5_6_REG		0x0020
30 
31 #define DPF_NLL_G_COEFF_REG_NUM		17
32 #define DPF_NLL_G_COEFF_REG(n)		(0x0024 + (4 * (n)))
33 
34 #define DPF_NLL_RB_COEFF_REG_NUM	17
35 #define DPF_NLL_RB_COEFF_REG(n)		(0x0068 + (4 * (n)))
36 
37 #define DPF_NF_GAIN_R_REG		0x00ac
38 #define DPF_NF_GAIN_GR_REG		0x00b0
39 #define DPF_NF_GAIN_GB_REG		0x00b4
40 #define DPF_NF_GAIN_B_REG		0x00b8
41 
42 static int rppx1_bd_probe(struct rpp_module *mod)
43 {
44 	/* Version check. */
45 	if (rpp_module_read(mod, DPF_VERSION_REG) != 5)
46 		return -EINVAL;
47 
48 	return 0;
49 }
50 
51 const struct rpp_module_ops rppx1_bd_ops = {
52 	.probe = rppx1_bd_probe,
53 };
54