lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1622389700.3462.10.camel@richtek.com>
Date:   Sun, 30 May 2021 15:48:20 +0000
From:   cy_huang(黃啟原) <cy_huang@...htek.com>
To:     "axel.lin@...ics.com" <axel.lin@...ics.com>,
        "broonie@...nel.org" <broonie@...nel.org>
CC:     "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "u0084500@...il.com" <u0084500@...il.com>
Subject: Re: [PATCH RFT 1/2] regulator: rtmv20: Fix
 .set_current_limit/.get_current_limit callbacks

>
> Current code does not set .curr_table and .n_linear_ranges settings,
> so it cannot use the regulator_get/set_current_limit_regmap helpers.
> If we setup the curr_table, it will has 200 entries.
> Implement customized .set_current_limit/.get_current_limit callbacks
> instead.
>
> Fixes: b8c054a5eaf0 ("regulator: rtmv20: Adds support for Richtek RTMV20 load
> switch regulator")
> Signed-off-by: Axel Lin <axel.lin@...ics.com>
> ---
> Hi ChiYuan,
> I don't have this h/w to test.
> Please help to review and test this patch.
>
> Thanks,
> Axel
Thanks for the fix. I really didn't notice that.

Reviewed-by: ChiYuan Huang <cy_huang@...htek.com>
>
>
>  drivers/regulator/rtmv20-regulator.c | 42 ++++++++++++++++++++++++++--
>  1 file changed, 40 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/regulator/rtmv20-regulator.c b/drivers/regulator/rtmv20-
> regulator.c
> index 852fb2596ffd..5adc552dffd5 100644
> --- a/drivers/regulator/rtmv20-regulator.c
> +++ b/drivers/regulator/rtmv20-regulator.c
> @@ -103,9 +103,47 @@ static int rtmv20_lsw_disable(struct regulator_dev *rdev)
>  return 0;
>  }
>
> +static int rtmv20_lsw_set_current_limit(struct regulator_dev *rdev, int
> min_uA,
> +int max_uA)
> +{
> +int sel;
> +
> +if (min_uA > RTMV20_LSW_MAXUA || max_uA < RTMV20_LSW_MINUA)
> +return -EINVAL;
> +
> +if (max_uA > RTMV20_LSW_MAXUA)
> +max_uA = RTMV20_LSW_MAXUA;
> +
> +sel = (max_uA - RTMV20_LSW_MINUA) / RTMV20_LSW_STEPUA;
> +
> +/* Ensure the selected setting is still in range */
> +if ((sel * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA) < min_uA)
> +return -EINVAL;
> +
> +sel <<= ffs(rdev->desc->csel_mask) - 1;
> +
> +return regmap_update_bits(rdev->regmap, rdev->desc->csel_reg,
> +  rdev->desc->csel_mask, sel);
> +}
> +
> +static int rtmv20_lsw_get_current_limit(struct regulator_dev *rdev)
> +{
> +unsigned int val;
> +int ret;
> +
> +ret = regmap_read(rdev->regmap, rdev->desc->csel_reg, &val);
> +if (ret)
> +return ret;
> +
> +val &= rdev->desc->csel_mask;
> +val >>= ffs(rdev->desc->csel_mask) - 1;
> +
> +return val * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA;
> +}
> +
>  static const struct regulator_ops rtmv20_regulator_ops = {
> -.set_current_limit = regulator_set_current_limit_regmap,
> -.get_current_limit = regulator_get_current_limit_regmap,
> +.set_current_limit = rtmv20_lsw_set_current_limit,
> +.get_current_limit = rtmv20_lsw_get_current_limit,
>  .enable = rtmv20_lsw_enable,
>  .disable = rtmv20_lsw_disable,
>  .is_enabled = regulator_is_enabled_regmap,
************* Email Confidentiality Notice ********************

The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ