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]
Date:   Mon, 23 May 2022 14:49:19 +0200
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Mark Brown <broonie@...nel.org>
Cc:     lgirdwood@...il.com, robh+dt@...nel.org,
        krzysztof.kozlowski+dt@...aro.org, matthias.bgg@...il.com,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators

Il 20/05/22 16:45, Mark Brown ha scritto:
> On Fri, May 20, 2022 at 03:33:03PM +0200, AngeloGioacchino Del Regno wrote:
> 
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (c) 2022 Collabora Ltd.
>> + * Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
>> + *
> 
> Please make the entire comment a C++ one so things look more
> intentional.
> 

Will do.

>> +static const unsigned int ldo_volt_table10[] = {
>> +	1200000, 1300000, 1500000, 1800000,
>> +	1200000, 1300000, 1500000, 1800000,
>> +	1200000, 1300000, 1500000, 1800000,
>> +	1200000, 1300000, 1500000, 1800000,
>> +};
> 
> So the top bits of the voltate selection field just get ignored?  Might
> be easier to just write the code to not include the top bits.
> 

No, they're all valid values for real... but I guess that I can simplify
this voltage table by simply modifying the bitmask that we use for the
regulators that are using this table....

Example:

MT6331_LDO_S("ldo-vcamio", VCAM_IO,  ldo_volt_table10, MT6331_SYSLDO_CON3, 10,

	MT6331_SYSLDO_CON11, GENMASK(6, 3), MT6331_SYSLDO_CON3, GENMASK(1, 0),

	MT6331_EN_STATUS1, BIT(13)),

So for VCAM_IO it's CON11... we have VGP2, VGP3 using CON14, CON15, then there
are no more users for this table.
If I use GENMASK(4, 3), I can effectively leave only four voltage values in
ldo_volt_table10.

Also, I've just noticed a mistake on ldo-vmipi: that's supposed to have a mask
of GENMASK(5, 3), not (6, 3) - which is in turn also making me able to remove
the ldo_volt_table_3a.

Alright, will fix in the next one :))

>> +static int mt6331_get_status(struct regulator_dev *rdev)
>> +{
>> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
>> +	u32 reg, en_mask, regval;
>> +	int ret;
>> +
>> +	if (info->qi > 0) {
>> +		reg = info->desc.enable_reg;
>> +		en_mask = info->qi;
> 
> If the regulator doesn't have status readback it shouldn't provide a
> get_status() operation.
> 

What I've understood is that when there's no "QI" flag, the enable register
will provide the regulator status (EN/DIS) acting like QI, that's why I've
added that if branch...

Anyway, I'll recheck this part before sending the next version!

>> +static int mt6331_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode)
>> +{
>> +	int ret, val = 0;
>> +	struct mt6331_regulator_info *info = rdev_get_drvdata(rdev);
>> +
>> +	if (!info->modeset_mask) {
>> +		dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n",
>> +			info->desc.name);
>> +		return -EINVAL;
>> +	}
> 
> Just don't provide the operation for these regulators then.  That'll
> mean a separate ops struct but that's fine.

Oki, I'll add new ops then.

Thanks for the review!
P.S.: I'll obviously apply the same suggestions on mt6332-regulator as well.

Cheers,
Angelo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ