Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2018920lqa; Tue, 30 Apr 2024 06:22:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6F+U934omDKVpCsQKqycF2QErJ/q3pof6fq574R5cvUuvuCp99VN5+wDxBAHINNpFiDsEtzMOBbqgRJaYi7XoDoBLOF5L5OY2oMFNow== X-Google-Smtp-Source: AGHT+IEgnh6coPpaJAtJwWmmvNUGinrP17ZBI06K4IKFa6QEcR6YGwr2MDFvyS2PyaRCvIQEW3W9 X-Received: by 2002:a05:6a21:9995:b0:1af:51f9:8597 with SMTP id ve21-20020a056a21999500b001af51f98597mr4364202pzb.6.1714483349954; Tue, 30 Apr 2024 06:22:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714483349; cv=pass; d=google.com; s=arc-20160816; b=t2ICiiY7BYnohllWLQCUG59nbRSyDtOgAoOKg+io9G5f+VPkeWi3MDZDIRSDM9nmIR upE9wBEq4Of8FdQJy7uDn+0E78FckHi9RjVtc7jlhBifocPcSArXN42TdFG5d7mUZYud c8Z5p9INBiU1SA4MP/5zDOdqtG2ciyA2MH9B6BsSjvlvsBwYYXm+r6jrGS0RiMVw859F 9I5KFClOIFETKQV+rlnLz+se9uOqra21t8HEq8LUeljJtcizMZEnwloPhmhCqoV7yWAa I/fK/dWoCSlpMiGKfRfFNuHj5xHWzE5lPuhM2eDq3E5ACeHJ0kIMWf6NSVjMdQa8WADB 0inA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jsBqYJUqIALBNEsrrvrGjLb+M32j/2md6rum60jfaGg=; fh=RuFaGV8MNU7EBTCW+thUKV+3otxe9qtmAbLEHIJsJ6I=; b=uPZQlnfZGEsXHV0dTyEfMbYlCgup6EDfNW5Se4+lfdq/oL7yUe2L81n1ygmi0ccacT l241wBeRA1QPL9Xw+h8DQWc6QiGlGQ6NzxYVBywqOy0tUH2ZZeEgdl5RZF5Fcs/zOwUA yDZocS2E8JfahiXqXmSxo2nveXOCfx46x5X9LJdx5VpsfWQBw+AJvrKlxtFofqv3eMxL Xz/AqV5EZXCAV57oo6dwUApUHYibsgVo0X8vPcOh8dziAJEgMRp1qxcBq5JT7CLZLsWG DyEi6RctXvjdntRrlcOCkJwzD/dRYNy90ELSPCP9Ldwz1T3T1XpJXzW4mintu99TFpNJ 5VcA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oENGpKbS; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-163991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x124-20020a636382000000b0060473c6a1ebsi12637669pgb.104.2024.04.30.06.22.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:22:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=oENGpKbS; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-163991-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163991-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 933E4283A7A for ; Tue, 30 Apr 2024 13:22:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2A65176FCF; Tue, 30 Apr 2024 13:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="oENGpKbS" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FDA0172BD1; Tue, 30 Apr 2024 13:20:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483238; cv=none; b=uFRUIj/GMnniqc38kKODktYjmWlBKF/kUAt3dR56bBxHaZD4QR7KH7E1mF1z+gIKR1bY4lay8w0b5rqCq+/DU918vxcf9mBU8uQP2ECl/3nQ3XhhHvGYoRwW4e9GMiaWyeQ8Vh3GWfG2YywR8PfX7sNoL7YFFds7WcsqHk0aZtw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483238; c=relaxed/simple; bh=QZpQRgobpHQl9Ix8vXok8CWGEIDsu/GsRRB0lJ2O/xQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XeURUALkUaLN67yiaxg8ES7cnu8wfrhJ2VRva5YRPYUA2qVcsFJcXcmM14ubFXNkLTLyuPJKLbZq4xbneJbW6fXv0nxzBN3mj7koJmoYedKGAuk9cJ4Q5Kbkf2KIPiXhz7A/tk06jyHU5v1p/ZvolpDJsa+F9v2ZZo7sbTVNoSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=oENGpKbS; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1714483235; bh=QZpQRgobpHQl9Ix8vXok8CWGEIDsu/GsRRB0lJ2O/xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oENGpKbSgfqGHVSamLzVNMuPo//MNqVwwyi8QzRy0dgP45z6Wrp5FtKb3fCmQ3RPt qTIdesRXp+yDVYLTQEPtRNvkoIxPDdEaJerX0y07Lhm6AvCXQFkmf3v4h1w31Ab41n aYXNtOejMJHi4T4CwiuXzz0QIRN+U+EYEF3JoQy0/qT2NTRQwdcVoPBzTAgLaHOdAX 2p1iKy4wLFoMHzUzrlIXoDurOdwKCDIOK+6xUYsQM42YjWHLL58mqftBtXfUnQbLQx Uh24JeiW2nAWvE7WukXpzT05nXHjUa1AwJCZaiZepw3c3Vz5D4IB8/lLRrRHCzZH/5 OKoJcCGB1ib9A== Received: from apertis.home (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: jmassot) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 2A587378212B; Tue, 30 Apr 2024 13:20:35 +0000 (UTC) From: Julien Massot To: linux-media@vger.kernel.org, sakari.ailus@iki.fi Cc: devicetree@vger.kernel.org, kernel@collabora.com, linux-kernel@vger.kernel.org, mchehab@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, Julien Massot Subject: [PATCH v7 5/5] drivers: media: max96717: stop the csi receiver before the source Date: Tue, 30 Apr 2024 15:19:31 +0200 Message-ID: <20240430131931.166012-6-julien.massot@collabora.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430131931.166012-1-julien.massot@collabora.com> References: <20240430131931.166012-1-julien.massot@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Stopping the CSI source before stopping the serializer CSI port may make the serializer not respond. Then all the next writes to the device will fail. max96717 1-0040: Error writing reg 0x0308: -121 max96717 1-0040: Error writing reg 0x0006: -121 Fix that by stopping the CSI receiver first and then CSI source. Seen on max96717f revision 4. Signed-off-by: Julien Massot --- drivers/media/i2c/max96717.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/media/i2c/max96717.c b/drivers/media/i2c/max96717.c index 1ea76f922bdb..499408837aef 100644 --- a/drivers/media/i2c/max96717.c +++ b/drivers/media/i2c/max96717.c @@ -384,24 +384,23 @@ static int max96717_disable_streams(struct v4l2_subdev *sd, { struct max96717_priv *priv = sd_to_max96717(sd); u64 sink_streams; - int ret; + + /* + * Stop the CSI receiver first then the source, + * otherwise the device may become unresponsive + * while holding the I2C bus low. + */ + priv->enabled_source_streams &= ~streams_mask; + if (!priv->enabled_source_streams) + max96717_start_csi(priv, false); sink_streams = v4l2_subdev_state_xlate_streams(state, MAX96717_PAD_SOURCE, MAX96717_PAD_SINK, &streams_mask); - ret = v4l2_subdev_disable_streams(priv->source_sd, priv->source_sd_pad, - sink_streams); - if (ret) - return ret; - - priv->enabled_source_streams &= ~streams_mask; - - if (!priv->enabled_source_streams) - max96717_start_csi(priv, false); - - return 0; + return v4l2_subdev_disable_streams(priv->source_sd, priv->source_sd_pad, + sink_streams); } static const struct v4l2_subdev_pad_ops max96717_pad_ops = { -- 2.44.0