Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4617796pxj; Wed, 12 May 2021 09:20:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUrcX35JlXtY2YIBQfYiHvapltmWzQ4SwfJsXscliD99RoqIlaht7eilcrVthKm5KEcsTO X-Received: by 2002:a17:906:c9d8:: with SMTP id hk24mr38974842ejb.480.1620836424623; Wed, 12 May 2021 09:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836424; cv=none; d=google.com; s=arc-20160816; b=Vuz3bh2EnQoi0IskNKPEdBTR3tcsmJvtEw0sTCKrTVWuk9hoD1vqe7MpmTrEWDg3BP urV1F5Y+GnoyILH8PQnAEkQnohidL9l7ed1bLe2c34SLLUqtV6hiSaHFtgtXFGTwAP3X J2Z1V48zN/6NRrJ+fc2PngLEq+kdS5HE5Tj4oJomELu0L2B8xm5kW2K4DGa0VGmmf+g8 ZqRPRY/P03xmjJtv6t6JGPDcTeq7EsGOYzvIbJD1BWa3/os/LjaV6qFIJk7WxC3PIvU9 3YwZpj0ClaheQHONKK/TU76Ql6F5oJs0tUOMgiG3j0sZh08JiuaCgLEG/ZzpSuU8yIhV 0CeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XZncQOkY8/e3KQQWBLO/O89Ie/IGxcozWrwNcwFIZY4=; b=qSd82bpjSruE49QueN32U5ZBbMYk2VUCFrFyj7g0sIMooYOQUUuf/3aQ3MXUmrC/g3 3zj2XyltL7Y8kN8xMcPn0A03anMUU4sva1yk4I1eRntg4Er85nUQv6ZWCTkb0pNmaVe2 lZI5uplO5t0OmUwpF+DlAj+WKsCX6RyIUPG+pEGOmAuNWLc7u5cM+DOYEh8GERLaUcnZ 9ADs4ukqhy3SYnlxv7GxdwpJtphgDtPTf3RKmwDTjP1nPP+G4afa9EK6WwjVZ5HEKBYW D6qPG5iast07gsK2eShFNVT8DAFl4KwsFb6gzCwP5EiIp6gpmRGx2BZ+AVZZEaJEakrS e0rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hoSNjEb6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si380101eji.560.2021.05.12.09.19.59; Wed, 12 May 2021 09:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hoSNjEb6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239516AbhELQJs (ORCPT + 99 others); Wed, 12 May 2021 12:09:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:40396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbhELP3F (ORCPT ); Wed, 12 May 2021 11:29:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 24CB8613EB; Wed, 12 May 2021 15:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832520; bh=IqrkexZiYUYNlsPW7FcNADj1RgE+DvMZMMInsO/nQT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hoSNjEb6A8NOaSLDC1NI8vbSQQs0WYLbrP+toN6fdWb+F0VkAl/YtO+ye1JJAU8CO jSmju0mMCoKCBga/ROHXCCAsm8vo6g1Wm6mnIrxBrXsaIUKpZBSsP8rtomD/uPMgh/ rkuoiAm1u4qwTSW1p0fifPOswrzXc4RpaSxO5Pzo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Laurent Pinchart , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 313/530] media: i2c: imx219: Move out locking/unlocking of vflip and hflip controls from imx219_set_stream Date: Wed, 12 May 2021 16:47:03 +0200 Message-Id: <20210512144830.094192632@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lad Prabhakar [ Upstream commit 745d4612d2c853c00abadbf69799c8aee7f99c39 ] Move out locking/unlocking of vflip and hflip controls from imx219_set_stream() to the imx219_start_streaming()/ imx219_stop_streaming() respectively. This fixes an issue in resume callback error path where streaming is stopped and the controls are left in locked state. Fixes: 1283b3b8f82b9 ("media: i2c: Add driver for Sony IMX219 sensor") Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/imx219.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 0ae66091a696..9520b5dc2bc7 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1047,8 +1047,16 @@ static int imx219_start_streaming(struct imx219 *imx219) return ret; /* set stream on register */ - return imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, - IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING); + ret = imx219_write_reg(imx219, IMX219_REG_MODE_SELECT, + IMX219_REG_VALUE_08BIT, IMX219_MODE_STREAMING); + if (ret) + return ret; + + /* vflip and hflip cannot change during streaming */ + __v4l2_ctrl_grab(imx219->vflip, true); + __v4l2_ctrl_grab(imx219->hflip, true); + + return 0; } static void imx219_stop_streaming(struct imx219 *imx219) @@ -1061,6 +1069,9 @@ static void imx219_stop_streaming(struct imx219 *imx219) IMX219_REG_VALUE_08BIT, IMX219_MODE_STANDBY); if (ret) dev_err(&client->dev, "%s failed to set stream\n", __func__); + + __v4l2_ctrl_grab(imx219->vflip, false); + __v4l2_ctrl_grab(imx219->hflip, false); } static int imx219_set_stream(struct v4l2_subdev *sd, int enable) @@ -1096,10 +1107,6 @@ static int imx219_set_stream(struct v4l2_subdev *sd, int enable) imx219->streaming = enable; - /* vflip and hflip cannot change during streaming */ - __v4l2_ctrl_grab(imx219->vflip, enable); - __v4l2_ctrl_grab(imx219->hflip, enable); - mutex_unlock(&imx219->mutex); return ret; -- 2.30.2