lkml.org 
[lkml]   [2022]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] regulator: Add driver for MT6331 PMIC regulators
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@collabora.com>
> + *

Please make the entire comment a C++ one so things look more
intentional.

> +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.

> +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.

> +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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2022-05-20 16:47    [W:0.076 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site