From nobody Mon Feb 9 14:50:58 2026 Received: from caracal.ash.relay.mailchannels.net (caracal.ash.relay.mailchannels.net [23.83.222.30]) (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 12EEC311C38; Mon, 27 Oct 2025 17:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=23.83.222.30 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761586572; cv=pass; b=opMOJmUC+NREuMzpc8rvGSOM3wRkCRf7ESEJ8GL3D/Jumfn3Nd+jCYzpWopsKCcyQIcqI6PKYYCxN1HubX/qW0n1+OOyNL6C9GLXBnw7oM8tTQqijX2Hp9D2WdlAiwkrchVvAFy107m+zf6JncvOWcSAssgTXzZxsPZSKVj4GA0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761586572; c=relaxed/simple; bh=cLgnUhjqtxE3ue8jKNO8wJhYJ2MVAbCV1AutJE6+Kcc=; h=From:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc:Date; b=LW63G5jd3ou71I/vKNgfEtax/gA9aep23I0FLyV7rrNm8GZMFY5G3P9n8XrIB5e5ZDpjUmGoIhUVgDlRQN08m+RqvLnBpzswlBF1+UDJuX7otG7kicSJMic6GiKazgV2ACMzrBWIGDvfmT78rRjGuHlXA0JjDUyuzVl4Gq5E8us= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smankusors.com; spf=pass smtp.mailfrom=smankusors.com; dkim=pass (2048-bit key) header.d=smankusors.com header.i=@smankusors.com header.b=h9BnXV5n; arc=pass smtp.client-ip=23.83.222.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smankusors.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=smankusors.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smankusors.com header.i=@smankusors.com header.b="h9BnXV5n" X-Sender-Id: hostingeremail|x-authuser|linux@smankusors.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 965F9435BB; Mon, 27 Oct 2025 17:29:24 +0000 (UTC) Received: from fr-int-smtpout26.hostinger.io (trex-green-3.trex.outbound.svc.cluster.local [100.121.22.161]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 33FCE42548; Mon, 27 Oct 2025 17:29:20 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1761586161; a=rsa-sha256; cv=none; b=4ywgjDUys5GOtl10dwTBpb55GXBGsC5fWsj8HaRP+Ql63Pi9PBK+qI9dh+2aE07GZd9hWr F9gsO26L4cSubL/9BtncToumo18OjusmVIuPH0c9qNB2dWq3nGVOJaVhS4MpP/IHtXPL66 548S+AdzeqbIzo3DTu0FwwXW3uCT8FhW07h01xPeyyPDYkUmt2ffMqXA7oAWyVd1JPPsu3 tsagJVvuQt2b67R3chgymC2hE55Bw/miAjy61H2T6zGGdIoQp/bnT9Fv65BT1ke7zyr252 B60azHZPjpxDhXJTNYvjewS92nWOql8Dvy57uhSShKNi3IxWthMa+fd2rjwWTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1761586161; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=F2+pEBigQD6/8zIYsLrP/KkObLZsezWI/xcTfxleyR0=; b=f5QR8O8Zj4U9Ck+gLSJopSw+F7HptXN+0IYhBbUqDLAhTica5/nxHz1JdDSP69qJJW0FS8 Q5N12ljRXfhjVI23ybYtRZjfUtsqLkYVAKX1Q86W/jcePEZASihnn3/u/9v0AQkpHDiXig i5m5H6DncWrkrjM2arzLNFixgao+c0nEKQvZvZI7YSb/dVeMU3gAKhzjv+HjU6QYzJwdIG xhpgHyxazJy6iPmt/OgoKNKQy1UCcdHCXPs6+7yqKNCoz0RfqBPevk7XP/wxRseQyMa6Nj ZsNVk5U2hjGX+xr0ymhFxz1/53hdFfLQ4oc7M9V38Au5TWPCkk1S/uCZ2kIrYA== ARC-Authentication-Results: i=1; rspamd-674f557ffc-ggxpt; auth=pass smtp.auth=hostingeremail smtp.mailfrom=linux@smankusors.com X-Sender-Id: hostingeremail|x-authuser|linux@smankusors.com X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|linux@smankusors.com X-MailChannels-Auth-Id: hostingeremail X-White-Obese: 33e60b38779a72b4_1761586164371_3076747356 X-MC-Loop-Signature: 1761586164371:3950152993 X-MC-Ingress-Time: 1761586164371 Received: from fr-int-smtpout26.hostinger.io (fr-int-smtpout26.hostinger.io [148.222.54.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.121.22.161 (trex/7.1.3); Mon, 27 Oct 2025 17:29:24 +0000 Received: from [172.17.0.2] (unknown [36.79.119.172]) (Authenticated sender: linux@smankusors.com) by smtp.hostinger.com (smtp.hostinger.com) with ESMTPSA id 4cwL8r4sNCz1yRM; Mon, 27 Oct 2025 17:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smankusors.com; s=hostingermail-a; t=1761586158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F2+pEBigQD6/8zIYsLrP/KkObLZsezWI/xcTfxleyR0=; b=h9BnXV5nULUPspx2hlErnjahUp/+GYJs7ybgnr+is7OwlSworBBm7GErnXkA0XaiSeAJ9O BxtGfvx7OZDpv/whAd99+AnJzBaPraRkcvodTnCePdptWhzGrEPRmmv5vizinQw54LcYsL L9kME3PM4soEVDO2qVV83UAQd2wMwMbJkpW+RxPtITm3PXVUY5Sy/QQIm3NV7TFASisQML 42csLXr658lGHKkORcOym8hL3/Y6lot3SJHKbZJIc5j936gJNdBHmuZOgz49Ld4GSTiuJK wMYsOyngK8aHTJ6f0K6GkQq3TAAv2PX9JKMAoPy2oetTR9El7D/Oy2crTYrwYg== From: Antony Kurniawan Soemardi Subject: [PATCH 1/2] iio: adc: qcom-pm8xxx-xoadc: add support for reading channel labels Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251028-pm8xxx-xoadc-fix-v1-1-b000e1036e41@smankusors.com> References: <20251028-pm8xxx-xoadc-fix-v1-0-b000e1036e41@smankusors.com> In-Reply-To: <20251028-pm8xxx-xoadc-fix-v1-0-b000e1036e41@smankusors.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Antony Kurniawan Soemardi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761586153; l=1001; i=linux@smankusors.com; s=20250609; h=from:subject:message-id; bh=cLgnUhjqtxE3ue8jKNO8wJhYJ2MVAbCV1AutJE6+Kcc=; b=J1PsCFJ5naQrve/LXDo3Zk5sQblR8vddMr5/l7ma3rJJKhMestCoJ/uQroUOL4lCAP8XjoIaw h6fWOfa2SFSAgZehYofVgHf0DAaJ/RtQq0Ml40lmLDiRZwHsD2rCIfa X-Developer-Key: i=linux@smankusors.com; a=ed25519; pk=65wTy06fJl2/h/EJwjr704YG+yjHFhZObJBWzzK+N00= Date: Mon, 27 Oct 2025 17:29:16 +0000 (UTC) X-CM-Analysis: v=2.4 cv=GbNFnhXL c=1 sm=1 tr=0 ts=68ffabee a=pMbO/JROBRbC3Cu+MWauHw==:117 a=pMbO/JROBRbC3Cu+MWauHw==:17 a=IkcTkHD0fZMA:10 a=wxLWbCv9AAAA:8 a=9BUqChrCs0__dafhRrMA:9 a=QEXdDO2ut3YA:10 a=QJY96suAAestDpCc5Gi9:22 X-CM-Envelope: MS4xfPMhP95yGjIFAld3TRf7KDkocukmG/asDfa12NxNEHZP5paIuOsOXNoUAuBETV9vvx8v3ihJRMKemz7wJ4l4SDlNNfy2DYcmKZuW+c4dd5KnfWvBSG5l ryt0fadibaqLtPlw6dWeb4eSzOdkYkKh9sqE23GSkz/lwG9xNP+vUt5uKiwUMjaICuIfnKHGe6FkNPnXK+mp7CT7Jh5NXR/TTBXdD9KvkBfQU1oHBjXZBz0v RMqvGBQ/3Kf6HvnQbRBn8yrUGx/5KLVMP8itc61IqNmguwvGwMxQIDvu4Y3laJ7vfURA+uWWPAQvnK+CbhzPT70uBKr81CHNDl//k3QDTJaW/J4Q80Lg5j3L oIfXf8gMdLFAQG6S84o/DoVq8cwmZtbgA0+iNLCsFkIcuJ+x9g/cHO9sOM0A+ztejz/q7jkF X-AuthUser: linux@smankusors.com This allows user-space tools to identify ADC channels by name through the IIO sysfs interface. Signed-off-by: Antony Kurniawan Soemardi --- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8= xxx-xoadc.c index 31f88cf7f7f18297132d152648b312c0fb60608e..8555f34036fb13c41ac720dc02c= 1dc39876e9198 100644 --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c @@ -725,8 +725,15 @@ static int pm8xxx_fwnode_xlate(struct iio_dev *indio_d= ev, return -EINVAL; } =20 +static int pm8xxx_read_label(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, char *label) +{ + return sysfs_emit(label, "%s\n", chan->datasheet_name); +} + static const struct iio_info pm8xxx_xoadc_info =3D { .fwnode_xlate =3D pm8xxx_fwnode_xlate, + .read_label =3D pm8xxx_read_label, .read_raw =3D pm8xxx_read_raw, }; =20 --=20 2.34.1 From nobody Mon Feb 9 14:50:58 2026 Received: from iguana.tulip.relay.mailchannels.net (iguana.tulip.relay.mailchannels.net [23.83.218.253]) (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 C97F331814A; Mon, 27 Oct 2025 17:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=23.83.218.253 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761586175; cv=pass; b=TkHnVr4BvfCQZxNIAkQX8IMoh9UIPpKAuxkHf3xlupGupkhnEgcEM2TyGxz6Y0x3yRfOEl1wKTgerUHRYFMswraUYrH5v7YB8efnE6QFlklAmKpXbZJdbkf03th9MnnuRt+LMcAJyJ9g1cFN/nF5MSdea1fV2GEVfJnRxCpN9W8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761586175; c=relaxed/simple; bh=GgWVH8NGOYkGn6vEw8dVSaC/+r+0SZEjRo035uSx3pk=; h=From:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc:Date; b=IRxkzodxo6nE7itbTQm6AcEv7v6Z+8NT4EbaCLkYggd7Arli1t01czQvJOOrjjZtFOIP1Py8XRZS0xOQRKpzptU4a5/xF4cFm2c+2PqvDug9e+TyiWtmuWLw28/Z5i7asLTUhcBuu1pkzJXgWzj3iB/aCQZheUFD6vHVu6myVxU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smankusors.com; spf=pass smtp.mailfrom=smankusors.com; dkim=pass (2048-bit key) header.d=smankusors.com header.i=@smankusors.com header.b=igZcA8O3; arc=pass smtp.client-ip=23.83.218.253 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=smankusors.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=smankusors.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=smankusors.com header.i=@smankusors.com header.b="igZcA8O3" X-Sender-Id: hostingeremail|x-authuser|linux@smankusors.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 96074421F2E; Mon, 27 Oct 2025 17:29:26 +0000 (UTC) Received: from fr-int-smtpout26.hostinger.io (trex-green-8.trex.outbound.svc.cluster.local [100.123.122.56]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 604DE421A26; Mon, 27 Oct 2025 17:29:22 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1761586163; a=rsa-sha256; cv=none; b=vn8rzg6P/Vkept0JqXnwi86x2Wmw5xhPIsDLtugjmp57uiGHaoQfvRmKSweV7DxrBb3tLL WrhxTRvtVhvsHLvDm5qLxQPtWQCqLWJzG2zJfH/iszLJmtBpGA2L2DlUg134xEqF6UBsQf /WNxtkEnIu04DumSi+hyF0NR6HWP0X7S3T9bPTLG8u1qNGA+LaUfUM0g7bHuXCSnvN7uLs 8B3NjHswl7WDMI/Y+1kw5KIEon8NQL6bLibcV2Lpc86P6R9LTsZIPUdBOfkwcGbYS6GyiU MeCySCWYC03cyYMFmdmsqnVeXQJgYERKcp4HXCMh1fv9JnOse7QvyObq4YS9ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1761586163; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CxflxuYLZUtFq/y0lEQkBNTrp1mbu2WIcxpYcXjl2Ws=; b=u0d4FLLkR1SGwyjC+VbB5PT1xKimvSYXSsytneOj47R/oDy50NV4Q6+wuFOxWq2/R+cqpK h0bRNnuUhe6fNrsomgXbysqSVZegyoCPoXfUPTW551RPZaCLMFkWHBQj2ee5CRgKKVeS4e JkmVYqDoWvIGDwCtTNO7i8/ZoZZFWu/YrVJzxk8n19ybsshK0CXjKAeM2Pb1Z8Eeka4O87 l5HwrCRLPqF+2eYhc/RvQD5TuBdI27zSzYSvbT24ZQCjWSrjBaqWcYDRhYwBZkc9irL90Z 0kihctvOEUpk5vo6PBwxACg6KLMfRa+AoF0/GKZqAVBc87GEmuPdV7xJUbsjIQ== ARC-Authentication-Results: i=1; rspamd-674f557ffc-sktqk; auth=pass smtp.auth=hostingeremail smtp.mailfrom=linux@smankusors.com X-Sender-Id: hostingeremail|x-authuser|linux@smankusors.com X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|linux@smankusors.com X-MailChannels-Auth-Id: hostingeremail X-Language-Towering: 348265f158d8ebf2_1761586166143_3099727680 X-MC-Loop-Signature: 1761586166143:1005675760 X-MC-Ingress-Time: 1761586166142 Received: from fr-int-smtpout26.hostinger.io (fr-int-smtpout26.hostinger.io [148.222.54.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.122.56 (trex/7.1.3); Mon, 27 Oct 2025 17:29:26 +0000 Received: from [172.17.0.2] (unknown [36.79.119.172]) (Authenticated sender: linux@smankusors.com) by smtp.hostinger.com (smtp.hostinger.com) with ESMTPSA id 4cwL8t6t06z1yRT; Mon, 27 Oct 2025 17:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smankusors.com; s=hostingermail-a; t=1761586160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CxflxuYLZUtFq/y0lEQkBNTrp1mbu2WIcxpYcXjl2Ws=; b=igZcA8O3fAdj5O+x6N4MOLlb4kyG6IC7fpxld13ef6cFKql/qVrgAwMshbzDCce9tzQOgz Q5G5Tkhz7Itq6zzoHrj4if0vQVeo35f/Qk4nr+ilGuoOOVjDhH6pVfC4RhYstvYVdPeS24 7JPFr/MN2v15+L6iYLGKHOuHc7zPX9eca3rQ5DN7b8DPw0Gw0SvQRpO9OxxjHk9I+Sv8E+ WiFT6LF6I0s12yuplcjWh7tGy+j5L8clSq/rnJRVejLfrXFl1CDMnxrLcMu4jYncmSRBTD G4n1QQobmqOLShpHoVTm1oRTt/YoAIMBV2BNY5CkJ0qpJKDt/5Uw9OJ5pXXMgg== From: Antony Kurniawan Soemardi Subject: [PATCH 2/2] iio: adc: qcom-pm8xxx-xoadc: fix incorrect calibration values Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251028-pm8xxx-xoadc-fix-v1-2-b000e1036e41@smankusors.com> References: <20251028-pm8xxx-xoadc-fix-v1-0-b000e1036e41@smankusors.com> In-Reply-To: <20251028-pm8xxx-xoadc-fix-v1-0-b000e1036e41@smankusors.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko Cc: linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Antony Kurniawan Soemardi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1761586153; l=2514; i=linux@smankusors.com; s=20250609; h=from:subject:message-id; bh=GgWVH8NGOYkGn6vEw8dVSaC/+r+0SZEjRo035uSx3pk=; b=bwLG1GMA8+vdcizG70YbUcF9vuSTbX29w260Agdhl43efS21o4WHOLUrd2NdAgAQY9hwBdTIc d47HxC/G9BBDCAUu1UCAw0+918nRmJnr6vaB5X0DqX6ZK6b9P/AmBzg X-Developer-Key: i=linux@smankusors.com; a=ed25519; pk=65wTy06fJl2/h/EJwjr704YG+yjHFhZObJBWzzK+N00= Date: Mon, 27 Oct 2025 17:29:18 +0000 (UTC) X-CM-Envelope: MS4xfFBzBe3D92rsrMlmPfFPT+SNEqLIcW6Z50gkI5ZV+HEYFxzf0H/nGNIkV3IfWCyIMCmORh5K7JEdCodCsVnWTFf4QcnttdzSEpoy3jYFJ7PIeL+UjuXN pZSRRZi9RqYyxLndyIllTUZkWMKr/tL9TsIkrtUiu0FoIiCFr3EnsIAypcLGnU/TqzAH6haDyNOiITuAGXudCLncFVbM+NceAGz/ekSoIYcSEXWurBm3VxwM vBaQUcJQFYZ3cYLlLYz7Nn8ukxus0mfROzzG/8EZ5vRdmbueYDn2H5aMz8oqnpLmV4BMVX9letpfLg8qjg1dH4zcAVXB1ccwC2OZR5dElXY6VAy3TfrfPavp nQg8Oh91IgOicsRTM+bBYaHZboUMZxOiU67fRtvL1H00pevtE0/XARQ0cQclB9qNDjDjNMv2 X-CM-Analysis: v=2.4 cv=NuiDcNdJ c=1 sm=1 tr=0 ts=68ffabf0 a=pMbO/JROBRbC3Cu+MWauHw==:117 a=pMbO/JROBRbC3Cu+MWauHw==:17 a=IkcTkHD0fZMA:10 a=NEAV23lmAAAA:8 a=wxLWbCv9AAAA:8 a=_rrzIsRTLJWE4oTtuQAA:9 a=QEXdDO2ut3YA:10 a=QJY96suAAestDpCc5Gi9:22 X-AuthUser: linux@smankusors.com On msm8960 phones, the XOADC driver was using incorrect calibration values: absolute calibration dx =3D 625000 uV, dy =3D 4 units ratiometric calibration dx =3D 1800, dy =3D -29041 units As a result, reading from the IIO bus returned unexpected results: in_voltage_7 (USB_VBUS): 0 in_voltage_10 (125V): 0 The issue was caused by not setting the ratiometric scale (amux_ip_rsv) from the predefined channels. Additionally, the downstream code always set the ADC_ARB_USRP_DIG_PARAM register to PM8XXX_ADC_ARB_ANA_DIG [1]. That value does not include the SEL_SHIFT0 and SEL_SHIFT1 bits. Enabling those bits caused calibration errors too, so they were removed. With these fixes, calibration now uses the correct values: absolute calibration dx =3D 625000 uV, dy =3D 6307 units ratiometric calibration dx =3D 1800, dy =3D 18249 units Reading from the IIO bus now returns expected results: in_voltage_7 (USB_VBUS): 4973836 in_voltage_10 (125V): 1249405 [1] https://github.com/LineageOS/android_kernel_sony_msm8960t/blob/93319b1e= 5aa343ec1c1aabcb028c5e88c7df7c01/drivers/hwmon/pm8xxx-adc.c#L407-L408 Signed-off-by: Antony Kurniawan Soemardi --- drivers/iio/adc/qcom-pm8xxx-xoadc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8= xxx-xoadc.c index 8555f34036fb13c41ac720dc02c1dc39876e9198..a53d361456ec36b66d258041877= bd96ab37838c4 100644 --- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c +++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c @@ -503,10 +503,11 @@ static int pm8xxx_read_channel_rsv(struct pm8xxx_xoad= c *adc, goto unlock; =20 /* Decimation factor */ - ret =3D regmap_write(adc->map, ADC_ARB_USRP_DIG_PARAM, - ADC_ARB_USRP_DIG_PARAM_SEL_SHIFT0 | - ADC_ARB_USRP_DIG_PARAM_SEL_SHIFT1 | - ch->decimation << ADC_DIG_PARAM_DEC_SHIFT); + ret =3D regmap_update_bits(adc->map, + ADC_ARB_USRP_DIG_PARAM, + ADC_ARB_USRP_DIG_PARAM_DEC_RATE0 | + ADC_ARB_USRP_DIG_PARAM_DEC_RATE1, + ch->decimation << ADC_DIG_PARAM_DEC_SHIFT); if (ret) goto unlock; =20 @@ -783,6 +784,7 @@ static int pm8xxx_xoadc_parse_channel(struct device *de= v, ch->calibration =3D VADC_CALIB_ABSOLUTE; /* Everyone seems to use default ("type 2") decimation */ ch->decimation =3D VADC_DEF_DECIMATION; + ch->amux_ip_rsv =3D hwchan->amux_ip_rsv; =20 if (!fwnode_property_read_u32(fwnode, "qcom,ratiometric", &rsv)) { ch->calibration =3D VADC_CALIB_RATIOMETRIC; --=20 2.34.1