drivers/media/platform/amd/isp4/isp4_debug.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/amd/isp4/isp4_debug.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/amd/isp4/isp4_debug.c
Extension
.c
Size
6573 bytes
Lines
272
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (cnt > rb_size) {
			dev_err(dev, "fail bad fw log size %u\n", cnt);
			goto quit;
		}

		memcpy(buf + offset, sys + rd_ptr, cnt);

		offset += cnt;
		total_cnt += cnt;
		rd_ptr = (rd_ptr + cnt) % rb_size;
	} while (rd_ptr < wr_ptr);

	isp4hw_wreg(isp->mmio, ISP_LOG_RB_RPTR0, rd_ptr);

quit:
	return total_cnt;
}

void isp_fw_log_print(struct isp4_subdev *isp)
{
	struct isp4_interface *ispif = &isp->ispif;
	char *fw_log_buf = isp->fw_log_output;
	u32 cnt;

	if (!isp->enable_fw_log || !fw_log_buf)
		return;

	cnt = isp_fw_fill_rb_log(isp, ispif->fw_log_buf->sys_addr,
				 ispif->fw_log_buf->mem_size);

	if (cnt) {
		char temp_ch;
		char *str;
		char *end;
		/* line end */
		char *le;

		str = (char *)fw_log_buf;
		end = ((char *)fw_log_buf + cnt);
		fw_log_buf[cnt] = 0;

		while (str < end) {
			le = strchr(str, 0x0A);
			if ((le && str + ISP4DBG_ONE_TIME_LOG_LEN >= le) ||
			    (!le && str + ISP4DBG_ONE_TIME_LOG_LEN >= end)) {
				if (le)
					*le = 0;

				if (*str != '\0')
					dev_dbg(isp->dev, "%s", str);

				if (le) {
					*le = 0x0A;
					str = le + 1;
				} else {
					break;
				}
			} else {
				u32 tmp_len = ISP4DBG_ONE_TIME_LOG_LEN;

				temp_ch = str[tmp_len];
				str[tmp_len] = 0;
				dev_dbg(isp->dev, "%s", str);
				str[tmp_len] = temp_ch;
				str = &str[tmp_len];
			}
		}
	}
}
#endif

char *isp4dbg_get_buf_src_str(u32 src)
{
	switch (src) {
	case ISP4FW_BUFFER_SOURCE_STREAM:
		return ISP4DBG_MACRO_2_STR(ISP4FW_BUFFER_SOURCE_STREAM);
	default:
		return "Unknown buf source";
	}
}

char *isp4dbg_get_buf_done_str(u32 status)
{
	switch (status) {
	case ISP4FW_BUFFER_STATUS_INVALID:
		return ISP4DBG_MACRO_2_STR(ISP4FW_BUFFER_STATUS_INVALID);
	case ISP4FW_BUFFER_STATUS_SKIPPED:
		return ISP4DBG_MACRO_2_STR(ISP4FW_BUFFER_STATUS_SKIPPED);
	case ISP4FW_BUFFER_STATUS_EXIST:
		return ISP4DBG_MACRO_2_STR(ISP4FW_BUFFER_STATUS_EXIST);

Annotation

Implementation Notes