Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp392152rdb; Mon, 22 Jan 2024 07:26:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEOmuxLUzo78wmwlwYJlBPaw14mG+xxhXCID7WVwZrQB3XydZdR8jZ119O8BaRqGXXk7QXr X-Received: by 2002:a17:902:c3c6:b0:1d6:f27f:2b51 with SMTP id j6-20020a170902c3c600b001d6f27f2b51mr3984360plj.8.1705937161828; Mon, 22 Jan 2024 07:26:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705937161; cv=pass; d=google.com; s=arc-20160816; b=eurkNUVrvrBAw1oi+xsDYCyUx33zu/QJPgLGepwItUlxUPMYDlG6Ec38R2vSBGo3MF IefuY9LHhrSKZiUD7NNW3f+/TcYZ1Dins2lhApb9ie+Bx9qhyvG+rDz2Vj4SosPRJ4rD K6Z49P59zBb9JfFvELpeStzemnjOMXinEuAcAN/xNGtWE6gOMCdEpw9EGlBIlboFUoG7 fnSnweS9PnIldyaLj//SnxEcL45uc2I6n8tWvMFbIk8e0RzBwLoemjDQKOiafhasM2wo URaUb3XpQmGfQMgRcpDqt93eO9s/YtDDJIVyNRWX1FxCh/vZDuZr2R6QzIOUmb92fHyX RIDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=WoaEMLFiZN5YSts4t4xq8rdMV1c8ORCH895R43fCtaw=; fh=mzOK5tUb7ZjT0LxsOjaKLSXUJfuf8/rxrSplOSil34Y=; b=qAMXus7uHIQfn3tWvIhSUfSVunUhEtad5ymQJEFiWmerL7AwMGL/w9XFMkUTS2MfXA AdiCnLW6glKPc1M47vzYBDFM4uPSfm7gs6lc5UKJMdMSm1TX4TamjfQvWOHi0eMzHY9O yaPf0/B+XV/ID38RGntImE7Yz+DMiWeUL5D+NlisM5Oj6chJ3+Wbnm4DIW09mcWU+Lfy uOmIvXr5/DYmiAjT9IagvgWwSHbgCDA3M6KTz2CrdUIfsJzDCnI2Pvm26qqpxJ6oFNDh SaqYMYSvJN153Ag5OUxtU4/reJi6kEW/wBo24Kxu+qdqfDw6N5cqssLZfUE9H7o1P2vL 5BEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qKtMfBap; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33268-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h7-20020a170902f54700b001d72f8984a6si4332263plf.171.2024.01.22.07.26.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 07:26:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33268-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qKtMfBap; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-33268-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33268-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8A69C28D080 for ; Mon, 22 Jan 2024 15:18:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1124D58129; Mon, 22 Jan 2024 14:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qKtMfBap" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39C875810B; Mon, 22 Jan 2024 14:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935526; cv=none; b=CrEgnd7y/jvN7YNJuTjQNz33JjCLDskTjiVdNDaIkIQStqzjdkVjjddjVw02nQ3ql7QJ9jhgTF/JhdY7C2abVoTsipTA/wg0aYYF72W3rfTs/1JIFSLoTyOLSS8E0mbp4RhvL2dR8p9y4Ku812aO2Y2zaUaPQc7Jzy12dA0c0ME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705935526; c=relaxed/simple; bh=BxkbzB02hWQbQjzM2m4HskZst9ihfxAqm88x70Uynb0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gPdiYW/FAt08Whmga0IFibiYyvd7W4aD69ClV8sLgHy039x78sA9fkytIWn8GH9BDAAhS41Y6rQwnihmtRon/FwI3qm71vSj8ucDcpK1JnNMVppe4vZt+N5BW1TL5IQb1zLSL3ut6AHIoOZek7UTbVUkbMhTGDeAlfDh7pvEAFc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qKtMfBap; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80DDC43394; Mon, 22 Jan 2024 14:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705935526; bh=BxkbzB02hWQbQjzM2m4HskZst9ihfxAqm88x70Uynb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qKtMfBap5eKFo1GWrqxuDgd4DY80lforrwUWZx9T2Fqm/U0SBuphKrqCsWa1mpfus IDsxqUwXCY7KUMorLwOvDOAZIf5FFFXsTUh6U+j4NPVESv7977pxTZBqhLR+a/8Ys5 Yc+vx9RTnMZmyxMOuCc8/Xx7f5Cn8Hy05LbaReBKhT0DOVOoNCjjKJwEZ8UROzQktv XHsLzRBakARD9EohCJmeL5f8lJqhAkOROZC3k3n474YecMctVsCmP9lSV9hcRGNqay JLK/zWoFIA+8oWNITgEbEwjTEuAAZ+LElpaNw5WG/FPwp+OnoAIhro0LmFaSSwCqgm YK6RkjK3nnEIA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hans de Goede , Sakari Ailus , Hans Verkuil , Sasha Levin , tian.shu.qiu@intel.com, mchehab@kernel.org, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 6.7 48/88] media: ov2740: Fix hts value Date: Mon, 22 Jan 2024 09:51:21 -0500 Message-ID: <20240122145608.990137-48-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122145608.990137-1-sashal@kernel.org> References: <20240122145608.990137-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.7.1 Content-Transfer-Encoding: 8bit From: Hans de Goede [ Upstream commit 3735228bbe3511f844e03dfcc4003fadb59dde23 ] 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 Signed-off-by: Sakari Ailus Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/i2c/ov2740.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 24e468485fbf..6be22586c3d2 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -310,7 +310,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 = { @@ -357,15 +357,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); @@ -598,8 +589,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); @@ -842,8 +832,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; -- 2.43.0