| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2013 - 2025 Intel Corporation |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef IPU7_ISYS_CSI2_H |
| 7 |
#define IPU7_ISYS_CSI2_H |
| 8 |
|
| 9 |
#include <linux/container_of.h> |
| 10 |
#include <linux/types.h> |
| 11 |
|
| 12 |
#include "ipu7-isys-subdev.h" |
| 13 |
#include "ipu7-isys-video.h" |
| 14 |
|
| 15 |
struct ipu7_isys; |
| 16 |
struct ipu7_isys_csi2_pdata; |
| 17 |
struct ipu7_isys_stream; |
| 18 |
|
| 19 |
#define IPU7_NR_OF_CSI2_VC 16U |
| 20 |
#define INVALID_VC_ID -1 |
| 21 |
#define IPU7_NR_OF_CSI2_SINK_PADS 1U |
| 22 |
#define IPU7_CSI2_PAD_SINK 0U |
| 23 |
#define IPU7_NR_OF_CSI2_SRC_PADS 8U |
| 24 |
#define IPU7_CSI2_PAD_SRC 1U |
| 25 |
#define IPU7_NR_OF_CSI2_PADS (IPU7_NR_OF_CSI2_SINK_PADS + \ |
| 26 |
IPU7_NR_OF_CSI2_SRC_PADS) |
| 27 |
|
| 28 |
/* |
| 29 |
* struct ipu7_isys_csi2 |
| 30 |
* |
| 31 |
* @nlanes: number of lanes in the receiver |
| 32 |
*/ |
| 33 |
struct ipu7_isys_csi2 { |
| 34 |
struct ipu7_isys_subdev asd; |
| 35 |
struct ipu7_isys_csi2_pdata *pdata; |
| 36 |
struct ipu7_isys *isys; |
| 37 |
struct ipu7_isys_video av[IPU7_NR_OF_CSI2_SRC_PADS]; |
| 38 |
|
| 39 |
void __iomem *base; |
| 40 |
u32 receiver_errors; |
| 41 |
u32 legacy_irq_mask; |
| 42 |
unsigned int nlanes; |
| 43 |
unsigned int port; |
| 44 |
unsigned int phy_mode; |
| 45 |
unsigned int stream_count; |
| 46 |
}; |
| 47 |
|
| 48 |
#define ipu7_isys_subdev_to_csi2(__sd) \ |
| 49 |
container_of(__sd, struct ipu7_isys_csi2, asd) |
| 50 |
|
| 51 |
#define to_ipu7_isys_csi2(__asd) container_of(__asd, struct ipu7_isys_csi2, asd) |
| 52 |
|
| 53 |
s64 ipu7_isys_csi2_get_link_freq(struct ipu7_isys_csi2 *csi2); |
| 54 |
int ipu7_isys_csi2_init(struct ipu7_isys_csi2 *csi2, struct ipu7_isys *isys, |
| 55 |
void __iomem *base, unsigned int index); |
| 56 |
void ipu7_isys_csi2_cleanup(struct ipu7_isys_csi2 *csi2); |
| 57 |
void ipu7_isys_csi2_sof_event_by_stream(struct ipu7_isys_stream *stream); |
| 58 |
void ipu7_isys_csi2_eof_event_by_stream(struct ipu7_isys_stream *stream); |
| 59 |
int ipu7_isys_csi2_get_remote_desc(u32 source_stream, |
| 60 |
struct ipu7_isys_csi2 *csi2, |
| 61 |
struct media_entity *source_entity, |
| 62 |
struct v4l2_mbus_frame_desc_entry *entry, |
| 63 |
int *nr_queues); |
| 64 |
#endif /* IPU7_ISYS_CSI2_H */ |