Fix 2720 hardware support and streamline changelog

This commit is contained in:
Luxferre committed 2026-11-10 08:38:40 +02:00
1 parent 3b96b8f242
commit a4f2051d50
20 files changed
+115 -391

No files matched your search

+27 -13
View File
@@ -171,6 +171,7 @@ struct msm8905_cam_dev {
u16 chip_id;
bool streaming;
bool hw_initialized;
bool rotate_180;
};
static struct msm8905_cam_dev *g_cam;
@@ -600,17 +601,19 @@ static int msm8905_cam_hw_init(struct msm8905_cam_dev *cam)
return 0;
}
static void msm8905_cam_demosaic(const u8 *raw, u8 *rgb)
static void msm8905_cam_demosaic(const u8 *raw, u8 *rgb, bool rotate_180)
{
u32 y, x;
u32 idx = 0;
for (y = 0; y < CAM_OUT_HEIGHT; y++) {
const u8 *r0 = raw + (2U * y) * CAM_RAW_STRIDE;
const u8 *r1 = raw + (2U * y + 1U) * CAM_RAW_STRIDE;
u32 src_y = rotate_180 ? CAM_OUT_HEIGHT - 1U - y : y;
const u8 *r0 = raw + (2U * src_y) * CAM_RAW_STRIDE;
const u8 *r1 = raw + (2U * src_y + 1U) * CAM_RAW_STRIDE;
for (x = 0; x < CAM_OUT_WIDTH; x += 2U) {
u32 g_off = (x >> 1) * 5U;
u32 src_x = rotate_180 ? CAM_OUT_WIDTH - 2U - x : x;
u32 g_off = (src_x >> 1) * 5U;
u8 b0 = r0[g_off + 0U];
u8 g0 = (u8)(((u32)r0[g_off + 1U] + (u32)r1[g_off + 0U]) >> 1);
u8 r_0 = r1[g_off + 1U];
@@ -618,12 +621,21 @@ static void msm8905_cam_demosaic(const u8 *raw, u8 *rgb)
u8 g1 = (u8)(((u32)r0[g_off + 3U] + (u32)r1[g_off + 2U]) >> 1);
u8 r_1 = r1[g_off + 3U];
rgb[idx + 0U] = r_0;
rgb[idx + 1U] = g0;
rgb[idx + 2U] = b0;
rgb[idx + 3U] = r_1;
rgb[idx + 4U] = g1;
rgb[idx + 5U] = b1;
if (rotate_180) {
rgb[idx + 0U] = r_1;
rgb[idx + 1U] = g1;
rgb[idx + 2U] = b1;
rgb[idx + 3U] = r_0;
rgb[idx + 4U] = g0;
rgb[idx + 5U] = b0;
} else {
rgb[idx + 0U] = r_0;
rgb[idx + 1U] = g0;
rgb[idx + 2U] = b0;
rgb[idx + 3U] = r_1;
rgb[idx + 4U] = g1;
rgb[idx + 5U] = b1;
}
idx += 6U;
}
}
@@ -723,7 +735,7 @@ static int msm8905_cam_capture_rgb(struct msm8905_cam_dev *cam, u8 *dst_rgb)
return -ETIMEDOUT;
}
msm8905_cam_demosaic(cam->raw_dma_buf, dst_rgb);
msm8905_cam_demosaic(cam->raw_dma_buf, dst_rgb, cam->rotate_180);
cam->sequence++;
return 0;
}
@@ -1105,6 +1117,8 @@ static int __init msm8905_cam_init(void)
return -ENOMEM;
mutex_init(&cam->lock);
/* The 2720 Flip sensor is mounted 180 degrees from the other Nokia targets. */
cam->rotate_180 = of_machine_is_compatible("nokia,beatles");
cam->pdev = platform_device_register_simple("msm8905-cam", -1, NULL, 0);
if (IS_ERR(cam->pdev)) {
@@ -1160,8 +1174,8 @@ static int __init msm8905_cam_init(void)
goto err_v4l2;
g_cam = cam;
pr_info("msm8905-cam: registered /dev/video%d (GC2395/GC2385 800x600 RGB24, dma=0x%08llx)\n",
cam->vdev.num, (unsigned long long)cam->raw_dma_phys);
pr_info("msm8905-cam: registered /dev/video%d (GC2395/GC2385 800x600 RGB24, dma=0x%08llx, rotate180=%u)\n",
cam->vdev.num, (unsigned long long)cam->raw_dma_phys, cam->rotate_180);
return 0;
err_v4l2: