xref: /linux/drivers/media/platform/dreamchip/rppx1/rppx1_is.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 IS_VERSION			0x0000
11 #define IS_H_OFFS			0x0008
12 #define IS_V_OFFS			0x000c
13 #define IS_H_SIZE			0x0010
14 #define IS_V_SIZE			0x0014
15 #define IS_H_OFFS_SHD			0x0024
16 #define IS_V_OFFS_SHD			0x0028
17 #define IS_H_SIZE_SHD			0x002c
18 #define IS_V_SIZE_SHD			0x0030
19 
20 static int rppx1_is_probe(struct rpp_module *mod)
21 {
22 	/* Version check. */
23 	if (rpp_module_read(mod, IS_VERSION) != 1)
24 		return -EINVAL;
25 
26 	return 0;
27 }
28 
29 static int rppx1_is_start(struct rpp_module *mod,
30 			  const struct v4l2_mbus_framefmt *fmt)
31 {
32 	rpp_module_write(mod, IS_H_OFFS, 0);
33 	rpp_module_write(mod, IS_V_OFFS, 0);
34 	rpp_module_write(mod, IS_H_SIZE, fmt->width);
35 	rpp_module_write(mod, IS_V_SIZE, fmt->height);
36 
37 	return 0;
38 }
39 
40 const struct rpp_module_ops rppx1_is_ops = {
41 	.probe = rppx1_is_probe,
42 	.start = rppx1_is_start,
43 };
44