From patchwork Wed Dec 4 11:05:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847495 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 7A49A1B4F15; Wed, 4 Dec 2024 11:05:49 +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=1733310351; cv=none; b=iM9bDDMmfeIipzo4N4jBHbfKdAn+UMMEApXWHnmoFpHT/IsyMNpp+o+MM0Eukufo2FAGIA+LqC+3TVgXnk3VX8lWJnU+mtVvCpFNTyuwB4m4KEe9v5Yjl0oqm2GepVoqTfzeyz5vzLdDblvwRlHeGhc+uwT/9qX9SZz15mYtPsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310351; c=relaxed/simple; bh=JiGQ0b5hfc6zIlLKLwEQZtJz1RrCwE+wHub95g3gf8Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CBli1TQoFBThbf8F43YraTDMyWxjne1uOXkwlUFPtxyMIpfdruzR2KFsB+ho3PjvxarYWuX59mti/jUBHc1HmmhMEuKc/7oDk0TS/HHs5ZxSmgNctfOhDiBjnoVrAfjKktY9gtvwocjUiJWU064dixSv0/YblK9bZcq3CzTDfb4= 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=Robn0ufy; 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="Robn0ufy" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 27B25B2B; Wed, 4 Dec 2024 12:05:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310317; bh=JiGQ0b5hfc6zIlLKLwEQZtJz1RrCwE+wHub95g3gf8Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Robn0ufyBOG+hqQdgKF/N4beJb1DNDm9RxsarXTM7NGftKcnjHYN+J6jrGmyMiQoX BDRRmBRsDcTA9R4r7QbXHCNZNvMNNr4Q/b2i+jlR+7UTmyZQ/ofQHCBgo5WGW36UZv KMk6lgZC8Nfd5oPQapZ6d+Wdt3g8GHrUkc+9njZM= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:16 +0200 Subject: [PATCH v3 02/15] 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: <20241204-ub9xx-fixes-v3-2-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1341; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=JiGQ0b5hfc6zIlLKLwEQZtJz1RrCwE+wHub95g3gf8Q=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeCRelz6rQj2edvFCi2rJaavv+P4syT8E82O bvOHkiM7p2JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3ggAKCRD6PaqMvJYe 9QP6EACZkXJIm8OWPDB5CPgg9sL7DBp6UbTF+C5UgJ64YDMgOM2gIg92Kk8p47qRwu8MzSqy5Qz dMvwwKzfkeYI6SreqhiSpIFNB1dF1TowOKcuEd1oQPRTKtAdmPkRhCgNjorPmLnLPFPmF/mpn8e sAm3HkmJ3Xwhx9qTmzs/oRNs1hm/iq4cKXbxTiW5tE5vUwOmNvTjDWFHKwDlBtDdn+wMkA6BfXg BSoSIkMxHrHY/fqWnwrovqaDeOcCg59ZlMBISXlyzPgLalOtWBnBu53wxl+GXOwv1Ic6ZlHEGB7 iyxr1z6UbnSwR0H6VLrZbMrx41q4iQXgRpEsngyzg9fsW6hrpsexSMWWCaX/GDkGJ7sUIsW8Ye5 QDnHXQlhAT2IKsxyXprugIM4HkFHbTqweMA+DOx0djlFKKhPgLkplfrX2OmEx8SlBnMXFkIyZ4Z YdpdUwST9TtA77PVecDk2e8S2+xRtcTlFjyU4XV8Q9QGY2lmR327dWdtnCMuoZuxHwnZNB8O6S6 lzMIIQ0ChuWXzDjD6pUQKOTkWMykpJ0iZ8H6J/ILtmKCh8KUgXhYG9RIubjHQUXLcWxFKEyRHoy l1i5uPHNFZYxqTFFKnz0CCjxIgd8NXo94wAU7uhmQI8tcYzsLfTrc+tDrumg5c2PTLBvEZecLbg n/8nso7MkHoQtFQ== 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 Cc: stable@vger.kernel.org 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 Wed Dec 4 11:05:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847494 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 749921B87CE; Wed, 4 Dec 2024 11:05:52 +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=1733310354; cv=none; b=fXBWqRRpK6j7R5DRP66PGCvKyXfdz12Afg06quQR5aH3pDxDzO/FvAyhRFvnSKoaZK+j27kGsH+1AjUtJmbMfW0MAMWdUh1zJyrG5gVLCdKtmAl81iHRmsa/+UfMV1Nybn32cvI4n2DDAGVy+GCOR+i51kX2CbBtMEEJ00lLbYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310354; c=relaxed/simple; bh=cHK+FvowlOFAeLxYTLErV9QO7P1rU8Vzws3yIpYDj/c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oXqF0/300TG7Dsn+E4Xs3NNl6rSy0K7Ozz6GOkitpKTyScB10CnIkiMI+J5lM+hJpm1fjkAzzcdnZjDhJJG1CqdrfQYSHeltRKQ1PIMPdxSxvdzVeodOMqt2RgqIni5aUQZRprWiL713STm5wmu4+4I5J0Lwc6JoSPJNv0O1yiA= 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=O7Nj/+pj; 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="O7Nj/+pj" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 67600DEE; Wed, 4 Dec 2024 12:05:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310318; bh=cHK+FvowlOFAeLxYTLErV9QO7P1rU8Vzws3yIpYDj/c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=O7Nj/+pjLh/Me1yxrVmtpcGZySsGAoHMk7GbixfuE4fwWAUnQQOBQ+/M9aRq0l1kb 9YO5cvHmO9+7N0PJ893aXmUV8oQMim6+vmyoz0cjtkRu4XC69d0CCVbms95qCArsWW 7/M6Mav09LUA5poDTKn77WzIPZyrdi1EmxKHp8X0= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:18 +0200 Subject: [PATCH v3 04/15] 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: <20241204-ub9xx-fixes-v3-4-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen , stable@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4127; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=cHK+FvowlOFAeLxYTLErV9QO7P1rU8Vzws3yIpYDj/c=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeCmff/IdOjYuhPXZI9o/v80viV7pENuYMod KUxv110AKyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3ggAKCRD6PaqMvJYe 9XsQD/4qeQlX04HK6glic51T/8oqthKz+Jf1My+M2LAdnsfGBDRpj1soaDOrmtnrjdx5bYeJ23s KqTE9L3VxmKWvIqz7mlTY4unqHfxcg0T63Q6uecbjgt2TIo5mLG1Qhl5HNYPZM4y66Ow4mQ6bPs KzaR5LojmgqtsWsBNFrIJXzjluo+Xz06omqEjr7Ol0vOYJx8uzjkTO1Lmwi9pS4YSBovH6WPyqJ dOMPST1KAn4BnNFcI2c4d+R/1VAAp8qmtCVwWLJY+5rXDiyeVyPuofNUvkTFxH9sd+tIECUCdDb hhTCFD3devq8ioV5VVAqnQ3NVJ1EFBcwDh1qnb8kG2aaJz7nGGPPYrlUaOEMjQ2TG6oxtH28HwH 6adB4/3HafLUQ/1NCWEgsQRQdtXRdWvdXfJfHqDpYkwOukPeV7r5r1wludvxWOt4jctRA+S6P0s GbEcRXlbXTWWVSkxlJznund/VdxQ+VBjJShNyRWtCixZpL9YW5PnoTMU3GuPvVIrLQd80+fEde+ lTOA4fu5JlSW0l5PtGIwK4iCV21KDjJYPUr3j+J+G/cuVdL4moxOmY2+rljyHEclcI1jyMO2gxg a1xUNfMfNnas1MGQQZlMIZlJ5cC1FIerxpTOVG0j9eCuM9EL0WvsE+MNRpnlq1Hb0tGdLdMMRwh eGhpwUu44WUDYDQ== 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 Cc: stable@vger.kernel.org Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") --- drivers/media/i2c/ds90ub960.c | 90 ++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 24198b803eff..94c8acf171b4 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2950,6 +2950,54 @@ 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 +3045,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 +3080,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 Wed Dec 4 11:05:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847493 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 1ABC81BD014; Wed, 4 Dec 2024 11:05:55 +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=1733310357; cv=none; b=hJ/vmLc3JvwTFosFCDFzVicNNUY8Gtaj3LQZUNfuWEWWqMcWQQUWRnSM4Bz7oJ6+lKB9mhGOzHRafdA8Y99YSooA9DZkUPPjOwSX3URCh5iae6CcQ3M7lY0k0l8BDyjkEQKI7hvW0aolQ9vuWMb7Bl5IkYysuCT+7v2aQ9KBn0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310357; c=relaxed/simple; bh=LcTkzRMj8n16JAAp2ctpyU8mBul44P0JDcLlKMR2mlU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fCKWesHHFwP/4hwmj8ZpObMJGplb8P2DdQo9pq2kjSe9Bo4UpaZeXZ8wDesUK07mCWVvTV+KgRLzyAVE9sf1WHeZo/XFC0+5Vv2OBZ/T5Y24ruH6wQ+URWAMb/ZwIH20RSqEHGcl/UmwLP5C4vFLVwtyWCUbPdapcS6cRawz3ec= 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=SN02lYlj; 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="SN02lYlj" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AAB9D157E; Wed, 4 Dec 2024 12:05:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310320; bh=LcTkzRMj8n16JAAp2ctpyU8mBul44P0JDcLlKMR2mlU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SN02lYlj4CLu2hyyXlZbuz8fSWVMIgn8Jor4OM44zw1+f15RIhelyfF9u1A9D5EhA sDLJ332RDPDL6veyLBaIg2pFPom747fhzYA4I8nj84xE9LOS3X5M33Lp2holewZG0K II1zPY4oEH/wjyDsq6U0pKblHvqwkQitc39u6gxM= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:20 +0200 Subject: [PATCH v3 06/15] media: i2c: ds90ub960: Use HZ_PER_MHZ Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241204-ub9xx-fixes-v3-6-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2070; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=LcTkzRMj8n16JAAp2ctpyU8mBul44P0JDcLlKMR2mlU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeDDj2N1BDnEYZnNtlEnXNb/4CrhhGkctte1 XncBjmHwtGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3gwAKCRD6PaqMvJYe 9SmoEACgX2EoExcCknhpChKYeuh8W6UFJr+to6FBICFba3vlOeal7GtKzK00JS6cyXQup98IDr1 +EzL0VlVHFNS2DC8gS5IZuzikavqkIEBb6SNJ6TR+8sKxhqTGy73P3sjwrgyfVvC2hVseZN0XRh dfA4HogHxtSaWXWkmj2L7cmNZeakwQwCuGxCKgQYXweFFvH95VFiAJwPjyWZSIykmtqEgEH1YBz 9SPlFZaZxulm6zPGiX2SxMR8KOX1SSvOXXFZu1kRojjFj+EtnwS1NQRvPbumG9IWzJ6c2wjCdCQ YAo7muRZv/X5lIRvvbk0h4NBOhl3ivxFmmoKfbVomo0/4hIbw6hhDQUKQ0BCd5O73wDkBdVQd4D loh+XCNSm60CIab/y5dV0XKah0CDoKJ7GfIZ+01d9CKHMd395kt4tAHDWnIN37Zsf4N6/zpKKoQ yKhQaDT7YFW9MK43hopZs7fybsV+u0q0tQlPYC90PGiFFsG/oY9ONnAnrZVu/LE9GwyYBLK40+x r1YYMPMjPRvVkhWF0lJNZ9HFr9hMxFnUqoKEtsgoDHHO2Oaq2jtE1zykZ9lfmTZgsGytycIxpe4 IUAvPHwpsVhNyP0QvWUrMWJYcHuUNhqenkxRNYzbzf2FrtfFQd31doaeotDr+7xSh5vJX3Lu26E jCavL+j2t0UiCZw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 Use HZ_PER_MHZ instead of 1000000U. Signed-off-by: Tomi Valkeinen --- drivers/media/i2c/ds90ub960.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index bfffa14e2049..98d815526341 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1579,7 +1580,7 @@ static int ub960_rxport_wait_locks(struct ub960_data *priv, if (priv->hw_data->is_ub9702) { dev_dbg(dev, "\trx%u: locked, freq %llu Hz\n", - nport, (v * 1000000ULL) >> 8); + nport, ((u64)v * HZ_PER_MHZ) >> 8); } else { ret = ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos); @@ -1593,7 +1594,7 @@ static int ub960_rxport_wait_locks(struct ub960_data *priv, dev_dbg(dev, "\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n", nport, strobe_pos, eq_level, - (v * 1000000ULL) >> 8); + ((u64)v * HZ_PER_MHZ) >> 8); } } @@ -3066,7 +3067,7 @@ static int ub960_log_status(struct v4l2_subdev *sd) dev_info(dev, "\trx_port_sts2 %#02x\n", v); ub960_rxport_read16(priv, nport, UB960_RR_RX_FREQ_HIGH, &v16); - dev_info(dev, "\tlink freq %llu Hz\n", (v16 * 1000000ULL) >> 8); + dev_info(dev, "\tlink freq %llu Hz\n", ((u64)v16 * HZ_PER_MHZ) >> 8); ub960_rxport_read16(priv, nport, UB960_RR_RX_PAR_ERR_HI, &v16); dev_info(dev, "\tparity errors %u\n", v16); @@ -3866,7 +3867,7 @@ static int ub960_enable_core_hw(struct ub960_data *priv) dev_dbg(dev, "refclk valid %u freq %u MHz (clk fw freq %lu MHz)\n", !!(dev_sts & BIT(4)), refclk_freq, - clk_get_rate(priv->refclk) / 1000000); + clk_get_rate(priv->refclk) / HZ_PER_MHZ); /* Disable all RX ports by default */ ret = ub960_write(priv, UB960_SR_RX_PORT_CTL, 0); From patchwork Wed Dec 4 11:05:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847492 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 265FD1B3950; Wed, 4 Dec 2024 11:05:58 +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=1733310360; cv=none; b=YwiqtA8SaeMYXVev+8DPl4AdyIFekt1/GnSZJHZvOFSG6KiY4BOFuGQUM7LHmIHiOiErF+9XmYGhI1l7cUxkdlSdwi+/4wEH+fvSDS5N/KS/Fvj2y5iw+6DwxIX7OzixGPE0dHFI3wI0D4zPbq9Zl192H0jcwygQpRzZZ4ClSAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310360; c=relaxed/simple; bh=/xIm447+xdq2t3RQ6TKOBOkTeZS8d2PO9dwv9gsXniE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=py+8F6HnThrdVW0ZGd3X4qFpia0iTn6W6gSxytm9ugtRi0IrHSIk0V6UvKodWSxL3yIXTlEXbScSJkqBhpftlnclXsPMCgvSqZZLRxM3dsH6uB0zKZDtlKRANuVPXyWGie7rzXysLmjXsVjq3CvnBaqbHTI4pTwOx22rW7SGf5Q= 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=XNw0MJT6; 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="XNw0MJT6" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D6BC918E5; Wed, 4 Dec 2024 12:05:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310321; bh=/xIm447+xdq2t3RQ6TKOBOkTeZS8d2PO9dwv9gsXniE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XNw0MJT6ZUVIy5flAibVFIOsW0ruof6oIUXTaAOURitWr6lYWHCocKyFEY8Fwhvn6 yqQQ2L9gqOWoaTicxYxwYTVuaFmYsJyGU1uKeKz5SmbmAMBJzjbrlgYTvU7PQfHRxB tEzpvzwGT+o9qi2EBYljeHHAyyDEpMgFYd8ou824= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:22 +0200 Subject: [PATCH v3 08/15] 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: <20241204-ub9xx-fixes-v3-8-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, 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=/xIm447+xdq2t3RQ6TKOBOkTeZS8d2PO9dwv9gsXniE=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeENfy+291E3/4FKwDUrE/ZK90sE+2PGhwsC iZhIlBk4nqJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3hAAKCRD6PaqMvJYe 9ZxVD/9axHsielmtClBguKUXT5S7Uy0qa9NGZDwqYp6VJ5ZCqimRHA8edQfVIbU+e6QtFfqHg3V VYMA9eho/Lzf9vvlbBNCsIT1eACx3DQObvSNVRrpHgcjWGMUC7y0lPBg/u2xoDNf3bJ5ukcG92N CjQKJuXJeiy1E2979W6CTBJn3XdMM22Z0h4mxJiRaqUlJUAIE88YKp8BTu+cTRGb5QftTXZe6dL zIq9M9f0azKXhNv7ri5bZgVEycYKuLCSkXu9DFW4CgY6g/q6n+N8jQFr0PnC8GDUEqN3E+ERkOD 8cIQNQayU/IEjSs22klMf+xdiIV9XU+5146fn0S5KZIU2YwVydPp8R4D6iN3r8O3hMT8RmWnvwm p2qVmlO8FPS81+04TsG0KFthZpB09jNdoBq2+7Uw6f+UKHt0wbcs+cIFmOLCd4aGsAaoyRY4f9f Qk6Gvs64l0f4MdgHq/fgsZvuo9orcQ2xGoOaTK6/7HUjqTaVh1CYnVdS8VwRNKMU+wn0xOsaOt3 +F9NOS2bF2VPz8f3LN2qEkCRyV3ghYG1aa6X7/Z2zLCQMXYmj9V6XmxYhFrPazp9L8TgMkQGYcN j6lUbRu77BjIWWP54MYPzH+kl5w8wJAQvPdoSFZ0LBr3WhKaQ6Hv6BXSvULmxNmt0GLJ+5urgVT tdINWGKlbZ2Qo6w== 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 03938def6ae9..c2035cabf579 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -581,11 +581,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 Wed Dec 4 11:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847491 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 00E2B1B3922; Wed, 4 Dec 2024 11:06:01 +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=1733310363; cv=none; b=MJjZeV/62EcFM3ntudCu0DZlNfncfRQm2cietAOp71vpu3knUHfwz+wjgMZEI1YVjOSgz/fmDggJvTGsX3pqbsy6jB9i3n8JmehI2/oz5T1HrIzc5ihjr7rvdRcsi39r5bVRjUjoIDjdm2tGOtZERjcLniXOu+m+vAHJwG1oqfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310363; c=relaxed/simple; bh=heR8KYwFA0qbODgROfqUDYupEapASDH6h0/td17hWK0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jtaQykhhH70GFCZdHpt/8R7tlLbF0QHO/iFyTiSLXBiMTWtRk6VRHgZmdVxWyF3zJZLApSF3A34BubmXopI6HDgfnF/0dOnMwNR0Bzw2R7JbyAYtXGPykhEMB67PIWgyI9eQKGD+Z818cSr9SrOcrhNwpn8xK3uNsf2zT5ZzX18= 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=h4j4YHdE; 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="h4j4YHdE" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F06B9FC; Wed, 4 Dec 2024 12:05:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310322; bh=heR8KYwFA0qbODgROfqUDYupEapASDH6h0/td17hWK0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=h4j4YHdEdqk5YmTRH+SpsrbjAEysy4ZHLxadpHZnu/czpjuq7C6+RH22w+raF1dXd YkTXG8lUJZTqHMhpjwN5VDLByjWgFUYliqzq/HTkOaK+ZjuVpkrbfMfOc80DDTCPYW s6Lof7pwhjbcQRKthFTOmLf1FmyLIUTL+iZQN/dc= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:24 +0200 Subject: [PATCH v3 10/15] 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: <20241204-ub9xx-fixes-v3-10-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, 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=heR8KYwFA0qbODgROfqUDYupEapASDH6h0/td17hWK0=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeFknKjkMmuZJRKMzfjngbiy02y66IPxiWE+ auFOJZ19xiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3hQAKCRD6PaqMvJYe 9dF+D/99Aaa26m+WQTcSqvC/fB17RTs/2bqMwyEt/xIpW1boFzFEmR8ucr8mbUELCgoT2FEnnQh Vv8oJBPcmpq4aZu2uYGDsZwGsEe94vufd3BWCSdng7kBUw337aGNla4kWk2e4HUUOtmFZTGGDXY Q0IDSK8kNG2KlHJ4uXdzKKXUaxAg4qMMqYKvLM5j/fOivkwA5846q510dpDozX4FUF6XJgqQPMI iNg/GATgGmgu4a0FEkrV4yWADzzxIepCWQPf09QTf+Nz7LTk3WeY1z8IXhGFzF4+cGuRVx1+/gj rJwCII+eOv2uTh+8Mug8nehqGi8n36o6MuJpFJcI5omeGQWEtVpnL2EESx9tFPetXGRDqg3HQya /g6HfQsgWAlrvXSTkkXXrdVsnoOB7g32AOA1O0PVjJhBPiXvRDQKlP/F0/a70Z9pUYddK2CmHlQ EnfmSBu8FZCaG9dWO9QFZRfHg+kxctkhmjRQELgwCYnt23RV1ByNJ2/Sz9kx39WCjayWaslivLP hQxDZjerqmsTOLu0Z1v5r/4IMSj/b0WWAfIVzh5xJBLEs6IVEm2hTZYpaAroQ49xDwySqGNdVYX iklTJjbsKSihB4uTWAKcHBQqlQPvq7JUU0q0E4kSjnJ25dj+kiKrsp5m4dco00E8hl39bI4WLF+ 1vBNGj6BD+RJL1g== 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 c2035cabf579..a4a624816d8b 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -367,7 +367,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 Wed Dec 4 11:05:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847490 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 16E081EE006; Wed, 4 Dec 2024 11:06:04 +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=1733310366; cv=none; b=FVqae3OEgJloEQ8D1nB2x7AJ5/szsid8TJD+HTu+54KctALf7mAZi+462xnFa8Gb3ubclC+KMbvwwa5XeQ82T2ongbvV6jlgeoDHzxNVSiDbiPzw1QwZ3NpHmh61e1drA1z/nwCCQerJxBo/dd3wRbp/qM0WUz+4b6XC0NOa8sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310366; c=relaxed/simple; bh=cvgAmZGnvd+MaIkpjSC6cQoWn3Y/Etg4xrzQpFwC5+E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IWSyBAcrpskinr0dBljpXiDnURrPbTsXMVlSwj0VGG7ZCyn5fDJxgaNWjcGHCXn0Y9wpjPLQr71J1fr94VfvBM28puwwtdDE06gg+6h2ZJdy7nVO6A8VBuuJn3SR48k3reE96PrmyR+C/XW/TEjenyDKTWn31DYJO6v7aBcVIfs= 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=f3TYs03S; 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="f3TYs03S" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3BFBA1D29; Wed, 4 Dec 2024 12:05:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310323; bh=cvgAmZGnvd+MaIkpjSC6cQoWn3Y/Etg4xrzQpFwC5+E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=f3TYs03SgifWvbv+gGweK5Bw/WH3wzU9SiwJYm27xL0NT4G8rmJ/M0vcCQ2vXAEe2 5roim0w8RPJ041vFu/QTUAP4Msy7o5CbVt5bYn3k+7mrxyd4JVECGkKs5SINHHbBXj vNdc/JdbLmv/IHw5iAVepkNjml5eUxRcl9NYoYis= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:26 +0200 Subject: [PATCH v3 12/15] 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: <20241204-ub9xx-fixes-v3-12-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2084; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=cvgAmZGnvd+MaIkpjSC6cQoWn3Y/Etg4xrzQpFwC5+E=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeF6SG7tS/eiKXoOzcD2sDQM4nC9mte+P+7b tQ7bhTo/MeJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3hQAKCRD6PaqMvJYe 9UpHD/9adFtA1QLcFEJKFxFjDQp1UUULtz21QokXid773ecBjFkD8OpdRDD4Q9+x7+Cg200mPr7 Cq51u+2yFiw4LDgp9QK+pLdZnwalxy4zPnHAfjPApkdjy920L73NPzQv+L/JqPXXKuCokijRuMA q7TZwyCUbzLUGDtAH3N2lm2uU8TL7gcmIDnQJLqhB52BFXHq1sYnjwprI5nGvoUaxdQ7fhESbQ0 981oxzOiJzu9HcadL+GvVnA6KHOAyNmjXHx2LEJwldyRlHwd1hT0xBlCuNGdxceAal9e5wBKRnk xErBZQjrcQmeF13mzY5dZQac9qM+IbYCAryGTyuynxVP3pJLd93epYLkSJjCgOzlMlq3rvOW0Mg +CYiHs8n+x6f3BScN3PccNFD0DesugsRA1XTTkkMi9b2UMp3vOpla+VtG3lGtZtBYESW/JdABjo 7JJNr2tiR9WK6Jxd79QidvKXOQyCCGW7I4Yuq2cpVIIUDuGGlIiF3DaiJ72CZ8d75TTuJdUHE/k 4u/0+SZqsE9SGRDJ6kTIqg6XJh5RQWNCZQ0ZJnxmdRKQyMF2qENAI38g7VuxZbA99fGr/AtBDAU 8u8YhPH6M5eEGQB4rr1n2awpt5NMYCuQ2NtY8RTdgBau4i6r63lNQD7hOmCov3zFoFuy+jFSC0e 9696riyYmu4TarA== 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 | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 64b5297c5f22..1dc10b2ba1f1 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -2982,38 +2982,49 @@ static void ub960_log_status_ub960_sp_eq(struct ub960_data *priv, struct device *dev = &priv->client->dev; u8 eq_level; s8 strobe_pos; - u8 v = 0; + int ret; + u8 v; /* 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) - 7, ((v >> UB960_XR_SFILTER_CFG_SFILTER_MAX_SHIFT) & 0xf) - 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 Wed Dec 4 11:05:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 847489 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 20C931F7061; Wed, 4 Dec 2024 11:06:07 +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=1733310369; cv=none; b=Z5lqZNtHJHMND9kEZZdnEDWYh4YehycUP9so3UBXNn+rmexaIAOKp1iz0qjMDusWNU+hWh5isucvEXK9c2LMKj0baFz3XDG9vmxOoBJxPpvP9+NG2BPr45Izu7+/zErzj7v0yIPE/14y5vZJecXJDVU5zfs/xPH+yTDoxiQwquI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733310369; c=relaxed/simple; bh=h/Wucr0WK1pNJOQNFzwHPdnYZcspI5Mizs3II33asmI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rOkVV7eF8PdYQjihewL4npGgFaQLo/H5xTTxtq42JOgYmdpsYFQPxgwpppGgHY/hLvHyu2jiaOALRHeQrdpA+0zhecZCI0vaJCL+y6lV5BVU+AyzOq6eOTwzcD3eftBK6/i24Y7i1C3TpyAwe1lToC1yFK6yMxTEXx2ozGxvtHs= 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=SS5F1O7f; 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="SS5F1O7f" Received: from [127.0.1.1] (91-157-155-49.elisa-laajakaista.fi [91.157.155.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 67E43B2B; Wed, 4 Dec 2024 12:05:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1733310324; bh=h/Wucr0WK1pNJOQNFzwHPdnYZcspI5Mizs3II33asmI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SS5F1O7f86sQAp3f39ULcd+DLu5J11aiUTNv8JW3ts51KEpH1xEOWUQFzM9Huymiy +al5pAcmLGZLNlwwoLAQdt5RWcXcTSU76rhMGVudFgvxWsZbT+lVwZzQJPzVvjTaiu gM5ilqHX0ZiVzcbeIo5utMlSGqNkE8RjWDZARAN4= From: Tomi Valkeinen Date: Wed, 04 Dec 2024 13:05:28 +0200 Subject: [PATCH v3 14/15] 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: <20241204-ub9xx-fixes-v3-14-a933c109b323@ideasonboard.com> References: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> In-Reply-To: <20241204-ub9xx-fixes-v3-0-a933c109b323@ideasonboard.com> To: Mauro Carvalho Chehab , Sakari Ailus , Hans Verkuil , Andy Shevchenko , Jai Luthra Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, 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/ZANAwAIAfo9qoy8lh71AcsmYgBnUDeGk/Dq4BHcqF4yxTfZcSNdZmUp6VN91Hi9S RGl9RjA8oaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZ1A3hgAKCRD6PaqMvJYe 9RRlD/9Y4nGs1k0Zozw4lFGWJnt1103CIYNlZB5IXt+vV7E+p9M0uTmv5DIB4jJQyqBDjuSrvye mTf85RbIJGlVuCYIlMu+myKxVh6IehJLspTp7rOsX5E6gAkjK8N2x4xLpJXpy/iLDrTAT6jxJY2 kYHgOlx/SMY3bckit2dNqMyLBvVa1UxdmrziliUTVDeTD70RfPPHE6ot/eIUq4B7/bXooAH52Ux 3P4WwuLZTvSCiX+zrg3XHlpVu9iJqiN3f0EbvqJdcH73ugUBOL6fn7zmpi2DyF5dVq7cp5buYU6 26OhyMt7G2l2xXiEU/kBUIINfCiyTwvFiSjR5dbqylDvVTZDAYlgRyjiwBx4J1lo9NZPtuULeOG YddngP9nw0SB1LH18Jal/Upyv2VCF7AqhYGnK1Lhchg9rxCle9JkbJbuARNJQZEsw2gpd5ISPzg JRovXCqWbfWAbjt/+QohnLHToBgiKqixB5zUNIwzbwwIYaEBy8gDMJwyn6i+Rj+y6+zQeT5rFkh /nubblFynGkfFzfcnkeBwEPHdLGjQ208oNa/JD2VFB3zh4Cp9TsM3oj24XQfKuMQpsNZdzdqQUt ZJ3VKpqyGSapDmtjgV6Hs2GeoeuyYyJwtMz8gR1HNakSFcGBhSRU77nFe8OmHZAJDMMRhrzCdmo v6KH5n+gmMGp+3w== 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; }