Re: [PATCH v1 03/10] media: platform: mediatek: add isp_7x seninf unit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Shu-hsiang:

On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces the driver of the MediaTek Sensor Interface,
> focusing on integration with the MediaTek ISP CAMSYS. The
> seninf device bridges camera sensors and the ISP system,
> providing management for sensor data routing and processing.
> Key features include V4L2 framework control, and dynamic
> handling of stream configurations and virtual channels.
> 
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang@xxxxxxxxxxxx>
> ---

[snip]

> +static ssize_t debug_ops_show(struct device *dev,
> +			      struct device_attribute *attr, char *buf)
> +{

Separate debug related code to debug patch.

> +	int len = 0;
> +
> +	len += snprintf(buf + len, PAGE_SIZE - len, "This is debug ops message\n");
> +
> +	return len;
> +}
> +
> +enum REG_OPS_CMD {
> +	REG_OPS_CMD_ID,
> +	REG_OPS_CMD_CSI,
> +	REG_OPS_CMD_RG,
> +	REG_OPS_CMD_VAL,
> +	REG_OPS_CMD_MAX_NUM,
> +};
> +
> +static ssize_t debug_ops_store(struct device *dev,
> +			       struct device_attribute *attr,
> +			       const char *buf, size_t count)
> +{

Ditto.

Regards,
CK

> +	char delim[] = " ";
> +	char csi_names[20];
> +	char *token = NULL;
> +	char *sbuf = kcalloc(count + 1, sizeof(char), GFP_KERNEL);
> +	char *s = sbuf;
> +	int ret;
> +	char *arg[REG_OPS_CMD_MAX_NUM];
> +	struct seninf_core *core = dev_get_drvdata(dev);
> +	struct seninf_ctx *ctx;
> +	int csi_port = -1;
> +	int rg_idx = -1;
> +	u32 val, i, num_para = 0;
> +
> +	if (!sbuf)
> +		goto ERR_DEBUG_OPS_STORE;
> +
> +	memcpy(sbuf, buf, count);
> +
> +	token = strsep(&s, delim);
> +	while (token && num_para < REG_OPS_CMD_MAX_NUM) {
> +		if (strlen(token)) {
> +			arg[num_para] = token;
> +			num_para++;
> +		}
> +
> +		token = strsep(&s, delim);
> +	}
> +
> +	if (num_para != REG_OPS_CMD_MAX_NUM) {
> +		dev_info(dev, "Wrong command parameter number\n");
> +		goto ERR_DEBUG_OPS_STORE;
> +	}
> +
> +	if (strncmp("SET_REG", arg[REG_OPS_CMD_ID], sizeof("SET_REG")) == 0) {
> +		for (i = 0; i < REG_KEY_MAX_NUM; i++) {
> +			if (!strcasecmp(arg[REG_OPS_CMD_RG], set_reg_names[i]))
> +				rg_idx = i;
> +		}
> +		if (rg_idx < 0)
> +			goto ERR_DEBUG_OPS_STORE;
> +
> +		ret = kstrtouint(arg[REG_OPS_CMD_VAL], 0, &val);
> +		if (ret)
> +			goto ERR_DEBUG_OPS_STORE;
> +
> +		for (i = 0; i < CSI_PORT_MAX_NUM; i++) {
> +			memset(csi_names, 0, ARRAY_SIZE(csi_names));
> +			snprintf(csi_names, 10, "csi-%s", csi_port_names[i]);
> +			if (!strcasecmp(arg[REG_OPS_CMD_CSI], csi_names))
> +				csi_port = i;
> +		}
> +
> +		if (csi_port < 0)
> +			goto ERR_DEBUG_OPS_STORE;
> +
> +		/* reg call */
> +		mutex_lock(&core->mutex);
> +
> +		list_for_each_entry(ctx, &core->list, list) {
> +			if (csi_port == ctx->port)
> +				mtk_cam_seninf_set_reg(ctx, rg_idx, val);
> +		}
> +
> +		mutex_unlock(&core->mutex);
> +	}
> +
> +ERR_DEBUG_OPS_STORE:
> +
> +	kfree(sbuf);
> +
> +	return count;
> +}
> +
> +static DEVICE_ATTR_RW(debug_ops);
> +





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux