summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-12-04 13:39:42 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2023-12-13 13:21:20 +0100
commit3735228bbe3511f844e03dfcc4003fadb59dde23 (patch)
tree4ef5a6c1caaee8c12741f907c23fe5f9cbabce55 /drivers/media/i2c
parent41543c7ccc682f7ec713dbe19be67fa694088f9c (diff)
downloadlinux-stable-3735228bbe3511f844e03dfcc4003fadb59dde23.tar.gz
linux-stable-3735228bbe3511f844e03dfcc4003fadb59dde23.tar.bz2
linux-stable-3735228bbe3511f844e03dfcc4003fadb59dde23.zip
media: ov2740: Fix hts value
HTS must be more then width, so the 1080 value clearly is wrong, this is then corrected with some weird math dividing clocks in to_pixels_per_line() which results in the hts getting multiplied by 2, resulting in 2160. Instead just directly set hts to the correct value of 2160 and drop to_pixels_per_line(). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ov2740.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
index 1cbe0ac16995..759e91f4169b 100644
--- a/drivers/media/i2c/ov2740.c
+++ b/drivers/media/i2c/ov2740.c
@@ -312,7 +312,7 @@ static const struct ov2740_mode supported_modes[] = {
{
.width = 1932,
.height = 1092,
- .hts = 1080,
+ .hts = 2160,
.vts_def = OV2740_VTS_DEF,
.vts_min = OV2740_VTS_MIN,
.reg_list = {
@@ -363,15 +363,6 @@ static u64 to_pixel_rate(u32 f_index)
return pixel_rate;
}
-static u64 to_pixels_per_line(u32 hts, u32 f_index)
-{
- u64 ppl = hts * to_pixel_rate(f_index);
-
- do_div(ppl, OV2740_SCLK);
-
- return ppl;
-}
-
static int ov2740_read_reg(struct ov2740 *ov2740, u16 reg, u16 len, u32 *val)
{
struct i2c_client *client = v4l2_get_subdevdata(&ov2740->sd);
@@ -604,8 +595,7 @@ static int ov2740_init_controls(struct ov2740 *ov2740)
V4L2_CID_VBLANK, vblank_min,
vblank_max, 1, vblank_default);
- h_blank = to_pixels_per_line(cur_mode->hts, cur_mode->link_freq_index);
- h_blank -= cur_mode->width;
+ h_blank = cur_mode->hts - cur_mode->width;
ov2740->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov2740_ctrl_ops,
V4L2_CID_HBLANK, h_blank, h_blank, 1,
h_blank);
@@ -848,8 +838,7 @@ static int ov2740_set_format(struct v4l2_subdev *sd,
mode->vts_min - mode->height,
OV2740_VTS_MAX - mode->height, 1, vblank_def);
__v4l2_ctrl_s_ctrl(ov2740->vblank, vblank_def);
- h_blank = to_pixels_per_line(mode->hts, mode->link_freq_index) -
- mode->width;
+ h_blank = mode->hts - mode->width;
__v4l2_ctrl_modify_range(ov2740->hblank, h_blank, h_blank, 1, h_blank);
return 0;