Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp113479lql; Fri, 12 Apr 2024 05:37:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVkB6nXdxkIaoLptq9qQeyb8oRcWuSh+5yzq0l7ygOb4HOMgWNYYioSxzrhSgfrMEtJEIMVJQv4qa3Sr7FMIIJC8c7l41SI0/9BZopBBg== X-Google-Smtp-Source: AGHT+IHtqMp1hAYCsMQnA13eKmvOGki4P89f73Q9h7MqC4HyZXBWynewgo+IOJGm+5YOW6MMv37h X-Received: by 2002:a05:620a:5a6e:b0:78d:6786:7637 with SMTP id wx46-20020a05620a5a6e00b0078d67867637mr2579244qkn.71.1712925447729; Fri, 12 Apr 2024 05:37:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712925447; cv=pass; d=google.com; s=arc-20160816; b=EdsWLebFNmVetby761xXiYRFdxEH/45dG7OdBB5hlnfV8Fb7rjXSAVHruQ15zNZPEw 89759tvn9+kX+4xiT9j/zgTIXrnYNWfZKeQq3wENBhpzR8nRzFwr06jIoxlezBL19D/H DBLgLDljejjWtIppFN9YKDjyHIaKP7YoHKHiSZWpGa6xFQP2XfjTYXhwKtAnejwZpy0W PTKLHPwJE/KVxXjO/yx06Ky2TmTt033IDzVxMNwqzqgaXm6yjmqvFxAnIY9wuL1MPYhg 7YIkh5vco2o9wVuAm0TUurPmuJ/qlVUtTxZRDumRZ3PjqRIscbYi/kESOSX8UC2JUyh3 uDvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=cK3MjKIp9JA6yW/CkbUjPNA1LCpvceIRYox9OMkE+U0=; fh=l6rc4kBqB5BIJXKtBKlXhhVNE9vCrUtDtHtR+D9X2I8=; b=KtzM2Y1CZkyoLaXx5ri+jtFNcvdxOd3cSqV6duFPsATEnpTEONZyY6j0WzxxSQpu7c VJEhhR72QnarYFanOpyFtTJZ4NHJWG8LTO28y5Q0yD/4hnU4/F9ok+rd5OIKH3No2IMd uOROrLTJuaj4n9NFxbTogTs5DQiDtrQFupzZ0vE7ZSvcaTyN2QvJLamGBcrGAjsJlf1F lEqvHVXUO3ZdpZC1vhtM5vS4aS6Go21cwJxe9soZGH8K3AkPxSgmJlAnvxXBFh0zEIuZ rEwympnplMLTjhHFrYQsho+XFALByqwBT+FKJ1CSKOcnd4ItazhPnR2PxrZorHFK+O4V mHPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T8Jv7tYM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pb26-20020a05620a839a00b0078d68c94045si3987726qkn.51.2024.04.12.05.37.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 05:37:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T8Jv7tYM; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-142656-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142656-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 51C601C212B5 for ; Fri, 12 Apr 2024 12:37:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A50705CDDB; Fri, 12 Apr 2024 12:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="T8Jv7tYM" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7DA4B54F87; Fri, 12 Apr 2024 12:36:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712925406; cv=none; b=t+/ngFnUoxZxrP/3x5cFh9WKbEl2Kr+5DnT5u1YQglGLQLylptPRsmgnxDVZdE7UoncYHNvBZn3MH1YV6zTFH2Sm+bVF+cv/dNEtSqVYtS0IJJnE2A3aepwzWbA6ZEED+XeSEtDiBzzebIRGReK9vTPqM/xuWMULKfDZCdHHGFQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712925406; c=relaxed/simple; bh=G0GWDtrUka0cfT9mQcWpAahixZ8YB0wM3L0wDhlXIfM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pmbVJC0TOUe+g0fCgBAaOxZTbSn0FA1cCQ5L2o23oApiX9Wckn0DQicW9r8E/gcbd04bxZd1ffF/2bXVQ2smBfRduDALrTjZPUVYDd6TGObCpcaxyAEeOUmNwCScO29202SROpKEwXS+pF8WWLSgRZiEY4nL+I8RrIn6/7Fo6vc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=T8Jv7tYM; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 25763C113CD; Fri, 12 Apr 2024 12:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712925406; bh=G0GWDtrUka0cfT9mQcWpAahixZ8YB0wM3L0wDhlXIfM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=T8Jv7tYMh4XmHvYCk3Ef3dBLhf9ol6d6T0ZmoocOLPYNtIlYuya9wazvPzrIv0smN WXXQgLR7gEYghgkHoa14096z1pg5nfxDStr443t5AQas3eJKeG9/x5Jn2t0Fx4F5fD 1xRHplyNihOltsAFeAfGvijfNzYovUIAmNsdnbrV5yyZsYD2fFiTejnFtEnDWN83wK 07svlSPhrr5Ad/HQAMtXFxtfU2xDmqNJ3lZC2qccaAD2rlLp5BmbCEBYde2jPG7aQ9 KrR2u6tN+b3ErRh48UphRCk00FwGII67mBDQdB5H37SJJO5Qp2cXW4E7mAodv/YDgQ Q2DxbhiclIZSA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14B41C04FF6; Fri, 12 Apr 2024 12:36:46 +0000 (UTC) From: Fenglin Wu via B4 Relay Date: Fri, 12 Apr 2024 20:36:25 +0800 Subject: [PATCH v10 1/4] input: pm8xxx-vibrator: correct VIB_MAX_LEVELS calculation 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: 7bit Message-Id: <20240412-pm8xxx-vibrator-new-design-v10-1-0ec0ad133866@quicinc.com> References: <20240412-pm8xxx-vibrator-new-design-v10-0-0ec0ad133866@quicinc.com> In-Reply-To: <20240412-pm8xxx-vibrator-new-design-v10-0-0ec0ad133866@quicinc.com> To: kernel@quicinc.com, Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Dmitry Baryshkov Cc: linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Fenglin Wu X-Mailer: b4 0.13-dev-83828 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712925404; l=1309; i=quic_fenglinw@quicinc.com; s=20240327; h=from:subject:message-id; bh=t75pzebWYsBpS9YipaE4zw2bQKsUcZAihoKdmtGp74A=; b=YtCTA1CmZN2cm3NtM2xXw4EX1VXMqT/MDV3Qn2DTUJ+AzruJdiuW3rieHUdYCU81qymp2/gIA 5QWFyJYudKOAsl78E36sVwaZaLJD/Hmv4W3TLR9I9Gc0at5cfVhC+Dr X-Developer-Key: i=quic_fenglinw@quicinc.com; a=ed25519; pk=BF8SA4IVDk8/EBCwlBehKtn2hp6kipuuAuDAHh9s+K4= X-Endpoint-Received: by B4 Relay for quic_fenglinw@quicinc.com/20240327 with auth_id=146 X-Original-From: Fenglin Wu Reply-To: quic_fenglinw@quicinc.com From: Fenglin Wu The output voltage is inclusive hence the max level calculation is off-by-one-step. Correct it. Fixes: 11205bb63e5c ("Input: add support for pm8xxx based vibrator driver") Signed-off-by: Fenglin Wu --- drivers/input/misc/pm8xxx-vibrator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index 04cb87efd799..844ca7e1f59f 100644 --- a/drivers/input/misc/pm8xxx-vibrator.c +++ b/drivers/input/misc/pm8xxx-vibrator.c @@ -14,7 +14,8 @@ #define VIB_MAX_LEVEL_mV (3100) #define VIB_MIN_LEVEL_mV (1200) -#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV) +#define VIB_PER_STEP_mV (100) +#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV + VIB_PER_STEP_mV) #define MAX_FF_SPEED 0xff @@ -118,10 +119,10 @@ static void pm8xxx_work_handler(struct work_struct *work) vib->active = true; vib->level = ((VIB_MAX_LEVELS * vib->speed) / MAX_FF_SPEED) + VIB_MIN_LEVEL_mV; - vib->level /= 100; + vib->level /= VIB_PER_STEP_mV; } else { vib->active = false; - vib->level = VIB_MIN_LEVEL_mV / 100; + vib->level = VIB_MIN_LEVEL_mV / VIB_PER_STEP_mV; } pm8xxx_vib_set(vib, vib->active); -- 2.25.1