| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2013 - 2025 Intel Corporation |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef IPU7_ISYS_SUBDEV_H |
| 7 |
#define IPU7_ISYS_SUBDEV_H |
| 8 |
|
| 9 |
#include <linux/container_of.h> |
| 10 |
|
| 11 |
#include <media/media-entity.h> |
| 12 |
#include <media/v4l2-ctrls.h> |
| 13 |
#include <media/v4l2-subdev.h> |
| 14 |
|
| 15 |
struct ipu7_isys; |
| 16 |
|
| 17 |
struct ipu7_isys_subdev { |
| 18 |
struct v4l2_subdev sd; |
| 19 |
struct ipu7_isys *isys; |
| 20 |
u32 const *supported_codes; |
| 21 |
struct media_pad *pad; |
| 22 |
struct v4l2_ctrl_handler ctrl_handler; |
| 23 |
void (*ctrl_init)(struct v4l2_subdev *sd); |
| 24 |
int source; /* SSI stream source; -1 if unset */ |
| 25 |
}; |
| 26 |
|
| 27 |
#define to_ipu7_isys_subdev(__sd) \ |
| 28 |
container_of(__sd, struct ipu7_isys_subdev, sd) |
| 29 |
unsigned int ipu7_isys_mbus_code_to_mipi(u32 code); |
| 30 |
bool ipu7_isys_is_bayer_format(u32 code); |
| 31 |
u32 ipu7_isys_convert_bayer_order(u32 code, int x, int y); |
| 32 |
|
| 33 |
int ipu7_isys_subdev_set_fmt(struct v4l2_subdev *sd, |
| 34 |
struct v4l2_subdev_state *state, |
| 35 |
struct v4l2_subdev_format *format); |
| 36 |
int ipu7_isys_subdev_enum_mbus_code(struct v4l2_subdev *sd, |
| 37 |
struct v4l2_subdev_state *state, |
| 38 |
struct v4l2_subdev_mbus_code_enum |
| 39 |
*code); |
| 40 |
int ipu7_isys_get_stream_pad_fmt(struct v4l2_subdev *sd, u32 pad, u32 stream, |
| 41 |
struct v4l2_mbus_framefmt *format); |
| 42 |
int ipu7_isys_subdev_set_routing(struct v4l2_subdev *sd, |
| 43 |
struct v4l2_subdev_state *state, |
| 44 |
enum v4l2_subdev_format_whence which, |
| 45 |
struct v4l2_subdev_krouting *routing); |
| 46 |
int ipu7_isys_subdev_init(struct ipu7_isys_subdev *asd, |
| 47 |
const struct v4l2_subdev_ops *ops, |
| 48 |
unsigned int nr_ctrls, |
| 49 |
unsigned int num_sink_pads, |
| 50 |
unsigned int num_source_pads); |
| 51 |
void ipu7_isys_subdev_cleanup(struct ipu7_isys_subdev *asd); |
| 52 |
#endif /* IPU7_ISYS_SUBDEV_H */ |