Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3643184pxb; Mon, 24 Jan 2022 14:14:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGvHm5JK2AhCLGYTbj8IUgGEIqAtSVsQKrt1whJPhXBxaOSBfUx9H2KnbTkoZtV7nVcoc7 X-Received: by 2002:a63:2bd0:: with SMTP id r199mr13241551pgr.57.1643062481757; Mon, 24 Jan 2022 14:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643062481; cv=none; d=google.com; s=arc-20160816; b=d2Dnz6StAJxHfQG2/RhEXCbRBa4H8YFnTHXsGnEB6jcCD7CFVtlYV6GkakEjq5ZnIZ ZwAmwpHg6AulOKO/5B1bgG6Xyz0IsTVnRItaTuF+XXnw05A0nP3jNMV0KHAp2YNC+HDI +lL2RzLAa+KHt94QFmP+E87fgdpKkHOZYdZiRDxjOPp9OxmhtzsDRA4BcxqtMyblX9kW OSbpCwSjTh5+G2LUtgL1aBeBv8Dv8Z+VY2Jo2+L+PWDILmt/Q5Zd+god3NpFemDuPL3u Vx92T/IK/eT3ZayPYTo9ovVcroI7UZdV6hWqezKmlCoLUUZBUzSCZhNtsSiZiDNnUCBn 0i8g== 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=wp0+D2MCoZ7S0aSKazdKIbRr6LRDP86jnIVGbswKClc=; b=L10v0ecpIBoT+sz3pSnjUiHW4DMvfAH+b+cbh0Y0W9199tuDpTb+Z8bj0WJr4EXpto TFf+k7dBc/AP9sFlVPU3l7gvDj5s/vvT2rGHIZadBgqx7XxrzjbuoBsLsP34UMM9kJpY jqszvicRviRPLcwXrj2raZM4fd8f30SUSvKbfUhonKd2oUt5p2RgLx/1JxfxGSGWNCLG +f9MkK3zEAxRXQRm6pQuj6ehuKGdH2mmwPRrysr1ae6M+ZW24SbrAhbXpkEsOq/5aCuH VExeZ+LUKFmg2TMie7I/oVF+PW80r7oaF39pSpoW7HzkJV3mqbvkqKxZRcg1daLudYNM Kr7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ig7ub3xR; 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 ob1si583011pjb.8.2022.01.24.14.14.23; Mon, 24 Jan 2022 14:14:41 -0800 (PST) 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=Ig7ub3xR; 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 S1579532AbiAXWFw (ORCPT + 99 others); Mon, 24 Jan 2022 17:05:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1451799AbiAXVXg (ORCPT ); Mon, 24 Jan 2022 16:23:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46451C09B060; Mon, 24 Jan 2022 12:17:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA3CF61497; Mon, 24 Jan 2022 20:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EAB5BC340E8; Mon, 24 Jan 2022 20:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055463; bh=ckyorOORVsIp70Q+mkMHGOBzftHyZMq+cQA994k0QLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ig7ub3xRW0Gel/f17JUAIQB80Phg5755om/lEaAyQM9vcfeByQGB8Ueg4/Pnhu3JM IaP7GPJOeJ49dvvo0Swhmzv37J7/V6Ug57BMr+IPE5rsw7jKCUjYL+0aE+LALZqiAJ 8AmxnKdNsVG/zFcTH5/WA2Tsg1MepNlh+AiVXsVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 160/846] media: i2c: imx274: fix s_frame_interval runtime resume not requested Date: Mon, 24 Jan 2022 19:34:37 +0100 Message-Id: <20220124184106.503558732@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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: Eugen Hristev [ Upstream commit da653498c20ba5b185214d8ae43b4e8e9594f520 ] pm_runtime_resume_and_get should be called when the s_frame_interval is called. The driver will try to access device registers to configure VMAX, coarse time and exposure. Currently if the runtime is not resumed, this fails: # media-ctl -d /dev/media0 --set-v4l2 '"IMX274 1-001a":0[fmt:SRGGB10_1X10/3840x2 160@1/10]' IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 3840x2160, goodness 0 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1920x1080, goodness -3000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x720, goodness -4000 IMX274 1-001a: imx274_binning_goodness: ask 3840x2160, size 1280x540, goodness -4180 IMX274 1-001a: __imx274_change_compose: selected 1x1 binning IMX274 1-001a: imx274_set_frame_interval: input frame interval = 1 / 10 IMX274 1-001a: imx274_read_mbreg : addr 0x300e, val=0x1 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register SVR = 1 IMX274 1-001a: imx274_read_mbreg : addr 0x30f6, val=0x6a8 (2 bytes) IMX274 1-001a: imx274_set_frame_interval : register HMAX = 1704 IMX274 1-001a: imx274_set_frame_length : input length = 2112 IMX274 1-001a: imx274_write_mbreg : i2c bulk write failed, 30f8 = 884 (3 bytes) IMX274 1-001a: imx274_set_frame_length error = -121 IMX274 1-001a: imx274_set_frame_interval error = -121 Unable to setup formats: Remote I/O error (121) The device is not resumed thus the remote I/O error. Setting the frame interval works at streaming time, because pm_runtime_resume_and_get is called at s_stream time before sensor setup. The failure happens when only the s_frame_interval is called separately independently on streaming time. Fixes: ad97bc37426c ("media: i2c: imx274: Add IMX274 power on and off sequence") Signed-off-by: Eugen Hristev Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/imx274.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index 0dce92872176d..4d9b64c61f603 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1367,6 +1367,10 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, int min, max, def; int ret; + ret = pm_runtime_resume_and_get(&imx274->client->dev); + if (ret < 0) + return ret; + mutex_lock(&imx274->lock); ret = imx274_set_frame_interval(imx274, fi->interval); @@ -1398,6 +1402,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, unlock: mutex_unlock(&imx274->lock); + pm_runtime_put(&imx274->client->dev); return ret; } -- 2.34.1