Hello JerryChang,
my sensor produces 12-bits-per-pixel monochrome pixels (aka Y12_1X12). This the media bus format produced by my driver.
Here are the relevant entries in vi4_video_formats
static const struct tegra_video_format vi4_video_formats[] = {
...
/* RAW 12 */
TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 2, 1, T_R16,
RAW12, Y16, "GRAY16_LE"),
TEGRA_VIDEO_FORMAT(RAW12, 12, Y12_1X12, 1, 1, T_L8,
RAW12, GREY, "GRAY8"),
To debug the problem described in Bandwidth problem when converting mipi RAW12 to T_R16_I or T_R16 on TX2, I had also added printk’s in file drivers/video/tegra/camera/tegra_camera_platform.c in function ‘tegra_camera_update_clknbw’
diff --git a/drivers/video/tegra/camera/tegra_camera_platform.c b/drivers/video/
tegra/camera/tegra_camera_platform.c
index aa221d10c..3fcb05341 100644
--- a/drivers/video/tegra/camera/tegra_camera_platform.c
+++ b/drivers/video/tegra/camera/tegra_camera_platform.c
@@ -985,6 +990,7 @@ int tegra_camera_update_clknbw(void *priv, bool stream_on)
if (!info)
return -EINVAL;
+printk("tegra_camera_update_clknbw: active_iso_bw = %llu\n", info->active_iso_bw);
mutex_lock(&info->device_list_mutex);
/* Need to traverse the list twice, first to make sure that
* stream on is set for the active stream and then to
@@ -997,11 +1003,13 @@ int tegra_camera_update_clknbw(void *priv, bool stream_on)
cdev->stream_on = stream_on;
if (stream_on) {
info->active_pixel_rate += cdev->pixel_rate;
+printk("tegra_camera_update_clknbw: adding %llu\n", cdev->bw);
info->active_iso_bw += cdev->bw;
info->num_active_streams++;
} else {
info->active_pixel_rate -= cdev->pixel_rate;
info->active_iso_bw -= cdev->bw;
+printk("tegra_camera_update_clknbw: removing %llu\n", cdev->bw);
info->num_active_streams--;
}
break;
@@ -1017,6 +1025,7 @@ int tegra_camera_update_clknbw(void *priv, bool stream_on)
}
}
mutex_unlock(&info->device_list_mutex);
+printk("tegra_camera_update_clknbw: active_iso_bw = %llu\n", info->active_iso_bw);
/* set BW */
tegra_camera_update_isobw();
and here are my testcases :
v4l2-ctl -d /dev/video0 --stream-mmap=3 --stream-count=256 '--set-fmt-video=width=2464,height=2056,pixelformat=GREY'
v4l2-ctl -d /dev/video0 --stream-mmap=3 --stream-count=256 '--set-fmt-video=width=2464,height=2056,pixelformat=Y16 '
I noticed that the ‘bw’ values used in tegra_camera_update_clknbw were identical in both cases, while it seems to me that the bw requirements for 1-byte-per-pixel images should be the half of the bw requirements for 2-bytes-per-pixel images.