From patchwork Fri Oct 4 14:46:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833288 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 2D40F2194A2; Fri, 4 Oct 2024 14:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053237; cv=none; b=RasuRHit37PjakYgs6YZ/765Bal1EPYfLQS2mwuHTtM5hlFTk3oKmaX50sb6aaTAAQLfNdnHTakIcd8xh3dQl+ZESjDefJkpz7BKxP7GqcBGg+98bdu1od0zgf4kcu6oSWstKtcsgiMqVGalECoO9YEGx3piPy06cOtUDoBLHBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053237; c=relaxed/simple; bh=jVVpja8HJr5tS26NiZRTQ7CgBBdWwcmpPnoC69uSxE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D0fFvI1ZRGUNxm+M2yeJEBiJ6O7EbY8lYpiGOvxO6m5z3gCCp9qpWJkeVYcM5U6F5OTlj4rFplfeC6kBgoN2NMQtZCLf+Bf9y9HXhakLzwJPWl8YXIUZLW1GAs5L1ppdEFXmOna/wPtEjG2d5R0Z5yc8YqTeZHNyqm6tWbcjqqo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=tKm/zeBY; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tKm/zeBY" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 094D059C; Fri, 4 Oct 2024 16:45:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053140; bh=jVVpja8HJr5tS26NiZRTQ7CgBBdWwcmpPnoC69uSxE4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tKm/zeBYbIU+KqRJTxCR1oXAcabPWn2rZxiSSjCxz0rxWpi1ofcw34GQWmZ8SSvqE /yURLFB3v+Xrr0jn0MRYDUDwlI8pcR3FmI+eTcaRQlkCse+bJBvEdZjNuYh6ruPd16 lXFsRBWOlIJygJ1DwYWrgMl9EbnumASv5Oxypfdc= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:32 +0300 Subject: [PATCH 01/13] media: i2c: ds90ub9x3: Fix extra fwnode_handle_put() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-1-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1669; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=jVVpja8HJr5tS26NiZRTQ7CgBBdWwcmpPnoC69uSxE4=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///s1QcMHkesnhTHxh1jern33gDE8+jLjmcua SV1eetVijCJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7AAKCRD6PaqMvJYe 9al9EACdSBxidw6MmXaZsXNDGnuXYfShvvY5SwCFMHIHiXcS/orQCCiuaVWLcpUM7rr3jqo5/Ah pOCA2lSaMShV476fUTKGFpjlfWull5icK2VojfCrf+2O7VApoHX2aiNUgX8taBUqVahZLPurdLl SF7OaUwSkjimK9IZplHsKKO4P+jSx986HsPrC3xwxiw0pQJw4hEAa/Mzq4AVKRKXCi5Rzaz5KLM NGYvEV7nKpgCxF0KdIAjl+g8o1lO1zVBasSsheZkq46JJBd9qic65RrIGcUScj3mqJP2OCKe+Gc 7Y5ZUNLIuDrMfKkpZCRgijsxpWfPY/1deiKqaIlUwXo/iMn1TFAYDSg1Udv4UunFBdP4Ewzu2Oj Ml6qXu1HNmPt8/XDdU50ZG5mRTf4dOoFhNNV0h46qNHxXMG0elQb0/r35byx9Avml/c2SdH2zBE OwHkhDoyyEQD5zpbroNja63v4vWYBX542taGBDFTohsRw+VFvLTFbgRIHosGHu0p5O9ennQWu90 cJEti07jMh8EJqBVIxXkBFNXCP7CUd3jhxX2wO9IxVMzbpscPlJS1XZXjPBw5owuHnW/amzUW7+ byd1LOAqdONdgIWbxB3gJdjzJagt1RG/IjVkIKxJgfr8v/LI+l74+DdZvCRBDRvfbsIL9aG8HLN UHdQR2yPtjye0pA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 The ub913 and ub953 drivers call fwnode_handle_put(priv->sd.fwnode) as part of their remove process, and if the driver is removed multiple times, eventually leads to put "overflow", possibly causing memory corruption or crash. The fwnode_handle_put() is a leftover from commit 905f88ccebb1 ("media: i2c: ds90ub9x3: Fix sub-device matching"), which changed the code related to the sd.fwnode, but missed removing these fwnode_handle_puts. Signed-off-by: Tomi Valkeinen Fixes: 905f88ccebb1 ("media: i2c: ds90ub9x3: Fix sub-device matching") --- drivers/media/i2c/ds90ub913.c | 1 - drivers/media/i2c/ds90ub953.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index ca9bb29dab89..150d6641516f 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -793,7 +793,6 @@ static void ub913_subdev_uninit(struct ub913_data *priv) v4l2_async_unregister_subdev(&priv->sd); ub913_v4l2_nf_unregister(priv); v4l2_subdev_cleanup(&priv->sd); - fwnode_handle_put(priv->sd.fwnode); media_entity_cleanup(&priv->sd.entity); } diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 16f88db14981..10daecf6f457 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -1291,7 +1291,6 @@ static void ub953_subdev_uninit(struct ub953_data *priv) v4l2_async_unregister_subdev(&priv->sd); ub953_v4l2_notifier_unregister(priv); v4l2_subdev_cleanup(&priv->sd); - fwnode_handle_put(priv->sd.fwnode); media_entity_cleanup(&priv->sd.entity); } From patchwork Fri Oct 4 14:46:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833287 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 02C63220802; Fri, 4 Oct 2024 14:47:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053242; cv=none; b=MW4Bsq3vjY6GxlZg/IPNU/jycS/v0Ogch8U7VTyVawzdTu9h8l+0YtHvhy5C2lATg+4TCmvVGInZuyCikIB6Y72Q4rVAbBb/ts2LGI0+RG69zzAt6lKTvJWo4/FJz/s+W0hcVEZNwhBDkhP66yotMbs/lmd+FUooevqrv8y/5nM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053242; c=relaxed/simple; bh=dW1qzALQAuTsR/DlBA4YNdLa29WamlEcXrtjr7uIUrY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qz3K++a9089YVydam1Qbx7USqx5uhTlGhsvrXAGYq7xlf+qJWLNQ5CR7NXgfslpGX0eW/FVpehdJlpRC5VGaCl3bZMLMswh3eU02h8dwvhwk7ULlPiaJ+5plxhlZ/PNy2LRJtkaFIqUdAZwIXDL8bqgLlzrHlp7KBDYT8rLCfp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=JyyoEceV; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JyyoEceV" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 993148A9; Fri, 4 Oct 2024 16:45:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053141; bh=dW1qzALQAuTsR/DlBA4YNdLa29WamlEcXrtjr7uIUrY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JyyoEceVs4ENW6WGb/MF86Pah/nIpaUPeSujbC9NmbEDMwXtXVvIuWMhzzXXVqQSN M0uCqSE5ApFz6UaSnRFqUC4DmI2J7gpc4jSL0qljq9i9FggLCFJhgoCn7PWgVAUyCe lgqWibG3/EVpYeVriyPHWu/7BYpyzJ9F0Va7jV7c= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:33 +0300 Subject: [PATCH 02/13] media: i2c: ds90ub960: Fix UB9702 refclk register access Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-2-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1313; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=dW1qzALQAuTsR/DlBA4YNdLa29WamlEcXrtjr7uIUrY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///sftMFUGqc0fsRuyEXu57S2uoxupJvMsgd5 eA/8gAAWCOJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7AAKCRD6PaqMvJYe 9U/GD/9E30mYm2kZUyfEPWdfT30DtuW0A/aTdCSVq0anCP8oCR1fLHI7XiaL+L4zlfJXHyTqHxj cF/uj6WQBobMw7QEfGt7XX48TCf00tkYAazzP45ulIkfw8TipO7bjCCS2AcasH4q5tbhfK5XhPZ EQnGqW+Vvq5UHiwxlRuh/ayNvulmiMkEmQKzc9SPJ4Lvw5NyfG85dX/ijkWBUP1Qm54FZ4iKUkL 6G8pKHnHWJlvFo2oWabg3jGS3Ww/ItZfzXiX7VGK+/jk/9lGNlIez60mPXZBsCkZzibddLH1x1v VVaRTkVP74I2GHNbPS9OIeUa2euS24FIEG7Rd4fRqbWan5xP0KJRXKzvBo24h3DVddjkpyIueAA +K0j8atTJSjdKRBbno75gPOSC2ja/PKGlu1za0sniQZmAmbJO7RAh0dlqbchKLShhPqzil4DKbW npGaWdjSAosLNoAZzrNQdu1Mw5q3HTGHmzIdcBenfxaqcYGjloOje0duWpqom9+KCPCjMddwKMr GxI42QENIhhEdS+uYkQaq1uyfvdQobfUSKlt+AU0oIWPvmCGcf5yhRpP5MY4dRW4QDqoS7K08la ZKzR0pCapEdXPqX7awnWcWSnaTda/CQeyo/h2Lf3L15Jzx5SYfcrmY28bhAzViKvJO3rFfF2IAY wzbSDiW42ixMuMg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 UB9702 has the refclk freq register at a different offset than UB960, but the code uses the UB960's offset for both chips. Fix this. The refclk freq is only used for a debug print, so there's no functional change here. Signed-off-by: Tomi Valkeinen Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") --- drivers/media/i2c/ds90ub960.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index ffe5f25f8647..b1e848678218 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -352,6 +352,8 @@ #define UB960_SR_I2C_RX_ID(n) (0xf8 + (n)) /* < UB960_FPD_RX_NPORTS */ +#define UB9702_SR_REFCLK_FREQ 0x3d + /* Indirect register blocks */ #define UB960_IND_TARGET_PAT_GEN 0x00 #define UB960_IND_TARGET_RX_ANA(n) (0x01 + (n)) @@ -3837,7 +3839,10 @@ static int ub960_enable_core_hw(struct ub960_data *priv) if (ret) goto err_pd_gpio; - ret = ub960_read(priv, UB960_XR_REFCLK_FREQ, &refclk_freq); + if (priv->hw_data->is_ub9702) + ret = ub960_read(priv, UB9702_SR_REFCLK_FREQ, &refclk_freq); + else + ret = ub960_read(priv, UB960_XR_REFCLK_FREQ, &refclk_freq); if (ret) goto err_pd_gpio; From patchwork Fri Oct 4 14:46:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832881 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 47CD42207E4; Fri, 4 Oct 2024 14:47:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053240; cv=none; b=PzaJ4bFdfBCEGu+ecOPo+Z7OfCl1BiR57pixTcr1lEBw8q6cE6HOjO+Nd+3+XrS69YaqJuGkl3AnacLBZxpHQNknKf1P5EyfIWkeF+WsGovsIGdetJ3hQ9BC9iUS8BKWfiQ+59Bb/pvwSZSp7ZruPhq3DagePq4/bMcVWTGHTm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053240; c=relaxed/simple; bh=KEJUa+NA275qqmfLngLNAjLh7UNjtzQi4qbdB1cIyjI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghAs++20g/DGt8oLJNBVMlYxWL+hIXWGBGYc1Y+S9Pieoytgfzv//bVvxfVgPdSbwP247k4BYe3rIcCkNVtqLhi4oLclolidrwXGOWwUrEZVKyA6mVI/4SmnTO/3q/xrgy3WEh5MidAB3695FN9KXAuTF82WLNeKC7lzoZ1sHUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=BiKGrvZP; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BiKGrvZP" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 32C89C62; Fri, 4 Oct 2024 16:45:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053141; bh=KEJUa+NA275qqmfLngLNAjLh7UNjtzQi4qbdB1cIyjI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BiKGrvZPt+oMw8JaZ8ZLefnljaJuH6Ta3wYOfrkWiLRs5vySNrk69iFGuCuEBJRUM iOjrAlXu5QuDQUoYc+/KphP/UxBcJH9i9XT/GXp0/gg51QNiSPnGjEFL0kBkxJMkFw uwtfqq/GHRvAZPzo2EuwL1Zn7+GwQUzRM11ZFfpE= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:34 +0300 Subject: [PATCH 03/13] media: i2c: ds90ub960: Fix use of non-existing registers on UB9702 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-3-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1652; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=KEJUa+NA275qqmfLngLNAjLh7UNjtzQi4qbdB1cIyjI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///s2ux6qwYAUE+td6KVRjl5XcLMg84d2E2lL 4Xj6JvlnAiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7AAKCRD6PaqMvJYe 9flJD/93tn6ulLNHvyRnRs0Bc4xTu0yf2Vbpfrc09Sa9WeeGT7Ds2oqinUSreMJcqE2b10yn0nW wvfwfNOr1jkf0T6ykSJouVF7iPL5eTaLmBpFK09AXI+y4YTrGyvXcwiZY50LATctxYOSYhxMI+3 utFmFu7MCWZKtoJZmbqFMvwkprF4DQicPx6NgIgusTTAYa3Ec0H2YKGwLXhoTN0u088sRNLyuab GSCApE6Dy1KctgD1yEVNiNVEFB8jRViXxLounyEzSgTkQP3pziMyRBBpeN+MT0bt58bCWnxa57a bZHsa5GI4sTsh1d1tFUh5jWdKe2LSDWcbqfNCS4T+6LE6o9TJXbyfySG/jVCABRnOxorh8wo78m 8BKbq9iq2sNuSOo1mu/AB1RyHsbQ7Pcy3tdLRbKZgB86CiQRKNsHoORt1w4hYRw6AlIyLgo2tGp uscu7Lr7az1S+NWiPt5UF0r8jdmHdpZBwLbwsa7vEV3MwLNyqsLBXjGeCJuFe5aoOGgl/jFjzTM AYKSzoVI58mhzKWyvou+Ac8nP61XG1Y+7T6UVZNNi0Nr0rCikNGVN1mv+gxEx0zEJICoYSMhU2N excVdjhZCNcBbSXcUyNPvPWyHTxDWdSs6vKNIeXBc6ieUsDl0kPhrUoVeGGp1Wp3z8VFi69cTby xWH/bKhfKaLfTpA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 UB9702 doesn't have the registers for SP and EQ. Adjust the code in ub960_rxport_wait_locks() to not use those registers for UB9702. As these values are only used for a debug print here, there's no functional change. Signed-off-by: Tomi Valkeinen Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") --- drivers/media/i2c/ds90ub960.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index b1e848678218..24198b803eff 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -1577,16 +1577,24 @@ static int ub960_rxport_wait_locks(struct ub960_data *priv, ub960_rxport_read16(priv, nport, UB960_RR_RX_FREQ_HIGH, &v); - ret = ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); - if (ret) - return ret; + if (priv->hw_data->is_ub9702) { + dev_dbg(dev, "\trx%u: locked, freq %llu Hz\n", + nport, (v * 1000000ULL) >> 8); + } else { + ret = ub960_rxport_get_strobe_pos(priv, nport, + &strobe_pos); + if (ret) + return ret; - ret = ub960_rxport_get_eq_level(priv, nport, &eq_level); - if (ret) - return ret; + ret = ub960_rxport_get_eq_level(priv, nport, &eq_level); + if (ret) + return ret; - dev_dbg(dev, "\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n", - nport, strobe_pos, eq_level, (v * 1000000ULL) >> 8); + dev_dbg(dev, + "\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n", + nport, strobe_pos, eq_level, + (v * 1000000ULL) >> 8); + } } return 0; From patchwork Fri Oct 4 14:46:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832880 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 48286220815; Fri, 4 Oct 2024 14:47:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053244; cv=none; b=JNRciiGPnIDzFPlW8Alw3T7yRPpxV+/uyLuFYZSeTeBoDKAkIZXB0DKBSZv7KtIxBfwnUiGhoLWzXCE3lAXmGoz1kfJV0gaFhnXnWafaMUqTBBuwlVO3M4w5A1iZLoqUjZxxe12WiNOwwWHRmKV9Or4F7lrOhioI+pSjZdTkrzs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053244; c=relaxed/simple; bh=PJSBX2bzqYP3+CKy9n8zSfhEFQa7EPI7dXwzmn9Bo1w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A4BL+fEALJ86yQZX2FjW2OOtg9Gz1DNqQHPxclXjK4yq2yQ2K1j3XzDryB0/7+gtB0nS10Qu4nupH6xg2/qPF9mirCTeOLqThz9fkeOf4GNi1+idljfHpAj6kF9WZaqWuZgNRfWiE7Jd94hAPnRT2BkP8CpwJsNE5MBHlSO5NBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FeoqdJJn; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FeoqdJJn" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BF6DEC8A; Fri, 4 Oct 2024 16:45:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053142; bh=PJSBX2bzqYP3+CKy9n8zSfhEFQa7EPI7dXwzmn9Bo1w=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=FeoqdJJnF+8KLup/lK2Qv12DTZ+0Sw+stb/lYGMmqAwsxHoG0RjOAh/ILeZxjkC5L ZeN5CEI+ucBrboZ0TYatYbjYt1T/x/NghnOY5CMeTX/Ei/GAxAAmT+qt0LNGx0QC11 kNF0T91FgBB2+tB8d9ksKcsk0IjnbfqOYWB7rHBg= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:35 +0300 Subject: [PATCH 04/13] media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-4-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4113; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=PJSBX2bzqYP3+CKy9n8zSfhEFQa7EPI7dXwzmn9Bo1w=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///txobIvR1pOFoUp0y17xNQxSyjk77xdBspu hJ3SHKZUASJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7QAKCRD6PaqMvJYe 9QMvD/9h115ssOQMTWhn/Kwb/OWKtnGZ95wUDA2iLZE8tnB/y9yD99rMK12c4laUMFZ77c6O8Po vGoaYOuEvv8ZygEcdtcBLvYuIIcm/w5DAWpRai1LxwBPVfSEtjR0W2zSdQw0q6L3gZUmHg5gQHS iUbOXtx+0GJ1cSW4Dqltnc5pmsYxWLv3a8AIHnYUM04ZcCGConiV9yH0KGnrrfi/pt5X+3PIRt+ q8B3aruwovIselV2WGq5g8PcZLOpvVFxx+u05o5APQcL+zU1/WmhrTyhLlntzCMPgzgFXczN7zj jBDfpZaG+aq5GUg6nEFcfL/VRMVtmDqGmuitM7VJwXwOL1M9LnM8/S4R66ghR/spr75DT8PVXfr gY+GgQaNlnr5t8nWwXeQ5ZT6xl0Pfq7iLhhoD/Cv8IJjFYFseEHGYGkof1zuU0TCXYJWZQazysE S6Fr97Bfmb7g+9+zqy2q2aOr5uqmlDt1795gyXLXnUVyVp8Lr/C5mvzrYd2njYHJZu/pKXzjvDy Dzs/s40JjFJY5P82mqSZ8JBjM6V2C2QEDS68AesbYzUyr9C6ZMKHoz/x55KhdRgpFIPel+mY/oh 7C2hLHoNeo8RkRHe4vCsu54Maz3Lv4uD5w0ix2GT+EZ1gT8P33SJiDRMjCpOc7kRswS7bvtFcQR YDPCoXyrPVB4zjQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 UB9702 does not have SP and EQ registers, but the driver uses them in log_status(). Fix this by separating the SP and EQ related log_status() work into a separate function (for clarity) and calling that function only for UB960. Signed-off-by: Tomi Valkeinen Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") --- drivers/media/i2c/ds90ub960.c | 92 ++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 24198b803eff..5c393ec6c682 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2950,6 +2950,56 @@ static const struct v4l2_subdev_pad_ops ub960_pad_ops = { .set_fmt = ub960_set_fmt, }; +static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv, + unsigned int nport) +{ + struct device *dev = &priv->client->dev; + u8 eq_level; + s8 strobe_pos; + u8 v = 0; + + /* Strobe */ + + ub960_read(priv, UB960_XR_AEQ_CTL1, &v); + + dev_info(dev, "\t%s strobe\n", + (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) ? "Adaptive" : + "Manual"); + + if (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) { + ub960_read(priv, UB960_XR_SFILTER_CFG, &v); + + dev_info(dev, "\tStrobe range [%d, %d]\n", + ((v >> UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT) & 0xf) - + 7, + ((v >> UB960_XR_SFILTER_CFG_SFILTER_MAX_SHIFT) & 0xf) - + 7); + } + + ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); + + dev_info(dev, "\tStrobe pos %d\n", strobe_pos); + + /* EQ */ + + ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v); + + dev_info(dev, "\t%s EQ\n", + (v & UB960_RR_AEQ_BYPASS_ENABLE) ? "Manual" : + "Adaptive"); + + if (!(v & UB960_RR_AEQ_BYPASS_ENABLE)) { + ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v); + + dev_info(dev, "\tEQ range [%u, %u]\n", + (v >> UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT) & 0xf, + (v >> UB960_RR_AEQ_MIN_MAX_AEQ_MAX_SHIFT) & 0xf); + } + + if (ub960_rxport_get_eq_level(priv, nport, &eq_level) == 0) + dev_info(dev, "\tEQ level %u\n", eq_level); +} + static int ub960_log_status(struct v4l2_subdev *sd) { struct ub960_data *priv = sd_to_ub960(sd); @@ -2997,8 +3047,6 @@ static int ub960_log_status(struct v4l2_subdev *sd) for (nport = 0; nport < priv->hw_data->num_rxports; nport++) { struct ub960_rxport *rxport = priv->rxports[nport]; - u8 eq_level; - s8 strobe_pos; unsigned int i; dev_info(dev, "RX %u\n", nport); @@ -3034,44 +3082,8 @@ static int ub960_log_status(struct v4l2_subdev *sd) ub960_rxport_read(priv, nport, UB960_RR_CSI_ERR_COUNTER, &v); dev_info(dev, "\tcsi_err_counter %u\n", v); - /* Strobe */ - - ub960_read(priv, UB960_XR_AEQ_CTL1, &v); - - dev_info(dev, "\t%s strobe\n", - (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) ? "Adaptive" : - "Manual"); - - if (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) { - ub960_read(priv, UB960_XR_SFILTER_CFG, &v); - - dev_info(dev, "\tStrobe range [%d, %d]\n", - ((v >> UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT) & 0xf) - 7, - ((v >> UB960_XR_SFILTER_CFG_SFILTER_MAX_SHIFT) & 0xf) - 7); - } - - ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); - - dev_info(dev, "\tStrobe pos %d\n", strobe_pos); - - /* EQ */ - - ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v); - - dev_info(dev, "\t%s EQ\n", - (v & UB960_RR_AEQ_BYPASS_ENABLE) ? "Manual" : - "Adaptive"); - - if (!(v & UB960_RR_AEQ_BYPASS_ENABLE)) { - ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v); - - dev_info(dev, "\tEQ range [%u, %u]\n", - (v >> UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT) & 0xf, - (v >> UB960_RR_AEQ_MIN_MAX_AEQ_MAX_SHIFT) & 0xf); - } - - if (ub960_rxport_get_eq_level(priv, nport, &eq_level) == 0) - dev_info(dev, "\tEQ level %u\n", eq_level); + if (!priv->hw_data->is_ub9702) + ub960_log_status_ub960_sp_eq(priv, nport); /* GPIOs */ for (i = 0; i < UB960_NUM_BC_GPIOS; i++) { From patchwork Fri Oct 4 14:46:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833286 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 069443DABF4; Fri, 4 Oct 2024 14:47:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053245; cv=none; b=Pu6x//M5JbqLlmx43zhIKxNBQldOwrsVNVSKr+ar07+nFByvKkUdcHsnWx5PEOirePeuL0GtBRaEnmUwrGJhF+tY+Bsr2UjilrweYyd7M5H7uwBdgnAMtAj/fPSvesrTH1WdaGVkv7abZzMyNWp58EgKnF6JKHztbUQ/8QjO/QQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053245; c=relaxed/simple; bh=m/agzLE2lwDPpvkW3rkxmsai5ULvAy4bkgrMDdi+ocI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JXIpXDkMl5eQx2vnGX49mPLtRc2l22ToLFqUxbqpzhOVkpU2owWQTrWo7S407/JjrtI2Z4Ce2md/MUSTz9jI1aslruiFmx7uyoVNxkmwHxVc/mPt1ZFk88CEkPzPgy6FVGfc0SyS3/j7UWGu2qGXpfzMLxqFPsGb+uNf61jnOjU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=eit4FMkb; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="eit4FMkb" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5764EE34; Fri, 4 Oct 2024 16:45:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053142; bh=m/agzLE2lwDPpvkW3rkxmsai5ULvAy4bkgrMDdi+ocI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eit4FMkbZQv/MKdpAJLPaGbwvIDe4FP2r9zPa41I+qGvcxCpCHHjIpuEddWwOGrpE bp/sVvhU0BgkNybcArQ5r2sgqtNPx4khgOjJogOPw14B3/CnmIHvDtGCIpZLW/VQ7n W/P/ufzaXuDGiXCI8m7jrp9zwuq53RZarwgM9iMg= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:36 +0300 Subject: [PATCH 05/13] media: i2c: ds90ub960: Fix UB9702 VC map Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-5-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1211; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=m/agzLE2lwDPpvkW3rkxmsai5ULvAy4bkgrMDdi+ocI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///tSjkFPYzlJ8H1Ay00+6rF4db6v3Fhxg19L CKVvDgDXSiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7QAKCRD6PaqMvJYe 9d2bD/kBlp6gRnmY6yA0FWM8j6ZYZQPfK1hiE82pIfONsZ8ZpkGD6527KTj5np5Od6qr2VBx1Iv ENRRiCbhY9lDCA/1kiGQQWh9zO2VuGDy/O+TfvoLU5cDIJZoAzfIBoXSUL09QejllpcWVgx2A5Y OG9l4bTTSrp4GVIfLHL3jQKNk2+3puMgBbcY7fumHsLXnBZxrtrHTiOrCiV+R+M18mH0QlS36u4 2dQgJeIMcpfaZ3WArvHXQyJyop/gf+EqQfTSOQL9hu5d4qcSqKBhd1ipX8xr6p/LaBEEiLXfcuH IquGDA8fv1s6QFIIAPk7lsy7A/iXXnaVKfvjMh9THLLlQwGPp1ffReEN1fRBpjB/EwlFxbTjv9a yQ0+ShBhRE/9gPRt/BUn1xN+QuMaZctfo02onaXDZjlba9PT7JOD3lOddEp1VV/VJN3YrcJ+pk+ xHAqQgzuBUUkFc/ZxSgHcaRLh/Mj2vIi8XtEdnCDblziqaUZ3hYQC1NU4BuGruCvlJdYonwSKVg LpehX91f4xI4ejgwu4IyoWdIYGG8v8TpVeZxcr5/kUpubUzwI3WLTV4Mhv/UrZT+CBGncmcEm2I pT+4EAInwguwilDUZ8CDzlmhddFC5b5FOG+6eSnNVVe6S/vwGItmQCNNuCiLlCQu/F67oC/QBw+ +HIgMebPLlq+GFw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 The driver uses a static CSI-2 virtual channel mapping where all virtual channels from an RX port are mapped to a virtual channel number matching the RX port number. The UB960 and UB9702 have different registers for the purpose, and the UB9702 version is not correct. Each of the VC_ID_MAP registers do not contain a single mapping, as the driver currently thinks, but two. This can cause received VCs other than 0 to be mapped in a wrong way. Fix this by writing both mappings to each register. Signed-off-by: Tomi Valkeinen Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") --- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 5c393ec6c682..9dc36bba0a87 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2533,7 +2533,7 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv, for (i = 0; i < 8; i++) ub960_rxport_write(priv, nport, UB960_RR_VC_ID_MAP(i), - nport); + (nport << 4) | nport); } break; From patchwork Fri Oct 4 14:46:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832879 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 026CE1AA781; Fri, 4 Oct 2024 14:47:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053247; cv=none; b=Nt+HIn0LxlzeuYldzVKlNImNv0EWOK8TPWu0jJz/4Fw2j3Ksx6CrNxk0tBbHkYKArNQxz8zAhkuYosMCzaQSdWM8Qt3NOeGR/3vsrQNbfz5J+xoWvKhiKN6smmojzFRrazUf6KgXu3rbycg1nPeLGerK5JUDewoH3pkIyFbiurY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053247; c=relaxed/simple; bh=qSsCPcVGpH7f2IeTssjNx0a1UIzRf92jRLnvfrYF2BM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A+hob0S7bIs0FTD8PSfKVQKm/APQXpDyI3FCB9yGBzXoywoApcF+lVMklGLN23jVVQWzQGOzSIqIqE1oJRR65jf6XlGiS5fCGC7rMzFIwhiSbF37dYIQJMzUW63T7nUk25Cea4KRivqpN55+7nGpBd3rVuNJLjgxGo7k6rBk8NU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=HmGQ9Fd9; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HmGQ9Fd9" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E6EE7EF3; Fri, 4 Oct 2024 16:45:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053143; bh=qSsCPcVGpH7f2IeTssjNx0a1UIzRf92jRLnvfrYF2BM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HmGQ9Fd9gK75DtvorqrZRhgDi3a9h/kdvRxATmYLjzQ6NM+ZfXRF33ojGrshY9x7b s2/6bI1iZmZcJ8U18RIDjt/gUwLdvSmfDudA35qmf3cf2DPCiKgvQ64uwpuwq8JQg/ eiKyWsWZDhRxtNxo+eHE+oJ0/LlShDQf0+YrlgD4= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:37 +0300 Subject: [PATCH 06/13] media: i2c: ds90ub960: Add support for I2C_RX_ID Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-6-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2244; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=qSsCPcVGpH7f2IeTssjNx0a1UIzRf92jRLnvfrYF2BM=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///tNONn6XaEMKvmcyGfNpIXPYdLRgDOf7P6z D7dnvDkcKaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7QAKCRD6PaqMvJYe 9SfyD/9vQ/T9R79l5MBY96j8Uhwh0l9YK8FvGuvfkMe9Flkpt+wXCKy6rpkUjYfcUEm06wdZKjH /39OCQILrbuXMUlhTapg8WGIc3z+C+LAokb8obV5uziCx6aLDObXgn0h7XqucuoeTYLS+grFXCu T+b+Q55f/B48PbF8e5voG48LkU10c3TKKT7nrUntXsxRQN1XkcZ5lNKdKeFBfgz05S5XJYsH9Sg +gU+WA+CDaVdGYhs1CyCWx1iOnxYYF437hEt8wRmz30w/mDNjXa7+Qjvc3W32rReiA0k4JRH/5J IlcFK9KLATNEF8TbM8T3KTlPNRVGcUwXvkMTp5nKcL2HVSD030dwa6nibtw1TgvzocQpPMBaMLw khmjVt8ohGolz8ZnJGWXzLQ4CBtN63ga7NzAe0YiDpyhSbzEJ+tHzpEb6FqeUczUywKffOZSgSF umgWaZ+qg4E7aFF83Y2AktqCSDYPb3+tyex4rwIvN+cskDKr9txXr35NmVW+epj2Z9CSAuA8WF/ vzzAfRz/UTnZl76G2Ba3f4yRRSKyVIE+tRx7scKefSVb3BcYjTv0/yL/vqk5vHxQWxbcYWc9Jog 1zSRoQCwiudT4mGyNHVg6WChqhpKcPipWWUWhsHn/BAsUq0SCWtaH6kebOhobGcInLYpjNXaSHx y3v7SHlkTSJzRCg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Normally the driver accesses both the RX and the TX port registers via a paging mechanism: one register is used to select the page (i.e. the port), which dictates the port used when accessing the port specific registers. The downside to this is that while debugging it's almost impossible to access the port specific registers from the userspace, as the driver can change the page at any moment. The hardware supports another access mechanism: using the I2C_RX_ID registers (one for each RX port), i2c addresses can be chosen which, when accessed, will always use the specific port's registers, skipping the paging mechanism. The support is only for the RX port, but it has proven very handy while debugging and testing. So let's add the code for this, but hide it behind a disabled define. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 9dc36bba0a87..5238088e23e2 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -54,6 +54,15 @@ #define MHZ(v) ((u32)((v) * 1000000U)) +/* + * If this is defined, the i2c addresses from UB960_DEBUG_I2C_RX_ID to + * UB960_DEBUG_I2C_RX_ID + 3 can be used to access the paged RX port registers + * directly. + * + * Only for debug purposes. + */ +/* #define UB960_DEBUG_I2C_RX_ID 0x40 */ + #define UB960_POLL_TIME_MS 500 #define UB960_MAX_RX_NPORTS 4 @@ -350,7 +359,7 @@ #define UB960_SR_FPD3_RX_ID(n) (0xf0 + (n)) #define UB960_SR_FPD3_RX_ID_LEN 6 -#define UB960_SR_I2C_RX_ID(n) (0xf8 + (n)) /* < UB960_FPD_RX_NPORTS */ +#define UB960_SR_I2C_RX_ID(n) (0xf8 + (n)) #define UB9702_SR_REFCLK_FREQ 0x3d @@ -4002,6 +4011,12 @@ static int ub960_probe(struct i2c_client *client) schedule_delayed_work(&priv->poll_work, msecs_to_jiffies(UB960_POLL_TIME_MS)); +#ifdef UB960_DEBUG_I2C_RX_ID + for (unsigned int i = 0; i < 4; ++i) + ub960_write(priv, UB960_SR_I2C_RX_ID(i), + (UB960_DEBUG_I2C_RX_ID + i) << 1); +#endif + return 0; err_free_sers: From patchwork Fri Oct 4 14:46:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833285 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 3A62B1AA79B; Fri, 4 Oct 2024 14:47:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053249; cv=none; b=cy0pB70R8JmhqTx8Ue+LxsZ+8oDggp6CJHHrTizytl/Mt2h0eE8DFCim6BCLHchpqgKVtFYw2beyxkeDlXNSEH4ToNSY5TcTjhQ66G9r5U6nVHMKSqBrrj5qRY+qKD44GLxLGEDTzw1OusYPK/+JzlBBl/vmrcga8sXkLk9gNhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053249; c=relaxed/simple; bh=YZwoXk1L8PJ7hPEEE4HBMEf7JF2aTivwff5T/dhxk50=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jbD0GBQZHhEpTvkNUHFXcWnojQu4sOXUqnaoDGVGbWrKWTUyIMdrFGSN6wAIgPIns89EV+y1K1nksHe57YKwAn8zliv76qbuql7pTZdtSGOna6xUYaCxiP1AmdPH1/Kpsw7MFlYWgELJmKSuaQlALqvxhGXW5PUKpa6Am5wjqkY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=vM3H1dAd; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="vM3H1dAd" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 802DFF89; Fri, 4 Oct 2024 16:45:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053143; bh=YZwoXk1L8PJ7hPEEE4HBMEf7JF2aTivwff5T/dhxk50=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=vM3H1dAd3Mv8C7eIub2xi87rHlTDfi+jloSUeldsDBs+5psqEYXpTExi9f229TfVE PDGSrKuYonLBb8M1HnNkGZ/Nlu+xDB7xEmb6lQkZLghZIAk0MbMOvpr8Zr6yoSzY8Z v0N+tGowIbh9T8MjVuJt0wGOol7dwogPNVqoBHRQ= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:38 +0300 Subject: [PATCH 07/13] media: i2c: ds90ub960: Add RGB24, RAW8 and RAW10 formats Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-7-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2006; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=YZwoXk1L8PJ7hPEEE4HBMEf7JF2aTivwff5T/dhxk50=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///ubNa/tNoH1W/FIvlR9qAZptXHoCIXsJw5H cuDizX7Fi6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7gAKCRD6PaqMvJYe 9QvhEACXMLAvEhGLpGRGz5x5/dSh89K2BualW4plfZNZctoDd7xjdthFVuy4gnLg48Pkyt4z7X2 GkrluMDRrYYNt/dweN2OeuTTZCPZ+W3ARvM++R+5P0XZGnfcNecxY/37HD5hiiVXY/8x99998dM FkUxEGLUUuze5Ru+IVqM+EK6oE0BGkgtbSvIKOMpo66OXjV/iuPPsYhFSA6ZHJ4sdrPHblQhJYo Tm+C5SYtIKJcrlUT7W0Vrp7NFGvMPLNP7MFoNNAPh72JDs/rrMBa8EJ4SXYxFx25CRU2t+EfjpH CEI3nVaq0qr2bl6hNNs1gptOQpvm62EZL9XH9jFdWZlgzehdGuPEi6jWrPQr5tHKeFVkEiAJHK/ Y/fKA2G82GYSVI5VJmSALS+uC4VvIe9DGIeKirMEYyMvJZSSU6z70rxlEjScg7lhZvybs0VzNiW yWz/OwtdmoFyH4yFLuutj41CCj/In1zhYu6t/XVwC2tEgt6wwqBGLL8edNSK+XFWlOMsT8vpEmh 8UgY7aLKYTxpWi8opm97TLKLDSu/wrTo1kCocCL91SRGP/pSi0BuYHGM7Dw1qD8aX3DQJubJfb3 j/ADsspxVP8K2BiNrq5NQw6FkUnrlYS7k0JPqs7fIQbSZ4nGS/FCNp+bzni05C8R8WjX2sFmbKO OlhEbL4vmrW2eqg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add RGB24 and RAW8 and RAW10 bayer formats. RGB24 is mostly for TPG purposes, but RAW8 and RAW10 are widely used by sensors. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 5238088e23e2..09a19553ec53 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -580,11 +580,23 @@ struct ub960_format_info { }; static const struct ub960_format_info ub960_formats[] = { + { .code = MEDIA_BUS_FMT_RGB888_1X24, .bpp = 24, .datatype = MIPI_CSI2_DT_RGB888, }, + { .code = MEDIA_BUS_FMT_YUYV8_1X16, .bpp = 16, .datatype = MIPI_CSI2_DT_YUV422_8B, }, { .code = MEDIA_BUS_FMT_UYVY8_1X16, .bpp = 16, .datatype = MIPI_CSI2_DT_YUV422_8B, }, { .code = MEDIA_BUS_FMT_VYUY8_1X16, .bpp = 16, .datatype = MIPI_CSI2_DT_YUV422_8B, }, { .code = MEDIA_BUS_FMT_YVYU8_1X16, .bpp = 16, .datatype = MIPI_CSI2_DT_YUV422_8B, }, + { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .bpp = 8, .datatype = MIPI_CSI2_DT_RAW8, }, + { .code = MEDIA_BUS_FMT_SGBRG8_1X8, .bpp = 8, .datatype = MIPI_CSI2_DT_RAW8, }, + { .code = MEDIA_BUS_FMT_SGRBG8_1X8, .bpp = 8, .datatype = MIPI_CSI2_DT_RAW8, }, + { .code = MEDIA_BUS_FMT_SRGGB8_1X8, .bpp = 8, .datatype = MIPI_CSI2_DT_RAW8, }, + + { .code = MEDIA_BUS_FMT_SBGGR10_1X10, .bpp = 10, .datatype = MIPI_CSI2_DT_RAW10, }, + { .code = MEDIA_BUS_FMT_SGBRG10_1X10, .bpp = 10, .datatype = MIPI_CSI2_DT_RAW10, }, + { .code = MEDIA_BUS_FMT_SGRBG10_1X10, .bpp = 10, .datatype = MIPI_CSI2_DT_RAW10, }, + { .code = MEDIA_BUS_FMT_SRGGB10_1X10, .bpp = 10, .datatype = MIPI_CSI2_DT_RAW10, }, + { .code = MEDIA_BUS_FMT_SBGGR12_1X12, .bpp = 12, .datatype = MIPI_CSI2_DT_RAW12, }, { .code = MEDIA_BUS_FMT_SGBRG12_1X12, .bpp = 12, .datatype = MIPI_CSI2_DT_RAW12, }, { .code = MEDIA_BUS_FMT_SGRBG12_1X12, .bpp = 12, .datatype = MIPI_CSI2_DT_RAW12, }, From patchwork Fri Oct 4 14:46:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832878 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 455B83DABF4; Fri, 4 Oct 2024 14:47:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053250; cv=none; b=rcVhbL8McEedswos7F6cjSoKVlPhDIbS+3ZEd7G3Zr/jCYZlNmewoZ5fYuj5Ct+zOC7bFi9OJWeKQl9u5V8JS4Ucp3asS4F+QVP7C/749nmcJbusmNpJxf+mYkvvVQe+X1lxulldR7q7bqiSe1bpMzcG16YgSMg0jed31ib+wAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053250; c=relaxed/simple; bh=jgGbPlVw9htVnBapbccOdLIZ3VXgt0d8E6hbJmD4w3s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aiFqJjBFCHd9uryDJfOmnFQbnc1WFRY/mhE/rTHKzU6mZrDq4HlfsVvIcLLNjZNZ9ImYt9SclWTFN/8/TrJ8SDgOnIw2FlPEVga5MJITRJJXxUM/FXQSjHxqmUSCuwPXvaIb5aJwDgWhF6BBvj9KokyVS99A7V3+ysJl6cpJ34w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=J5liEe//; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="J5liEe//" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1AF6FFF6; Fri, 4 Oct 2024 16:45:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053144; bh=jgGbPlVw9htVnBapbccOdLIZ3VXgt0d8E6hbJmD4w3s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=J5liEe//47vwdet1Vi3VkdQxrjr0HpaGRaUr2N0bLMNr/HV+EB1bsYxqRrlIXR+sW qoUVW31t9hY4tfpQa4rl9LM+eXAEoy7/p36g4HtM5RD5gFlmpryLQW376Lekq0yHWR xk7ycxengNlRH92nDz3adlSLj4vT1NzMug3mkTDs= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:39 +0300 Subject: [PATCH 08/13] media: i2c: ds90ub953: Clear CRC errors in ub953_log_status() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-8-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1264; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=jgGbPlVw9htVnBapbccOdLIZ3VXgt0d8E6hbJmD4w3s=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///uSS6hBrAAn1miI2EzxaG0vQiaM+wrwnSS4 A0WPHv9eI+JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7gAKCRD6PaqMvJYe 9TiLEACK8QVnLwYhpNxlu51TOjeJfsInR9/w9mwDP3YgCgzd96nJ9QqPU5mQrZ8jCSjp5+LDR9z iKL58KRfclXiD247cEMldLB+tkEmam4fNhIaTnR1ah4BT1m9OC+khm8JrC0okBV3uv1NDfkBQ4v 9NIW/WmNZEH3AMVh6Kz9is814zx9eYw6bZBiqIUGg0WI7OQCTv2tS1mUbq7ruVUlXkXiag1px27 o8A51dDcwj/USHSh12dChaNmCZQSVP25rt75zCnpmSiDVr1ebkUJg0eckWmx9YOSf2tmLdWMny/ kagvEd3ovChMQsRppZFVowf3FYB0W/ikhH+MqUv+f0+z49bzFKWYEU6LiSSFqT+LPTEqee67ppL rNvE7ZLn27O66w6MBdQk2S31NHIVtVMY8XO+EdEATRRx8710LZaZQUITRw2/OqvLeqaDhrTI/u1 sJaEAUB6yLmHpkRXEv7gXwPataUFBWoXDR4qITi+ycjaS60kCkr5+sPMvA4ZpAYRm6DzXJP7epw x1ylLrLm13B+rJqMdRABpGZlD7iScQXIGdqRvhpkZQj6xw/4MhCvw2gZwCw3awlwIHA5f0I4GDv 9MOdfw9NVsjje04+82F8IU/xixxsyns3tHnR5HSwv5Ra0tM7G8X7AxwC67kf36PSp8r7Plnml9j fx679SfuEg2QFew== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Clear the CRC error counter after showing it in ub953_log_status() to make its behavior match the other counter values. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub953.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 10daecf6f457..b6451811f906 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -66,6 +66,9 @@ #define UB953_REG_GPIO_INPUT_CTRL_OUT_EN(n) BIT(4 + (n)) #define UB953_REG_GPIO_INPUT_CTRL_INPUT_EN(n) BIT(0 + (n)) +#define UB953_REG_BC_CTRL 0x49 +#define UB953_REG_BC_CTRL_CRC_ERR_CLR BIT(3) + #define UB953_REG_REV_MASK_ID 0x50 #define UB953_REG_GENERAL_STATUS 0x52 @@ -619,6 +622,12 @@ static int ub953_log_status(struct v4l2_subdev *sd) ub953_read(priv, UB953_REG_CRC_ERR_CNT2, &v2); dev_info(dev, "CRC error count %u\n", v1 | (v2 << 8)); + /* Clear CRC error counter */ + if (v1 || v2) + regmap_update_bits(priv->regmap, UB953_REG_BC_CTRL, + UB953_REG_BC_CTRL_CRC_ERR_CLR, + UB953_REG_BC_CTRL_CRC_ERR_CLR); + ub953_read(priv, UB953_REG_CSI_ERR_CNT, &v); dev_info(dev, "CSI error count %u\n", v); From patchwork Fri Oct 4 14:46:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833284 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 52F1E1C3031; Fri, 4 Oct 2024 14:47:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053253; cv=none; b=JkwOK8QxrhAlKd5wwszWULsFOiIKrk9hUbNPz9msQKAu1CvY/xIrTw4eqVCQYHawT9QgKnyD7B34oPCCnJ3DYQeUiiK1FFgWlDd3V83ppOijS7Om8v83nEFdyKEuCwv36TVeOnp6MsR9iBYxvCZtwSpyNmocxaYfviyVYwk5eXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053253; c=relaxed/simple; bh=qKxdFEJd3KSL7NpISVW6N32V2S3UB2c4wWfyL/7uadU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tH9Ho6ICUkocmtotVXbuxghYOIgr5jKuBSa5ZgXE9zRrp+tXcw22MtVWqu+8rfyWpP8i6VO+9cD7jgTlW3/idWv6mbsDVWsEgUx+wOhdNM2VMJ5XdQcH+gunprj16GQIx2APdFyI0IxFOX0VbImrD5kSKYun+QSntn9gHRepY6E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=sQq/pu9c; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="sQq/pu9c" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A77CC1590; Fri, 4 Oct 2024 16:45:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053145; bh=qKxdFEJd3KSL7NpISVW6N32V2S3UB2c4wWfyL/7uadU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sQq/pu9czEyVEo+V5wGRi3HK6eALeHooY6POESoGd1Eku/xDHyuUT2Nixw3/IKSa3 Dcl8/RlEJa0tvHLTzyc8FHkyyTQ3YBAdtVjUwMoG3BXEGbeYHtKHHfhVFVcSt/wNHQ +93Vrpn93OOIV7L95aqq7V2qZvAsy9lptDTMQTE4= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:40 +0300 Subject: [PATCH 09/13] media: i2c: ds90ub960: Drop unused indirect block define Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-9-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=855; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=qKxdFEJd3KSL7NpISVW6N32V2S3UB2c4wWfyL/7uadU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///vG1KHxaDyqpkAIdM6rdA/HuNSTdx7cT4u8 +NG89KtetqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7wAKCRD6PaqMvJYe 9bSgD/4xb1whfKV3pYanCpN9wsbKRDfL1TYcWOG5UNmWhBqeuWCmCvCUYrlNT6XHGwmW6WV9dCa 0r0eQywktARZGLGU/7lLZrzQe3MuvkX96P3LAqunRAZqpBL5Z1UJ6nmtSIKVOkK7pdBpjbkNPYk MOd2TZZMYTDHIY9MuRBsdwffvkR/kEmY0pEdYwhE8v3o5nr6gFxp6i9gVXBk0dQhn8brit+MSOO HViDyZOvtZdd5PWL6YeEGKZYRBkrjNTYEueejTDCTUpYxRS83OJ5PwNtDiWAK3Ev7FqwXcqQ3lm oj0BZKKoSZwwfRKIq3qsxYvHZfDNGLAclhtOqtVwRyfx092GuBnnrdSX6m9PmRkPaKK7ZgQzMSn aD/gsjGj0jRwPaNBUnNMqA+/PK9JEtRKa4BLn+39J2fHJ7msiyf4iH17eNghtvev/opkimStt/5 EhBVbj3ld8+r3xVleje7rfMb17jXOQWHiPsWh649sDrQ7QuyF15RylVLWzoaNwv1yJ73pVRDhnM b85CYPsxRyzdCNtZ5nbSbpeH8nGXRVmWKuLVOPxOR2+k7m0ojQdc4jWRdruhKoQQWtil5jZQOl5 2ijY3z1Sz7BReuyOrwPlfESKRUaanJa+eIQkmKtJoipYUyf7NNVlQ7gF/9x4b6uX+Rzi9ytGdss 6Q0OcSvN6kQmnrg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Drop the unused UB960_IND_TARGET_CSI_CSIPLL_REG_1 define. It does not even match to any block in the more recent documents, so it's possible it is not only unused but also wrong. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 09a19553ec53..d4a3759bc568 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -366,7 +366,6 @@ /* Indirect register blocks */ #define UB960_IND_TARGET_PAT_GEN 0x00 #define UB960_IND_TARGET_RX_ANA(n) (0x01 + (n)) -#define UB960_IND_TARGET_CSI_CSIPLL_REG_1 0x92 /* UB9702 */ #define UB960_IND_TARGET_CSI_ANA 0x07 /* UB960_IR_PGEN_*: Indirect Registers for Test Pattern Generator */ From patchwork Fri Oct 4 14:46:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832877 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 5A6041AA781; Fri, 4 Oct 2024 14:47:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053254; cv=none; b=DnhZmDW4TPiXqWm2CtM5Ja7JPfJjaBEZWfn/+wArYWPYXHY0x81OG+vOt2uM6VZUq2sg8RGh4ujujL++vJ3BPWJCsqYwHD7ava1JH07ifvJFn2fzCoo2YDBEQ5As4P6BTd79w2UM0e/FNuWM20WmJC/aVCfmHnjAlwwkUbfNytE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053254; c=relaxed/simple; bh=6fdywc+cwHNt5RhThvIeXc9zfPMryohuBnbUtfZSyhk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q2Cd216rMx0Vu70ZHPLq6jyjFv3ff2gTNoJeMCHXy2puEluDGBH3+uFzhzUTFeaZugdk+nP/EbCa/nK9S2y9c2yKO8SHY/VJRMyAf1jSPSAovgLYytuLU+VNOGnMmTBOCO/Dif6+3iP5fmCLBRn7+nsaul8S/NzTlI/BWs5J0D4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Yu8G66oZ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Yu8G66oZ" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 425D315A8; Fri, 4 Oct 2024 16:45:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053145; bh=6fdywc+cwHNt5RhThvIeXc9zfPMryohuBnbUtfZSyhk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Yu8G66oZL2cD/WpIpG00Zj0VkW+qsXjxuTERD06uDGYRiKM7c/Avh8oYp7sTHc24u 5GaQUmMYx8AcV3rep+FVt8epRsqSAluvQFUGM8NMwXZGaysjZvohYvdPLujdBCzpZI gPfkQhT6KpUrU/TAgVlR2RMwnLkrfWUCU48Qi350= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:41 +0300 Subject: [PATCH 10/13] media: i2c: ds90ub960: Reduce sleep in ub960_rxport_wait_locks() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-10-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=826; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=6fdywc+cwHNt5RhThvIeXc9zfPMryohuBnbUtfZSyhk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///vrp6tBCvdYYky9HEEsPvqymb2hMB4DKjcW Ci8lHttoI6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7wAKCRD6PaqMvJYe 9XS2EACqljzonZYt9wRcN57HrvjAPaCWfqqaU7XQ+edybGxrik46osbv7WcqmXNIlypoQdoWNtZ BGmd2fpO91cCA26tBE23RBU259PbfzjOpBSi9ZkuHTDEByDU5pwq/DWaW3kTjEZjPBDvmv5foJ6 iLOmG/bjJMWXmuHAdtvwdwvuQLXp+AWRPfg93raeJ+7djLA3BV8Gy9RO2zWN0ipJZw8QQ+V4HEw c4kjQVhYb8RSnqkgoVGJ25CyMnW/WhncPgOXjAzZVEnvsgGeEEdKVsicY9OC6NePqrDM784xdhl 7cB3xljZhYTJph2O4H9zRyHqcWJZu91jgHY5ddUuCYi3l0vPBppnHcH02+cOqmln7rN2xx56HIj DyTmibLfQKkECNYnjstfHQNm1A0MhkR/34xcmpcqLPOk5ATxwjCAorMqwimmJqwI5Q1hLecivHX mT4GAT7ZHdjmacROGSuQ4QN/e+Mq/8oUtR58a1M5cJc5/j0icrPfDBGT4qdb4fy2Ym9R+2kQfYh My07nbC0Tm4q5BrDdrMwr1gGpsFri2zClrCu9HvzGGo8ahdAYKBV/KJ0oKgqj3S4foYTH502vJX Gs6o+Ww406ncfLMqTrZyX5PPfaQt87vA40aEMObnqYO9EC38U6fhwQDj+k0WEHnXAbcjtVLnDfH 2ugCKTkZ3fmPj7g== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 We currently sleep for 50 ms at the end of each iteration in ub960_rxport_wait_locks(). This feels a bit excessive, especially as we always do at least two loops, so there's always at least one sleep, even if we already have a stable lock. Change the sleep to 10 ms. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index d4a3759bc568..ab5330db4162 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -1575,7 +1575,7 @@ static int ub960_rxport_wait_locks(struct ub960_data *priv, if (missing == 0) break; - msleep(50); + fsleep(10 * 1000); } if (lock_mask) From patchwork Fri Oct 4 14:46:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833283 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 B150A1C7607; Fri, 4 Oct 2024 14:47:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053256; cv=none; b=pqspuZ8syBX7xkvm0IQQsTKxzQB5yBBjlon6OYQ6MgLBHFfLDjkllzUq+wILKQh9C153cU+VYwPphOZB8Dyzqj2rhsPVkVM54/F282ZNKUo2vEXCUtxdX4LdBZBLvWAQEAFJqcQ5J0qKFdte9y9LyrigQnHtIqXwgZZqrLFJH88= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053256; c=relaxed/simple; bh=fYfSSOrKZmAiaAi47MtEcgYXH+Y8u5Bkiv3Y38PojcE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T882NLY7ZclP6viS60uVOYOXhc9lKsf+dBk8j06CvRKEAKYpDqQC8OcDZEmt54yrbBX5aw75PRH5JGCm+FEMwPW+bewrBy+Ga88ETgh1SbD5mmhkZ0XS4RK2ieysoSxzyWiRDSFLgCYvLEdLry8y7VgH6sRYLmgRd7QsMCRprqA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=upnEP8i6; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="upnEP8i6" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D076415E9; Fri, 4 Oct 2024 16:45:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053146; bh=fYfSSOrKZmAiaAi47MtEcgYXH+Y8u5Bkiv3Y38PojcE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=upnEP8i6jIXLN2T99tOtnY54Xz46ijnV8KZvyXm8cANwh86xWcrtDgums5qHI41w5 x+v8kFCFx67Q22vg/JJbsRQxWHxfC0xQCySL+zyFwqZl+Ahpbcmkao7BgDyi8L7qPA 9FCB6p1R1GKGmwZTyJ77SQyeejy74t80HZYLcDbw= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:42 +0300 Subject: [PATCH 11/13] media: i2c: ds90ub960: Handle errors in ub960_log_status_ub960_sp_eq() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-11-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2061; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=fYfSSOrKZmAiaAi47MtEcgYXH+Y8u5Bkiv3Y38PojcE=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///vVbwmJr3aIzxht4ncPEG/GKFXkdOe3CaHg 5ifB/ASQ4CJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//7wAKCRD6PaqMvJYe 9dXFEACFziU37fwoItBA1M0f/fY6uIkX/y0O6HN6bUNT8aXjb/Cu7v4ExRNgjrgQMdOcQANRscb hFyNkNPp4ne7g+PRe9MVw5MkUidEZNdHKUp2MYfF6Ben32o2NPJJOXP4yilVzYlr3jCvN6KnmKD s/f7wgJCmkozibs8vaY/nmZgwTm+D0eXTLxnu8/QyrX5GYPMnbtJTkn+48HEQVCT+pi1aJMDZ7k L5uznwg7uwd1IubvsCgKB8djD51qtZ0ivx4DFHC/jnY1Yo2arQVc9qsRQPNF3Ya3xlf/wj7S9g5 2XkQU0thYw8yX7Qkp3V0hSzBe6gpFhMzPMDFEyU7d70NColZ0oRZIUCg1TMjtFUAxxbsbgPuxww ZdCqva2pZfEISb9sy7qKCf2TWuh3LIRvxC4aNEvGSX46LTOySvLFpXxETGzJsFvL72IaRUR6I5a yai0ErcwYiB2V8aawdAjTRwLF9l5ft6PzsYE/Cm3waaLh8QCEqvrt6eSP0B/Vpe42Jmo5UpvSgq 9UKw8Oy6EcasNO/4fl2lli3BMUnM+530mVLbnGBqv3ySr/yD7u/72Uefn7E/lL2wS2bL5A+ZPAG CuksTzjmtc69YFMTQwV8PGeL2vgZGSgpg7bzbr6kWAnC7PzZYGhCssOATfcK9BW+dNxOOYs2PB3 kOW3kBaOHZjlfXA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add error handling for i2c read/write calls to ub960_log_status_ub960_sp_eq() Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index ab5330db4162..47990aa1f007 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2977,17 +2977,22 @@ static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv, u8 eq_level; s8 strobe_pos; u8 v = 0; + int ret; /* Strobe */ - ub960_read(priv, UB960_XR_AEQ_CTL1, &v); + ret = ub960_read(priv, UB960_XR_AEQ_CTL1, &v); + if (ret) + return; dev_info(dev, "\t%s strobe\n", (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) ? "Adaptive" : "Manual"); if (v & UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN) { - ub960_read(priv, UB960_XR_SFILTER_CFG, &v); + ret = ub960_read(priv, UB960_XR_SFILTER_CFG, &v); + if (ret) + return; dev_info(dev, "\tStrobe range [%d, %d]\n", ((v >> UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT) & 0xf) - @@ -2996,20 +3001,26 @@ static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv, 7); } - ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); + ret = ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); + if (ret) + return; dev_info(dev, "\tStrobe pos %d\n", strobe_pos); /* EQ */ - ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v); + ret = ub960_rxport_read(priv, nport, UB960_RR_AEQ_BYPASS, &v); + if (ret) + return; dev_info(dev, "\t%s EQ\n", (v & UB960_RR_AEQ_BYPASS_ENABLE) ? "Manual" : "Adaptive"); if (!(v & UB960_RR_AEQ_BYPASS_ENABLE)) { - ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v); + ret = ub960_rxport_read(priv, nport, UB960_RR_AEQ_MIN_MAX, &v); + if (ret) + return; dev_info(dev, "\tEQ range [%u, %u]\n", (v >> UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT) & 0xf, From patchwork Fri Oct 4 14:46:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 832876 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 9CD521C761A; Fri, 4 Oct 2024 14:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053257; cv=none; b=KMzXTjmoaitLEfXeNHt9OqFexWj0BcdnueGbNm+J77owNvL0ElJk7bFrSmgqMz8bhi2yInlAmpf/xjVenN/2O5x5pv1mZjfm5Y7q2W+wlke61EPOfkw+HBhOVBGXJ14X8i4+gJJZr/yG0v492OBDV6H5eiI/wy6NP+S2Q5BbU3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053257; c=relaxed/simple; bh=+ZxOAztOuJeE3hYoiQ1EiplfA7HJJP/spI/ixKxrsf0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NcDkJ8w+Q1Ru/FGVErd1fiDoV/rmB4J2h6S4TvuhYMEoMeuEnOjy3gaIXU5U1v/OLmXxWwjurq24BtxkNI6NSA+teWidnylvpyVVQsA87Huwuu/ZcHm37UqPsAvV7wDmi2F+CYD97ublBYQxOINvp+JfI3oCugi48Fz1HzFOLTk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=K3+Wm7b9; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="K3+Wm7b9" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6781317D6; Fri, 4 Oct 2024 16:45:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053146; bh=+ZxOAztOuJeE3hYoiQ1EiplfA7HJJP/spI/ixKxrsf0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=K3+Wm7b9vjtgRf+yCSZjrmf6gdInIfX6b/pXpMXfkQJApwzxmjZNQ9yKImWgKGWlh 1EcESIROatqZE2Gs8ZSOQ0vMB7/K1tGMKFR+syOVlj9GMNZF0X9X+t5LbF4qLRbV4H YXOOIV9DwatGwsCkOZvhiXGfTiOmpb2GmheQ8h/Y= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:43 +0300 Subject: [PATCH 12/13] media: i2c: ds90ub913: Add error handling to ub913_hw_init() Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-12-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1528; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=+ZxOAztOuJeE3hYoiQ1EiplfA7HJJP/spI/ixKxrsf0=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///wpKrNi5tRqkM405PXKPOQ1epABh3DRq2m8 adne70l3qyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//8AAKCRD6PaqMvJYe 9ZTED/4yO6+8OpikFMHTLXfHuiZnvx+z8P4fjp1ey5atbQXxjCkfXusChh4npDWEyahHg73CI8b VILe+PVBsWHzIBvBmbJtkoa8eVG1xuuIYHX1gCwyRJ2R5nVk6lerzEAbA1pBVm2Uwi/IqysOQDy coyFTqj0oBOfmsJuXrDAU2B4r6zVwQKJp//gGlWESCRLmf7JvT/bC87uWgqM6Fp4zlAGn94M8sE V6wm2KefkSTB5nFlWpEtFvR2tEi+KIqcbazudeojevpw6PTCWen7nEr0gNNlLooG/EkWRxgxeJ8 RC5mw/ZDY9Ezt5A2LwUL9VJX6rZjYhSsLZjow9Ev35jvXxbhYkvLXiJD1idcU/0Fgf34t87or+U p2O6GmoUZNIx2SPNwmbzj+cygl2uMzQx0rpOWqoypSaISmHrwIjL3tE0yvOLNAb2ejkjAyHn3j3 jYakdR4gQ9Z5iM9Pzy3RO6b+dFWxdVe7OwmIzagl5IM01e4guTJqxFJ4Ml6HqOpg1oDXsTG8x7D eqvDaSeZYGX6ShYQ3d5puQ7P1OICJrml/o/3yItGOxD+g5WCRP6MaUwd6y9PCYNyC58dsrjV+GO jRO87zR3uxpaLHaKBmys9gqTBXl8A75pZVOwjbQdHrjaQNLfczLU3+OXjXKlCm/dledVVsQKcNE TnnKxvMgESnCQJA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add error handling to ub913_hw_init() using a new helper function, ub913_update_bits(). Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub913.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ds90ub913.c b/drivers/media/i2c/ds90ub913.c index 150d6641516f..8b540b360e79 100644 --- a/drivers/media/i2c/ds90ub913.c +++ b/drivers/media/i2c/ds90ub913.c @@ -146,6 +146,19 @@ static int ub913_write(const struct ub913_data *priv, u8 reg, u8 val) return ret; } +static int ub913_update_bits(const struct ub913_data *priv, u8 reg, u8 mask, + u8 val) +{ + int ret; + + ret = regmap_update_bits(priv->regmap, reg, mask, val); + if (ret < 0) + dev_err(&priv->client->dev, + "Cannot update register 0x%02x %d!\n", reg, ret); + + return ret; +} + /* * GPIO chip */ @@ -733,10 +746,13 @@ static int ub913_hw_init(struct ub913_data *priv) if (ret) return dev_err_probe(dev, ret, "i2c master init failed\n"); - ub913_read(priv, UB913_REG_GENERAL_CFG, &v); - v &= ~UB913_REG_GENERAL_CFG_PCLK_RISING; - v |= priv->pclk_polarity_rising ? UB913_REG_GENERAL_CFG_PCLK_RISING : 0; - ub913_write(priv, UB913_REG_GENERAL_CFG, v); + ret = ub913_update_bits(priv, UB913_REG_GENERAL_CFG, + UB913_REG_GENERAL_CFG_PCLK_RISING, + priv->pclk_polarity_rising ? + UB913_REG_GENERAL_CFG_PCLK_RISING : + 0); + if (ret) + return ret; return 0; } From patchwork Fri Oct 4 14:46:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 833282 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (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 BE2A21C877F; Fri, 4 Oct 2024 14:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053259; cv=none; b=Bw04srtsD3tdVBBA4xLH/VQkzNzwo/bWlf1o5+ZBjWsdOKOx+QPa0KNZ6AxbO5ON7G9oO1khE33csGs9GwKcSCTkW2Z+hntKbjgLviQIZB79qurDsDo7VHEBR6S52DWxLbkOfALxxsiNrDdl3nngSEw9LPAZbxLSo0zlgDJ82CQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728053259; c=relaxed/simple; bh=h/Wucr0WK1pNJOQNFzwHPdnYZcspI5Mizs3II33asmI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lIJcdVeAs0xuEsyOOja7g/0irhWMGq4MNAbfyhe0hgIHn8CVpvTdvR9pc83jFMM+p4ttmNtkeTBO5qPBs1KlmjXlycgCeSBL1EtLyyFWB8oaOeCDEnFJwb/dSLf0FcmaXESpL+wQR4irrN/o/ZKVQ5EG8BK1OwlZfkWOH0acuOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=PFHTP/PH; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PFHTP/PH" Received: from [127.0.1.1] (91-156-87-48.elisa-laajakaista.fi [91.156.87.48]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 007CB182C; Fri, 4 Oct 2024 16:45:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728053147; bh=h/Wucr0WK1pNJOQNFzwHPdnYZcspI5Mizs3II33asmI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PFHTP/PHEIvwRYoNQV12iADtZoOr6b59TbPIT6LrTw4tr9qhZ/qHJKF9HZmrv8pxH VFNnD2PojyCLwh+Y8a8UiGSAERAEYq0sVfHmXZIeE2R2Yy91xKZuwgY1wB7KjpfUa8 M2+rU7o9cyvHEXThYDLEUEHvXeZ1Cf9obqxuaIV8= From: Tomi Valkeinen Date: Fri, 04 Oct 2024 17:46:44 +0300 Subject: [PATCH 13/13] media: i2c: ds90ub953: Add error handling for i2c reads/writes Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241004-ub9xx-fixes-v1-13-e30a4633c786@ideasonboard.com> References: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> In-Reply-To: <20241004-ub9xx-fixes-v1-0-e30a4633c786@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Jai Luthra , Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3421; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=h/Wucr0WK1pNJOQNFzwHPdnYZcspI5Mizs3II33asmI=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBm///w/p5A9tBK89OCs4dP21pfQLBqO7ah1tMbp 0zPmu/HoCSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZv//8AAKCRD6PaqMvJYe 9bGgD/0VLLRgDAwwiOXAdxs/0NTOI5qUPxEAL+0mQy2F2F+4UrrNG+rbJqZMncYtkJWUHvKuZt2 ut0sn/J6hTDxHU/gbI4KaVtnvmaUSioH72cTZlYSfp1hY2GH36sRYcAS6k62QA+B7Mvpfyzdx3m u2ZRodhIQX4H7CMGxPjROpoKrHKOXD4KHFzkjQfLJn582F+MU5mv9oUzIRErj86MSeiBC2CzFdc d7P/fUDtyW+yyyOjlwlvnTI/0V4IjReJ4/1NB9/v3S31BAqgCzB+V8JmXUkeiWrx6fZY0Zh/PjK nNm8DBQOVYQY7wt2sIspAGY5f+KK6NQZuhOIgcD8iPVBjTLwxyamuevwuyoEvdS4DhYGbIBmDve uR8GuDuybUCwct+KqINvKJhy5/Yv9VsEKDfygzWoqAt1AAZB6IoI/jV0XkrIkWuUOzBB8JmNS6h sk2GPqZ2dfMXSpohBqPnneQTTSOYpRI8LIGvFbknhqWY8yaa6sy64wI4HwCWFEFIC+NebpPZP2F 2vb7RmK+KTEssPS+OrjiwkYa0prZ2J/BPJwShQGyyaY1g53edB0Zw8BnRjKW9bJhWnjSp4dG1kp bDRTULpyLtusd78RoGNZKwy2i/W26BUKmCMnZlQWe1xK52ms9Wr/3MNwNENZlBWDiRTC8JzFXdl imnI9PYA7R3VLmg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Add error handling for i2c reads/writes in various places. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub953.c | 46 ++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index b6451811f906..f8f3e31f0077 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -401,8 +401,13 @@ static int ub953_gpiochip_probe(struct ub953_data *priv) int ret; /* Set all GPIOs to local input mode */ - ub953_write(priv, UB953_REG_LOCAL_GPIO_DATA, 0); - ub953_write(priv, UB953_REG_GPIO_INPUT_CTRL, 0xf); + ret = ub953_write(priv, UB953_REG_LOCAL_GPIO_DATA, 0); + if (ret) + return ret; + + ret = ub953_write(priv, UB953_REG_GPIO_INPUT_CTRL, 0xf); + if (ret) + return ret; gc->label = dev_name(dev); gc->parent = dev; @@ -970,10 +975,11 @@ static void ub953_calc_clkout_params(struct ub953_data *priv, clkout_data->rate = clkout_rate; } -static void ub953_write_clkout_regs(struct ub953_data *priv, - const struct ub953_clkout_data *clkout_data) +static int ub953_write_clkout_regs(struct ub953_data *priv, + const struct ub953_clkout_data *clkout_data) { u8 clkout_ctrl0, clkout_ctrl1; + int ret; if (priv->hw_data->is_ub971) clkout_ctrl0 = clkout_data->m; @@ -983,8 +989,15 @@ static void ub953_write_clkout_regs(struct ub953_data *priv, clkout_ctrl1 = clkout_data->n; - ub953_write(priv, UB953_REG_CLKOUT_CTRL0, clkout_ctrl0); - ub953_write(priv, UB953_REG_CLKOUT_CTRL1, clkout_ctrl1); + ret = ub953_write(priv, UB953_REG_CLKOUT_CTRL0, clkout_ctrl0); + if (ret) + return ret; + + ret = ub953_write(priv, UB953_REG_CLKOUT_CTRL1, clkout_ctrl1); + if (ret) + return ret; + + return 0; } static unsigned long ub953_clkout_recalc_rate(struct clk_hw *hw, @@ -1064,9 +1077,7 @@ static int ub953_clkout_set_rate(struct clk_hw *hw, unsigned long rate, dev_dbg(&priv->client->dev, "%s %lu (requested %lu)\n", __func__, clkout_data.rate, rate); - ub953_write_clkout_regs(priv, &clkout_data); - - return 0; + return ub953_write_clkout_regs(priv, &clkout_data); } static const struct clk_ops ub953_clkout_ops = { @@ -1091,7 +1102,9 @@ static int ub953_register_clkout(struct ub953_data *priv) /* Initialize clkout to 25MHz by default */ ub953_calc_clkout_params(priv, UB953_DEFAULT_CLKOUT_RATE, &clkout_data); - ub953_write_clkout_regs(priv, &clkout_data); + ret = ub953_write_clkout_regs(priv, &clkout_data); + if (ret) + return ret; priv->clkout_clk_hw.init = &init; @@ -1238,10 +1251,15 @@ static int ub953_hw_init(struct ub953_data *priv) if (ret) return dev_err_probe(dev, ret, "i2c init failed\n"); - ub953_write(priv, UB953_REG_GENERAL_CFG, - (priv->non_continous_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK) | - ((priv->num_data_lanes - 1) << UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT) | - UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE); + v = 0; + v |= priv->non_continous_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK; + v |= (priv->num_data_lanes - 1) << + UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT; + v |= UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE; + + ret = ub953_write(priv, UB953_REG_GENERAL_CFG, v); + if (ret) + return ret; return 0; }