File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
drivers/media/platform/raspberrypi/rp1_cfe Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2204,12 +2204,18 @@ static int of_cfe_connect_subdevs(struct cfe_device *cfe)
22042204 return - EINVAL ;
22052205 }
22062206
2207+ cfe -> csi2 .dphy .lane_polarities [0 ] =
2208+ ep .bus .mipi_csi2 .lane_polarities [0 ];
2209+
22072210 for (lane = 0 ; lane < ep .bus .mipi_csi2 .num_data_lanes ; lane ++ ) {
22082211 if (ep .bus .mipi_csi2 .data_lanes [lane ] != lane + 1 ) {
22092212 cfe_err ("subdevice %pOF: data lanes reordering not supported\n" ,
22102213 sensor_node );
22112214 goto cleanup_exit ;
22122215 }
2216+
2217+ cfe -> csi2 .dphy .lane_polarities [lane + 1 ] =
2218+ ep .bus .mipi_csi2 .lane_polarities [lane + 1 ];
22132219 }
22142220
22152221 cfe -> csi2 .dphy .max_lanes = ep .bus .mipi_csi2 .num_data_lanes ;
Original file line number Diff line number Diff line change 3434#define DPHY_PLL_INPUT_DIV_OFFSET 0x17
3535#define DPHY_PLL_LOOP_DIV_OFFSET 0x18
3636#define DPHY_PLL_DIV_CTRL_OFFSET 0x19
37+ #define DPHY_CLK_PN_SWAP 0x35
38+ #define DPHY_D0_PN_SWAP 0x45
39+ #define DPHY_D1_PN_SWAP 0x55
40+ #define DPHY_D2_PN_SWAP 0x85
41+ #define DPHY_D3_PN_SWAP 0x95
3742
3843static u32 dw_csi2_host_read (struct dphy_data * dphy , u32 offset )
3944{
@@ -141,6 +146,12 @@ static void dphy_init(struct dphy_data *dphy)
141146
142147 dphy_set_hsfreqrange (dphy , dphy -> dphy_rate );
143148
149+ dphy_transaction (dphy , DPHY_CLK_PN_SWAP , dphy -> lane_polarities [0 ]);
150+ dphy_transaction (dphy , DPHY_D0_PN_SWAP , dphy -> lane_polarities [1 ]);
151+ dphy_transaction (dphy , DPHY_D1_PN_SWAP , dphy -> lane_polarities [2 ]);
152+ dphy_transaction (dphy , DPHY_D2_PN_SWAP , dphy -> lane_polarities [3 ]);
153+ dphy_transaction (dphy , DPHY_D3_PN_SWAP , dphy -> lane_polarities [4 ]);
154+
144155 usleep_range (5 , 10 );
145156 dw_csi2_host_write (dphy , PHY_SHUTDOWNZ , 1 );
146157 usleep_range (5 , 10 );
Original file line number Diff line number Diff line change 99
1010#include <linux/io.h>
1111#include <linux/types.h>
12+ #include <media/v4l2-mediabus.h>
1213
1314struct dphy_data {
1415 struct device * dev ;
@@ -18,6 +19,7 @@ struct dphy_data {
1819 u32 dphy_rate ;
1920 u32 max_lanes ;
2021 u32 active_lanes ;
22+ bool lane_polarities [1 + V4L2_MBUS_CSI2_MAX_DATA_LANES ];
2123};
2224
2325void dphy_probe (struct dphy_data * dphy );
You can’t perform that action at this time.
0 commit comments