Thread (14 messages) 14 messages, 4 authors, 2020-07-21

Re: [RFC PATCH V7 1/3] media: platform: mtk-isp: Add Mediatek sensor interface driver

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Date: 2020-07-12 23:14:44
Also in: linux-arm-kernel, linux-media, linux-mediatek

Hi, Louis:

Louis Kuo [off-list ref] 於 2020年7月8日 週三 下午6:41寫道:
This patch adds Mediatek's sensor interface driver. Sensor interface
driver is a MIPI-CSI2 host driver, namely, a HW camera interface controller.
It support a widely adopted, simple, high-speed protocol primarily intended
for point-to-point image and video transmission between cameras and host
devices. The mtk-isp directory will contain drivers for multiple IP blocks
found in Mediatek ISP system. It will include ISP Pass 1 driver, sensor
interface driver, DIP driver and face detection driver.

Signed-off-by: Louis Kuo <redacted>
---
[snip]
+
+enum CFG_CSI_PORT {
+       CFG_CSI_PORT_0 = 0x0,   /* 4D1C */
+       CFG_CSI_PORT_1,         /* 4D1C */
+       CFG_CSI_PORT_2,         /* 4D1C */
+       CFG_CSI_PORT_0A,        /* 2D1C */
+       CFG_CSI_PORT_0B,        /* 2D1C */
+       CFG_CSI_PORT_MAX_NUM,
+       CFG_CSI_PORT_NONE       /*for non-MIPI sensor */
+};
+
+enum PIXEL_MODE {
+       ONE_PIXEL_MODE  = 0x0,
+       TWO_PIXEL_MODE  = 0x1,
+       FOUR_PIXEL_MODE = 0x2,
+};
+
+enum SENINF_ID {
+       SENINF_1 = 0x0,
+       SENINF_2 = 0x1,
+       SENINF_3 = 0x2,
+       SENINF_4 = 0x3,
+       SENINF_5 = 0x4,
+       SENINF_NUM,
+};
+
[snip]
+
+static int seninf_link_setup(struct media_entity *entity,
+                            const struct media_pad *local,
+                            const struct media_pad *remote, u32 flags)
+{
+       struct v4l2_subdev *sd;
+       struct mtk_seninf *priv;
+       struct device *dev;
+
+       sd = media_entity_to_v4l2_subdev(entity);
+       priv = v4l2_get_subdevdata(sd);
+       dev = priv->dev;
+
+       if (!(flags & MEDIA_LNK_FL_ENABLED))
+               return 0;
+
+       if (local->flags & MEDIA_PAD_FL_SOURCE) {
+               priv->mux_sel = local->index - CAM_MUX_IDX_MIN;
+       } else {
+               /* Select port */
+               priv->port = local->index;
I don't understand V4L2 much, but the port definition is inside this
file, how does the caller know what to pass to here? Could you explain
how does it work?

Regards,
Chun-Kuang.
+               if (priv->port >= NUM_SENSORS) {
+                       dev_err(dev, "port index is over number of ports\n");
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help