aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/platform/samsung
AgeCommit message (Collapse)AuthorFilesLines
2024-10-18media: s5p-jpeg: prevent buffer overflowsMauro Carvalho Chehab1-6/+11
The current logic allows word to be less than 2. If this happens, there will be buffer overflows, as reported by smatch. Add extra checks to prevent it. While here, remove an unused word = 0 assignment. Fixes: 6c96dbbc2aa9 ("[media] s5p-jpeg: add support for 5433") Cc: [email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]> Reviewed-by: Jacek Anaszewski <[email protected]>
2024-08-09media: platform: exynos-gsc: use 'time_left' variable with wait_event_timeout()Wolfram Sang1-5/+5
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_event_timeout() causing patterns like: timeout = wait_event_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-08-09media: fimc-is: use 'time_left' variable with wait_event_timeout()Wolfram Sang1-5/+5
There is a confusing pattern in the kernel to use a variable named 'timeout' to store the result of wait_event_timeout() causing patterns like: timeout = wait_event_timeout(...) if (!timeout) return -ETIMEDOUT; with all kinds of permutations. Use 'time_left' as a variable to make the code self explaining. Fix to the proper variable type 'long' while here. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-06-29media: exynos4-is: add missing MODULE_DESCRIPTION() macrosJeff Johnson3-0/+3
make allmodconfig && make W=1 C=1 reports: WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/platform/samsung/exynos4-is/exynos-fimc-lite.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/platform/samsung/exynos4-is/exynos-fimc-is.o WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/media/platform/samsung/exynos4-is/exynos4-is-common.o Add the missing invocations of the MODULE_DESCRIPTION() macro. Signed-off-by: Jeff Johnson <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-23media: platform: replace of_graph_get_next_endpoint()Kuninori Morimoto2-2/+3
From DT point of view, in general, drivers should be asking for a specific port number because their function is fixed in the binding. of_graph_get_next_endpoint() doesn't match to this concept. Simply replace - of_graph_get_next_endpoint(xxx, NULL); + of_graph_get_endpoint_by_regs(xxx, 0, -1); Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kuninori Morimoto <[email protected]> Signed-off-by: Sakari Ailus <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: samsung: s5p-mfc: Fix kerneldocRicardo Ribalda1-1/+0
Remove doc from missing fields. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-02-05media: samsung: exynos4-is: Fix kerneldocRicardo Ribalda1-3/+0
Remove doc from missing fields. Signed-off-by: Ricardo Ribalda <[email protected]> Reviewed-by: Randy Dunlap <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop static device variable in s5p_mfc_pm.cKrzysztof Kozlowski7-69/+67
Change the interface of power management functions in s5p_mfc_pm.c to accept the pointer to S5P MFC device structure. instead of relying on file-scope static variable. This makes code easier to read and modify in case more devices are added. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop useless static s5p_mfc_dev in s5p_mfc_pm.cKrzysztof Kozlowski1-3/+0
Pointer "struct s5p_mfc_dev" is stored in s5p_mfc_pm.c once and never used again. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop useless clock refcnt debuggingKrzysztof Kozlowski1-8/+0
Drop useless debugging of clock enabl/disable counts, because core handles this much better. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify local pointers to s5p_mfc_enc_paramsKrzysztof Kozlowski2-16/+16
Constify the local variables pointing to "struct s5p_mfc_enc_params" and other encoding params to annotate the function is not modifying pointed data. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify pointers to s5p_mfc_cmd_argsKrzysztof Kozlowski3-3/+3
In few places functions do not modify pointed "struct s5p_mfc_cmd_args", thus the pointer can point to const data for additional safety and self-documenting intention of the function. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify struct structuresKrzysztof Kozlowski4-6/+6
Static "struct" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify s5p_mfc_fmt structuresKrzysztof Kozlowski3-9/+9
Static "s5p_mfc_fmt" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify s5p_mfc_hw_ops structuresKrzysztof Kozlowski5-7/+7
Static "s5p_mfc_hw_ops" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify s5p_mfc_hw_cmds structuresKrzysztof Kozlowski5-7/+7
Static "s5p_mfc_hw_cmds" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify s5p_mfc_variant structuresKrzysztof Kozlowski1-7/+7
Static "s5p_mfc_variant" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify s5p_mfc_buf_size structuresKrzysztof Kozlowski6-20/+20
Static "s5p_mfc_buf_size*" structures are not modified by the driver, so they can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: constify fw_name stringsKrzysztof Kozlowski1-1/+1
Constify stored pointers to firmware names for code safety. These are not modified by the driver. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop unused get_*_def_fmt declarationsKrzysztof Kozlowski2-2/+0
get_dec_def_fmt() and get_enc_def_fmt() do not have definitions, so their declarations are pointless. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop unused static s5p_mfc_opsKrzysztof Kozlowski1-5/+2
File-scope static variable "s5p_mfc_ops" is not read after assignment, thus it can be dropped entirely. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: s5p-mfc: drop unused static s5p_mfc_cmdsKrzysztof Kozlowski1-6/+2
File-scope static variable "s5p_mfc_cmds" is not read after assignment, thus it can be dropped entirely. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify local pointers to fimc_frameKrzysztof Kozlowski4-25/+25
Constify the local variables pointing to "struct fimc_frame" to annotate the function is not modifying pointed data. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify local pointers to fimc_vid_capKrzysztof Kozlowski1-2/+2
Constify the local variables pointing to "struct fimc_vid_cap" to annotate the function is not modifying pointed data. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify local pointers to fimc_dma_offsetKrzysztof Kozlowski1-2/+2
Constify the local variables pointing to "struct fimc_dma_offset" to annotate the function is not modifying pointed data. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify pointers to v4l2_pix_format_mplaneKrzysztof Kozlowski3-3/+3
In few places functions do not modify pointed "struct v4l2_pix_format_mplane", thus the pointer can point to const data for additional safety and self-documenting intention of the function. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify fimc_formats arrayKrzysztof Kozlowski4-25/+28
Pointers to elements of the static array "fimc_formats" with "struct fimc_fmt" are passed all around to various calls, but all of them do not modify pointed data. Constify the pointers everywhere which at the end allows to make static array "fimc_formats" const itself. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify local pointers to fimc_fmtKrzysztof Kozlowski3-6/+6
Constify the local variable pointing to "struct fimc_fmt" to annotate the function is not modifying pointed data. This is the easy and obvious step of constifying all "struct fimc_fmt" instances. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify several pointers in function argumentsKrzysztof Kozlowski4-19/+19
Several functions do not modify pointed structure, thus the pointer can point to const data for additional safety and self-documenting intention of the function. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: constify clock namesKrzysztof Kozlowski1-1/+1
Static array with clock names can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-is: drop unused fimc_vidioc_enum_fmt_mplane()Krzysztof Kozlowski1-2/+0
Function fimc_vidioc_enum_fmt_mplane() is not defined, so drop its declaration from the header. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-lite: constify pointers to v4l2_pix_format_mplaneKrzysztof Kozlowski1-1/+1
In few places functions do not modify pointed "struct v4l2_pix_format_mplane", thus the pointer can point to const data for additional safety and self-documenting intention of the function. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-lite: constify several pointers in function argumentsKrzysztof Kozlowski2-11/+12
Several functions do not modify pointed structure, thus the pointer can point to const data for additional safety and self-documenting intention of the function. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2024-01-22media: fimc-lite: drop unused flite_hw_set_camera_polarity()Krzysztof Kozlowski1-2/+0
Function flite_hw_set_camera_polarity() is not defined, so drop its declaration from the header. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: DPB Count Independent of VIDIOC_REQBUFAakarsh Jain2-16/+9
Add allocation of DPB buffers based on MFC requirement so, codec buffers allocations has been moved after state MFCINST_HEAD_PRODUCED. It is taken care that codec buffer allocation is performed in process context from userspace IOCTL call. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Load firmware for each run in MFCv12.Aakarsh Jain1-2/+8
In MFCv12, some section of firmware gets updated at each MFC run. Hence we need to reload original firmware for each run at the start. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Set context for valid case before calling try_runAakarsh Jain1-0/+2
Context bit is set for hardware execution if there is a buffer in source and destination queue before calling try_run in the init_buffers function. Now there will be a new context created and hardware will be invoked for the buffer queued instead of waiting for another buffer to be queued from userspace to set this context bit for hw execution. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Add support for DMABUF for encoderAakarsh Jain2-11/+13
Add dmabuf support for mfc encoder Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Add support for UHD encoding.Aakarsh Jain2-3/+18
MFC driver had restriction on max resolution of 1080p, updated it for UHD. Added corresponding support to set recommended profile and level for H264 in UHD scenario. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Add support for rate controls in MFCv12Aakarsh Jain2-4/+19
In MFCv12, the rc configs are changed with support for CBR loose, CBR tight and Variable Bitrate (VBR) added. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Add YV12 and I420 multiplanar format supportAakarsh Jain9-63/+276
YV12 and I420 format (3-plane) support is added. Stride information is added to all formats and planes since it is necessary for YV12/I420 which are different from width. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Add initial support for MFCv12Aakarsh Jain9-35/+172
Add support for MFCv12, with a new register file and necessary hw control, decoder, encoder and structural changes. Add luma dbp, chroma dpb and mv sizes for each codec as per the UM for MFCv12, along with appropriate alignment. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: s5p-mfc: Rename IS_MFCV10 macroAakarsh Jain3-20/+20
Renames macro IS_MFCV10 to IS_MFCV10_PLUS so that the MFCv10 code can be resued for MFCv12 support. Since some part of MFCv10 specific code holds good for MFCv12 also. Cc: [email protected] Signed-off-by: Smitha T Murthy <[email protected]> Signed-off-by: Aakarsh Jain <[email protected]> Reviewed-by: Alim Akhtar <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-13media: platform: exynos4-is: return callee's error code rather than -ENXIOSu Hui1-1/+1
Clang static analyzer complains that value stored to 'ret' is never read. Return the callee's error code to fix this. Signed-off-by: Su Hui <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-12-07media: exynos-gsc: remove unused improper CONFIG definitionLukas Bulwahn1-1/+0
Defines prefixed with "CONFIG" should be limited to proper Kconfig options, that are introduced in a Kconfig file. In the driver code, there is a define for CONFIG_VB2_GSC_DMA_CONTIG, but this is not used anywhere in the code. Just remove this unused definition. No functional change. Signed-off-by: Lukas Bulwahn <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-11-23media: v4l: subdev: Switch to stream-aware state functionsSakari Ailus5-34/+29
Switch all drivers accessing sub-device state to use the stream-aware functions. We will soon remove the old ones. This patch has been generated using the following Coccinelle script: ---------8<------------ @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_format(E1, E2, E3) + v4l2_subdev_state_get_format(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_crop(E1, E2, E3) + v4l2_subdev_state_get_crop(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_pad_compose(E1, E2, E3) + v4l2_subdev_state_get_compose(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_format(E1, E2, E3) + v4l2_subdev_state_get_format(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_crop(E1, E2, E3) + v4l2_subdev_state_get_crop(E2, E3) @@ expression E1, E2, E3; @@ - v4l2_subdev_get_try_compose(E1, E2, E3) + v4l2_subdev_state_get_compose(E2, E3) ---------8<------------ Additionally drivers/media/i2c/s5k5baf.c and drivers/media/platform/samsung/s3c-camif/camif-capture.c have been manually changed as Coccinelle didn't. Further local variables have been removed as they became unused as a result of the other changes. Also Coccinelle introduced indentation by space in files drivers/media/i2c/st-mipid02.c and drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c. This has been also corrected. The diff from Coccinelle-generated changes are: > diff --git b/drivers/media/i2c/imx319.c a/drivers/media/i2c/imx319.c > index e549692ff478..420984382173 100644 > --- b/drivers/media/i2c/imx319.c > +++ a/drivers/media/i2c/imx319.c > @@ -2001,7 +2001,6 @@ static int imx319_do_get_pad_format(struct imx319 *imx319, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &imx319->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/imx355.c a/drivers/media/i2c/imx355.c > index 96bdde685d65..e1b1d2fc79dd 100644 > --- b/drivers/media/i2c/imx355.c > +++ a/drivers/media/i2c/imx355.c > @@ -1299,7 +1299,6 @@ static int imx355_do_get_pad_format(struct imx355 *imx355, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &imx355->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov08x40.c a/drivers/media/i2c/ov08x40.c > index ca799bbcfdb7..abbb0b774d43 100644 > --- b/drivers/media/i2c/ov08x40.c > +++ a/drivers/media/i2c/ov08x40.c > @@ -2774,7 +2774,6 @@ static int ov08x40_do_get_pad_format(struct ov08x40 *ov08x, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov08x->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov13858.c a/drivers/media/i2c/ov13858.c > index 7816d9787c61..09387e335d80 100644 > --- b/drivers/media/i2c/ov13858.c > +++ a/drivers/media/i2c/ov13858.c > @@ -1316,7 +1316,6 @@ static int ov13858_do_get_pad_format(struct ov13858 *ov13858, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov13858->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/ov13b10.c a/drivers/media/i2c/ov13b10.c > index 268cd4b03f9c..c06411d5ee2b 100644 > --- b/drivers/media/i2c/ov13b10.c > +++ a/drivers/media/i2c/ov13b10.c > @@ -1001,7 +1001,6 @@ static int ov13b10_do_get_pad_format(struct ov13b10 *ov13b, > struct v4l2_subdev_format *fmt) > { > struct v4l2_mbus_framefmt *framefmt; > - struct v4l2_subdev *sd = &ov13b->sd; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > framefmt = v4l2_subdev_state_get_format(sd_state, fmt->pad); > diff --git b/drivers/media/i2c/s5c73m3/s5c73m3-core.c a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > index 47605e36bc60..8f9b5713daf7 100644 > --- b/drivers/media/i2c/s5c73m3/s5c73m3-core.c > +++ a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > @@ -819,7 +819,6 @@ static void s5c73m3_oif_try_format(struct s5c73m3 *state, > struct v4l2_subdev_format *fmt, > const struct s5c73m3_frame_size **fs) > { > - struct v4l2_subdev *sd = &state->sensor_sd; > u32 code; > > switch (fmt->pad) { > diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c > index 67da2045f543..03ccfb0e1e11 100644 > --- a/drivers/media/i2c/s5k5baf.c > +++ b/drivers/media/i2c/s5k5baf.c > @@ -1472,14 +1472,11 @@ static int s5k5baf_set_selection(struct v4l2_subdev *sd, > > if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { > rects = (struct v4l2_rect * []) { > - &s5k5baf_cis_rect, > - v4l2_subdev_get_try_crop(sd, sd_state, > - PAD_CIS), > - v4l2_subdev_get_try_compose(sd, sd_state, > - PAD_CIS), > - v4l2_subdev_get_try_crop(sd, sd_state, > - PAD_OUT) > - }; > + &s5k5baf_cis_rect, > + v4l2_subdev_state_get_crop(sd_state, PAD_CIS), > + v4l2_subdev_state_get_compose(sd_state, PAD_CIS), > + v4l2_subdev_state_get_crop(sd_state, PAD_OUT) > + }; > s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r); > return 0; > } > diff --git b/drivers/media/platform/samsung/s3c-camif/camif-capture.c a/drivers/media/platform/samsung/s3c-camif/camif-capture.c > index 295e083f38e8..be58260ea67e 100644 > --- b/drivers/media/platform/samsung/s3c-camif/camif-capture.c > +++ a/drivers/media/platform/samsung/s3c-camif/camif-capture.c > @@ -1216,7 +1216,7 @@ static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd, > struct v4l2_mbus_framefmt *mf = &fmt->format; > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > - mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); > + mf = v4l2_subdev_state_get_format(sd_state, fmt->pad); > fmt->format = *mf; > return 0; > } > @@ -1305,7 +1305,7 @@ static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd, > __camif_subdev_try_format(camif, mf, fmt->pad); > > if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { > - mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); > + mf = v4l2_subdev_state_get_format(sd_state, fmt->pad); > *mf = fmt->format; > mutex_unlock(&camif->lock); > return 0; > diff --git b/drivers/media/platform/ti/cal/cal-camerarx.c a/drivers/media/platform/ti/cal/cal-camerarx.c > index cea454ed9c20..61433744c6c4 100644 > --- b/drivers/media/platform/ti/cal/cal-camerarx.c > +++ a/drivers/media/platform/ti/cal/cal-camerarx.c > @@ -621,8 +621,6 @@ static int cal_camerarx_sd_enum_mbus_code(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state, > struct v4l2_subdev_mbus_code_enum *code) > { > - struct cal_camerarx *phy = to_cal_camerarx(sd); > - > /* No transcoding, source and sink codes must match. */ > if (cal_rx_pad_is_source(code->pad)) { > struct v4l2_mbus_framefmt *fmt; > diff --git b/drivers/staging/media/imx/imx-ic-prp.c a/drivers/staging/media/imx/imx-ic-prp.c > index dd558fac6477..61d69f19657e 100644 > --- b/drivers/staging/media/imx/imx-ic-prp.c > +++ a/drivers/staging/media/imx/imx-ic-prp.c > @@ -82,8 +82,6 @@ static struct v4l2_mbus_framefmt * > __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, > unsigned int pad, enum v4l2_subdev_format_whence which) > { > - struct imx_ic_priv *ic_priv = priv->ic_priv; > - > if (which == V4L2_SUBDEV_FORMAT_TRY) > return v4l2_subdev_state_get_format(sd_state, pad); > else > diff --git b/drivers/staging/media/imx/imx-ic-prpencvf.c a/drivers/staging/media/imx/imx-ic-prpencvf.c > index 02db7dbb884b..ec73c901079e 100644 > --- b/drivers/staging/media/imx/imx-ic-prpencvf.c > +++ a/drivers/staging/media/imx/imx-ic-prpencvf.c > @@ -790,8 +790,6 @@ static struct v4l2_mbus_framefmt * > __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, > unsigned int pad, enum v4l2_subdev_format_whence which) > { > - struct imx_ic_priv *ic_priv = priv->ic_priv; > - > if (which == V4L2_SUBDEV_FORMAT_TRY) > return v4l2_subdev_state_get_format(sd_state, pad); > else > diff --git a/drivers/media/i2c/st-mipid02.c b/drivers/media/i2c/st-mipid02.c > index 9c9361354c00..b08a249b5fdd 100644 > --- a/drivers/media/i2c/st-mipid02.c > +++ b/drivers/media/i2c/st-mipid02.c > @@ -751,7 +751,7 @@ static void mipid02_set_fmt_source(struct v4l2_subdev *sd, > format->format = bridge->fmt; > else > format->format = *v4l2_subdev_state_get_format(sd_state, > - MIPID02_SINK_0); > + MIPID02_SINK_0); > > /* but code may need to be converted */ > format->format.code = serial_to_parallel_code(format->format.code); > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > index 117912d3bfbd..96353648c032 100644 > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c > @@ -319,7 +319,7 @@ static void rkisp1_isp_start(struct rkisp1_isp *isp, > rkisp1_write(rkisp1, RKISP1_CIF_ISP_CTRL, val); > > src_fmt = v4l2_subdev_state_get_format(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > src_info = rkisp1_mbus_info_get_by_code(src_fmt->code); > > if (src_info->pixel_enc != V4L2_PIXEL_ENC_BAYER) > @@ -475,9 +475,9 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, > sink_fmt = v4l2_subdev_state_get_format(sd_state, > RKISP1_ISP_PAD_SINK_VIDEO); > src_fmt = v4l2_subdev_state_get_format(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > src_crop = v4l2_subdev_state_get_crop(sd_state, > - RKISP1_ISP_PAD_SOURCE_VIDEO); > + RKISP1_ISP_PAD_SOURCE_VIDEO); > > /* > * Media bus code. The ISP can operate in pass-through mode (Bayer in, Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-11-23media: exynos4-is: fimc-is-i2c: remove I2C_CLASS_SPD supportHeiner Kallweit1-1/+0
This I2C bus is used by the firmware only and it seems I2C_CLASS_SPD device auto-detection has never been used. So we can safely remove it. That's one further step towards removing I2C_CLASS_SPD completely. Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
2023-10-07media: s5p-mfc: Fix potential deadlock on condlockChengfeng Ye1-1/+1
As &dev->condlock is acquired under irq context along the following call chain from s5p_mfc_irq(), other acquisition of the same lock inside process context or softirq context should disable irq avoid double lock. enc_post_frame_start() seems to be one such function that execute under process context or softirq context. <deadlock #1> enc_post_frame_start() --> clear_work_bit() --> spin_loc(&dev->condlock) <interrupt> --> s5p_mfc_irq() --> s5p_mfc_handle_frame() --> clear_work_bit() --> spin_lock(&dev->condlock) This flaw was found by an experimental static analysis tool I am developing for irq-related deadlock. To prevent the potential deadlock, the patch change clear_work_bit() inside enc_post_frame_start() to clear_work_bit_irqsave(). Signed-off-by: Chengfeng Ye <[email protected]> Acked-by: Marek Szyprowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-10-07media: s3c-camif: Avoid inappropriate kfree()Katya Orlova1-4/+2
s3c_camif_register_video_node() works with video_device structure stored as a field of camif_vp, so it should not be kfreed. But there is video_device_release() on error path that do it. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface") Signed-off-by: Katya Orlova <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
2023-09-27media: exynos4-is: fimc-is: replace duplicate pmu node with phandleKrzysztof Kozlowski1-9/+24
Devicetree for the FIMC IS camera included duplicated PMU node as its child like: soc@0 { system-controller@10020000 { ... }; // Real PMU camera@11800000 { fimc-is@12000000 { // FIMC IS camera node pmu@10020000 { reg = <0x10020000 0x3000>; // Fake PMU node }; }; }; }; This is not a correct representation of the hardware. Mapping the PMU (Power Management Unit) IO memory should be via syscon-like phandle (samsung,pmu-syscon, already used for other drivers), not by duplicating "pmu" Devicetree node inside the FIMC IS. Backward compatibility is preserved. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>