Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp729290lqb; Wed, 29 May 2024 08:55:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXL6CYDF1R5/OaaaI6r/uDre3TkmIOOSicP/K1IJyXK2fJiKjhErGr70Y3S5AK8E7i8p9pM27ZawvbhgGHomlOpYYUS1xfo95V0BpY4g== X-Google-Smtp-Source: AGHT+IHpOOGnBZDoiL+HgGuSBM7/4oJHrCmqL1XmdbAV52qG4S+EzNsLPB8zZiwCQok78wMAZcBc X-Received: by 2002:a17:902:ea05:b0:1f4:9b2a:b337 with SMTP id d9443c01a7336-1f49b2ab6f0mr113153255ad.3.1716998126766; Wed, 29 May 2024 08:55:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716998126; cv=pass; d=google.com; s=arc-20160816; b=K//lpW9n9CNGtaOiDfr4FNluwzx/tyKIrs+RaqMCpXENF3FgRa/CIahUsp7HzsTgjI lJxrKlBlr4p5mktuJPNy4l7tp3V9jbj3P3jse78uFu5i84ODuOBxYUPdoTJha1Glqkhp MuEWOOn71H6aNW8UMFeLJxd3kW9pkIZmFlDs9y+PUfWhsGgOGPPekqEocdRhIJ8sNId5 dRMYrMOwttmPmSALdmAJhZz5mlmmnYPBZpp7ACtDs7UAdvviZvQ7WgO99FvBGBAYUaXg fNavd8Pmy7T0V4ylfIwU7ZwcWiVK4fKWoEc0D2S3gZmYJOAEo4jxcxGvDYHdeogcglZe fTEw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=IttdarSw9DwNkxcHfb6oQyqtjcPmioGfv9Ig2VmzqT4=; fh=B//fZvjBwi46bTUNPbGqPRZTLV0hFdkqhDSnxWdDNc0=; b=vKXbxJU3bffVFSr14FVetLVYc/69n/Go181B5fv32JGI3HcZRxfgFNvv+/Oy5/5C86 eAQKhM7/kHIpdvnsDOpZKXe1J6orr/4P68YzmLeT+GqpFH+UMbJsYxeF+DlWWjbk7jfR gOVcMyk0f4rBaa+lc25isSrgYnlx4cW1Sq0SJ0Dx7co16hGlb5AarVvXG7C93din/DwT 0/dAQuDGJl74hPSwCYXpexVr10soAgXR8/m8ouCOFQEspuHZyLGUcq5fe3jql3ZZgRQB derf9Uhsu/HibKJNyoCCcMUh0Z6YWzKRmk663skdzhPAHqw8KlTUjDcr5dehlzstksxO aFqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="WmXp/s9v"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194393-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f4960c83f7si61502145ad.363.2024.05.29.08.55.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 08:55:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="WmXp/s9v"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-194393-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194393-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6A7E328566F for ; Wed, 29 May 2024 15:55:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B79DA181D13; Wed, 29 May 2024 15:55:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="WmXp/s9v" 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 C6650181BB3; Wed, 29 May 2024 15:55:16 +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=1716998116; cv=none; b=ij5u8Q4Wgtoze/z0M1p1LDZ7aeXVT9U7tTiEdpDPnT0fGfApBg1/0tfQZBilI8lt5j6H0Avx766RH90XPeDmF97v1Aar/pXElnnAw1pUc9jW8QhA+J0gyTg04jUoN8mJ2eKEbiEEo17GIIG1cXAFwChK5NQoSBBaPheIEuUgLWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716998116; c=relaxed/simple; bh=cvCI74XULFLsUOYSrpSQ5aAd1HGoaFATJaZrDy1RBK8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UBOavMln/ZRfgK9DmWPjVcvS5YZeWcy52UoQZitKviT2i++HU3NflKidbK/na3yI5vVUrL+cWtRuxEYal6MZE3WYe7Q7tOxiTyZoo7u8L9/VZPXvcz1znHG48B8o5FhvkmAv/LR1pjCTSgiJ8a0/WmS1zQI8JBFmWkjXSTIJoW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WmXp/s9v; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B30FC113CC; Wed, 29 May 2024 15:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716998116; bh=cvCI74XULFLsUOYSrpSQ5aAd1HGoaFATJaZrDy1RBK8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WmXp/s9vHFC0BXI3VHUObfGwuQj1zxrYLOB2NH1CaxvAcKrnnmPbBpHqtmBaUIvmO 7OrKLE0HbBrxG9SObqzJVZTEUPG/49lSTHcWRAx6eQMz/CWbsqWhjE0DyfIqS9e1Z2 gKhlZzo3158eL4rQlpNGpBVvfOeL+DRbOCbaCcs3hiRNd8jpj8MIJdeAwj/T+dja+8 M0sHpT3wWbHEhzVpJzyvzpKPbWrzN5C3J+pA56Dew8ffLEk9zjHJLEqsVeBZWspcol rpW0Q5iOxnzsbvj6xFLHkjQ4h0e3px1WIoyVOf6b1ntkimc+DWUImO5SMuZXkkFxKI jnc9o0VQW92WA== Received: from johan by xi.lan with local (Exim 4.97.1) (envelope-from ) id 1sCLdz-000000004DT-1fTP; Wed, 29 May 2024 17:55:15 +0200 Date: Wed, 29 May 2024 17:55:15 +0200 From: Johan Hovold To: Stephen Boyd Cc: Bjorn Andersson , Johan Hovold , Lee Jones , Linus Walleij , Mark Brown , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Das Srinagesh , Satya Priya , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org Subject: Re: [PATCH 12/13] regulator: add pm8008 pmic regulator driver Message-ID: References: <20240506150830.23709-1-johan+linaro@kernel.org> <20240506150830.23709-13-johan+linaro@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: On Thu, May 09, 2024 at 11:10:41AM +0200, Johan Hovold wrote: > On Wed, May 08, 2024 at 10:37:50PM +0000, Stephen Boyd wrote: > > Quoting Johan Hovold (2024-05-06 08:08:29) > > > +struct pm8008_regulator { > > > + struct regmap *regmap; > > > + struct regulator_desc rdesc; > > > + u16 base; > > > + int step_rate; > > > > Is struct regulator_desc::vsel_step usable for this? If not, can it be > > unsigned? > > Not sure, I'll take a look when respinning. No, vsel_step is unrelated to this, which is really a slew rate. I've reworked the driver and dropped this field in favour of regulator_desc::ramp_delay. > > > +}; > > > +static int pm8008_regulator_get_voltage(struct regulator_dev *rdev) > > > +{ > > > + struct pm8008_regulator *pm8008_reg = rdev_get_drvdata(rdev); > > > + __le16 mV; > > > + int uV; > > > + > > > + regmap_bulk_read(pm8008_reg->regmap, > > > + LDO_VSET_LB_REG(pm8008_reg->base), (void *)&mV, 2); > > > > Is struct regulator_desc::vsel_reg usable for this? > > Will look into that. I don't think vsel_reg can be used here as the voltage is set using two registers (LSB and MSB). > > > + > > > + uV = le16_to_cpu(mV) * 1000; > > > + return (uV - pm8008_reg->rdesc.min_uV) / pm8008_reg->rdesc.uV_step; > > > +} Johan