summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorKieran Bingham2017-08-03 15:50:23 +0200
committerMauro Carvalho Chehab2017-12-08 16:03:00 +0100
commitb0fe777884f5cebc46427f63bc9df1a78bfab1a1 (patch)
tree52212206c1e988c57f8f10399934a8dab69c4aff /drivers/media/i2c
parentmedia: v4l: mt9v032: Disable clock on error paths (diff)
downloadkernel-qcow2-linux-b0fe777884f5cebc46427f63bc9df1a78bfab1a1.tar.gz
kernel-qcow2-linux-b0fe777884f5cebc46427f63bc9df1a78bfab1a1.tar.xz
kernel-qcow2-linux-b0fe777884f5cebc46427f63bc9df1a78bfab1a1.zip
media: i2c: adv748x: Store the pixel rate ctrl on CSI objects
The current implementation has to search the list of controls for the pixel rate control, each time it is set. This can be optimised easily by storing the ctrl pointer in the CSI/TX object, and referencing that directly. While at it, fix up a missing blank line also highlighted in review comments. Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Tested-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv748x/adv748x-afe.c1
-rw-r--r--drivers/media/i2c/adv748x/adv748x-csi2.c13
-rw-r--r--drivers/media/i2c/adv748x/adv748x.h1
3 files changed, 9 insertions, 6 deletions
diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c
index 4aa8e45b5cd3..5188178588c9 100644
--- a/drivers/media/i2c/adv748x/adv748x-afe.c
+++ b/drivers/media/i2c/adv748x/adv748x-afe.c
@@ -267,6 +267,7 @@ static int adv748x_afe_g_input_status(struct v4l2_subdev *sd, u32 *status)
ret = adv748x_afe_status(afe, status, NULL);
mutex_unlock(&state->mutex);
+
return ret;
}
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 979825d4a419..820b44ed56a8 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -223,13 +223,12 @@ static const struct v4l2_subdev_ops adv748x_csi2_ops = {
int adv748x_csi2_set_pixelrate(struct v4l2_subdev *sd, s64 rate)
{
- struct v4l2_ctrl *ctrl;
+ struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd);
- ctrl = v4l2_ctrl_find(sd->ctrl_handler, V4L2_CID_PIXEL_RATE);
- if (!ctrl)
+ if (!tx->pixel_rate)
return -EINVAL;
- return v4l2_ctrl_s_ctrl_int64(ctrl, rate);
+ return v4l2_ctrl_s_ctrl_int64(tx->pixel_rate, rate);
}
static int adv748x_csi2_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -251,8 +250,10 @@ static int adv748x_csi2_init_controls(struct adv748x_csi2 *tx)
v4l2_ctrl_handler_init(&tx->ctrl_hdl, 1);
- v4l2_ctrl_new_std(&tx->ctrl_hdl, &adv748x_csi2_ctrl_ops,
- V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1);
+ tx->pixel_rate = v4l2_ctrl_new_std(&tx->ctrl_hdl,
+ &adv748x_csi2_ctrl_ops,
+ V4L2_CID_PIXEL_RATE, 1, INT_MAX,
+ 1, 1);
tx->sd.ctrl_handler = &tx->ctrl_hdl;
if (tx->ctrl_hdl.error) {
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index cc4151b5b31e..6789e2f3bc8c 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -97,6 +97,7 @@ struct adv748x_csi2 {
struct media_pad pads[ADV748X_CSI2_NR_PADS];
struct v4l2_ctrl_handler ctrl_hdl;
+ struct v4l2_ctrl *pixel_rate;
struct v4l2_subdev sd;
};