Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3067682ybi; Sun, 26 May 2019 13:50:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTS/NnNtJBSGdrdrQVLzQbKd6Rbcj3b1YdGS+JrrZyplIfDHhgTjQluNPEiW51+c9Aba8z X-Received: by 2002:a65:448a:: with SMTP id l10mr4794843pgq.53.1558903832371; Sun, 26 May 2019 13:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558903832; cv=none; d=google.com; s=arc-20160816; b=W7QUJXQmCNPErT80SuUK6Rko1zlpJ/86iT4sI2NoACmmBKCeIjGrWXvOrUpcMHMZpf YTWv/f2mEUr7i8brGHVVm7dVDEc0UuQkySSGrAGuN0jeSCxIfHal7A9pxfIB09g26LlR d7aiG1hzNju9pJOXC3buuAQglHUVqeCCxQSC0CUZqNl8YMHut1hHJB5BPCDFKPmwitTy +72aDR0psXWYWURU2Z5cP5/PyC5Ybf/HPlVwVY01/FaplD9yXd1ywd+ypYxCStkntDss fpsnfl4H12OOM9Kpv++PmjfAqtz+WhOXJ+zI8XDpGfiyNitH/CISMYNu/o03bOFVYkIZ 5lsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yxy8jhb7vj4f583mX+9bjwUeoCyJQOsv4k9GjkXUQ2g=; b=lNsfEUqJjdlB7EuR+FGQqctZoi7HckT0qFwJJ9KFqArOKhSMd34ogoyz1FV3pckdy0 6ehqckeEb9ftG4z7OMHs5QQOz1Gz46OqTzIDxP6uQ6cEPq8oN8l00IBWS0OPR2npRSDi dM+8YGhJIOaBX3yzZn4OD4ly7Zk2IvN+7jyXqxWVUp8mcTj4oS13UwKYSvJh1Tzidtdc IcKKaqSh0vUx/R1/ZOSvBnxTN+J/pR/zJAFeweoLsVS6W2i0Ujq4uNeXXFFuywj0Ktdb HV/vBzpi5FZQIEuzxvxqUmQKc8TyKmJfZK8TjtTMJKvnZ9Jw3S8oKhmENA7/+6Ay6E6r GS0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h6tdj+sL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si16525902pld.344.2019.05.26.13.50.15; Sun, 26 May 2019 13:50:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h6tdj+sL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbfEZUsc (ORCPT + 99 others); Sun, 26 May 2019 16:48:32 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41151 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbfEZUsS (ORCPT ); Sun, 26 May 2019 16:48:18 -0400 Received: by mail-lj1-f196.google.com with SMTP id q16so4530021ljj.8; Sun, 26 May 2019 13:48:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yxy8jhb7vj4f583mX+9bjwUeoCyJQOsv4k9GjkXUQ2g=; b=h6tdj+sL53sdFiNAj75lH6fUo0CsOzTPQ7xv1AERtT/h1WVe35E4pq/nB90f9V/C+v WHORIAj3z4FRPd24Z2dwdelOP5Yf05LMyqDj5HGxWqNXp50gGmyFnAXVZFCg7uhOEM8J 7dJRsJ4htsB3CDvLc6j+GbjBe88DML8fUMdpFzYpFTYNg5icFqxfRJEi8aimcrUc7QiY MQZbDjfUfvC60XnIwlMoqYInsEZn9P+iDMKfGQIDMFRNo6j4GPfKD17sSprcD/Oxa491 lCvEVEhZKZGNePdbgFhtpolAfYzL0IrfCzqCsc55FUUXf2yk4D5sNMD4Ym6JHg/jpQNn p5qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yxy8jhb7vj4f583mX+9bjwUeoCyJQOsv4k9GjkXUQ2g=; b=Yc9F4mB1xhp8voF8CxhXMe6AJU2HWZMh/DxFdNV+sCyhtSg1X8MSLJ9Irq88h3inX0 yU3DgiuvfqSGuXh5iLmniKa187Xrd2CaTJzcK1aq4Vd/FtegDEhJSv+dAt++k8eFijV7 Ty7w38st/ciwOMytF0wWaantMaCpe62P/a61HT2siZYS2CRc+lDkF+yn72SDTxPTG609 TuuMsIwyH5rY3TmwOSa+36Edqm5GQHz40K/n7tbQ7ReEP8mnypbd59zCdvin/0Vh56V5 z8YbSozILYalMrXnnM7awCfQSdk22+UU21EC+x+8cSJR0ajrRhCOcAyl+sQAi14WnAm2 e8Og== X-Gm-Message-State: APjAAAWlQ7NPrRRh9h1/vjz555DzD0+u1a5l62Wd3BR3AotqgVLSgcJ5 zLLwGN1xA7DUdbx/PVUvesM= X-Received: by 2002:a2e:900e:: with SMTP id h14mr39180739ljg.77.1558903696049; Sun, 26 May 2019 13:48:16 -0700 (PDT) Received: from z50.gdansk-morena.vectranet.pl (109241207190.gdansk.vectranet.pl. [109.241.207.190]) by smtp.gmail.com with ESMTPSA id i187sm1859475lfe.64.2019.05.26.13.48.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 13:48:15 -0700 (PDT) From: Janusz Krzysztofik To: Mauro Carvalho Chehab Cc: Sakari Ailus , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [RFC PATCH 4/5] media: ov6650: Fix frame scaling not reset on crop Date: Sun, 26 May 2019 22:47:57 +0200 Message-Id: <20190526204758.1904-5-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190526204758.1904-1-jmkrzyszt@gmail.com> References: <20190526204758.1904-1-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to V4L2 subdevice interface specification, frame scaling factors should be reset to default values on modification of input frame format. Assuming that requirement also applies in case of crop rectangle modification unless V4L2_SEL_FLAG_KEEP_CONFIG is requested, the driver now does not respect it. The KEEP_CONFIG case is already implemented, fix the other path. Signed-off-by: Janusz Krzysztofik --- drivers/media/i2c/ov6650.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c index 47590cd51190..cc70d8952999 100644 --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -472,6 +472,8 @@ static int ov6650_get_selection(struct v4l2_subdev *sd, } } +static int ov6650_s_fmt(struct v4l2_subdev *sd, u32 code, bool half_scale); + static int ov6650_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) @@ -515,7 +517,13 @@ static int ov6650_set_selection(struct v4l2_subdev *sd, } if (!ret) priv->rect.height = sel->r.height; + else + return ret; + if (priv->half_scale) { + /* turn off half scaling, preserve media bus format */ + ret = ov6650_s_fmt(sd, priv->code, false); + } return ret; } -- 2.21.0