[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b3144b7080410192477f5113671c2910329be67.camel@mediatek.com>
Date: Fri, 18 Oct 2024 08:54:20 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
"christian.koenig@....com" <christian.koenig@....com>, "mchehab@...nel.org"
<mchehab@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
"robh@...nel.org" <robh@...nel.org>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "krzk+dt@...nel.org" <krzk+dt@...nel.org>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Shu-hsiang Yang (楊舒翔)
<Shu-hsiang.Yang@...iatek.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"yunkec@...omium.org" <yunkec@...omium.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, Yaya Chang (張雅清)
<Yaya.Chang@...iatek.com>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Teddy Chen (陳乾元) <Teddy.Chen@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "hidenorik@...omium.org"
<hidenorik@...omium.org>, Shun-Yi Wang (王順億)
<Shun-Yi.Wang@...iatek.com>
Subject: Re: [PATCH v1 03/10] media: platform: mediatek: add isp_7x seninf
unit
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@...iatek.com>
> ---
[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);
> +
Powered by blists - more mailing lists