Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3071100imu; Mon, 19 Nov 2018 10:10:51 -0800 (PST) X-Google-Smtp-Source: AJdET5eSnpDuNgInBR8rnzHQnQCenmMFoIl4KCNDR+XyH2YebUchul0jQfGiLrOdpDpvhIc8ohbF X-Received: by 2002:a62:f247:: with SMTP id y7mr14418873pfl.25.1542651051491; Mon, 19 Nov 2018 10:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542651051; cv=none; d=google.com; s=arc-20160816; b=wnVN1ao7XeVxVXBeAx7PjUXrQt23M+jpvNq5W80FVoIPGomFeq41Mp9dWA6oY2y+RU 6j+8WCISAVbq2CmFJPHPNqQeSH/abBLavAChvkm4plbQMn2PczffYYNEMxcVL6evwDYV +NUxFWISsLy3ov/otZSjoTd/txISMhXM18aJzzdQXttOMbDq5KcIxdaerRqPClka1sN6 O2lnFY3K+SMewjcb9kbVTo2f+Wt+Zo1hRHpP+Ht9gA4thUKzVtiSKvofz/vq1mb3Nbp1 mM+8EZa+1y47k0eR7ETGy2mdqomKQbmqfUPp22Nx8Od35SpMf5N7vqvs6RZVK3ZextR6 ZE1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qUS4Lde+9DzwM+TACPnEfeqN/bpn1Vw98aH7wuVl89w=; b=EcHp/st34WkIpiNO1u9CywoSc73TQ1xpCUJfZ0gJ1PSQwIIHbei1HDnWtQtAbPMQfW 3xyKammf4kq3UcUcbdtvQsqjGu4y0ZrBtbYnVs54j8Bgf+myEeY9AEYfWT3ULHnhYQ7B cTD1eIAzuSJIN/AoOdx4e7mWugiRydVfV1QS9P45YFXEKwjEZUhm5LZzQ62WeV5acI8k t1uPz1FkD4Ikr3N/3/PKxQ83UuSutLRM+mel2HVc2Ov7633sL8jj50wOZWs2Z+EeXnNT 3CN1/xh1Ln87Z64hKfGVvSSOzdpvDMIRFrlqVzDXbhVtQhTjGBwHfvYKkYkXHSVJXmJG vDYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f1m3v1FY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si42490505plc.140.2018.11.19.10.10.36; Mon, 19 Nov 2018 10:10:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f1m3v1FY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730467AbeKTCzn (ORCPT + 99 others); Mon, 19 Nov 2018 21:55:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:53498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbeKTCzk (ORCPT ); Mon, 19 Nov 2018 21:55:40 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F10E20870; Mon, 19 Nov 2018 16:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645093; bh=/k8WI06S1VvuBQuya3x8FN7+M2I9r+JEToz28pf06GM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1m3v1FYVp2MXl9G1R1YDX/NYEB8kTyFxSrR6U8d715knwJML5m8kMM6F1hPVzBQg gyt0D/ZnsihCoUVTfr7IHR5VZ2uEIWSD8lVZ1JfZEYYbxPehtYRpzv7diBCxrlOzh7 k3NvUmJD0ZeEd0S8MDsOTS4yCI3CRVpfXWZWGvRw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Ardelean , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.19 034/205] staging:iio:ad7606: fix voltage scales Date: Mon, 19 Nov 2018 17:25:41 +0100 Message-Id: <20181119162623.536053994@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexandru Ardelean [ Upstream commit 4ee033301c898dd0835d035d0e0eb768a3d35da1 ] Fixes commit 17be2a2905a6ec9aa27cd59521495e2f490d2af0 ("staging: iio: ad7606: replace range/range_available with corresponding scale"). The AD7606 devices don't have a 2.5V voltage range, they have 5V & 10V voltage range, which is selectable via the `gpio_range` descriptor. The scales also seem to have been miscomputed, because when they were applied to the raw values, the results differ from the expected values. After checking the ADC transfer function in the datasheet, these were re-computed. Signed-off-by: Alexandru Ardelean Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/adc/ad7606.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/staging/iio/adc/ad7606.c +++ b/drivers/staging/iio/adc/ad7606.c @@ -26,9 +26,12 @@ #include "ad7606.h" -/* Scales are computed as 2.5/2**16 and 5/2**16 respectively */ +/* + * Scales are computed as 5000/32768 and 10000/32768 respectively, + * so that when applied to the raw values they provide mV values + */ static const unsigned int scale_avail[2][2] = { - {0, 38147}, {0, 76294} + {0, 152588}, {0, 305176} }; static int ad7606_reset(struct ad7606_state *st)