From: Janusz Krzysztofik <jmkrzyszt@gmail.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Janusz Krzysztofik <jmkrzyszt@gmail.com>
Subject: [PATCH 2/6] media: ov6650: Drop obsolete .pclk_limit attribute
Date: Sun, 13 Oct 2019 14:50:46 +0200 [thread overview]
Message-ID: <20191013125050.4153-3-jmkrzyszt@gmail.com> (raw)
In-Reply-To: <20191013125050.4153-1-jmkrzyszt@gmail.com>
That attribute used to be obtained from platform data by a soc_camera
host interface and passed to the sensor driver for .s_mbus_fmt() video
operation callback, later reused as .set_fmt() pad operation callback,
to be able to limit frame rate. The driver stored that value in its
private structure for further use from .g/s_parm(), later converted to
g/s_frame_interval().
On conversion of the driver from soc_camera sensor to a standalone V4L2
subdevice by commit 23a52386fabe ("media: ov6650: convert to standalone
v4l2 subdevice"), that attribute had been replaced by a constant and
hardcoded to an arbitrarily chosen pixel clock limit. Drop it. Host
interfaces can limit frame rate if needed by calling
.s_frame_interval().
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
---
drivers/media/i2c/ov6650.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
index f60aeb1f7813..a50244401491 100644
--- a/drivers/media/i2c/ov6650.c
+++ b/drivers/media/i2c/ov6650.c
@@ -197,7 +197,6 @@ struct ov6650 {
struct v4l2_clk *clk;
bool half_scale; /* scale down output by 2 */
struct v4l2_rect rect; /* sensor cropping window */
- unsigned long pclk_limit; /* from host */
unsigned long pclk_max; /* from resolution and format */
struct v4l2_fract tpf; /* as requested with s_frame_interval */
u32 code;
@@ -546,8 +545,7 @@ static bool is_unscaled_ok(int width, int height, struct v4l2_rect *rect)
return width > rect->width >> 1 || height > rect->height >> 1;
}
-static u8 to_clkrc(struct v4l2_fract *timeperframe,
- unsigned long pclk_limit, unsigned long pclk_max)
+static u8 to_clkrc(struct v4l2_fract *timeperframe, unsigned long pclk_max)
{
unsigned long pclk;
@@ -557,9 +555,6 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe,
else
pclk = pclk_max;
- if (pclk_limit && pclk_limit < pclk)
- pclk = pclk_limit;
-
return (pclk_max - 1) / pclk;
}
@@ -653,10 +648,9 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
clkrc = CLKRC_12MHz;
mclk = 12000000;
- priv->pclk_limit = 1334000;
dev_dbg(&client->dev, "using 12MHz input clock\n");
- clkrc |= to_clkrc(&priv->tpf, priv->pclk_limit, priv->pclk_max);
+ clkrc |= to_clkrc(&priv->tpf, priv->pclk_max);
pclk = priv->pclk_max / GET_CLKRC_DIV(clkrc);
dev_dbg(&client->dev, "pixel clock divider: %ld.%ld\n",
@@ -756,7 +750,7 @@ static int ov6650_g_frame_interval(struct v4l2_subdev *sd,
struct ov6650 *priv = to_ov6650(client);
ival->interval.numerator = GET_CLKRC_DIV(to_clkrc(&priv->tpf,
- priv->pclk_limit, priv->pclk_max));
+ priv->pclk_max));
ival->interval.denominator = FRAME_RATE_MAX;
dev_dbg(&client->dev, "Frame interval: %u/%u s\n",
@@ -787,7 +781,7 @@ static int ov6650_s_frame_interval(struct v4l2_subdev *sd,
tpf->numerator = div;
tpf->denominator = FRAME_RATE_MAX;
- clkrc = to_clkrc(tpf, priv->pclk_limit, priv->pclk_max);
+ clkrc = to_clkrc(tpf, priv->pclk_max);
ret = ov6650_reg_rmw(client, REG_CLKRC, clkrc, CLKRC_DIV_MASK);
if (!ret) {
--
2.21.0
next prev parent reply other threads:[~2019-10-13 12:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-13 12:50 [PATCH 0/6] media: ov6650: Master and pixel clock handling fixes Janusz Krzysztofik
2019-10-13 12:50 ` [PATCH 1/6] media: ov6650: Fix stored frame interval not in sync with hardware Janusz Krzysztofik
2019-10-13 12:50 ` Janusz Krzysztofik [this message]
2019-10-13 12:50 ` [PATCH 3/6] media: ov6650: Simplify clock divisor calculation Janusz Krzysztofik
2019-10-13 12:50 ` [PATCH 4/6] media: ov6650: Don't reapply pixel clock divisor on format change Janusz Krzysztofik
2019-10-13 12:50 ` [PATCH 5/6] media: ov6650: Drop unused .pclk_max field Janusz Krzysztofik
2019-10-13 12:50 ` [PATCH 6/6] media: ov6650: Fix arbitrary selection of master clock rate Janusz Krzysztofik
2019-10-18 18:54 ` Sakari Ailus
2019-10-18 19:11 ` Janusz Krzysztofik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191013125050.4153-3-jmkrzyszt@gmail.com \
--to=jmkrzyszt@gmail.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab+samsung@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox