Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3257978yba; Mon, 8 Apr 2019 14:45:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqMXU4ZOu6m3TORjZ77iT4tLO+T3/49mVVFW/nrcyAljZ9FoeXu0WBWWYQlgzxluoWGkeM X-Received: by 2002:aa7:8212:: with SMTP id k18mr32183979pfi.50.1554759951687; Mon, 08 Apr 2019 14:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554759951; cv=none; d=google.com; s=arc-20160816; b=vJ+tU8eyuF8AY+4KBQQwbBAx/i7UzhItAG6IDQg26Gh42IbhJwQrpHbA6QfsQ29lry JqoAt/T+Fpp0n8ew9VoT8KPxCF5WUt1HtpLVFR7LNHgg+rP3/sP5T8if4YQhTImiVtpb xLQO6COP8GIwImzyDOELMvSQP8GjlIgxX66XUiMTsNfJ5saDWKMZoJw2NTJOk/bvC9Xs puQ14O8WYeRWt1i+nraN7XXLP7o8qfrXGSrmykLW1EeUivg2DKq3fB+OjV7NGWfhQaRT pauvQqQD/2WwjC/0r+DWWXFpk7himlK6k57Q5W96zMUmSkY15KGsP0hyVBUJd35U1CH4 iuAA== 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=X/wndm5aXTboBKQBo07EQSuwKC5btc/Z56ajATwmTuc=; b=qOWvWI3tJhGetPK6vEQyta6I+yaH4TpvNu6tVRkE5aynmaAeZQfoFkGAYW9Lrefb4r O//Q9ZrfeCe+STC3celLtPdkpIiP5XRVjWhP/0wh2+soQ7/EbEykTCEFOdvtW6VFs+bw iGixR1iZctvPVfBKFshd5B4FedGUGkxp7tEliSDx6VAhIKTRy3fyjm4IXW3wKE8MJ+0B ltNhiGji+l15eQz7bHDWGLS52nvmMSZPx8wtUNai8YValwmZ91JCxm/yDfO923OS6Mba 0mlVvRw4BialCBIVp9VC5c9wmGGjVAQpwsqm+rcRfW1Kv4faIZLPT/vGHUd7avqGNZwy oO5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dVaUmxO4; 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 l7si27865312plb.219.2019.04.08.14.45.36; Mon, 08 Apr 2019 14:45:51 -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=dVaUmxO4; 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 S1727260AbfDHVoB (ORCPT + 99 others); Mon, 8 Apr 2019 17:44:01 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:45685 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726188AbfDHVnW (ORCPT ); Mon, 8 Apr 2019 17:43:22 -0400 Received: by mail-lf1-f65.google.com with SMTP id t15so6780012lfl.12; Mon, 08 Apr 2019 14:43:20 -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=X/wndm5aXTboBKQBo07EQSuwKC5btc/Z56ajATwmTuc=; b=dVaUmxO4/6iYQ0WLE5PxeLWpy9nu79cgZkPAQIuUkm9WqoHxj1JTPDzbUTjd7gIOx9 WEOivKC+LeSDawac2O8vBOUgzma0stzZ+DTk0iD1no5VDHWQZmjWBxnWOHnCR0/R2tK0 8uYZPRsirgid2kTq4h36QmsOMTm7g71EDbqI049RE+LCAMLfkkiGM3RQeoAc2JEJGPAW 1YdaaYyukdQGsfFCJENu/VhBStac6YfsJXiiluMnUi91ISpIKmElWwE7afqLKw/dInUH denVDV2F8x5DSoHGflQ+ge/zOJk99u401VR+d6DYmHURLWApU/fbVMkv1jteogdgUbv/ cqDQ== 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=X/wndm5aXTboBKQBo07EQSuwKC5btc/Z56ajATwmTuc=; b=OmtdVuXa+bOkD3gQhT8eq+ZAOgztMPJ205BFgjXgT1qglYo4RVJGtp7Doukc+gh+5H q2caVcRnHjGNXT0iN5aFsAM5S21+46dEequb2+MjnYoh1ocVOBQ7xyD/RGGpHbu/xOB2 R66DLmzyZGaDyZ79RaHRS2zFybkVh0bRd1RANAKaAU+1kOyXgSkxMdPZj/tDTAFBE6FX IksoDDp/LKvxLqU0k0Oah2bUc7QreiWITMM3BqChp09oxF7YcBpCIIxsPcwXbPDLssWY F7EL90sCgQLH+U3Yuc6hyf3dLQ80Aibl0KnDyWb+Vm3hFPPs1cSYt5QRSmF3AoAab90V TPHw== X-Gm-Message-State: APjAAAWrVYqjC0qFJnsUfoMTJi2qrliWOeh1HAKZDvlqNvjYVVaUG+4+ 6gZY8BEFVEM11Z4lvZ+Lixo= X-Received: by 2002:ac2:4424:: with SMTP id w4mr14293963lfl.148.1554759800118; Mon, 08 Apr 2019 14:43:20 -0700 (PDT) Received: from z50.gdansk-morena.vectranet.pl (109241207190.gdansk.vectranet.pl. [109.241.207.190]) by smtp.gmail.com with ESMTPSA id j6sm5286048ljc.0.2019.04.08.14.43.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Apr 2019 14:43:19 -0700 (PDT) From: Janusz Krzysztofik To: Mauro Carvalho Chehab Cc: Sakari Ailus , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Janusz Krzysztofik Subject: [PATCH 11/14] media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support Date: Mon, 8 Apr 2019 23:42:39 +0200 Message-Id: <20190408214242.9603-12-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190408214242.9603-1-jmkrzyszt@gmail.com> References: <20190408214242.9603-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 Commit da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt") converted a former ov6650_g_fmt() video operation callback to an ov6650_get_fmt() pad operation callback. However, the converted function disregards a format->which flag that pad operations should obey and always returns active frame format settings. That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with -EINVAL, or providing the response from a pad config argument, likely updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt(). Since implementation of the latter is trivial, go for it. Fixes: da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt") Signed-off-by: Janusz Krzysztofik Cc: stable@vger.kernel.org --- drivers/media/i2c/ov6650.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c index f6b0b77c5abf..e72210653f55 100644 --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -530,25 +530,27 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd, if (format->pad) return -EINVAL; + /* initialize response with default media bus frame format */ + *mf = ov6650_def_fmt; + + /* update media bus format code and frame size */ switch (format->which) { case V4L2_SUBDEV_FORMAT_ACTIVE: + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; break; case V4L2_SUBDEV_FORMAT_TRY: - if (cfg) + if (cfg) { + mf->width = cfg->try_fmt.width; + mf->height = cfg->try_fmt.height; + mf->code = cfg->try_fmt.code; break; + } /* fall through */ default: return -EINVAL; } - - /* initialize response with default media bus frame format */ - *mf = ov6650_def_fmt; - - /* update media bus format code and frame size */ - mf->width = priv->rect.width >> priv->half_scale; - mf->height = priv->rect.height >> priv->half_scale; - mf->code = priv->code; - return 0; } -- 2.21.0