Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp319175lqg; Thu, 11 Apr 2024 04:12:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2RoXjxvRLq9NarXW+aJmQCE0+p95Gw8vqw/oNCF39qzVapuCQ0etMl+9Cw0xtelatl+acs/yvfg7i9rmivXILywh0CpLi5VSH1nL1mQ== X-Google-Smtp-Source: AGHT+IERiB5epvzpNzjiBa+YHMYAqH8B0zH/rUaA9x6RJ7f/LP4E3midKoo9K/cyBuacwRuEK1vq X-Received: by 2002:a17:902:d2d1:b0:1e4:436e:801b with SMTP id n17-20020a170902d2d100b001e4436e801bmr4976181plc.67.1712833926383; Thu, 11 Apr 2024 04:12:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712833926; cv=pass; d=google.com; s=arc-20160816; b=VLtFCogbiLM2jLoEDgEa64Or2cNtFC4MqQXHHzOMpRe1LDo8V62sXNVLvDOYQX3MBt ATFY5q9XjmuLyhCtZPvwEU2/N/rrY0DTEg4hUckoI06+LYZmuJP8Qt04bUUefGZ0uzst gkCyyroClWKaCmL2xSQx0TxY1aEcRJAhbez4VIX+hftnrLp6296PnVca3ionvSTczQ4q X4PXwsndKgTuWjSJp9V36hRKUeB+ibOTosZzH6mEVVIF93DI2CItsEnIKu2ym3O9H13o BNEfUnN1vVH+0yHqbwfBhgpLfHxublLdYRHqhh/pv98FgQrMF18DHqfPojjElsV+5/Fg Ew4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=CGKOXnPZPzqd2pAhBq9S6tbEuJ6FZt58jgxu5zksa9E=; fh=36MjDVwRZPDSH35ZXk+O6ImJgDmnLdvXOVaSgMQiygo=; b=YTLA1FK/Um7PMLQZB9jjZhkmhj/lpCw1dCpOKGoxlTnJFglaDHJV3KKfFya6fg3Pvy 4WhMRfrYalS0WTHEquzZxwTBw7M4EAK365pnr1dJOcYTkfmdD4Ecdmsf+ngK8Bkh0ufq lbcZPu3jg46C6SOnVzIlVqxLbqDZqsWASPcS63dKcJJGs8sQgtly2Gefhmz58hZ2ff3+ YmfSk7L3D0+nEeMcSgnChBd669oUWQs17N/W+YOjYUs9ZrR2rg0YGpaKRV7mgvKGyS93 B+M7gl+CR1KKD7JXszA1V5dJr9sIaMQOBMeo4n+NRtlvcPzZPEA2KW1zbx72rN/PCBTy N8Hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BEOUjBIS; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-140292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e13-20020a170902784d00b001e3dda65129si1045243pln.644.2024.04.11.04.12.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 04:12:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BEOUjBIS; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-140292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id D5BF4B228D7 for ; Thu, 11 Apr 2024 10:56:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04473146D76; Thu, 11 Apr 2024 10:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="BEOUjBIS" Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 659FA146A74 for ; Thu, 11 Apr 2024 10:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832980; cv=none; b=rxi/IjWXkcOxChRGeFX/3n+h/LDZhdcAEVexBbMyKE/3XCcLJiWBG+MZ7ZRXzKRD230VM53vrz6Gi/ZFhd6VcXgoyR7Yac5kjhlzmoOoCivPCWN7pgaoV7TXsJLaRjXZd8QDcPGOpJqqVMpHNKe9vIcTZng4E3A60kRzpeoSRbo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832980; c=relaxed/simple; bh=Xq/0joFiXzYqUks+vVl32eEq//+gRKOhLkmx39S+mn8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Tlr5cn3337oPTrmK1trEG39B+DDe1vFBtP4IrISUDqmYn0SI+WwDAxt626/sfDWW261pV40fB4UEJEH24uM7kw8GEJhWwXMPWa9f3/eUwEirqoaOdQsmmeY9aYLlxS3u+cXSDUXhz8PLWH5O1D/hEAs8iWi1HPFwKvUKwPr9et8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=BEOUjBIS; arc=none smtp.client-ip=209.85.128.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-617dfcf80aeso63430457b3.3 for ; Thu, 11 Apr 2024 03:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712832976; x=1713437776; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CGKOXnPZPzqd2pAhBq9S6tbEuJ6FZt58jgxu5zksa9E=; b=BEOUjBIS9K5AaucVXdaGZ1JcAgueDT2qS7i4UchwyFCyQqP/n4mx7kvDXyoR603Mmx XuF4tVJ+sXMMqg/6ZoUQ5/4WxcNxTs4Q3CdC3Li27/T+abVdzbtYe/9PmBVAPyR2duDQ VlvdQAiUnCfwvxyynA+LSM8OIk5Ole+WKqx10viOHraz57KTg9xH4WWpdSx7VJWQcC1T 13EkngrIdTsV2/wgjglokJDqU2gTeLKFA7IHK17L41UqNudUXIyHVBypolYR0xLLYXNn XuqDhQEDk+dZ+09nq+5VU8a3bJ6wnvpwn0jdcXcQumZ2w8OLVogRZggkQumY4ioyleEW myRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712832976; x=1713437776; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CGKOXnPZPzqd2pAhBq9S6tbEuJ6FZt58jgxu5zksa9E=; b=kTvWeovJNnHpmCcj8zbuNDNbywKHGSDfAg4RDlTUz7aSZF7/b65Lr5YTTzwvMMj0tw +1Bla/wBrSvCMGNaBpQEj4QG7T8ge3Nm12zpDackaeUiZ8/ib3wthimepj5IkQRfUp9E M06lYaPT6hEiO2IkYCeuQ1YJ8YSefBFbCUvqCfyNNFwxDWo4UxHvFC2JuCXDbPpRekvm ix19bkTvWdMJVFiY37pooSrbDJt70LmYRiOAj1NFpFWDi9ayL8ihEOu9dUFYzNK67eWf IcI0wnMLi92uhglfDrxZhqiYZiHTFpUVFOHmzYLTswZv82nt52eHFR7SAFhZHjI8ySmJ EVrA== X-Forwarded-Encrypted: i=1; AJvYcCWVxK044+xZYvJODtpNBYn5S+1uOz7ISceF7YxKp3wENH/zV5zVGx9b6Wfpx5PRd7kIe2kr00LYlMAEl2d9linF0nLZFG/lYl+6NBab X-Gm-Message-State: AOJu0Yx5UlRw2S+alNoFa0aBh31y6xRIyKwpMb2WqNp86tkI3kWvbHxn 5AZh2IRc+Cxp6l/SsNTWK0dpfx1lw4gNYx0M8HFvGdo9hLUM/4ugmqn0y8RAp+01pIBGJvOkqks ZrtOUieYZkfE+m9Szfw9dr9VfiBHiSxKrR43FkA== X-Received: by 2002:a05:6902:102e:b0:de0:f74b:25f3 with SMTP id x14-20020a056902102e00b00de0f74b25f3mr6033843ybt.60.1712832976450; Thu, 11 Apr 2024 03:56:16 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240411-pm8xxx-vibrator-new-design-v9-0-7bf56cb92b28@quicinc.com> <20240411-pm8xxx-vibrator-new-design-v9-1-7bf56cb92b28@quicinc.com> In-Reply-To: <20240411-pm8xxx-vibrator-new-design-v9-1-7bf56cb92b28@quicinc.com> From: Dmitry Baryshkov Date: Thu, 11 Apr 2024 13:56:05 +0300 Message-ID: Subject: Re: [PATCH v9 1/4] input: pm8xxx-vibrator: correct VIB_MAX_LEVELS calculation To: quic_fenglinw@quicinc.com Cc: kernel@quicinc.com, Andy Gross , Bjorn Andersson , Konrad Dybcio , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Thu, 11 Apr 2024 at 11:32, Fenglin Wu via B4 Relay wrote: > > From: Fenglin Wu > > The output voltage is inclusive hence the max level calculation is > off-by-one-step. Correct it. > > Signed-off-by: Fenglin Wu > --- > drivers/input/misc/pm8xxx-vibrator.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Fixes tag? > > diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c > index 04cb87efd799..89f0f1c810d8 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 > > -- With best wishes Dmitry