Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8257308imu; Fri, 28 Dec 2018 13:54:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN5BNkC+2N9MuZXI0LOlqXqLqgYklv7/qf1qf2wi6YfKvdc+CmIIQkDC6LdUeitaYRtz47GI X-Received: by 2002:a63:8c2:: with SMTP id 185mr28334984pgi.26.1546034087439; Fri, 28 Dec 2018 13:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546034087; cv=none; d=google.com; s=arc-20160816; b=oSkSh7A4PUklGde2Q183bqtQ7ZPXMWkyhZilfIhktMTVLXZZxAIOx1ddGFmzknuf1c Ixu87oFh7lU7QNPRYEETaRCuNw8zTOufJbDIzVEb2ArvwJFsLgJIiKpjw5qWsd1WFcSZ uKfzEY4Q8DtSTv8n8ZQmI+qAQRvpTYo9sEzQsmyAIAgq/rQb4ijdND28lN9qmMQeb3C9 X07c1nA/9MeBZJere7S/D+WU5cxnKPVvXoEP/YhxhcAlNAUOkzk55/YsduYxh20DosVX cI+D7eIE5OTiOGQc92xR/e8iuuy9UHCLXHsc2z6Tb5hYFAd1vhdRnGxOogVKc2bWQdpz 1Zkw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2508c9qWLuo+BhQ3ptex5+ixk2NHgVCsYUjs77nPcJ0=; b=neUuZAYAHDS79ECammOZ9LiwMn21W/qGkH//1bibYLlF0mV2xfj/JwJDWAdTiFZcvW i/U8Djpm93vEFtJrUYFaYLaS7mf3R7r1Xf6/byNGoQJh1KWXXGc5hGnM761v2jeRkkvd /nfcypxiKg31vf/lCr6H1t2bGC3JcBMTKbC4oWLuEkt3l8O0g4LFtJMZ3c36iUa9GQdK EvjrssClAA9OHuqT5xZ18BwzbzL1k02XW/73v8jGnyU/zMmRy73GxD6/JGP55RGOxt8v xzSVQqZHMLQXhzd6NPdr7G++IzG3gty6Jnyo+omB9KFM7JHd830XsFeFSiwAW+Vmwbq5 4MPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mJVmqHTg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si13780525pgi.359.2018.12.28.13.54.31; Fri, 28 Dec 2018 13:54:47 -0800 (PST) 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=@kernel.org header.s=default header.b=mJVmqHTg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731350AbeL1MO6 (ORCPT + 99 others); Fri, 28 Dec 2018 07:14:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:33878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731293AbeL1MOz (ORCPT ); Fri, 28 Dec 2018 07:14:55 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BCFE2184B; Fri, 28 Dec 2018 12:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545999294; bh=UVY5grcJCQB/9liYA7OOkxirK3m6fbJCRLAxEUG3kvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mJVmqHTgi2nVXNAxdPfkz9vhym2UTrKKL/wwodST876XxyNGnPb5IjYwjkK8USc3n +PDBTNWTye5+1k/XkEMQ2qZQNi/W63UDrskKTk1X/IWnmCP5E8HtRbQfU7ztXKeyum B+jb4/7Jxuon13ahBofhqHNmRKLbIGsL9PjHIOOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacopo Mondi , Maxime Ripard , Sakari Ailus , Mauro Carvalho Chehab , Adam Ford Subject: [PATCH 4.19 39/46] media: ov5640: Fix set format regression Date: Fri, 28 Dec 2018 12:52:33 +0100 Message-Id: <20181228113127.171051863@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181228113124.971620049@linuxfoundation.org> References: <20181228113124.971620049@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jacopo Mondi commit 07115449919383548d094ff83cc27bd08639a8a1 upstream. The set_fmt operations updates the sensor format only when the image format is changed. When only the image sizes gets changed, the format do not get updated causing the sensor to always report the one that was previously in use. Without this patch, updating frame size only fails: [fmt:UYVY8_2X8/640x480@1/30 field:none colorspace:srgb xfer:srgb ...] With this patch applied: [fmt:UYVY8_2X8/1024x768@1/30 field:none colorspace:srgb xfer:srgb ...] Fixes: 6949d864776e ("media: ov5640: do not change mode if format or frame interval is unchanged") Signed-off-by: Jacopo Mondi Signed-off-by: Maxime Ripard Tested-by: Adam Ford #imx6 w/ CSI2 interface on 4.19.6 and 4.20-RC5 Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov5640.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -2020,6 +2020,7 @@ static int ov5640_set_fmt(struct v4l2_su struct ov5640_dev *sensor = to_ov5640_dev(sd); const struct ov5640_mode_info *new_mode; struct v4l2_mbus_framefmt *mbus_fmt = &format->format; + struct v4l2_mbus_framefmt *fmt; int ret; if (format->pad != 0) @@ -2037,22 +2038,20 @@ static int ov5640_set_fmt(struct v4l2_su if (ret) goto out; - if (format->which == V4L2_SUBDEV_FORMAT_TRY) { - struct v4l2_mbus_framefmt *fmt = - v4l2_subdev_get_try_format(sd, cfg, 0); + if (format->which == V4L2_SUBDEV_FORMAT_TRY) + fmt = v4l2_subdev_get_try_format(sd, cfg, 0); + else + fmt = &sensor->fmt; - *fmt = *mbus_fmt; - goto out; - } + *fmt = *mbus_fmt; if (new_mode != sensor->current_mode) { sensor->current_mode = new_mode; sensor->pending_mode_change = true; } - if (mbus_fmt->code != sensor->fmt.code) { - sensor->fmt = *mbus_fmt; + if (mbus_fmt->code != sensor->fmt.code) sensor->pending_fmt_change = true; - } + out: mutex_unlock(&sensor->lock); return ret;