xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_outif.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 OUT_IF_VERSION_REG			0x0000
11 
12 #define OUT_IF_ON_REG				0x0004
13 #define OUT_IF_ON_RPP_ON			BIT(0)
14 
15 #define OUT_IF_OFF_REG				0x0008
16 
17 #define OUT_IF_NR_FRAMES_REG			0x000c
18 #define OUT_IF_NR_FRAMES_NR_FRAMES		GENMASK(9, 0)
19 
20 #define OUT_IF_NR_FRAMES_CNT_REG		0x0010
21 #define FLAGS_SHD_REG				0x0018
22 
23 static int rppx1_outif_probe(struct rpp_module *mod)
24 {
25 	/* Version check. */
26 	if (rpp_module_read(mod, OUT_IF_VERSION_REG) != 1)
27 		return -EINVAL;
28 
29 	return 0;
30 }
31 
32 static int rppx1_outif_start(struct rpp_module *mod,
33 			     const struct v4l2_mbus_framefmt *fmt)
34 {
35 	rpp_module_clrset(mod, OUT_IF_NR_FRAMES_REG,
36 			  OUT_IF_NR_FRAMES_NR_FRAMES, 0);
37 
38 	rpp_module_write(mod, OUT_IF_ON_REG, OUT_IF_ON_RPP_ON);
39 
40 	return 0;
41 }
42 
43 const struct rpp_module_ops rppx1_outif_ops = {
44 	.probe = rppx1_outif_probe,
45 	.start = rppx1_outif_start,
46 };
47