| .. | .. |
|---|
| 8 | 8 | #ifndef _PHY_ROCKCHIP_CSI2_DPHY_COMMON_H_ |
|---|
| 9 | 9 | #define _PHY_ROCKCHIP_CSI2_DPHY_COMMON_H_ |
|---|
| 10 | 10 | |
|---|
| 11 | +#include <linux/rk-camera-module.h> |
|---|
| 12 | + |
|---|
| 13 | +#define PHY_MAX 16 |
|---|
| 14 | +#define MAX_DEV_NAME_LEN 32 |
|---|
| 15 | + |
|---|
| 11 | 16 | /* add new chip id in tail by time order */ |
|---|
| 12 | 17 | enum csi2_dphy_chip_id { |
|---|
| 13 | 18 | CHIP_ID_RK3568 = 0x0, |
|---|
| 19 | + CHIP_ID_RK3588 = 0x1, |
|---|
| 20 | + CHIP_ID_RK3588_DCPHY = 0x2, |
|---|
| 21 | + CHIP_ID_RV1106 = 0x3, |
|---|
| 22 | + CHIP_ID_RK3562 = 0x4, |
|---|
| 14 | 23 | }; |
|---|
| 15 | 24 | |
|---|
| 16 | 25 | enum csi2_dphy_rx_pads { |
|---|
| .. | .. |
|---|
| 46 | 55 | }; |
|---|
| 47 | 56 | |
|---|
| 48 | 57 | struct csi2_dphy_hw; |
|---|
| 58 | +struct samsung_mipi_dcphy; |
|---|
| 59 | + |
|---|
| 60 | +struct dphy_drv_data { |
|---|
| 61 | + const char dev_name[MAX_DEV_NAME_LEN]; |
|---|
| 62 | + enum csi2_dphy_vendor vendor; |
|---|
| 63 | +}; |
|---|
| 49 | 64 | |
|---|
| 50 | 65 | struct csi2_dphy { |
|---|
| 51 | 66 | struct device *dev; |
|---|
| 52 | 67 | struct list_head list; |
|---|
| 53 | 68 | struct csi2_dphy_hw *dphy_hw; |
|---|
| 69 | + struct samsung_mipi_dcphy *samsung_phy; |
|---|
| 54 | 70 | struct v4l2_async_notifier notifier; |
|---|
| 55 | 71 | struct v4l2_subdev sd; |
|---|
| 56 | 72 | struct mutex mutex; /* lock for updating protection */ |
|---|
| .. | .. |
|---|
| 61 | 77 | int phy_index; |
|---|
| 62 | 78 | bool is_streaming; |
|---|
| 63 | 79 | enum csi2_dphy_lane_mode lane_mode; |
|---|
| 80 | + const struct dphy_drv_data *drv_data; |
|---|
| 81 | + struct rkmodule_csi_dphy_param dphy_param; |
|---|
| 64 | 82 | }; |
|---|
| 65 | 83 | |
|---|
| 66 | 84 | struct dphy_hw_drv_data { |
|---|
| 67 | | - const struct clk_bulk_data *clks; |
|---|
| 68 | | - int num_clks; |
|---|
| 69 | 85 | const struct hsfreq_range *hsfreq_ranges; |
|---|
| 70 | 86 | int num_hsfreq_ranges; |
|---|
| 87 | + const struct hsfreq_range *hsfreq_ranges_cphy; |
|---|
| 88 | + int num_hsfreq_ranges_cphy; |
|---|
| 71 | 89 | const struct grf_reg *grf_regs; |
|---|
| 72 | 90 | const struct txrx_reg *txrx_regs; |
|---|
| 73 | 91 | const struct csi2dphy_reg *csi2dphy_regs; |
|---|
| 74 | 92 | void (*individual_init)(struct csi2_dphy_hw *hw); |
|---|
| 93 | + int (*stream_on)(struct csi2_dphy *dphy, struct v4l2_subdev *sd); |
|---|
| 94 | + int (*stream_off)(struct csi2_dphy *dphy, struct v4l2_subdev *sd); |
|---|
| 75 | 95 | enum csi2_dphy_chip_id chip_id; |
|---|
| 76 | 96 | }; |
|---|
| 77 | 97 | |
|---|
| 78 | 98 | struct csi2_dphy_hw { |
|---|
| 79 | 99 | struct device *dev; |
|---|
| 80 | 100 | struct regmap *regmap_grf; |
|---|
| 101 | + struct regmap *regmap_sys_grf; |
|---|
| 81 | 102 | const struct grf_reg *grf_regs; |
|---|
| 82 | 103 | const struct txrx_reg *txrx_regs; |
|---|
| 83 | 104 | const struct csi2dphy_reg *csi2dphy_regs; |
|---|
| 84 | 105 | const struct dphy_hw_drv_data *drv_data; |
|---|
| 85 | 106 | void __iomem *hw_base_addr; |
|---|
| 86 | | - struct clk_bulk_data *clks; |
|---|
| 107 | + struct clk_bulk_data *clks_bulk; |
|---|
| 108 | + struct reset_control *rsts_bulk; |
|---|
| 87 | 109 | struct csi2_dphy *dphy_dev[MAX_NUM_CSI2_DPHY]; |
|---|
| 88 | 110 | struct v4l2_subdev sd; |
|---|
| 89 | 111 | struct mutex mutex; /* lock for updating protection */ |
|---|
| .. | .. |
|---|
| 95 | 117 | |
|---|
| 96 | 118 | int (*stream_on)(struct csi2_dphy *dphy, struct v4l2_subdev *sd); |
|---|
| 97 | 119 | int (*stream_off)(struct csi2_dphy *dphy, struct v4l2_subdev *sd); |
|---|
| 120 | + int (*ttl_mode_enable)(struct csi2_dphy_hw *hw); |
|---|
| 121 | + void (*ttl_mode_disable)(struct csi2_dphy_hw *hw); |
|---|
| 98 | 122 | }; |
|---|
| 99 | 123 | |
|---|
| 100 | | -extern struct platform_driver rockchip_csi2_dphy_driver; |
|---|
| 124 | +int rockchip_csi2_dphy_hw_init(void); |
|---|
| 125 | +int rockchip_csi2_dphy_init(void); |
|---|
| 101 | 126 | |
|---|
| 102 | 127 | #endif |
|---|