Merge "msm: camera: utils: Add support for multiline printing to log buffers" into camera-kernel.lnx.5.0

This commit is contained in:
Haritha Chintalapati
2021-04-30 19:17:36 -07:00
committed by Gerrit - the friendly Code Review server
6 changed files with 146 additions and 134 deletions

View File

@@ -3968,58 +3968,49 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
evt_payload->irq_status[CAM_IFE_CSID_IRQ_REG_RX]); evt_payload->irq_status[CAM_IFE_CSID_IRQ_REG_RX]);
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len, "Fatal Errors:\n");
"Fatal Errors:\n");
if (irq_status & IFE_CSID_VER1_RX_LANE0_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER1_RX_LANE0_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"RX_ERROR_LANE0_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n", "RX_ERROR_LANE0_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER1_RX_LANE1_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER1_RX_LANE1_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"RX_ERROR_LANE1_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n", "RX_ERROR_LANE1_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER1_RX_LANE2_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER1_RX_LANE2_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"RX_ERROR_LANE2_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n", "RX_ERROR_LANE2_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER1_RX_LANE3_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER1_RX_LANE3_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"RX_ERROR_LANE3_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n", "RX_ERROR_LANE3_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER1_RX_TG_FIFO_OVERFLOW) { if (irq_status & IFE_CSID_VER1_RX_TG_FIFO_OVERFLOW) {
event_type |= CAM_ISP_HW_ERROR_CSID_FIFO_OVERFLOW; event_type |= CAM_ISP_HW_ERROR_CSID_FIFO_OVERFLOW;
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"RX_ERROR_TPG_FIFO_OVERFLOW: Backpressure from IFE\n"); "RX_ERROR_TPG_FIFO_OVERFLOW: Backpressure from IFE\n");
} }
if (irq_status & IFE_CSID_VER1_RX_CPHY_PH_CRC) if (irq_status & IFE_CSID_VER1_RX_CPHY_PH_CRC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"CPHY_PH_CRC: Pkt Hdr CRC mismatch\n"); "CPHY_PH_CRC: Pkt Hdr CRC mismatch\n");
if (irq_status & IFE_CSID_VER1_RX_STREAM_UNDERFLOW) { if (irq_status & IFE_CSID_VER1_RX_STREAM_UNDERFLOW) {
val = cam_io_r_mb(soc_info->reg_map[0].mem_base + val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
csi2_reg->captured_long_pkt_0_addr); csi2_reg->captured_long_pkt_0_addr);
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"ERROR_STREAM_UNDERFLOW: Fewer bytes rcvd than WC:%d in pkt hdr\n", "ERROR_STREAM_UNDERFLOW: Fewer bytes rcvd than WC:%d in pkt hdr\n",
val & 0xFFFF); val & 0xFFFF);
} }
if (irq_status & IFE_CSID_VER1_RX_ERROR_ECC) if (irq_status & IFE_CSID_VER1_RX_ERROR_ECC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"DPHY_ERROR_ECC: Pkt hdr errors unrecoverable\n"); "DPHY_ERROR_ECC: Pkt hdr errors unrecoverable\n");
} }
@@ -4027,30 +4018,26 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
csi2_reg->part_fatal_err_mask; csi2_reg->part_fatal_err_mask;
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf + len, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
"Recoverable-errors:\n"); "Recoverable-errors:\n");
if (irq_status & IFE_CSID_VER1_RX_CPHY_EOT_RECEPTION) if (irq_status & IFE_CSID_VER1_RX_CPHY_EOT_RECEPTION)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"CPHY_EOT_RECEPTION: No EOT on lane/s, is_EPD: %d, PHY_Type: %s(%u)\n", "CPHY_EOT_RECEPTION: No EOT on lane/s, is_EPD: %d, PHY_Type: %s(%u)\n",
csid_hw->rx_cfg.epd_supported, csid_hw->rx_cfg.epd_supported,
(csid_hw->rx_cfg.lane_type) ? "cphy" : "dphy", (csid_hw->rx_cfg.lane_type) ? "cphy" : "dphy",
csid_hw->rx_cfg.lane_type); csid_hw->rx_cfg.lane_type);
if (irq_status & IFE_CSID_VER1_RX_CPHY_SOT_RECEPTION) if (irq_status & IFE_CSID_VER1_RX_CPHY_SOT_RECEPTION)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"CPHY_SOT_RECEPTION: Less SOTs on lane/s\n"); "CPHY_SOT_RECEPTION: Less SOTs on lane/s\n");
if (irq_status & IFE_CSID_VER1_RX_ERROR_CRC) if (irq_status & IFE_CSID_VER1_RX_ERROR_CRC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"CPHY_ERROR_CRC: Long pkt payload CRC mismatch\n"); "CPHY_ERROR_CRC: Long pkt payload CRC mismatch\n");
if (irq_status & IFE_CSID_VER1_RX_UNBOUNDED_FRAME) if (irq_status & IFE_CSID_VER1_RX_UNBOUNDED_FRAME)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"UNBOUNDED_FRAME: Frame started with EOF or No EOF\n"); "UNBOUNDED_FRAME: Frame started with EOF or No EOF\n");
} }
@@ -4058,14 +4045,13 @@ static int cam_ife_csid_ver1_rx_bottom_half_handler(
csi2_reg->non_fatal_err_mask; csi2_reg->non_fatal_err_mask;
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf + len, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
"Non-fatal errors:\n"); "Non-fatal errors:\n");
if (irq_status & IFE_CSID_VER1_RX_MMAPPED_VC_DT) { if (irq_status & IFE_CSID_VER1_RX_MMAPPED_VC_DT) {
val = cam_io_r_mb(soc_info->reg_map[0].mem_base + val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
csi2_reg->captured_long_pkt_0_addr); csi2_reg->captured_long_pkt_0_addr);
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"MMAPPED_VC_DT: VC:%d DT:%d mapped to more than 1 csid paths\n", "MMAPPED_VC_DT: VC:%d DT:%d mapped to more than 1 csid paths\n",
(val >> 22), ((val >> 16) & 0x3F)); (val >> 22), ((val >> 16) & 0x3F));
} }
@@ -4115,8 +4101,7 @@ static int cam_ife_csid_ver1_path_bottom_half_handler(
while (irq_status) { while (irq_status) {
if ((irq_status & 0x1)) if ((irq_status & 0x1))
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len,
"%s\n", ver1_path_irq_desc[bit_pos]); "%s\n", ver1_path_irq_desc[bit_pos]);
bit_pos++; bit_pos++;
irq_status >>= 1; irq_status >>= 1;

View File

@@ -882,7 +882,7 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
uint8_t *log_buf = NULL; uint8_t *log_buf = NULL;
uint32_t irq_status; uint32_t irq_status;
uint32_t rx_irq_status = 0; uint32_t rx_irq_status = 0;
uint32_t len = 0; size_t len = 0;
uint32_t val = 0; uint32_t val = 0;
uint32_t event_type = 0; uint32_t event_type = 0;
bool fatal_err_detected = false; bool fatal_err_detected = false;
@@ -907,52 +907,45 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
csi2_reg->fatal_err_mask; csi2_reg->fatal_err_mask;
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
"Fatal Errors:\n"); "Fatal Errors:");
if (irq_status & IFE_CSID_VER2_RX_LANE0_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER2_RX_LANE0_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "RX_ERROR_LANE0_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz",
"RX_ERROR_LANE0_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER2_RX_LANE1_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER2_RX_LANE1_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "RX_ERROR_LANE1_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz",
"RX_ERROR_LANE1_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER2_RX_LANE2_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER2_RX_LANE2_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "RX_ERROR_LANE2_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz",
"RX_ERROR_LANE2_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER2_RX_LANE3_FIFO_OVERFLOW) if (irq_status & IFE_CSID_VER2_RX_LANE3_FIFO_OVERFLOW)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "RX_ERROR_LANE3_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz",
"RX_ERROR_LANE3_FIFO_OVERFLOW: Skew/Less Data on lanes/ Slow csid clock:%luHz\n",
soc_info->applied_src_clk_rate); soc_info->applied_src_clk_rate);
if (irq_status & IFE_CSID_VER2_RX_ERROR_CPHY_PH_CRC) if (irq_status & IFE_CSID_VER2_RX_ERROR_CPHY_PH_CRC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "CPHY_PH_CRC: Pkt Hdr CRC mismatch");
"CPHY_PH_CRC: Pkt Hdr CRC mismatch\n");
if (irq_status & IFE_CSID_VER2_RX_STREAM_UNDERFLOW) { if (irq_status & IFE_CSID_VER2_RX_STREAM_UNDERFLOW) {
val = cam_io_r_mb(soc_info->reg_map[0].mem_base + val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
csi2_reg->captured_long_pkt_0_addr); csi2_reg->captured_long_pkt_0_addr);
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "ERROR_STREAM_UNDERFLOW: Fewer bytes rcvd than WC:%d in pkt hdr",
"ERROR_STREAM_UNDERFLOW: Fewer bytes rcvd than WC:%d in pkt hdr\n",
val & 0xFFFF); val & 0xFFFF);
} }
if (irq_status & IFE_CSID_VER2_RX_ERROR_ECC) if (irq_status & IFE_CSID_VER2_RX_ERROR_ECC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "DPHY_ERROR_ECC: Pkt hdr errors unrecoverable");
"DPHY_ERROR_ECC: Pkt hdr errors unrecoverable\n");
rx_irq_status |= irq_status; rx_irq_status |= irq_status;
fatal_err_detected = true; fatal_err_detected = true;
@@ -962,31 +955,27 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
csi2_reg->part_fatal_err_mask; csi2_reg->part_fatal_err_mask;
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf + len, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
"Recoverable-errors:\n"); "Recoverable-errors:");
if (irq_status & IFE_CSID_VER2_RX_CPHY_EOT_RECEPTION) if (irq_status & IFE_CSID_VER2_RX_CPHY_EOT_RECEPTION)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "CPHY_EOT_RECEPTION: No EOT on lane/s, is_EPD: %d, PHY_Type: %s(%u) ",
"CPHY_EOT_RECEPTION: No EOT on lane/s, is_EPD: %d, PHY_Type: %s(%u) \n",
csid_hw->rx_cfg.epd_supported, csid_hw->rx_cfg.epd_supported,
(csid_hw->rx_cfg.lane_type) ? "cphy" : "dphy", (csid_hw->rx_cfg.lane_type) ? "cphy" : "dphy",
csid_hw->rx_cfg.lane_type); csid_hw->rx_cfg.lane_type);
if (irq_status & IFE_CSID_VER2_RX_CPHY_SOT_RECEPTION) if (irq_status & IFE_CSID_VER2_RX_CPHY_SOT_RECEPTION)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "CPHY_SOT_RECEPTION: Less SOTs on lane/s");
"CPHY_SOT_RECEPTION: Less SOTs on lane/s\n");
if (irq_status & IFE_CSID_VER2_RX_ERROR_CRC) if (irq_status & IFE_CSID_VER2_RX_ERROR_CRC)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "CPHY_ERROR_CRC: Long pkt payload CRC mismatch");
"CPHY_ERROR_CRC: Long pkt payload CRC mismatch\n");
if (irq_status & IFE_CSID_VER2_RX_UNBOUNDED_FRAME) if (irq_status & IFE_CSID_VER2_RX_UNBOUNDED_FRAME)
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "UNBOUNDED_FRAME: Frame started with EOF or No EOF");
"UNBOUNDED_FRAME: Frame started with EOF or No EOF\n");
rx_irq_status |= irq_status; rx_irq_status |= irq_status;
fatal_err_detected = true; fatal_err_detected = true;
@@ -996,16 +985,15 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
csi2_reg->non_fatal_err_mask; csi2_reg->non_fatal_err_mask;
if (irq_status) { if (irq_status) {
len += scnprintf(log_buf + len, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
"Non-fatal-errors:\n"); "Non-fatal-errors:");
if (irq_status & IFE_CSID_VER2_RX_MMAPPED_VC_DT) { if (irq_status & IFE_CSID_VER2_RX_MMAPPED_VC_DT) {
val = cam_io_r_mb(soc_info->reg_map[0].mem_base + val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
csi2_reg->captured_long_pkt_0_addr); csi2_reg->captured_long_pkt_0_addr);
len += scnprintf(log_buf + len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len,
CAM_IFE_CSID_LOG_BUF_LEN - len, "MMAPPED_VC_DT: VC:%d DT:%d mapped to more than 1 csid paths",
"MMAPPED_VC_DT: VC:%d DT:%d mapped to more than 1 csid paths\n",
(val >> 22), ((val >> 16) & 0x3F)); (val >> 22), ((val >> 16) & 0x3F));
} }
} }
@@ -1104,7 +1092,7 @@ static int cam_ife_csid_ver2_parse_path_irq_status(
uint32_t bit_pos = 0; uint32_t bit_pos = 0;
uint32_t status; uint32_t status;
uint32_t sof_irq_debug_en = 0; uint32_t sof_irq_debug_en = 0;
uint32_t len = 0; size_t len = 0;
uint8_t *log_buf = NULL; uint8_t *log_buf = NULL;
log_buf = csid_hw->log_buf; log_buf = csid_hw->log_buf;
@@ -1115,8 +1103,8 @@ static int cam_ife_csid_ver2_parse_path_irq_status(
status = irq_status & err_mask; status = irq_status & err_mask;
while (status) { while (status) {
if (status & 0x1 ) if (status & 0x1 )
len += scnprintf(log_buf + len, CAM_IFE_CSID_LOG_BUF_LEN - len, CAM_ERR_BUF(CAM_ISP, log_buf, CAM_IFE_CSID_LOG_BUF_LEN, &len, "%s",
"\n%s", ver2_path_irq_desc[bit_pos].desc); ver2_path_irq_desc[bit_pos].desc);
bit_pos++; bit_pos++;
status >>= 1; status >>= 1;
} }

View File

@@ -389,7 +389,8 @@ static void cam_sfe_top_check_module_status(
const struct cam_sfe_top_debug_info status_list[][8]) const struct cam_sfe_top_debug_info status_list[][8])
{ {
bool found = false; bool found = false;
uint32_t i, j, val = 0, len = 0; uint32_t i, j, val = 0;
size_t len = 0;
uint8_t log_buf[1024]; uint8_t log_buf[1024];
if (!status_list) if (!status_list)
@@ -406,11 +407,9 @@ static void cam_sfe_top_check_module_status(
if (val == 0 || val == 5) if (val == 0 || val == 5)
continue; continue;
len += scnprintf(log_buf + len, 1024 - CAM_INFO_BUF(CAM_SFE, log_buf, 1024, &len, "%s [I:%u V:%u R:%u]",
len, "\nCAM_INFO: %s [I:%u V:%u R:%u]",
status_list[i][j].clc_name, status_list[i][j].clc_name,
((val >> 2) & 1), ((val >> 1) & 1), ((val >> 2) & 1), ((val >> 1) & 1), (val & 1));
(val & 1));
found = true; found = true;
} }
if (found) if (found)

View File

@@ -852,7 +852,8 @@ static void cam_vfe_top_ver4_check_module_status(
const struct cam_vfe_top_debug_info status_list[][8]) const struct cam_vfe_top_debug_info status_list[][8])
{ {
bool found = false; bool found = false;
uint32_t i, j, val = 0, len = 0; uint32_t i, j, val = 0;
size_t len = 0;
uint8_t log_buf[1024]; uint8_t log_buf[1024];
if (!status_list) if (!status_list)
@@ -869,10 +870,9 @@ static void cam_vfe_top_ver4_check_module_status(
if (val == 0 || val == 5) if (val == 0 || val == 5)
continue; continue;
len += scnprintf(log_buf + len, 1024 - CAM_INFO_BUF(CAM_ISP, log_buf, 1024, &len, "%s [I:%u V:%u R:%u]",
len, "\nCAM_INFO: %s [I:%u V:%u R:%u]", status_list[i][j].clc_name,
status_list[i][j].clc_name, ((val >> 2) & 1), ((val >> 2) & 1), ((val >> 1) & 1), (val & 1));
((val >> 1) & 1), (val & 1));
found = true; found = true;
} }
if (found) if (found)
@@ -889,7 +889,8 @@ static void cam_vfe_top_ver4_print_debug_reg_status(
struct cam_vfe_top_ver4_reg_offset_common *common_reg; struct cam_vfe_top_ver4_reg_offset_common *common_reg;
uint32_t val = 0; uint32_t val = 0;
uint32_t num_reg = 0; uint32_t num_reg = 0;
uint32_t i = 0, j, len = 0; uint32_t i = 0, j;
size_t len = 0;
uint8_t *log_buf; uint8_t *log_buf;
uint32_t *reg_val = NULL; uint32_t *reg_val = NULL;
struct cam_hw_soc_info *soc_info; struct cam_hw_soc_info *soc_info;
@@ -908,17 +909,14 @@ static void cam_vfe_top_ver4_print_debug_reg_status(
return; return;
while (i < num_reg) { while (i < num_reg) {
len += scnprintf(log_buf + len, CAM_VFE_LEN_LOG_BUF - len,
"VFE[%u]: Top Debug Status",
soc_info->index);
for(j = 0; j < 4 && i < num_reg; j++, i++) { for(j = 0; j < 4 && i < num_reg; j++, i++) {
val = cam_io_r(base + val = cam_io_r(base +
common_reg->top_debug[i]); common_reg->top_debug[i]);
reg_val[i] = val; reg_val[i] = val;
len += scnprintf(log_buf + len, CAM_VFE_LEN_LOG_BUF - CAM_INFO_BUF(CAM_ISP, log_buf, CAM_VFE_LEN_LOG_BUF, &len,
len, "\nstatus %2d : 0x%08x", i, val); "status %2d : 0x%08x", i, val);
} }
CAM_INFO(CAM_ISP, "%s", log_buf); CAM_INFO(CAM_ISP, "VFE[%u]: Top Debug Status: %s", soc_info->index, log_buf);
len = 0; len = 0;
memset(log_buf, 0, sizeof(uint8_t)*CAM_VFE_LEN_LOG_BUF); memset(log_buf, 0, sizeof(uint8_t)*CAM_VFE_LEN_LOG_BUF);
} }

View File

@@ -257,58 +257,66 @@ const char *cam_get_tag_name(unsigned int tag_id)
return name; return name;
} }
void cam_debug_log(unsigned int module_id, unsigned int priority, static inline void __cam_print_to_buffer(char *buf, const size_t buf_size, size_t *len,
const char *func, const int line, const char *fmt, ...) unsigned int tag, unsigned int module_id, const char *func, const int line,
const bool is_final_print, const char *fmt, va_list args)
{
size_t buf_len = *len;
if (is_final_print)
buf_len += scnprintf(buf + buf_len, (buf_size - buf_len), "%s: %s: %s: %d: ",
cam_get_tag_name(tag), cam_get_module_name(module_id), func, line);
else
buf_len += scnprintf(buf + buf_len, (buf_size - buf_len), "\n%-8s: %s:\t",
cam_get_tag_name(tag), cam_get_module_name(module_id));
buf_len += vscnprintf(buf + buf_len, (buf_size - buf_len), fmt, args);
*len = buf_len;
}
void cam_print_to_buffer(char *buf, const size_t buf_size, size_t *len, unsigned int tag,
unsigned int module_id, const char *fmt, ...)
{ {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
__cam_print_to_buffer(buf, buf_size, len, tag, module_id, "", 0, false, fmt, args);
if ((debug_mdl & module_id) && (priority >= debug_priority)) {
char str_buffer[STR_BUFFER_MAX_LENGTH];
vsnprintf(str_buffer, STR_BUFFER_MAX_LENGTH, fmt, args);
if ((debug_type == 0) || (debug_type == 2)) {
pr_info("CAM_DBG: %s: %s: %d: %s\n",
cam_get_module_name(module_id),
func, line, str_buffer);
}
if ((debug_type == 1) || (debug_type == 2)) {
char trace_buffer[STR_BUFFER_MAX_LENGTH];
snprintf(trace_buffer, sizeof(trace_buffer),
"%s: %s: %s: %d: %s",
cam_get_tag_name(CAM_TYPE_DBG),
cam_get_module_name(module_id),
func, line, str_buffer);
trace_cam_log_debug(trace_buffer);
}
}
va_end(args); va_end(args);
} }
void cam_debug_log(unsigned int module_id, unsigned int priority,
const char *func, const int line, const char *fmt, ...)
{
if ((debug_mdl & module_id) && (priority >= debug_priority)) {
char str_buf[STR_BUFFER_MAX_LENGTH];
size_t len = 0;
va_list args;
va_start(args, fmt);
__cam_print_to_buffer(str_buf, STR_BUFFER_MAX_LENGTH, &len, CAM_TYPE_DBG, module_id,
func, line, true, fmt, args);
if ((debug_type == 0) || (debug_type == 2))
pr_info("%s\n", str_buf);
if ((debug_type == 1) || (debug_type == 2))
trace_cam_log_debug(str_buf);
va_end(args);
}
}
void cam_debug_trace(unsigned int tag, unsigned int module_id, void cam_debug_trace(unsigned int tag, unsigned int module_id,
const char *func, const int line, const char *fmt, ...) const char *func, const int line, const char *fmt, ...)
{ {
char str_buffer[STR_BUFFER_MAX_LENGTH];
va_list args;
if ((tag == CAM_TYPE_TRACE) || (debug_type == 1) || (debug_type == 2)) { if ((tag == CAM_TYPE_TRACE) || (debug_type == 1) || (debug_type == 2)) {
char trace_buffer[STR_BUFFER_MAX_LENGTH]; char str_buf[STR_BUFFER_MAX_LENGTH];
size_t len = 0;
va_list args;
va_start(args, fmt); va_start(args, fmt);
__cam_print_to_buffer(str_buf, STR_BUFFER_MAX_LENGTH, &len, CAM_TYPE_TRACE,
vsnprintf(str_buffer, STR_BUFFER_MAX_LENGTH, fmt, args); module_id, func, line, true, fmt, args);
trace_cam_log_debug(str_buf);
snprintf(trace_buffer, sizeof(trace_buffer),
"%s: %s: %s: %d: %s",
cam_get_tag_name(tag), cam_get_module_name(module_id),
func, line, str_buffer);
trace_cam_log_debug(trace_buffer);
va_end(args); va_end(args);
} }
} }

View File

@@ -331,6 +331,40 @@ const char *cam_get_module_name(unsigned int module_id);
fmt, ##args); \ fmt, ##args); \
}) })
/**
* cam_print_to_buffer
* @brief: Function to print to camera logs to a buffer. Don't use directly. Use macros
* provided below.
*
* @buf: Buffer to print into
* @buf_size: Total size of the buffer
* @len: Pointer to variable used to keep track of the length
* @tag: Log level tag to be prefixed
* @module_id: Module id tag to be prefixed
* @fmt: Formatted string which needs to be print in log
* @args: Arguments which needs to be print in log
*/
void cam_print_to_buffer(char *buf, const size_t buf_size, size_t *len, unsigned int tag,
unsigned int module_id, const char *fmt, ...);
/**
* CAM_[ERR/WARN/INFO]_BUF
* @brief: Macro to print a new line into log buffer.
*
* @module_id: Module id tag to be prefixed
* @buf: Buffer to print into
* @buf_size: Total size of the buffer
* @len: Pointer to the variable used to keep track of the length
* @fmt: Formatted string which needs to be print in log
* @args: Arguments which needs to be print in log
*/
#define CAM_ERR_BUF(module_id, buf, buf_size, len, fmt, args...) \
cam_print_to_buffer(buf, buf_size, len, CAM_TYPE_ERR, module_id, fmt, ##args)
#define CAM_WARN_BUF(module_id, buf, buf_size, len, fmt, args...) \
cam_print_to_buffer(buf, buf_size, len, CAM_TYPE_WARN, module_id, fmt, ##args)
#define CAM_INFO_BUF(module_id, buf, buf_size, len, fmt, args...) \
cam_print_to_buffer(buf, buf_size, len, CAM_TYPE_INFO, module_id, fmt, ##args)
/** /**
* @brief : API to get camera debug settings * @brief : API to get camera debug settings
* @return const struct camera_debug_settings pointer. * @return const struct camera_debug_settings pointer.