int mipi_csi2_reset(struct mipi_csi2_info *info, int mipi_lane_bps)
{
int value;
dev_info(&info->pdev->dev, "mipi_csi2_reset: mipi_lane_bps = %d Mbps\n", mipi_lane_bps);
_mipi_csi2_lock(info);
mipi_csi2_write(info, 0x0, CSI2_PHY_SHUTDOWNZ);
mipi_csi2_write(info, 0x0, CSI2_DPHY_RSTZ);
mipi_csi2_write(info, 0x0, CSI2_RESETN);
mipi_csi2_write(info, 0x00000001, CSI2_PHY_TST_CTRL0);
mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL1);
mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL0);
mipi_csi2_write(info, 0x00000002, CSI2_PHY_TST_CTRL0);
mipi_csi2_write(info, 0x00010044, CSI2_PHY_TST_CTRL1);
mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL0);
if (mipi_lane_bps < 90)
value = 0x00;
else if (mipi_lane_bps < 100)
value = 0x20;
else if (mipi_lane_bps < 110)
value = 0x40;
else if (mipi_lane_bps < 125)
value = 0x02;
else if (mipi_lane_bps < 140)
value = 0x22;
else if (mipi_lane_bps < 150)
value = 0x42;
else if (mipi_lane_bps < 160)
value = 0x04;
else if (mipi_lane_bps < 180)
value = 0x24;
else if (mipi_lane_bps < 200)
value = 0x44;
else if (mipi_lane_bps < 210)
value = 0x06;
else if (mipi_lane_bps < 240)
value = 0x26;
else if (mipi_lane_bps < 250)
value = 0x46;
else if (mipi_lane_bps < 270)
value = 0x08;
else if (mipi_lane_bps < 300)
value = 0x28;
else if (mipi_lane_bps < 330)
value = 0x48;
else if (mipi_lane_bps < 360)
value = 0x2a;
else if (mipi_lane_bps < 400)
value = 0x4a;
else if (mipi_lane_bps < 450)
value = 0x0c;
else if (mipi_lane_bps < 500)
value = 0x2c;
else if (mipi_lane_bps < 550)
value = 0x0e;
else if (mipi_lane_bps < 600)
value = 0x2e;
else if (mipi_lane_bps < 650)
value = 0x10;
else if (mipi_lane_bps < 700)
value = 0x30;
else if (mipi_lane_bps < 750)
value = 0x12;
else if (mipi_lane_bps < 800)
value = 0x32;
else if (mipi_lane_bps < 850)
value = 0x14;
else if (mipi_lane_bps < 900)
value = 0x34;
else if (mipi_lane_bps < 950)
value = 0x54;
else
value = 0x74;
dev_info(&info->pdev->dev, "mipi_csi2_reset: value = 0x%x.\n", value);
mipi_csi2_write(info, value, CSI2_PHY_TST_CTRL1);
mipi_csi2_write(info, 0x00000002, CSI2_PHY_TST_CTRL0);
mipi_csi2_write(info, 0x00000000, CSI2_PHY_TST_CTRL0);
mipi_csi2_write(info, 0xffffffff, CSI2_PHY_SHUTDOWNZ);
mipi_csi2_write(info, 0xffffffff, CSI2_DPHY_RSTZ);
mipi_csi2_write(info, 0xffffffff, CSI2_RESETN);
_mipi_csi2_unlock(info);
return 0;
}
|