* [cip-dev] [PATCH 4.19.y-cip 1/2] media: i2c: imx219: Move out locking/unlocking of vflip and hflip controls from imx219_set_stream
2021-05-12 17:01 [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Lad Prabhakar
@ 2021-05-12 17:01 ` Lad Prabhakar
2021-05-12 17:01 ` [cip-dev] [PATCH 4.19.y-cip 2/2] media: i2c: imx219: Balance runtime PM use-count Lad Prabhakar
2021-05-13 1:11 ` [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Nobuhiro Iwamatsu
2 siblings, 0 replies; 6+ messages in thread
From: Lad Prabhakar @ 2021-05-12 17:01 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]
commit 745d4612d2c853c00abadbf69799c8aee7f99c39 upstream.
Move out locking/unlocking of vflip and hflip controls from
imx219_set_stream() to the imx219_start_streaming()/
imx219_stop_streaming() respectively.
This fixes an issue in resume callback error path where streaming is
stopped and the controls are left in locked state.
Fixes: 1283b3b8f82b9 ("media: i2c: Add driver for Sony IMX219 sensor")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/media/i2c/imx219.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index a2829c7012aa..d856019cb070 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1056,8 +1056,16 @@ static int imx219_start_streaming(struct imx219 *imx219)
return ret;
/* set stream on register */
- return imx219_write_reg(imx219, IMX219_REG_MODE_SELECT,
- IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING);
+ ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT,
+ IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING);
+ if (ret)
+ return ret;
+
+ /* vflip and hflip cannot change during streaming */
+ __v4l2_ctrl_grab(imx219->vflip, true);
+ __v4l2_ctrl_grab(imx219->hflip, true);
+
+ return 0;
}
static void imx219_stop_streaming(struct imx219 *imx219)
@@ -1070,6 +1078,9 @@ static void imx219_stop_streaming(struct imx219 *imx219)
IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY);
if (ret)
dev_err(&client->dev, "%s failed to set stream\n", __func__);
+
+ __v4l2_ctrl_grab(imx219->vflip, false);
+ __v4l2_ctrl_grab(imx219->hflip, false);
}
static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
@@ -1105,10 +1116,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
imx219->streaming = enable;
- /* vflip and hflip cannot change during streaming */
- __v4l2_ctrl_grab(imx219->vflip, enable);
- __v4l2_ctrl_grab(imx219->hflip, enable);
-
mutex_unlock(&imx219->mutex);
return ret;
--
2.17.1
[-- Attachment #2: Type: text/plain, Size: 428 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6449): https://lists.cip-project.org/g/cip-dev/message/6449
Mute This Topic: https://lists.cip-project.org/mt/82777614/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [cip-dev] [PATCH 4.19.y-cip 2/2] media: i2c: imx219: Balance runtime PM use-count
2021-05-12 17:01 [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Lad Prabhakar
2021-05-12 17:01 ` [cip-dev] [PATCH 4.19.y-cip 1/2] media: i2c: imx219: Move out locking/unlocking of vflip and hflip controls from imx219_set_stream Lad Prabhakar
@ 2021-05-12 17:01 ` Lad Prabhakar
2021-05-13 1:11 ` [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Nobuhiro Iwamatsu
2 siblings, 0 replies; 6+ messages in thread
From: Lad Prabhakar @ 2021-05-12 17:01 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das
[-- Attachment #1: Type: text/plain, Size: 3573 bytes --]
commit dd90caa0111e178b52b21e56364bc2244a3973b3 upstream.
Move incrementing/decrementing runtime PM count to
imx219_start_streaming()/imx219_stop_streaming() functions respectively.
This fixes an issue of unbalanced runtime PM count in resume callback
error path where streaming is stopped and runtime PM count is left
unbalanced.
Fixes: 1283b3b8f82b9 ("media: i2c: Add driver for Sony IMX219 sensor")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/media/i2c/imx219.c | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
index d856019cb070..27df9d87f392 100644
--- a/drivers/media/i2c/imx219.c
+++ b/drivers/media/i2c/imx219.c
@@ -1035,37 +1035,47 @@ static int imx219_start_streaming(struct imx219 *imx219)
const struct imx219_reg_list *reg_list;
int ret;
+ ret = pm_runtime_get_sync(&client->dev);
+ if (ret < 0) {
+ pm_runtime_put_noidle(&client->dev);
+ return ret;
+ }
+
/* Apply default values of current mode */
reg_list = &imx219->mode->reg_list;
ret = imx219_write_regs(imx219, reg_list->regs, reg_list->num_of_regs);
if (ret) {
dev_err(&client->dev, "%s failed to set mode\n", __func__);
- return ret;
+ goto err_rpm_put;
}
ret = imx219_set_framefmt(imx219);
if (ret) {
dev_err(&client->dev, "%s failed to set frame format: %d\n",
__func__, ret);
- return ret;
+ goto err_rpm_put;
}
/* Apply customized values from user */
ret = __v4l2_ctrl_handler_setup(imx219->sd.ctrl_handler);
if (ret)
- return ret;
+ goto err_rpm_put;
/* set stream on register */
ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT,
IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING);
if (ret)
- return ret;
+ goto err_rpm_put;
/* vflip and hflip cannot change during streaming */
__v4l2_ctrl_grab(imx219->vflip, true);
__v4l2_ctrl_grab(imx219->hflip, true);
return 0;
+
+err_rpm_put:
+ pm_runtime_put(&client->dev);
+ return ret;
}
static void imx219_stop_streaming(struct imx219 *imx219)
@@ -1081,12 +1091,13 @@ static void imx219_stop_streaming(struct imx219 *imx219)
__v4l2_ctrl_grab(imx219->vflip, false);
__v4l2_ctrl_grab(imx219->hflip, false);
+
+ pm_runtime_put(&client->dev);
}
static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
{
struct imx219 *imx219 = to_imx219(sd);
- struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret = 0;
mutex_lock(&imx219->mutex);
@@ -1096,22 +1107,15 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
}
if (enable) {
- ret = pm_runtime_get_sync(&client->dev);
- if (ret < 0) {
- pm_runtime_put_noidle(&client->dev);
- goto err_unlock;
- }
-
/*
* Apply default & customized values
* and then start streaming.
*/
ret = imx219_start_streaming(imx219);
if (ret)
- goto err_rpm_put;
+ goto err_unlock;
} else {
imx219_stop_streaming(imx219);
- pm_runtime_put(&client->dev);
}
imx219->streaming = enable;
@@ -1120,8 +1124,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable)
return ret;
-err_rpm_put:
- pm_runtime_put(&client->dev);
err_unlock:
mutex_unlock(&imx219->mutex);
--
2.17.1
[-- Attachment #2: Type: text/plain, Size: 428 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6451): https://lists.cip-project.org/g/cip-dev/message/6451
Mute This Topic: https://lists.cip-project.org/mt/82777616/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes
2021-05-12 17:01 [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Lad Prabhakar
2021-05-12 17:01 ` [cip-dev] [PATCH 4.19.y-cip 1/2] media: i2c: imx219: Move out locking/unlocking of vflip and hflip controls from imx219_set_stream Lad Prabhakar
2021-05-12 17:01 ` [cip-dev] [PATCH 4.19.y-cip 2/2] media: i2c: imx219: Balance runtime PM use-count Lad Prabhakar
@ 2021-05-13 1:11 ` Nobuhiro Iwamatsu
2021-05-14 7:40 ` Pavel Machek
2 siblings, 1 reply; 6+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-05-13 1:11 UTC (permalink / raw)
To: prabhakar.mahadev-lad.rj, cip-dev, pavel; +Cc: biju.das.jz
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
Hi,
> -----Original Message-----
> From: Lad Prabhakar [mailto:prabhakar.mahadev-lad.rj@bp.renesas.com]
> Sent: Thursday, May 13, 2021 2:01 AM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT)
> <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>
> Subject: [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes
>
> Hi All,
>
> This patch series fixes trivial issues found in imx219 driver.
>
> Both the patches have been cherry-picked from upstream kernel v5.13-rc1.
>
> Cheers,
> Prabhakar
>
> Lad Prabhakar (2):
> media: i2c: imx219: Move out locking/unlocking of vflip and hflip
> controls from imx219_set_stream
> media: i2c: imx219: Balance runtime PM use-count
Both patches looks good to me.
If no other opinion, I can apply this series.
https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/302030301
>
> drivers/media/i2c/imx219.c | 49 ++++++++++++++++++++++----------------
> 1 file changed, 29 insertions(+), 20 deletions(-)
>
> --
> 2.17.1
Best regards,
Nobuhiro
[-- Attachment #2: Type: text/plain, Size: 428 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6453): https://lists.cip-project.org/g/cip-dev/message/6453
Mute This Topic: https://lists.cip-project.org/mt/82777615/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes
2021-05-13 1:11 ` [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes Nobuhiro Iwamatsu
@ 2021-05-14 7:40 ` Pavel Machek
2021-05-14 8:29 ` Nobuhiro Iwamatsu
0 siblings, 1 reply; 6+ messages in thread
From: Pavel Machek @ 2021-05-14 7:40 UTC (permalink / raw)
To: nobuhiro1.iwamatsu; +Cc: prabhakar.mahadev-lad.rj, cip-dev, pavel, biju.das.jz
[-- Attachment #1.1: Type: text/plain, Size: 665 bytes --]
Hi!
> > Lad Prabhakar (2):
> > media: i2c: imx219: Move out locking/unlocking of vflip and hflip
> > controls from imx219_set_stream
> > media: i2c: imx219: Balance runtime PM use-count
>
> Both patches looks good to me.
> If no other opinion, I can apply this series.
>
> https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/302030301
It looks okay to me, too.
(And same patches are queued for 5.10.37, so we won't need to do
anything there).
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 428 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6455): https://lists.cip-project.org/g/cip-dev/message/6455
Mute This Topic: https://lists.cip-project.org/mt/82777615/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [cip-dev] [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes
2021-05-14 7:40 ` Pavel Machek
@ 2021-05-14 8:29 ` Nobuhiro Iwamatsu
0 siblings, 0 replies; 6+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-05-14 8:29 UTC (permalink / raw)
To: pavel, prabhakar.mahadev-lad.rj; +Cc: cip-dev, biju.das.jz
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
Hi,
> -----Original Message-----
> From: Pavel Machek [mailto:pavel@denx.de]
> Sent: Friday, May 14, 2021 4:40 PM
> To: iwamatsu nobuhiro(岩松 信洋 □SWC◯ACT) <nobuhiro1.iwamatsu@toshiba.co.jp>
> Cc: prabhakar.mahadev-lad.rj@bp.renesas.com; cip-dev@lists.cip-project.org; pavel@denx.de;
> biju.das.jz@bp.renesas.com
> Subject: Re: [PATCH 4.19.y-cip 0/2] media: i2c: imx219: Trivial Fixes
>
> Hi!
>
> > > Lad Prabhakar (2):
> > > media: i2c: imx219: Move out locking/unlocking of vflip and hflip
> > > controls from imx219_set_stream
> > > media: i2c: imx219: Balance runtime PM use-count
> >
> > Both patches looks good to me.
> > If no other opinion, I can apply this series.
> >
> > https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/302030301
>
> It looks okay to me, too.
>
> (And same patches are queued for 5.10.37, so we won't need to do
> anything there).
I just pushed this series, thanks.
Best regards,
Nobuhiro
>
> Best regards,
> Pavel
> --
> DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: Type: text/plain, Size: 428 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6456): https://lists.cip-project.org/g/cip-dev/message/6456
Mute This Topic: https://lists.cip-project.org/mt/82777615/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/4520388/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 6+ messages in thread