Skip to content

Commit

Permalink
media: ov6650: Drop obsolete .pclk_limit attribute
Browse files Browse the repository at this point in the history
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 23a5238 ("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 <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jkrzyszt authored and mchehab committed Oct 24, 2019
1 parent 5782206 commit b1c5794
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions drivers/media/i2c/ov6650.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
}

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b1c5794

Please sign in to comment.