diff options
author | NĂcolas F. R. A. Prado <nfraprado@protonmail.com> | 2020-05-01 15:11:02 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-05-05 17:25:14 +0200 |
commit | b77da87c84f8d3f0290ef96f72edac9a9d2b1d23 (patch) | |
tree | d67311996ff40192d2f4d0de0f005cf9a8540368 /drivers/media/test-drivers/vimc/vimc-scaler.c | |
parent | 6c8d0cdd6ccb21badd52a10d627f80cf1a6ab63f (diff) |
media: vimc: Support multiple media bus codes for each pixelformat
Change vimc_pix_map_list to allow multiple media bus codes to map to the
same pixelformat, making it possible to add media bus codes for which
there are no pixelformat.
Acked-by: Helen Koike <helen.koike@collabora.com>
Signed-off-by: NĂcolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix sparse warning: const u32 -> u32]
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/test-drivers/vimc/vimc-scaler.c')
-rw-r--r-- | drivers/media/test-drivers/vimc/vimc-scaler.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/media/test-drivers/vimc/vimc-scaler.c b/drivers/media/test-drivers/vimc/vimc-scaler.c index 2231e72b24e2..121fa7d62a2e 100644 --- a/drivers/media/test-drivers/vimc/vimc-scaler.c +++ b/drivers/media/test-drivers/vimc/vimc-scaler.c @@ -110,13 +110,19 @@ static int vimc_sca_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_mbus_code_enum *code) { - const struct vimc_pix_map *vpix = vimc_pix_map_by_index(code->index); + u32 mbus_code = vimc_mbus_code_by_index(code->index); + const struct vimc_pix_map *vpix; + + if (!mbus_code) + return -EINVAL; + + vpix = vimc_pix_map_by_code(mbus_code); /* We don't support bayer format */ if (!vpix || vpix->bayer) return -EINVAL; - code->code = vpix->code; + code->code = mbus_code; return 0; } |