TC358748XBG功能簡介:
TC358748是用於轉換Parallel to MIPI CSI 或者是MIPI CSI to Parallel橋接設備,通過並行端口從相機等設備傳輸到應用處理器接口,所有內部寄存器都可以通過I2C或SPI訪問。
線路規劃方塊圖:
高通驅動程式修改:
請找尋目前可以正常運作的Camera驅動來進行修改,此文案中的範例是使用ov5645的型號來修改。
kernel中的ov5645.c:
1. 請修改struct msm_sensor_power_setting ov5645_power_setting[]程式中的POWER與SENSOR CLK、SENSOR RESET等參數來符合TC358748的Power On Sequence與REFCLK。
{ .seq_type = SENSOR_GPIO,
.seq_val = SENSOR_GPIO_RESET,
.config_val = GPIO_OUT_LOW,
.delay = 1,
},
{ .seq_type = SENSOR_CLK,
.seq_val = SENSOR_CAM_MCLK,
.config_val = 24000000,
.delay = 10,
},
2. 請修改struct msm_camera_i2c_reg_conf ov5645_recommend_settings0[] 加入對TC358748的初始化設定。
{0x0002, 0x0001},
{0x0002, 0x0000},
// TC358746(A)XBG PLL,Clock Setting
{0x0016, 0x205F},
{0x0018, 0x0A03},
{0x0018, 0x0A13},
// TC358746(A)XBG DPI Input Control
{0x0006, 0x0005},
{0x0008, 0x0060},
{0x0022, 0x0500},
// TC358746(A)XBG D-PHY Setting
{0x0140, 0x0000},
{0x0142, 0x0000},
{0x0144, 0x0000},
{0x0146, 0x0000},
{0x0148, 0x0001},
{0x014A, 0x0000},
{0x014C, 0x0001},
{0x014E, 0x0000},
{0x0150, 0x0001},
{0x0152, 0x0000},
// TC358746(A)XBG CSI2-TX PPI Control
{0x0210, 0x0708},
{0x0212, 0x0000},
{0x0214, 0x0001},
{0x0216, 0x0000},
{0x0218, 0x0901},
{0x021A, 0x0000},
{0x0220, 0x0001},
{0x0222, 0x0000},
{0x0224, 0x4650},
{0x0226, 0x0000},
{0x022C, 0x0000},
{0x022E, 0x0000},
{0x0230, 0x0005},
{0x0232, 0x0000},
{0x0234, 0x0003},
{0x0236, 0x0000},
{0x0238, 0x0001},
{0x023A, 0x0000},
{0x0204, 0x0001},
{0x0206, 0x0000},
3. 請修改struct msm_camera_i2c_reg_conf ov5645_start_settings[]加入對TC358748的訊號輸出的設定。
// Enable MIPI clock
{0x0518, 0x0001},
{0x051A, 0x0000},
// Set to HS mode
{0x0500, 0x8081},
{0x0502, 0xA300},
{0x0004, 0x8040},
Vendor中的ov5645_lib.c:
1. 請確認static sensor_output_t sensor_output 中的設定是否正確。
static sensor_output_t sensor_output =
{
.output_format = SENSOR_YCBCR,
.connection_mode = SENSOR_MIPI_CSI,
.raw_output = SENSOR_8_BIT_DIRECT,
};
2. 請確認static struct csi_lane_params_t csi_lane_params 中的設定是否正確。
static struct csi_lane_params_t csi_lane_params =
{
.csi_lane_assign = 0x4320,
.csi_lane_mask = 0x3,
.csi_if = 1,
.csid_core = {0},
.csi_phy_sel = 0,
};
3. 請確認static struct msm_camera_csi2_params ov5645_csi_params中的設定是否正確。
static struct msm_camera_csi2_params ov5645_csi_params =
{
.csid_params = {
.lane_cnt = 1,
.lut_params = {
.num_cid = ARRAY_SIZE(ov5645_cid_cfg),
.vc_cfg = {
&ov5645_cid_cfg[0],
&ov5645_cid_cfg[1],
},
},
},
.csiphy_params = {
.lane_cnt = 1,
.settle_cnt = 29,
},
.csi_clk_scale_enable = 1,
};