From patchwork Mon Sep 4 22:02:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philipp Rossak X-Patchwork-Id: 13374303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BD0CC71153 for ; Mon, 4 Sep 2023 22:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/XvIqrK7GUoZEuVuWkINiNzU3SxQQI8INsK863VZkm4=; b=ac23npreFknt6V bsoRQ6ktcbEc2FXKoJq2oRa0BuWYRgECeAuV2cWP05ac9e8ymBDDG2gkIpbAKUUeuZcbtfESnqmoN P0nJJRrVh/oD6WzPdXoj2A9UL0NJmvtpKY1FN8wTHRcpIXBEVWQOzQ+A6VWF95/HSflMVY/lMLk6n CQpczTH1dlMh0Z3tYhAlxkNZ5volTjptAh2ollviGwW7cLGfEOeVnFls5KWSTda7ox9DEgdlyg7hb X1nCrVVjsz9Zdqb9RTHYtgJR/GwGUoXKd5gd7FKDz593z5KYbmM5ZSkNG0eyBzQpMu9O4alIJC53k ukSYdGSWvY5n8EhIT5Xg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qdHe9-004t36-2S; Mon, 04 Sep 2023 22:02:13 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qdHe7-004t2i-1A for linux-arm-kernel@lists.infradead.org; Mon, 04 Sep 2023 22:02:12 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-9a5e37a39ecso253396266b.3 for ; Mon, 04 Sep 2023 15:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693864929; x=1694469729; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xMaoJXfSUTGUV6QmpzTNhrGbBGCZavotUULkh8MgnQA=; b=j+ThTGVgXKguPgw6/ghkPXVOleL1d7iWDDMajEfzWMDrZ6CvZFAeVRo/DAZQwbff/4 upg1sx/Tm5IxKOhixm0UtkOjdJ87Vdxe4wcEpdZ+b0PkxXBRYt2b4T4i6qw/fz3ty11Q r6ave7AHM5IRL6qiXRRQPpmoZwE5AK/l7djAlgssqJ7ez2+8LPp7YPz7DWJsLsYBTBLH leDmB7Tp7x9uhk7uBeALAgxjsKmZbTEcJdKtJBMxcHM2eNQmUmi98YHcI7qg/PjDD+eF wF9LUMuLAa6qKNj1FdwyGYrfREO7NIIw6TC1CUZ5YRIU3w1niWdBotCe0j0qp4k5XFbf hTrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693864929; x=1694469729; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xMaoJXfSUTGUV6QmpzTNhrGbBGCZavotUULkh8MgnQA=; b=M0FOJT2CZvMmnUioy5nT5CKXvocAfgauNZ7F0DxrCgmzXDxx59e/0Bq/11gjnBBhHy 3JetvC2L3vuRliA5HSzH66P1UcQgHjdchD24fwqIlutk87ePxjiRT7929+cl9xuAvqTP wvGwpk6883Rv+RypVmM5aOApIiEq5zVVeY/xnD17vGGziidaJwDMY1MjdoSWBBRTXEU4 hrMXNwqpV9QkFteZuizMeHsb4gNDW0DfjZQmAofRqQ/neq5tMotZ4jjiepfst2lxoxX6 kHTCsr6d6evQZ0hl4rc1+Vl0ENkrGlABqs8G2iYiwb6mn+FG+W6udtTxS4Q0UuOWCpkC 2tBg== X-Gm-Message-State: AOJu0YwphJtTBZBO2i12l7RAydP1Jfad2mGhTBRdO/pO/gcLm/Ug4185 tHsNR0HCH0KWgXC8/5/ZpiFBZT32aC8= X-Google-Smtp-Source: AGHT+IGawf0GPRwtAfFkpDQtSL1yhynnboG0lTJh4YRpwT/zygNcLkKKHHMi4UoM8zi+B7IkwpNUGw== X-Received: by 2002:a17:907:b18:b0:9a5:e441:4cf2 with SMTP id h24-20020a1709070b1800b009a5e4414cf2mr7473042ejl.58.1693864928721; Mon, 04 Sep 2023 15:02:08 -0700 (PDT) Received: from thinkpad-philipp.localdomain (pd9eb53b2.dip0.t-ipconnect.de. [217.235.83.178]) by smtp.googlemail.com with ESMTPSA id lj17-20020a170906f9d100b009829dc0f2a0sm6692456ejb.111.2023.09.04.15.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 15:02:08 -0700 (PDT) From: Philipp Rossak To: Cai Huoqing , Haibo Chen , Jonathan Cameron , Lars-Peter Clausen , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Philipp Rossak Subject: [PATCH] iio: adc: imx8qxp: Fix address for command buffer registers Date: Tue, 5 Sep 2023 00:02:04 +0200 Message-Id: <20230904220204.23841-1-embed3d@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230904_150211_419891_58FC7006 X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The ADC Command Buffer Register high and low are currently pointing to the wrong address and makes it impossible to perform correct ADC measurements over all channels. According to the datasheet of the imx8qxp the ADC_CMDL register starts at address 0x100 and the ADC_CMDH register starts at address 0x104. This bug seems to be in the kernel since the introduction of this driver. This can be observed by checking all raw voltages of the adc and they are all nearly identical: cat /sys/bus/iio/devices/iio\:device0/in_voltage*_raw 3498 3494 3491 3491 3489 3490 3490 3490 Fixes: 1e23dcaa1a9fa ("iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC") Signed-off-by: Philipp Rossak Acked-by: Haibo Chen --- drivers/iio/adc/imx8qxp-adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c index f5a0fc9e64c5..fff6e5a2d956 100644 --- a/drivers/iio/adc/imx8qxp-adc.c +++ b/drivers/iio/adc/imx8qxp-adc.c @@ -38,8 +38,8 @@ #define IMX8QXP_ADR_ADC_FCTRL 0x30 #define IMX8QXP_ADR_ADC_SWTRIG 0x34 #define IMX8QXP_ADR_ADC_TCTRL(tid) (0xc0 + (tid) * 4) -#define IMX8QXP_ADR_ADC_CMDH(cid) (0x100 + (cid) * 8) -#define IMX8QXP_ADR_ADC_CMDL(cid) (0x104 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDL(cid) (0x100 + (cid) * 8) +#define IMX8QXP_ADR_ADC_CMDH(cid) (0x104 + (cid) * 8) #define IMX8QXP_ADR_ADC_RESFIFO 0x300 #define IMX8QXP_ADR_ADC_TST 0xffc