From 14f79046eb19a0a5b37b0958828819e565513002 Mon Sep 17 00:00:00 2001 From: snchen Date: Thu, 19 Oct 2023 14:56:31 +0800 Subject: [PATCH] kernel: camera: add bayer raw14 format. Add raw14 bayer format driver support bug 4335141 Change-Id: I45c4fb2f692a98cf33d81415104e815c14340a68 Signed-off-by: snchen Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3176545 (cherry picked from commit b2db309d50bed552d656e4fbd8c04cfb1c902f9a) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3226512 Reviewed-by: svcacv GVS: buildbot_gerritrpt Reviewed-by: Anubhav Rai Reviewed-by: Bibek Basu --- .../platform/tegra/camera/camera_common.c | 35 +++++++++++++++++-- .../platform/tegra/camera/sensor_common.c | 23 ++++++++++-- .../platform/tegra/camera/vi/vi5_formats.h | 22 ++++++++++-- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/tegra/camera/camera_common.c b/drivers/media/platform/tegra/camera/camera_common.c index 5c74bba1..c0111bee 100644 --- a/drivers/media/platform/tegra/camera/camera_common.c +++ b/drivers/media/platform/tegra/camera/camera_common.c @@ -1,8 +1,19 @@ // SPDX-License-Identifier: GPL-2.0 /* - * camera_common.c - utilities for tegra camera driver + * SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. + * All rights reserved. * - * Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved. + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -33,6 +44,26 @@ #define HDR_ENABLE 0x1 static const struct camera_common_colorfmt camera_common_color_fmts[] = { + { + MEDIA_BUS_FMT_SBGGR14_1X14, + V4L2_COLORSPACE_SRGB, + V4L2_PIX_FMT_SBGGR14, + }, + { + MEDIA_BUS_FMT_SRGGB14_1X14, + V4L2_COLORSPACE_SRGB, + V4L2_PIX_FMT_SRGGB14, + }, + { + MEDIA_BUS_FMT_SGRBG14_1X14, + V4L2_COLORSPACE_SRGB, + V4L2_PIX_FMT_SGRBG14, + }, + { + MEDIA_BUS_FMT_SGBRG14_1X14, + V4L2_COLORSPACE_SRGB, + V4L2_PIX_FMT_SGBRG14 + }, { MEDIA_BUS_FMT_SRGGB12_1X12, V4L2_COLORSPACE_SRGB, diff --git a/drivers/media/platform/tegra/camera/sensor_common.c b/drivers/media/platform/tegra/camera/sensor_common.c index 92cc2fdf..12306ecc 100644 --- a/drivers/media/platform/tegra/camera/sensor_common.c +++ b/drivers/media/platform/tegra/camera/sensor_common.c @@ -1,8 +1,19 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * sensor_common.c - utilities for tegra sensor drivers + * SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. + * All rights reserved. * - * Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -243,6 +254,14 @@ static int extract_pixel_format( *format = V4L2_PIX_FMT_SGBRG12; else if (strncmp(pixel_t, "bayer_grbg12", size) == 0) *format = V4L2_PIX_FMT_SGRBG12; + else if (strncmp(pixel_t, "bayer_bggr14", size) == 0) + *format = V4L2_PIX_FMT_SBGGR14; + else if (strncmp(pixel_t, "bayer_rggb14", size) == 0) + *format = V4L2_PIX_FMT_SRGGB14; + else if (strncmp(pixel_t, "bayer_gbrg14", size) == 0) + *format = V4L2_PIX_FMT_SGBRG14; + else if (strncmp(pixel_t, "bayer_grbg14", size) == 0) + *format = V4L2_PIX_FMT_SGRBG14; else if (strncmp(pixel_t, "rgb_rgb88824", size) == 0) *format = V4L2_PIX_FMT_RGB24; else if (strncmp(pixel_t, "bayer_wdr_pwl_rggb12", size) == 0) diff --git a/drivers/media/platform/tegra/camera/vi/vi5_formats.h b/drivers/media/platform/tegra/camera/vi/vi5_formats.h index 1d0c1133..4baafc71 100644 --- a/drivers/media/platform/tegra/camera/vi/vi5_formats.h +++ b/drivers/media/platform/tegra/camera/vi/vi5_formats.h @@ -1,8 +1,14 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* +/* SPDX-License-Identifier: GPL-2.0-only + * SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. + * All rights reserved. + * * NVIDIA Tegra Video Input Device Driver VI5 formats * - * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved. + * Author: Bhanu Murthy V + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. */ #ifndef __VI5_FORMATS_H_ @@ -91,6 +97,16 @@ static const struct tegra_video_format vi5_video_formats[] = { TEGRA_VIDEO_FORMAT(RAW8, 8, SBGGR8_1X8, 1, 1, T_R8, RAW8, SBGGR8, "BGBG.. GRGR.."), + /* RAW 14 */ + TEGRA_VIDEO_FORMAT(RAW14, 14, SRGGB14_1X14, 2, 1, T_R16, + RAW14, SRGGB14, "RGRG.. GBGB.."), + TEGRA_VIDEO_FORMAT(RAW14, 14, SGRBG14_1X14, 2, 1, T_R16, + RAW14, SGRBG14, "GRGR.. BGBG.."), + TEGRA_VIDEO_FORMAT(RAW14, 14, SGBRG14_1X14, 2, 1, T_R16, + RAW14, SGBRG14, "GBGB.. RGRG.."), + TEGRA_VIDEO_FORMAT(RAW14, 14, SBGGR14_1X14, 2, 1, T_R16, + RAW14, SBGGR14, "BGBG.. GRGR.."), + /* RAW 10 */ TEGRA_VIDEO_FORMAT(RAW10, 10, SRGGB10_1X10, 2, 1, T_R16, RAW10, SRGGB10, "RGRG.. GBGB.."),