From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C20D4C7EE25 for ; Thu, 8 Jun 2023 08:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:Subject:From:References:Cc:To: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kfj93M6fTn48hXwlQYwBfRaa/wVmTAwE8H89j/F+4eg=; b=d7xomD7N7meyK6 cKqBvIC45DOGh5UzMBq7RLMx5qkRsIIrYOUCt1F+ukGy6U2J562IDDefsA5nam9Kyp5HgJyoTn/4w 5e8rrvISiHwgr5/vgrtd+Aom62Q/EmKEbTeynTaqwUTxSsUnUhh9QgEInRCKWAa6bUc5CVLQiW78o vdQBAWEshF/hzYGLPoS7+XkwA+X50XbYAKAyxrB+3v8kiufzqwUh2aMEps7jKVPdxR9JmDPL8hjtz ahOmYe90OHEHfapb6lhkR493RW+6G4bVmf+IMfqQXBbsTujPNs0mrYBZTxOTTW8hWyos3HgGDnU8n x8pfOehp1BwzWd8uVh2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7B2W-008Xo9-2r; Thu, 08 Jun 2023 08:30:40 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7B2U-008XnJ-1O; Thu, 08 Jun 2023 08:30:39 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f6170b1486so468314e87.0; Thu, 08 Jun 2023 01:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686213034; x=1688805034; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=9XY47hELzwip0lIu4ibeSPP8B13egx66c2j6pExWBEA=; b=Cau52P98VQ2uueYSexxRDcaZORLJubNm6rSDoh+vDnNXM+uLh6tWYAUTZ7R8lTqZRk acEwVCISqxlIZNNz12Uy6sNGoZ0mkNiVMDYRdkb1q9pOE88DU1zKxitKNCtTJl9efiQg PlObBpFvIXmbfPkVjofKOI5sUcpRMAPXLEGEEuyRmJqma84lY/v0lRgMOXlPrQQOOGVP EJromc9xEeyfUFTNmknsM84/jeLF2owbR5FLSxNS/CJrg1BP3V0/tyRFHIrPgtpK7sWD dS0sM+ESqfARLc68omGcHN5XldsUQhFU/7/BYu1Ys6JxiOIdXpvGNh/9M4NxqNqOfJ+R gxCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686213034; x=1688805034; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9XY47hELzwip0lIu4ibeSPP8B13egx66c2j6pExWBEA=; b=OjNCOtuC3b8Mn1zDN6s9yKvx1tC/KqOyc6A4ZC4nmCz65W4J/OE2f0EARsGV6ezoV4 VTeQcmkc2SMIp3YRHymmsVhAxOdH+6v3vSQcO5ZaNdkbXcv3XrNPT8vWH5n6kRBE8Ivv 7BFmXCRIFTIzGerQDyhNVbnB48kb7BSrMqli+zowMW6qWE05FIBYb4S81bTAGciEC/8R lM4TQGUYnVwKNJfgx9yeYKuAAvWlLPlDxy82Xtpwp5NKCDL6wxI72DJ04gtoHUvlIuT3 6bXjptn5KdE4AA5tP28zXOiZjp4kKjETox5gFeApKsQOnQ0gGPZxzDNYgbkxIz284bCk 5iJA== X-Gm-Message-State: AC+VfDxwfQqL9mVCZS2cVaeL1IqZLez3kTfMILoIpQiPLHGSnMY/GPVd 0dwkZn9MIJdRayj+vXTCfCg= X-Google-Smtp-Source: ACHHUZ7nNqvlGBT2n2ZGLpCjYm0ss1hx/qmwjv5eBkF1mTi9N2vny9l32a015Cbfpa7/IpZqYqFKUA== X-Received: by 2002:a05:6512:2309:b0:4f6:4466:7ebb with SMTP id o9-20020a056512230900b004f644667ebbmr455326lfu.20.1686213034102; Thu, 08 Jun 2023 01:30:34 -0700 (PDT) Received: from ?IPV6:2001:14ba:16f8:1500::1? (dc78bmyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::1]) by smtp.gmail.com with ESMTPSA id v26-20020a2e925a000000b002a7899eaf9csm147177ljg.63.2023.06.08.01.30.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jun 2023 01:30:33 -0700 (PDT) Message-ID: <775471c6-7a68-938d-3641-6eb2a0f055f2@gmail.com> Date: Thu, 8 Jun 2023 11:30:32 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US, en-GB To: Chen-Yu Tsai , Mark Brown , Liam Girdwood , Manivannan Sadhasivam , Cristian Ciocaltea Cc: linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230608075651.3214540-1-wenst@chromium.org> From: Matti Vaittinen Subject: Re: [PATCH] regulator: Use bitfield values for range selectors In-Reply-To: <20230608075651.3214540-1-wenst@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230608_013038_473535_293A5447 X-CRM114-Status: GOOD ( 20.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/8/23 10:56, Chen-Yu Tsai wrote: > Right now the regulator helpers expect raw register values for the range > selectors. This is different from the voltage selectors, which are > normalized as bitfield values. This leads to a bit of confusion. Also, > raw values are harder to copy from datasheets or match up with them, > as datasheets will typically have bitfield values. > > Make the helpers expect bitfield values, and convert existing users. > Include bitops.h explicitly for ffs(), and reorder the header include > statements. While at it, also replace module.h with export.h, since the > only use is EXPORT_SYMBOL_GPL. > > Signed-off-by: Chen-Yu Tsai > --- > drivers/regulator/atc260x-regulator.c | 2 +- > drivers/regulator/bd718x7-regulator.c | 8 ++++---- > drivers/regulator/helpers.c | 9 ++++++--- > drivers/regulator/tps6287x-regulator.c | 2 +- > 4 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/drivers/regulator/atc260x-regulator.c b/drivers/regulator/atc260x-regulator.c > index 87e237d740bc..0bba33955a1a 100644 > --- a/drivers/regulator/atc260x-regulator.c > +++ b/drivers/regulator/atc260x-regulator.c > @@ -37,7 +37,7 @@ static const struct linear_range atc2609a_ldo_voltage_ranges1[] = { > }; > > static const unsigned int atc260x_ldo_voltage_range_sel[] = { > - 0x0, 0x20, > + 0x0, 0x1, > }; > > static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev, > diff --git a/drivers/regulator/bd718x7-regulator.c b/drivers/regulator/bd718x7-regulator.c > index b0b9938c20a1..da1eea1207e5 100644 > --- a/drivers/regulator/bd718x7-regulator.c > +++ b/drivers/regulator/bd718x7-regulator.c > @@ -289,7 +289,7 @@ static const struct linear_range bd71837_buck5_volts[] = { > * and 0x1 for last 3 ranges. > */ > static const unsigned int bd71837_buck5_volt_range_sel[] = { > - 0x0, 0x0, 0x0, 0x80, 0x80, 0x80 > + 0x0, 0x0, 0x0, 0x1, 0x1, 0x1 > }; > > /* > @@ -309,7 +309,7 @@ static const struct linear_range bd71847_buck3_volts[] = { > }; > > static const unsigned int bd71847_buck3_volt_range_sel[] = { > - 0x0, 0x0, 0x0, 0x40, 0x80, 0x80, 0x80 > + 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2 > }; > > static const struct linear_range bd71847_buck4_volts[] = { > @@ -360,7 +360,7 @@ static const struct linear_range bd718xx_ldo1_volts[] = { > REGULATOR_LINEAR_RANGE(1600000, 0x00, 0x03, 100000), > }; Shouldn't the static const unsigned int bd71847_buck4_volt_range_sel[] = { 0x0, 0x40 }; be also converted to { 0x0, 0x1 }? The range mask seems to be: #define BD71847_BUCK4_RANGE_MASK 0x40 Other than that - the helpers + bd718x7 look good to me. Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel