* [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration
@ 2022-11-01 11:26 Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 02/34] media: rkisp1: Don't pass the quantization to rkisp1_csm_config() Sasha Levin
` (17 more replies)
0 siblings, 18 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Laurent Pinchart, Dafna Hirschfeld, Paul Elder,
Mauro Carvalho Chehab, Sasha Levin, heiko, linux-media,
linux-rockchip, linux-arm-kernel
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Upstream commit cb00f3a4421d5c7d7155bd4bded7fb2ff8eec211 ]
The ISP converts Bayer data to YUV when operating normally, and can also
operate in pass-through mode where the input and output formats must
match. Converting from YUV to Bayer isn't possible. If such an invalid
configuration is attempted, adjust it by copying the sink pad media bus
code to the source pad.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../platform/rockchip/rkisp1/rkisp1-isp.c | 40 +++++++++++++++----
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
index 383a3ec83ca9..00032b849a07 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
@@ -472,23 +472,43 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
struct v4l2_mbus_framefmt *format,
unsigned int which)
{
- const struct rkisp1_mbus_info *mbus_info;
+ const struct rkisp1_mbus_info *sink_info;
+ const struct rkisp1_mbus_info *src_info;
+ struct v4l2_mbus_framefmt *sink_fmt;
struct v4l2_mbus_framefmt *src_fmt;
const struct v4l2_rect *src_crop;
+ sink_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state,
+ RKISP1_ISP_PAD_SINK_VIDEO, which);
src_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state,
RKISP1_ISP_PAD_SOURCE_VIDEO, which);
src_crop = rkisp1_isp_get_pad_crop(isp, sd_state,
RKISP1_ISP_PAD_SOURCE_VIDEO, which);
+ /*
+ * Media bus code. The ISP can operate in pass-through mode (Bayer in,
+ * Bayer out or YUV in, YUV out) or process Bayer data to YUV, but
+ * can't convert from YUV to Bayer.
+ */
+ sink_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
+
src_fmt->code = format->code;
- mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
- if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SRC)) {
+ src_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
+ if (!src_info || !(src_info->direction & RKISP1_ISP_SD_SRC)) {
src_fmt->code = RKISP1_DEF_SRC_PAD_FMT;
- mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
+ src_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
}
- if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
- isp->src_fmt = mbus_info;
+
+ if (sink_info->pixel_enc == V4L2_PIXEL_ENC_YUV &&
+ src_info->pixel_enc == V4L2_PIXEL_ENC_BAYER) {
+ src_fmt->code = sink_fmt->code;
+ src_info = sink_info;
+ }
+
+ /*
+ * The source width and height must be identical to the source crop
+ * size.
+ */
src_fmt->width = src_crop->width;
src_fmt->height = src_crop->height;
@@ -498,14 +518,18 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
*/
if (format->flags & V4L2_MBUS_FRAMEFMT_SET_CSC &&
format->quantization == V4L2_QUANTIZATION_FULL_RANGE &&
- mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
+ src_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
src_fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
- else if (mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
+ else if (src_info->pixel_enc == V4L2_PIXEL_ENC_YUV)
src_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;
else
src_fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE;
*format = *src_fmt;
+
+ /* Store the source format info when setting the active format. */
+ if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
+ isp->src_fmt = src_info;
}
static void rkisp1_isp_set_src_crop(struct rkisp1_isp *isp,
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 02/34] media: rkisp1: Don't pass the quantization to rkisp1_csm_config()
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 03/34] media: rkisp1: Initialize color space on resizer sink and source pads Sasha Levin
` (16 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Laurent Pinchart, Dafna Hirschfeld, Paul Elder,
Mauro Carvalho Chehab, Sasha Levin, heiko, linux-media,
linux-rockchip, linux-arm-kernel
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Upstream commit 711d91497e203b058cf0a08c0f7d41c04efbde76 ]
The rkisp1_csm_config() function takes a pointer to the rkisp1_params
structure which contains the quantization value. There's no need to pass
it separately to the function. Drop it from the function parameters.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
index 9da7dc1bc690..32485f7c79d5 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
@@ -1066,7 +1066,7 @@ static void rkisp1_ie_enable(struct rkisp1_params *params, bool en)
}
}
-static void rkisp1_csm_config(struct rkisp1_params *params, bool full_range)
+static void rkisp1_csm_config(struct rkisp1_params *params)
{
static const u16 full_range_coeff[] = {
0x0026, 0x004b, 0x000f,
@@ -1080,7 +1080,7 @@ static void rkisp1_csm_config(struct rkisp1_params *params, bool full_range)
};
unsigned int i;
- if (full_range) {
+ if (params->quantization == V4L2_QUANTIZATION_FULL_RANGE) {
for (i = 0; i < ARRAY_SIZE(full_range_coeff); i++)
rkisp1_write(params->rkisp1,
RKISP1_CIF_ISP_CC_COEFF_0 + i * 4,
@@ -1552,11 +1552,7 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params)
rkisp1_param_set_bits(params, RKISP1_CIF_ISP_HIST_PROP_V10,
rkisp1_hst_params_default_config.mode);
- /* set the range */
- if (params->quantization == V4L2_QUANTIZATION_FULL_RANGE)
- rkisp1_csm_config(params, true);
- else
- rkisp1_csm_config(params, false);
+ rkisp1_csm_config(params);
spin_lock_irq(¶ms->config_lock);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 03/34] media: rkisp1: Initialize color space on resizer sink and source pads
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 02/34] media: rkisp1: Don't pass the quantization to rkisp1_csm_config() Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 04/34] media: rkisp1: Use correct macro for gradient registers Sasha Levin
` (15 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Laurent Pinchart, Paul Elder, Dafna Hirschfeld,
Mauro Carvalho Chehab, Sasha Levin, heiko, linux-media,
linux-rockchip, linux-arm-kernel
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Upstream commit 83b9296e399367862845d3b19984444fc756bd61 ]
Initialize the four color space fields on the sink and source video pads
of the resizer in the .init_cfg() operation. The resizer can't perform
any color space conversion, so set the sink and source color spaces to
the same defaults, which match the ISP source video pad default.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
index f4caa8f684aa..a2dc6f60d9cf 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
@@ -411,6 +411,10 @@ static int rkisp1_rsz_init_config(struct v4l2_subdev *sd,
sink_fmt->height = RKISP1_DEFAULT_HEIGHT;
sink_fmt->field = V4L2_FIELD_NONE;
sink_fmt->code = RKISP1_DEF_FMT;
+ sink_fmt->colorspace = V4L2_COLORSPACE_SRGB;
+ sink_fmt->xfer_func = V4L2_XFER_FUNC_SRGB;
+ sink_fmt->ycbcr_enc = V4L2_YCBCR_ENC_601;
+ sink_fmt->quantization = V4L2_QUANTIZATION_LIM_RANGE;
sink_crop = v4l2_subdev_get_try_crop(sd, sd_state,
RKISP1_RSZ_PAD_SINK);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 04/34] media: rkisp1: Use correct macro for gradient registers
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 02/34] media: rkisp1: Don't pass the quantization to rkisp1_csm_config() Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 03/34] media: rkisp1: Initialize color space on resizer sink and source pads Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 05/34] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Sasha Levin
` (14 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Laurent Pinchart, Dafna Hirschfeld, Mauro Carvalho Chehab,
Sasha Levin, heiko, linux-media, linux-rockchip, linux-arm-kernel
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Upstream commit 4c3501f13e8e60f6e7e7308c77ac4404e1007c18 ]
The rkisp1_lsc_config() function incorrectly uses the
RKISP1_CIF_ISP_LSC_SECT_SIZE() macro for the gradient registers. Replace
it with the correct macro, and rename it from
RKISP1_CIF_ISP_LSC_GRAD_SIZE() to RKISP1_CIF_ISP_LSC_SECT_GRAD() as the
corresponding registers store the gradients for each sector, not a size.
This doesn't cause any functional change as the two macros are defined
identically (the size and gradient registers store fields in the same
number of bits at the same positions).
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-params.c | 4 ++--
drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
index 32485f7c79d5..02ac3043badd 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-params.c
@@ -343,7 +343,7 @@ static void rkisp1_lsc_config(struct rkisp1_params *params,
RKISP1_CIF_ISP_LSC_XSIZE_01 + i * 4, data);
/* program x grad tables */
- data = RKISP1_CIF_ISP_LSC_SECT_SIZE(arg->x_grad_tbl[i * 2],
+ data = RKISP1_CIF_ISP_LSC_SECT_GRAD(arg->x_grad_tbl[i * 2],
arg->x_grad_tbl[i * 2 + 1]);
rkisp1_write(params->rkisp1,
RKISP1_CIF_ISP_LSC_XGRAD_01 + i * 4, data);
@@ -355,7 +355,7 @@ static void rkisp1_lsc_config(struct rkisp1_params *params,
RKISP1_CIF_ISP_LSC_YSIZE_01 + i * 4, data);
/* program y grad tables */
- data = RKISP1_CIF_ISP_LSC_SECT_SIZE(arg->y_grad_tbl[i * 2],
+ data = RKISP1_CIF_ISP_LSC_SECT_GRAD(arg->y_grad_tbl[i * 2],
arg->y_grad_tbl[i * 2 + 1]);
rkisp1_write(params->rkisp1,
RKISP1_CIF_ISP_LSC_YGRAD_01 + i * 4, data);
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
index dd3e6c38be67..025491f8793f 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h
@@ -576,7 +576,7 @@
(((v0) & 0x1FFF) | (((v1) & 0x1FFF) << 13))
#define RKISP1_CIF_ISP_LSC_SECT_SIZE(v0, v1) \
(((v0) & 0xFFF) | (((v1) & 0xFFF) << 16))
-#define RKISP1_CIF_ISP_LSC_GRAD_SIZE(v0, v1) \
+#define RKISP1_CIF_ISP_LSC_SECT_GRAD(v0, v1) \
(((v0) & 0xFFF) | (((v1) & 0xFFF) << 16))
/* LSC: ISP_LSC_TABLE_SEL */
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 05/34] media: rkisp1: Zero v4l2_subdev_format fields in when validating links
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (2 preceding siblings ...)
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 04/34] media: rkisp1: Use correct macro for gradient registers Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 06/34] media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE Sasha Levin
` (13 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Laurent Pinchart, Paul Elder, Dafna Hirschfeld,
Mauro Carvalho Chehab, Sasha Levin, heiko, linux-media,
linux-rockchip, linux-arm-kernel
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[ Upstream commit c53e3a049f35978a150526671587fd46b1ae7ca1 ]
The local sd_fmt variable in rkisp1_capture_link_validate() has
uninitialized fields, which causes random failures when calling the
subdev .get_fmt() operation. Fix it by initializing the variable when
declaring it, which zeros all other fields.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Dafna Hirschfeld <dafna@fastmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
index d5904c96ff3f..c66963a2ccd9 100644
--- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
+++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
@@ -1273,11 +1273,12 @@ static int rkisp1_capture_link_validate(struct media_link *link)
struct rkisp1_capture *cap = video_get_drvdata(vdev);
const struct rkisp1_capture_fmt_cfg *fmt =
rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat);
- struct v4l2_subdev_format sd_fmt;
+ struct v4l2_subdev_format sd_fmt = {
+ .which = V4L2_SUBDEV_FORMAT_ACTIVE,
+ .pad = link->source->index,
+ };
int ret;
- sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
- sd_fmt.pad = link->source->index;
ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
if (ret)
return ret;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 06/34] media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (3 preceding siblings ...)
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 05/34] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 07/34] media: cros-ec-cec: " Sasha Levin
` (12 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin, m.szyprowski,
linux-samsung-soc, linux-media
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[ Upstream commit 93f65ce036863893c164ca410938e0968964b26c ]
I expect that the hardware will have limited this to 16, but just in
case it hasn't, check for this corner case.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/cec/platform/s5p/s5p_cec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/cec/platform/s5p/s5p_cec.c b/drivers/media/cec/platform/s5p/s5p_cec.c
index ce9a9d922f11..0a30e7acdc10 100644
--- a/drivers/media/cec/platform/s5p/s5p_cec.c
+++ b/drivers/media/cec/platform/s5p/s5p_cec.c
@@ -115,6 +115,8 @@ static irqreturn_t s5p_cec_irq_handler(int irq, void *priv)
dev_dbg(cec->dev, "Buffer overrun (worker did not process previous message)\n");
cec->rx = STATE_BUSY;
cec->msg.len = status >> 24;
+ if (cec->msg.len > CEC_MAX_MSG_SIZE)
+ cec->msg.len = CEC_MAX_MSG_SIZE;
cec->msg.rx_status = CEC_RX_STATUS_OK;
s5p_cec_get_rx_buf(cec, cec->msg.len,
cec->msg.msg);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 07/34] media: cros-ec-cec: limit msg.len to CEC_MAX_MSG_SIZE
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (4 preceding siblings ...)
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 06/34] media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE Sasha Levin
@ 2022-11-01 11:26 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 08/34] media: dvb-frontends/drxk: initialize err to 0 Sasha Levin
` (11 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:26 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin, bleung, groeck,
ajye_huang, zhuohao, hellojacky0226, scott_chao, linux-media,
chrome-platform
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[ Upstream commit 2dc73b48665411a08c4e5f0f823dea8510761603 ]
I expect that the hardware will have limited this to 16, but just in
case it hasn't, check for this corner case.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
index 3b583ed4da9d..e5ebaa58be45 100644
--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
+++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
@@ -44,6 +44,8 @@ static void handle_cec_message(struct cros_ec_cec *cros_ec_cec)
uint8_t *cec_message = cros_ec->event_data.data.cec_message;
unsigned int len = cros_ec->event_size;
+ if (len > CEC_MAX_MSG_SIZE)
+ len = CEC_MAX_MSG_SIZE;
cros_ec_cec->rx_msg.len = len;
memcpy(cros_ec_cec->rx_msg.msg, cec_message, len);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 08/34] media: dvb-frontends/drxk: initialize err to 0
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (5 preceding siblings ...)
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 07/34] media: cros-ec-cec: " Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 09/34] media: platform: cros-ec: Add Kuldax to the match table Sasha Levin
` (10 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin, linux-media
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[ Upstream commit 20694e96ca089ce6693c2348f8f628ee621e4e74 ]
Fix a compiler warning:
drivers/media/dvb-frontends/drxk_hard.c: In function 'drxk_read_ucblocks':
drivers/media/dvb-frontends/drxk_hard.c:6673:21: warning: 'err' may be used uninitialized [-Wmaybe-uninitialized]
6673 | *ucblocks = (u32) err;
| ^~~~~~~~~
drivers/media/dvb-frontends/drxk_hard.c:6663:13: note: 'err' was declared here
6663 | u16 err;
| ^~~
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/dvb-frontends/drxk_hard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c
index 9430295a8175..ef0d063ec352 100644
--- a/drivers/media/dvb-frontends/drxk_hard.c
+++ b/drivers/media/dvb-frontends/drxk_hard.c
@@ -6660,7 +6660,7 @@ static int drxk_read_snr(struct dvb_frontend *fe, u16 *snr)
static int drxk_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
struct drxk_state *state = fe->demodulator_priv;
- u16 err;
+ u16 err = 0;
dprintk(1, "\n");
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 09/34] media: platform: cros-ec: Add Kuldax to the match table
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (6 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 08/34] media: dvb-frontends/drxk: initialize err to 0 Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 10/34] media: meson: vdec: fix possible refcount leak in vdec_probe() Sasha Levin
` (9 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Rory Liu, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
bleung, groeck, scott_chao, ajye_huang, zhuohao, linux-media,
chrome-platform
From: Rory Liu <hellojacky0226@hotmail.com>
[ Upstream commit 594b6bdde2e7833a56413de5092b6e4188d33ff7 ]
The Google Kuldax device uses the same approach as the Google Brask
which enables the HDMI CEC via the cros-ec-cec driver.
Signed-off-by: Rory Liu <hellojacky0226@hotmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
index e5ebaa58be45..6ebedc71d67d 100644
--- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
+++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c
@@ -223,6 +223,8 @@ static const struct cec_dmi_match cec_dmi_match_table[] = {
{ "Google", "Moli", "0000:00:02.0", "Port B" },
/* Google Kinox */
{ "Google", "Kinox", "0000:00:02.0", "Port B" },
+ /* Google Kuldax */
+ { "Google", "Kuldax", "0000:00:02.0", "Port B" },
};
static struct device *cros_ec_cec_find_hdmi_dev(struct device *dev,
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 10/34] media: meson: vdec: fix possible refcount leak in vdec_probe()
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (7 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 09/34] media: platform: cros-ec: Add Kuldax to the match table Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 11/34] media: hantro: Store HEVC bit depth in context Sasha Levin
` (8 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hangyu Hua, Hans Verkuil, Mauro Carvalho Chehab, Sasha Levin,
neil.armstrong, gregkh, khilman, linux-media, linux-amlogic,
linux-staging, linux-arm-kernel
From: Hangyu Hua <hbh25y@gmail.com>
[ Upstream commit 7718999356234d9cc6a11b4641bb773928f1390f ]
v4l2_device_unregister need to be called to put the refcount got by
v4l2_device_register when vdec_probe fails or vdec_remove is called.
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/meson/vdec/vdec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/media/meson/vdec/vdec.c b/drivers/staging/media/meson/vdec/vdec.c
index 8549d95be0f2..52f224d8def1 100644
--- a/drivers/staging/media/meson/vdec/vdec.c
+++ b/drivers/staging/media/meson/vdec/vdec.c
@@ -1102,6 +1102,7 @@ static int vdec_probe(struct platform_device *pdev)
err_vdev_release:
video_device_release(vdev);
+ v4l2_device_unregister(&core->v4l2_dev);
return ret;
}
@@ -1110,6 +1111,7 @@ static int vdec_remove(struct platform_device *pdev)
struct amvdec_core *core = platform_get_drvdata(pdev);
video_unregister_device(core->vdev_dec);
+ v4l2_device_unregister(&core->v4l2_dev);
return 0;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 11/34] media: hantro: Store HEVC bit depth in context
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (8 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 10/34] media: meson: vdec: fix possible refcount leak in vdec_probe() Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 12/34] media: hantro: HEVC: Fix auxilary buffer size calculation Sasha Levin
` (7 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Benjamin Gaignard, Ezequiel Garcia, Hans Verkuil,
Mauro Carvalho Chehab, Sasha Levin, p.zabel, gregkh, linux-media,
linux-rockchip, linux-staging
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
[ Upstream commit 4bec03301ecd81760c159402467dbb2cfd527684 ]
Store HEVC bit depth in context.
Bit depth is equal to hevc sps bit_depth_luma_minus8 + 8.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/hantro/hantro_drv.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index 2036f72eeb4a..1dd8312d824c 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -251,6 +251,11 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
{
+ struct hantro_ctx *ctx;
+
+ ctx = container_of(ctrl->handler,
+ struct hantro_ctx, ctrl_handler);
+
if (ctrl->id == V4L2_CID_STATELESS_H264_SPS) {
const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
@@ -272,6 +277,8 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
if (sps->bit_depth_luma_minus8 != 0)
/* Only 8-bit is supported */
return -EINVAL;
+
+ ctx->bit_depth = sps->bit_depth_luma_minus8 + 8;
} else if (ctrl->id == V4L2_CID_STATELESS_VP9_FRAME) {
const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 12/34] media: hantro: HEVC: Fix auxilary buffer size calculation
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (9 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 11/34] media: hantro: Store HEVC bit depth in context Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 13/34] media: hantro: HEVC: Fix chroma offset computation Sasha Levin
` (6 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Benjamin Gaignard, Ezequiel Garcia, Hans Verkuil,
Mauro Carvalho Chehab, Sasha Levin, p.zabel, gregkh, linux-media,
linux-rockchip, linux-staging
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
[ Upstream commit 8a438580a09ecef78cd6c5825d628b4d5ae1c127 ]
SAO and FILTER buffers size depend of the bit depth.
Make sure we have enough space for 10bit bitstreams.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/hantro/hantro_hevc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/media/hantro/hantro_hevc.c
index b990bc98164c..9383fb7081f6 100644
--- a/drivers/staging/media/hantro/hantro_hevc.c
+++ b/drivers/staging/media/hantro/hantro_hevc.c
@@ -104,7 +104,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
hevc_dec->tile_bsd.cpu = NULL;
}
- size = VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1);
+ size = (VERT_FILTER_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
hevc_dec->tile_filter.cpu = dma_alloc_coherent(vpu->dev, size,
&hevc_dec->tile_filter.dma,
GFP_KERNEL);
@@ -112,7 +112,7 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)
goto err_free_tile_buffers;
hevc_dec->tile_filter.size = size;
- size = VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1);
+ size = (VERT_SAO_RAM_SIZE * height64 * (num_tile_cols - 1) * ctx->bit_depth) / 8;
hevc_dec->tile_sao.cpu = dma_alloc_coherent(vpu->dev, size,
&hevc_dec->tile_sao.dma,
GFP_KERNEL);
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 13/34] media: hantro: HEVC: Fix chroma offset computation
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (10 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 12/34] media: hantro: HEVC: Fix auxilary buffer size calculation Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 14/34] media: v4l: subdev: Fail graciously when getting try data for NULL state Sasha Levin
` (5 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Benjamin Gaignard, Ezequiel Garcia, Hans Verkuil,
Mauro Carvalho Chehab, Sasha Levin, p.zabel, gregkh, linux-media,
linux-rockchip, linux-staging
From: Benjamin Gaignard <benjamin.gaignard@collabora.com>
[ Upstream commit f64853ad7f964b3bf7c1d63b27ca7ef972797a1c ]
The chroma offset depends of the bitstream depth.
Make sure that ctx->bit_depth is used to compute it.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
index 233ecd863d5f..a917079a6ed3 100644
--- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
+++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c
@@ -12,7 +12,7 @@
static size_t hantro_hevc_chroma_offset(struct hantro_ctx *ctx)
{
- return ctx->dst_fmt.width * ctx->dst_fmt.height;
+ return ctx->dst_fmt.width * ctx->dst_fmt.height * ctx->bit_depth / 8;
}
static size_t hantro_hevc_motion_vectors_offset(struct hantro_ctx *ctx)
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 14/34] media: v4l: subdev: Fail graciously when getting try data for NULL state
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (11 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 13/34] media: hantro: HEVC: Fix chroma offset computation Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt() Sasha Levin
` (4 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Sakari Ailus, Bingbu Cao, Tomi Valkeinen, Mauro Carvalho Chehab,
Sasha Levin, linux-media
From: Sakari Ailus <sakari.ailus@linux.intel.com>
[ Upstream commit 2ba3e38517f5a4ebf9c997168079dca01b7f9fc6 ]
The state argument for the functions for obtaining various parts of the
state is NULL if it is called by drivers for active state. Fail graciously
in that case instead of dereferencing a NULL pointer.
Suggested-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/media/v4l2-subdev.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 9689f38a0af1..ec1896886dbd 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -1046,6 +1046,8 @@ v4l2_subdev_get_pad_format(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
unsigned int pad)
{
+ if (WARN_ON(!state))
+ return NULL;
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_fmt;
@@ -1064,6 +1066,8 @@ v4l2_subdev_get_pad_crop(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
unsigned int pad)
{
+ if (WARN_ON(!state))
+ return NULL;
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_crop;
@@ -1082,6 +1086,8 @@ v4l2_subdev_get_pad_compose(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
unsigned int pad)
{
+ if (WARN_ON(!state))
+ return NULL;
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_compose;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt()
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (12 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 14/34] media: v4l: subdev: Fail graciously when getting try data for NULL state Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 13:27 ` Hans de Goede
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 16/34] media: atomisp: Fix VIDIOC_TRY_FMT Sasha Levin
` (3 subsequent siblings)
17 siblings, 1 reply; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans de Goede, Andy Shevchenko, Mauro Carvalho Chehab,
Sasha Levin, gregkh, linux-media, linux-staging
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit adea153b4f6537f367fe77abada263fde8a1f7b6 ]
On sets actually store the set (closest) format inside ov2680_device.dev,
so that it also properly gets returned by get_fmt.
This fixes the following problem:
1. App does an VIDIOC_SET_FMT 640x480, calling ov2680_set_fmt()
2. Internal buffers (atomisp_create_pipes_stream()) get allocated
at 640x480 size by atomisp_set_fmt()
3. ov2680_get_fmt() gets called later on and returns 1600x1200
since ov2680_device.dev was not updated. So things get configured
to stream at 1600x1200, but the internal buffers created during
atomisp_create_pipes_stream() do not get updated in size
4. streaming starts, internal buffers overflow and the entire
machine freezes eventually due to memory being corrupted
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
index 4ba99c660681..ab52e35266bb 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
@@ -894,11 +894,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
if (v_flag)
ov2680_v_flip(sd, v_flag);
- /*
- * ret = startup(sd);
- * if (ret)
- * dev_err(&client->dev, "ov2680 startup err\n");
- */
+ dev->res = res;
err:
mutex_unlock(&dev->input_lock);
return ret;
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 16/34] media: atomisp: Fix VIDIOC_TRY_FMT
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (13 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt() Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 17/34] media: atomisp: Ensure that USERPTR pointers are page aligned Sasha Levin
` (2 subsequent siblings)
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans de Goede, Andy Shevchenko, Mauro Carvalho Chehab,
Sasha Levin, gregkh, andriy.shevchenko, kitakar, xiam0nd.tong,
linux-media, linux-staging
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit 4d3aafb9c9bba59c9b6f6df8ea6c89483bfed8d4 ]
atomisp_try_fmt() calls the sensor's try_fmt handler but it does
not copy the result back to the passed in v4l2_pix_format under
some circumstances.
Potentially returning an unsupported resolution to userspace,
which VIDIOC_TRY_FMT is not supposed to do.
atomisp_set_fmt() also uses atomisp_try_fmt() and relies
on this wrong behavior. The VIDIOC_TRY_FMT call passes NULL for
the res_overflow argument where as the atomisp_set_fmt() call
passes non NULL.
Use the res_overflow argument to differentiate between the 2 callers
and always propagate the sensors result in the VIDIOC_TRY_FMT case.
This fixes the resolution list in camorama showing resolutions like e.g.
1584x1184 instead of 1600x1200.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/atomisp/pci/atomisp_cmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index c932f340068f..db6465756e49 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -4886,8 +4886,8 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
return 0;
}
- if (snr_mbus_fmt->width < f->width
- && snr_mbus_fmt->height < f->height) {
+ if (!res_overflow || (snr_mbus_fmt->width < f->width &&
+ snr_mbus_fmt->height < f->height)) {
f->width = snr_mbus_fmt->width;
f->height = snr_mbus_fmt->height;
/* Set the flag when resolution requested is
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 17/34] media: atomisp: Ensure that USERPTR pointers are page aligned
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (14 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 16/34] media: atomisp: Fix VIDIOC_TRY_FMT Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 18/34] media: atomisp: Fix v4l2_fh resource leak on open errors Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 19/34] media: atomisp: Fix locking around asd->streaming read/write Sasha Levin
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans de Goede, Andy Shevchenko, Mauro Carvalho Chehab,
Sasha Levin, gregkh, andriy.shevchenko, kitakar, linux-media,
linux-staging
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit 6e6c4ae0f0ba295dbf6cbd48d93bec169d6ce431 ]
The atomisp code needs USERPTR pointers to be page aligned,
otherwise bad things (scribbling over other parts of the
process' RAM) happen.
Add a check to ensure this and exit VIDIOC_QBUF calls with
unaligned pointers with -EINVAL.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 459645c2e2a7..4de01aa28fe5 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -1338,6 +1338,12 @@ static int atomisp_qbuf(struct file *file, void *fh, struct v4l2_buffer *buf)
* address and reprograme out page table properly
*/
if (buf->memory == V4L2_MEMORY_USERPTR) {
+ if (offset_in_page(buf->m.userptr)) {
+ dev_err(isp->dev, "Error userptr is not page aligned.\n");
+ ret = -EINVAL;
+ goto error;
+ }
+
vb = pipe->capq.bufs[buf->index];
vm_mem = vb->priv;
if (!vm_mem) {
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 18/34] media: atomisp: Fix v4l2_fh resource leak on open errors
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (15 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 17/34] media: atomisp: Ensure that USERPTR pointers are page aligned Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 19/34] media: atomisp: Fix locking around asd->streaming read/write Sasha Levin
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans de Goede, Andy Shevchenko, Mauro Carvalho Chehab,
Sasha Levin, gregkh, andriy.shevchenko, kitakar, alan,
linux-media, linux-staging
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit 5b9853ad1329be49343a608d574eb232ff1273d0 ]
When atomisp_open() fails then it must call v4l2_fh_release() to undo
the results of v4l2_fh_open().
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/staging/media/atomisp/pci/atomisp_fops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 77150e4ae144..92cbc0e263e8 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -903,6 +903,7 @@ static int atomisp_open(struct file *file)
pm_runtime_put(vdev->v4l2_dev->dev);
error:
rt_mutex_unlock(&isp->mutex);
+ v4l2_fh_release(file);
return ret;
}
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH AUTOSEL 6.0 19/34] media: atomisp: Fix locking around asd->streaming read/write
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
` (16 preceding siblings ...)
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 18/34] media: atomisp: Fix v4l2_fh resource leak on open errors Sasha Levin
@ 2022-11-01 11:27 ` Sasha Levin
17 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-01 11:27 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Hans de Goede, Andy Shevchenko, Mauro Carvalho Chehab,
Sasha Levin, gregkh, kitakar, xiam0nd.tong, alan, linux-media,
linux-staging
From: Hans de Goede <hdegoede@redhat.com>
[ Upstream commit 2468083f799eb9eef7b03f48ebb9673ad5655f88 ]
For reading / writing the asd->streaming enum the following rules
should be followed:
1. Writers of streaming must hold both isp->mutex and isp->lock.
2. Readers of streaming need to hold only one of the two locks.
Not all writers where properly taking both locks this fixes this.
In the case of the readers, many readers depend on their caller
to hold isp->mutex, add asserts for this
And in the case of atomisp_css_get_dis_stat() it is called with
isp->mutex held, so there is no need to take the spinlock just
for reading the streaming value.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../staging/media/atomisp/pci/atomisp_cmd.c | 32 +++++++++++++++++--
.../media/atomisp/pci/atomisp_compat_css20.c | 10 +++---
.../staging/media/atomisp/pci/atomisp_fops.c | 3 ++
.../media/atomisp/pci/atomisp_internal.h | 2 +-
.../staging/media/atomisp/pci/atomisp_ioctl.c | 4 +++
.../media/atomisp/pci/atomisp_subdev.c | 8 ++++-
.../media/atomisp/pci/atomisp_subdev.h | 6 +++-
7 files changed, 55 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
index db6465756e49..4d5c7328610f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
@@ -908,6 +908,8 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
struct v4l2_control ctrl;
bool reset_wdt_timer = false;
+ lockdep_assert_held(&isp->mutex);
+
if (
buf_type != IA_CSS_BUFFER_TYPE_METADATA &&
buf_type != IA_CSS_BUFFER_TYPE_3A_STATISTICS &&
@@ -1307,6 +1309,9 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
bool stream_restart[MAX_STREAM_NUM] = {0};
bool depth_mode = false;
int i, ret, depth_cnt = 0;
+ unsigned long flags;
+
+ lockdep_assert_held(&isp->mutex);
if (!isp->sw_contex.file_input)
atomisp_css_irq_enable(isp,
@@ -1331,7 +1336,9 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
stream_restart[asd->index] = true;
+ spin_lock_irqsave(&isp->lock, flags);
asd->streaming = ATOMISP_DEVICE_STREAMING_STOPPING;
+ spin_unlock_irqrestore(&isp->lock, flags);
/* stream off sensor */
ret = v4l2_subdev_call(
@@ -1346,7 +1353,9 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
css_pipe_id = atomisp_get_css_pipe_id(asd);
atomisp_css_stop(asd, css_pipe_id, true);
+ spin_lock_irqsave(&isp->lock, flags);
asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;
+ spin_unlock_irqrestore(&isp->lock, flags);
asd->preview_exp_id = 1;
asd->postview_exp_id = 1;
@@ -1387,11 +1396,14 @@ static void __atomisp_css_recover(struct atomisp_device *isp, bool isp_timeout)
IA_CSS_INPUT_MODE_BUFFERED_SENSOR);
css_pipe_id = atomisp_get_css_pipe_id(asd);
- if (atomisp_css_start(asd, css_pipe_id, true))
+ if (atomisp_css_start(asd, css_pipe_id, true)) {
dev_warn(isp->dev,
"start SP failed, so do not set streaming to be enable!\n");
- else
+ } else {
+ spin_lock_irqsave(&isp->lock, flags);
asd->streaming = ATOMISP_DEVICE_STREAMING_ENABLED;
+ spin_unlock_irqrestore(&isp->lock, flags);
+ }
atomisp_csi2_configure(asd);
}
@@ -1627,6 +1639,8 @@ void atomisp_css_flush(struct atomisp_device *isp)
{
int i;
+ lockdep_assert_held(&isp->mutex);
+
if (!atomisp_streaming_count(isp))
return;
@@ -4077,6 +4091,8 @@ void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe)
unsigned long irqflags;
bool need_to_enqueue_buffer = false;
+ lockdep_assert_held(&asd->isp->mutex);
+
if (!asd) {
dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n",
__func__, pipe->vdev.name);
@@ -4170,6 +4186,8 @@ int atomisp_set_parameters(struct video_device *vdev,
struct atomisp_css_params *css_param = &asd->params.css_param;
int ret;
+ lockdep_assert_held(&asd->isp->mutex);
+
if (!asd) {
dev_err(pipe->isp->dev, "%s(): asd is NULL, device is %s\n",
__func__, vdev->name);
@@ -5604,6 +5622,8 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)
struct v4l2_subdev_fh fh;
int ret;
+ lockdep_assert_held(&isp->mutex);
+
if (!asd) {
dev_err(isp->dev, "%s(): asd is NULL, device is %s\n",
__func__, vdev->name);
@@ -6275,6 +6295,8 @@ int atomisp_offline_capture_configure(struct atomisp_sub_device *asd,
{
struct v4l2_ctrl *c;
+ lockdep_assert_held(&asd->isp->mutex);
+
/*
* In case of M10MO ZSL capture case, we need to issue a separate
* capture request to M10MO which will output captured jpeg image
@@ -6549,6 +6571,8 @@ int atomisp_exp_id_capture(struct atomisp_sub_device *asd, int *exp_id)
int value = *exp_id;
int ret;
+ lockdep_assert_held(&isp->mutex);
+
ret = __is_raw_buffer_locked(asd, value);
if (ret) {
dev_err(isp->dev, "%s exp_id %d invalid %d.\n", __func__, value, ret);
@@ -6570,6 +6594,8 @@ int atomisp_exp_id_unlock(struct atomisp_sub_device *asd, int *exp_id)
int value = *exp_id;
int ret;
+ lockdep_assert_held(&isp->mutex);
+
ret = __clear_raw_buffer_bitmap(asd, value);
if (ret) {
dev_err(isp->dev, "%s exp_id %d invalid %d.\n", __func__, value, ret);
@@ -6605,6 +6631,8 @@ int atomisp_inject_a_fake_event(struct atomisp_sub_device *asd, int *event)
if (!event || asd->streaming != ATOMISP_DEVICE_STREAMING_ENABLED)
return -EINVAL;
+ lockdep_assert_held(&asd->isp->mutex);
+
dev_dbg(asd->isp->dev, "%s: trying to inject a fake event 0x%x\n",
__func__, *event);
diff --git a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
index 5aa108a1724c..19ecc751d594 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_compat_css20.c
@@ -3626,6 +3626,8 @@ int atomisp_css_get_dis_stat(struct atomisp_sub_device *asd,
struct atomisp_dis_buf *dis_buf;
unsigned long flags;
+ lockdep_assert_held(&isp->mutex);
+
if (!asd->params.dvs_stat->hor_prod.odd_real ||
!asd->params.dvs_stat->hor_prod.odd_imag ||
!asd->params.dvs_stat->hor_prod.even_real ||
@@ -3637,12 +3639,8 @@ int atomisp_css_get_dis_stat(struct atomisp_sub_device *asd,
return -EINVAL;
/* isp needs to be streaming to get DIS statistics */
- spin_lock_irqsave(&isp->lock, flags);
- if (asd->streaming != ATOMISP_DEVICE_STREAMING_ENABLED) {
- spin_unlock_irqrestore(&isp->lock, flags);
+ if (asd->streaming != ATOMISP_DEVICE_STREAMING_ENABLED)
return -EINVAL;
- }
- spin_unlock_irqrestore(&isp->lock, flags);
if (atomisp_compare_dvs_grid(asd, &stats->dvs2_stat.grid_info) != 0)
/* If the grid info in the argument differs from the current
@@ -3827,6 +3825,8 @@ int atomisp_css_isr_thread(struct atomisp_device *isp,
bool reset_wdt_timer[MAX_STREAM_NUM] = {false};
int i;
+ lockdep_assert_held(&isp->mutex);
+
while (!ia_css_dequeue_psys_event(¤t_event.event)) {
if (current_event.event.type ==
IA_CSS_EVENT_TYPE_FW_ASSERT) {
diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c
index 92cbc0e263e8..d24be2341a9b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c
@@ -918,6 +918,7 @@ static int atomisp_release(struct file *file)
struct v4l2_requestbuffers req;
struct v4l2_subdev_fh fh;
struct v4l2_rect clear_compose = {0};
+ unsigned long flags;
int ret = 0;
v4l2_fh_init(&fh.vfh, vdev);
@@ -1008,7 +1009,9 @@ static int atomisp_release(struct file *file)
/* clear the asd field to show this camera is not used */
isp->inputs[asd->input_curr].asd = NULL;
+ spin_lock_irqsave(&isp->lock, flags);
asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;
+ spin_unlock_irqrestore(&isp->lock, flags);
if (atomisp_dev_users(isp))
goto done;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_internal.h b/drivers/staging/media/atomisp/pci/atomisp_internal.h
index f71ab1ee6e19..b86f9bd7574c 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_internal.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_internal.h
@@ -280,7 +280,7 @@ struct atomisp_device {
atomic_t wdt_work_queued;
- spinlock_t lock; /* Just for streaming below */
+ spinlock_t lock; /* Protects asd[i].streaming */
bool need_gfx_throttle;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
index 4de01aa28fe5..44ed8aa51fdc 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
@@ -1925,7 +1925,9 @@ static int atomisp_streamon(struct file *file, void *fh,
if (ret)
goto out;
+ spin_lock_irqsave(&isp->lock, irqflags);
asd->streaming = ATOMISP_DEVICE_STREAMING_ENABLED;
+ spin_unlock_irqrestore(&isp->lock, irqflags);
atomic_set(&asd->sof_count, -1);
atomic_set(&asd->sequence, -1);
atomic_set(&asd->sequence_temp, -1);
@@ -2005,7 +2007,9 @@ static int atomisp_streamon(struct file *file, void *fh,
ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera,
video, s_stream, 1);
if (ret) {
+ spin_lock_irqsave(&isp->lock, irqflags);
asd->streaming = ATOMISP_DEVICE_STREAMING_DISABLED;
+ spin_unlock_irqrestore(&isp->lock, irqflags);
ret = -EINVAL;
goto out;
}
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
index 394fe6959033..5a3dd476f194 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
@@ -874,12 +874,18 @@ static int s_ctrl(struct v4l2_ctrl *ctrl)
{
struct atomisp_sub_device *asd = container_of(
ctrl->handler, struct atomisp_sub_device, ctrl_handler);
+ unsigned int streaming;
+ unsigned long flags;
switch (ctrl->id) {
case V4L2_CID_RUN_MODE:
return __atomisp_update_run_mode(asd);
case V4L2_CID_DEPTH_MODE:
- if (asd->streaming != ATOMISP_DEVICE_STREAMING_DISABLED) {
+ /* Use spinlock instead of mutex to avoid possible locking issues */
+ spin_lock_irqsave(&asd->isp->lock, flags);
+ streaming = asd->streaming;
+ spin_unlock_irqrestore(&asd->isp->lock, flags);
+ if (streaming != ATOMISP_DEVICE_STREAMING_DISABLED) {
dev_err(asd->isp->dev,
"ISP is streaming, it is not supported to change the depth mode\n");
return -EINVAL;
diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
index 798a93793a9a..a955a38246cf 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h
+++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
@@ -364,7 +364,11 @@ struct atomisp_sub_device {
atomic_t sequence; /* Sequence value that is assigned to buffer. */
atomic_t sequence_temp;
- unsigned int streaming; /* Hold both mutex and lock to change this */
+ /*
+ * Writers of streaming must hold both isp->mutex and isp->lock.
+ * Readers of streaming need to hold only one of the two locks.
+ */
+ unsigned int streaming;
bool stream_prepared; /* whether css stream is created */
/* subdev index: will be used to show which subdev is holding the
--
2.35.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt()
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt() Sasha Levin
@ 2022-11-01 13:27 ` Hans de Goede
2022-11-06 17:05 ` Sasha Levin
0 siblings, 1 reply; 21+ messages in thread
From: Hans de Goede @ 2022-11-01 13:27 UTC (permalink / raw)
To: Sasha Levin, linux-kernel, stable
Cc: Andy Shevchenko, Mauro Carvalho Chehab, gregkh, linux-media,
linux-staging
Hi Sasha,
I have no specific objections against the backporting of this
and other atomisp related patches.
But in general the atomisp driver is not yet in a state where
it is ready to be used by normal users. Progress is being made
but atm I don't really expect normal users to have it enabled /
in active use.
As such I'm also not sure if there is much value in backporting
atomisp changes to the stable series.
I don't know if you have a way to opt out certain drivers /
file-paths from stable series backporting, but if you do
you may want to consider opting out everything under:
drivers/staging/media/atomisp/
As said above I don't think doing the backports offers
much (if any) value to end users and I assume it does take
you some time, so opting this path out might be better.
Also given the fragile state of atomisp support atm
it is hard to say for me if partially backporting some of
the changes won't break the driver.
Regards,
Hans
On 11/1/22 12:27, Sasha Levin wrote:
> From: Hans de Goede <hdegoede@redhat.com>
>
> [ Upstream commit adea153b4f6537f367fe77abada263fde8a1f7b6 ]
>
> On sets actually store the set (closest) format inside ov2680_device.dev,
> so that it also properly gets returned by get_fmt.
>
> This fixes the following problem:
>
> 1. App does an VIDIOC_SET_FMT 640x480, calling ov2680_set_fmt()
> 2. Internal buffers (atomisp_create_pipes_stream()) get allocated
> at 640x480 size by atomisp_set_fmt()
> 3. ov2680_get_fmt() gets called later on and returns 1600x1200
> since ov2680_device.dev was not updated. So things get configured
> to stream at 1600x1200, but the internal buffers created during
> atomisp_create_pipes_stream() do not get updated in size
> 4. streaming starts, internal buffers overflow and the entire
> machine freezes eventually due to memory being corrupted
>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/staging/media/atomisp/i2c/atomisp-ov2680.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
> index 4ba99c660681..ab52e35266bb 100644
> --- a/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
> +++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
> @@ -894,11 +894,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
> if (v_flag)
> ov2680_v_flip(sd, v_flag);
>
> - /*
> - * ret = startup(sd);
> - * if (ret)
> - * dev_err(&client->dev, "ov2680 startup err\n");
> - */
> + dev->res = res;
> err:
> mutex_unlock(&dev->input_lock);
> return ret;
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt()
2022-11-01 13:27 ` Hans de Goede
@ 2022-11-06 17:05 ` Sasha Levin
0 siblings, 0 replies; 21+ messages in thread
From: Sasha Levin @ 2022-11-06 17:05 UTC (permalink / raw)
To: Hans de Goede
Cc: linux-kernel, stable, Andy Shevchenko, Mauro Carvalho Chehab,
gregkh, linux-media, linux-staging
On Tue, Nov 01, 2022 at 02:27:53PM +0100, Hans de Goede wrote:
>Hi Sasha,
>
>I have no specific objections against the backporting of this
>and other atomisp related patches.
>
>But in general the atomisp driver is not yet in a state where
>it is ready to be used by normal users. Progress is being made
>but atm I don't really expect normal users to have it enabled /
>in active use.
>
>As such I'm also not sure if there is much value in backporting
>atomisp changes to the stable series.
>
>I don't know if you have a way to opt out certain drivers /
>file-paths from stable series backporting, but if you do
>you may want to consider opting out everything under:
>
>drivers/staging/media/atomisp/
>
>As said above I don't think doing the backports offers
>much (if any) value to end users and I assume it does take
>you some time, so opting this path out might be better.
>
>Also given the fragile state of atomisp support atm
>it is hard to say for me if partially backporting some of
>the changes won't break the driver.
I'll blacklist drivers/staging/media/atomisp/, thank you!
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2022-11-06 17:06 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-01 11:26 [PATCH AUTOSEL 6.0 01/34] media: rkisp1: Fix source pad format configuration Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 02/34] media: rkisp1: Don't pass the quantization to rkisp1_csm_config() Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 03/34] media: rkisp1: Initialize color space on resizer sink and source pads Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 04/34] media: rkisp1: Use correct macro for gradient registers Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 05/34] media: rkisp1: Zero v4l2_subdev_format fields in when validating links Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 06/34] media: s5p_cec: limit msg.len to CEC_MAX_MSG_SIZE Sasha Levin
2022-11-01 11:26 ` [PATCH AUTOSEL 6.0 07/34] media: cros-ec-cec: " Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 08/34] media: dvb-frontends/drxk: initialize err to 0 Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 09/34] media: platform: cros-ec: Add Kuldax to the match table Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 10/34] media: meson: vdec: fix possible refcount leak in vdec_probe() Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 11/34] media: hantro: Store HEVC bit depth in context Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 12/34] media: hantro: HEVC: Fix auxilary buffer size calculation Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 13/34] media: hantro: HEVC: Fix chroma offset computation Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 14/34] media: v4l: subdev: Fail graciously when getting try data for NULL state Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 15/34] media: atomisp-ov2680: Fix ov2680_set_fmt() Sasha Levin
2022-11-01 13:27 ` Hans de Goede
2022-11-06 17:05 ` Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 16/34] media: atomisp: Fix VIDIOC_TRY_FMT Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 17/34] media: atomisp: Ensure that USERPTR pointers are page aligned Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 18/34] media: atomisp: Fix v4l2_fh resource leak on open errors Sasha Levin
2022-11-01 11:27 ` [PATCH AUTOSEL 6.0 19/34] media: atomisp: Fix locking around asd->streaming read/write Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox