Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3096012rwb; Mon, 7 Aug 2023 08:11:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2t75V4FhN1DoZ3xHTittQK+IPWYkN/bdVWVkfkl3eZlPMIJf9hj5n6Wof2E9o5gZ06wV8 X-Received: by 2002:a05:6402:148a:b0:523:2707:1921 with SMTP id e10-20020a056402148a00b0052327071921mr5869827edv.21.1691421114545; Mon, 07 Aug 2023 08:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691421114; cv=none; d=google.com; s=arc-20160816; b=k3LVYDj/JSeOWyuIl222KTm3sNKeIjtYKVCgE6MmXnJDN+r7YumnrZSuCn8zIcxOh8 TARJ1I/Nf9kluVtlTRnmY0cJ/8zxkGwTGVB/lhCC9q4yslcPbj21IHJ+AvMtYRs9vlMG kJxgFps9LuFMwXeO1aG2QFmDVyDN0xpA/B1WHEHftOWOUkvbxpnyZ/wT9qowrZfvpu5R C0/5L5aKtZF8qi4vWc1FnOEACnCdC55b492kZTMWHrAEMrJi/+9Jj3pWoYg7+BrnofWH SHbJQ5Emz4oZiN7nn4iLQSl+/747eYS5jWi26xX/mRwl4uxT9O/3v9QexejSEqrthirR VdkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6y/uMbhakWSS8oAqg45H0ccmFpSOu2nRFKRQ6r7ECl0=; fh=qPturt8a7BGl9xh2ra5lDlKzzRIIUrPRbXZ4OcdfHWw=; b=OfmwLGjx1QjE6/yF6xpmT8KUdMJVd1JzIlbldFdivLyVR4qIjB5S19hEYk4dsGy446 QGGctO4J/mQI4w8XXk+KD6vTtBdHAcY4QIpka/yxk94sYXArSVKFhe0vxBRvIIWoFJBO Z9iP/x70cmf67TDp+EBsbK9LRJrOupQrBZ/beQW84sSd4HcRxLF4XGaAhZNBHYLeeHPh O2UcLI4rVt5qGtKsqN7zpqS6w/dPLJJ/eXPhXyzzruXw4iULxmDMQiDlZZ3xhzMFYrZQ q7UMgc4Czt9kMtXvwj9J+kscuAhTL30gnvGgcaoaECoIzs1btSQS1grG38sLpb0J3wmi 7UVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a50ea88000000b00522d742bc4dsi5870838edo.334.2023.08.07.08.11.29; Mon, 07 Aug 2023 08:11:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234717AbjHGOil (ORCPT + 99 others); Mon, 7 Aug 2023 10:38:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234537AbjHGOii (ORCPT ); Mon, 7 Aug 2023 10:38:38 -0400 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D97510DD; Mon, 7 Aug 2023 07:38:37 -0700 (PDT) Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 377EAbHa025188; Mon, 7 Aug 2023 10:38:25 -0400 Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3s9kb1ty85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Aug 2023 10:38:25 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 377EcNkZ056328 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 7 Aug 2023 10:38:23 -0400 Received: from ASHBCASHYB5.ad.analog.com (10.64.17.133) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 7 Aug 2023 10:38:23 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB5.ad.analog.com (10.64.17.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Mon, 7 Aug 2023 10:38:22 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Mon, 7 Aug 2023 10:38:22 -0400 Received: from amiclaus-VirtualBox.ad.analog.com (AMICLAUS-L02.ad.analog.com [10.48.65.194]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 377EcAFV022976; Mon, 7 Aug 2023 10:38:15 -0400 From: Antoniu Miclaus To: , , , CC: Antoniu Miclaus Subject: [PATCH] iio: admv1013: add mixer_vgate corner cases Date: Mon, 7 Aug 2023 17:38:05 +0300 Message-ID: <20230807143806.6954-1-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: 8O4WMoDGPjjBTTYZ8mooRsYqTmoqwkrM X-Proofpoint-ORIG-GUID: 8O4WMoDGPjjBTTYZ8mooRsYqTmoqwkrM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-07_15,2023-08-03_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 impostorscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2306200000 definitions=main-2308070135 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Include the corner cases in the computation of the MIXER_VGATE register value. According to the datasheet: The MIXER_VGATE values follows the VCM such as, that for a 0V to 1.8V VCM, MIXER_VGATE = 23.89 VCM + 81, and for a > 1.8V to 2.6V VCM, MIXER_VGATE = 23.75 VCM + 1.25. Fixes: da35a7b526d9 ("iio: frequency: admv1013: add support for ADMV1013") Signed-off-by: Antoniu Miclaus --- drivers/iio/frequency/admv1013.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/frequency/admv1013.c b/drivers/iio/frequency/admv1013.c index 9bf8337806fc..df29f1216b9a 100644 --- a/drivers/iio/frequency/admv1013.c +++ b/drivers/iio/frequency/admv1013.c @@ -348,9 +348,9 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st) vcm = regulator_get_voltage(st->reg); - if (vcm < 1800000) + if (vcm <= 1800000) mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100; - else if (vcm > 1800000 && vcm < 2600000) + else if (vcm > 1800000 && vcm <= 2600000) mixer_vgate = (2375 * vcm / 1000000 + 125) / 100; else return -EINVAL; -- 2.41.0