accel/ivpu: Move recovery work to system_unbound_wq
[drm/drm-misc.git] / drivers / media / platform / qcom / camss / camss-csiphy.h
blobeebc1ff1cfabc7d8b30e921371c23fff8a0918d8
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * camss-csiphy.h
5 * Qualcomm MSM Camera Subsystem - CSIPHY Module
7 * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
8 * Copyright (C) 2016-2018 Linaro Ltd.
9 */
10 #ifndef QC_MSM_CAMSS_CSIPHY_H
11 #define QC_MSM_CAMSS_CSIPHY_H
13 #include <linux/clk.h>
14 #include <linux/interrupt.h>
15 #include <media/media-entity.h>
16 #include <media/v4l2-device.h>
17 #include <media/v4l2-mediabus.h>
18 #include <media/v4l2-subdev.h>
20 #define MSM_CSIPHY_PAD_SINK 0
21 #define MSM_CSIPHY_PAD_SRC 1
22 #define MSM_CSIPHY_PADS_NUM 2
24 struct csiphy_lane {
25 u8 pos;
26 u8 pol;
29 struct csiphy_lanes_cfg {
30 int num_data;
31 struct csiphy_lane *data;
32 struct csiphy_lane clk;
35 struct csiphy_csi2_cfg {
36 struct csiphy_lanes_cfg lane_cfg;
39 struct csiphy_config {
40 u8 combo_mode;
41 u8 csid_id;
42 struct csiphy_csi2_cfg *csi2;
45 struct csiphy_format_info {
46 u32 code;
47 u8 bpp;
50 struct csiphy_formats {
51 unsigned int nformats;
52 const struct csiphy_format_info *formats;
55 struct csiphy_device;
57 struct csiphy_hw_ops {
59 * csiphy_get_lane_mask - Calculate CSI2 lane mask configuration parameter
60 * @lane_cfg - CSI2 lane configuration
62 * Return lane mask
64 u8 (*get_lane_mask)(struct csiphy_lanes_cfg *lane_cfg);
65 void (*hw_version_read)(struct csiphy_device *csiphy,
66 struct device *dev);
67 void (*reset)(struct csiphy_device *csiphy);
68 void (*lanes_enable)(struct csiphy_device *csiphy,
69 struct csiphy_config *cfg,
70 s64 link_freq, u8 lane_mask);
71 void (*lanes_disable)(struct csiphy_device *csiphy,
72 struct csiphy_config *cfg);
73 irqreturn_t (*isr)(int irq, void *dev);
76 struct csiphy_subdev_resources {
77 const struct csiphy_hw_ops *hw_ops;
78 const struct csiphy_formats *formats;
81 struct csiphy_device {
82 struct camss *camss;
83 u8 id;
84 struct v4l2_subdev subdev;
85 struct media_pad pads[MSM_CSIPHY_PADS_NUM];
86 void __iomem *base;
87 void __iomem *base_clk_mux;
88 u32 irq;
89 char irq_name[30];
90 struct camss_clock *clock;
91 bool *rate_set;
92 int nclocks;
93 u32 timer_clk_rate;
94 struct regulator_bulk_data *supplies;
95 int num_supplies;
96 struct csiphy_config cfg;
97 struct v4l2_mbus_framefmt fmt[MSM_CSIPHY_PADS_NUM];
98 const struct csiphy_subdev_resources *res;
101 struct camss_subdev_resources;
103 int msm_csiphy_subdev_init(struct camss *camss,
104 struct csiphy_device *csiphy,
105 const struct camss_subdev_resources *res, u8 id);
107 int msm_csiphy_register_entity(struct csiphy_device *csiphy,
108 struct v4l2_device *v4l2_dev);
110 void msm_csiphy_unregister_entity(struct csiphy_device *csiphy);
112 extern const struct csiphy_formats csiphy_formats_8x16;
113 extern const struct csiphy_formats csiphy_formats_8x96;
114 extern const struct csiphy_formats csiphy_formats_sdm845;
116 extern const struct csiphy_hw_ops csiphy_ops_2ph_1_0;
117 extern const struct csiphy_hw_ops csiphy_ops_3ph_1_0;
119 #endif /* QC_MSM_CAMSS_CSIPHY_H */