devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Chen Feng <puck.chen@hisilicon.com>
Cc: w.f@huawei.com, sameo@linux.intel.com, lee.jones@linaro.org,
	linux-kernel@vger.kernel.org, lgirdwood@gmail.com,
	robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
	ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
	joro@8bytes.org, iommu@lists.linux-foundation.org,
	haojian.zhuang@linaro.org, devicetree@vger.kernel.org,
	xuwei5@hisilicon.com, xuyiping@hisilicon.com,
	kong.kongxinwei@hisilicon.com, z.liuxinliang@hisilicon.com,
	yudongbin@hisilicon.com, weidong2@hisilicon.com,
	saberlily.xia@hisilicon.com, haojian.zhuang@outlook.com,
	leo.yan@linaro.org, linuxarm@huawei.com, dan.zhao@hisilicon.com,
	peter.panshilin@hisilicon.com, qijiwen@hisilicon.com
Subject: Re: [PATCH 6/7] regulator: hisilicon: Add hi655x pmic voltage regulator driver
Date: Thu, 5 Nov 2015 14:52:35 +0000	[thread overview]
Message-ID: <20151105145235.GL18409@sirena.org.uk> (raw)
In-Reply-To: <1446730488-31930-7-git-send-email-puck.chen@hisilicon.com>

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

On Thu, Nov 05, 2015 at 09:34:47PM +0800, Chen Feng wrote:

> +config REGULATOR_HI6220_MTCMOS
> +        bool "Hisilicon Hi6220 mtcmos support"
> +        depends on ARCH_HISI
> +        help
> +          This driver provides support for the mtcmos regulators of Hi6220 Soc.
> +

The Kconfig and Makefile updates for MCTMOS should have been in the
patch adding the driver for that.

> +config REGULATOR_HI655X
> +        bool "HiSilicon Hi655x PMIC voltage regulator support"
> +        depends on ARCH_HISI

For both of these we should have an || COMPILE_TEST and there's no need
for either to be bool I can see, they should be tristate.

> +static int hi655x_is_enabled(struct regulator_dev *rdev)
> +{
> +	unsigned int value = 0;
> +
> +	struct hi655x_regulator *regulator = rdev_get_drvdata(rdev);
> +	struct hi655x_regulator_ctrl_regs *ctrl_regs = &regulator->ctrl_regs;
> +
> +	regmap_read(rdev->regmap, ctrl_regs->status_reg, &value);
> +	return (value & BIT(regulator->ctrl_mask));
> +}

Use the standard regmap helpers, don't open code them.

> +static int hi655x_set_voltage(struct regulator_dev *rdev,
> +			      int min_uV, int max_uV, unsigned *selector)

Use the standard helpers, including one of the map_voltage()s and
set_voltage_sel_regmap(), don't open code them.

> +static unsigned int hi655x_map_mode(unsigned int mode)
> +{
> +	/* hi655x pmic on hi6220 SoC only support normal mode */
> +	if (mode == REGULATOR_MODE_NORMAL)
> +		return REGULATOR_MODE_NORMAL;
> +	else
> +		return -EINVAL;
> +}

If the device only has one mode it should not have any mode operations,
they're only meaningful if there are multiple modes to set and they are
optional.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-11-05 14:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05 13:34 [PATCH 0/7] Add Support for Hi6220 PMIC Hi6553 MFD Core Chen Feng
     [not found] ` <1446730488-31930-1-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 13:34   ` [PATCH 1/7] doc:bindings:Add document for mfd hi665x PMIC Chen Feng
     [not found]     ` <1446730488-31930-2-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 14:04       ` Mark Brown
2015-11-05 13:34   ` [PATCH 2/7] doc:bindings:Document for mtcmos regulator on hi6220 SoC Chen Feng
2015-11-05 14:14     ` Mark Brown
     [not found]     ` <1446730488-31930-3-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 20:31       ` Rob Herring
2015-11-05 13:34   ` [PATCH 3/7] doc:bindings:Document for hi655x pmic driver Chen Feng
     [not found]     ` <1446730488-31930-4-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 14:23       ` Mark Brown
2015-11-05 13:34   ` [PATCH 4/7] mfd: hi655x: Add hi665x " Chen Feng
     [not found]     ` <1446730488-31930-5-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 14:30       ` Mark Brown
2015-11-06 20:21     ` Andy Shevchenko
2015-11-05 13:34   ` [PATCH 5/7] regulator: add driver for mtcmos voltage regulator on hi6220 SoC Chen Feng
     [not found]     ` <1446730488-31930-6-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-05 14:44       ` Mark Brown
2015-11-05 13:34   ` [PATCH 6/7] regulator: hisilicon: Add hi655x pmic voltage regulator driver Chen Feng
2015-11-05 14:52     ` Mark Brown [this message]
     [not found]     ` <1446730488-31930-7-git-send-email-puck.chen-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2015-11-06 11:47       ` kbuild test robot
2015-11-06 21:29       ` Andy Shevchenko
2015-11-05 13:34   ` [PATCH 7/7] arm64: dts: Add mtcmos and pmic node for hi6220 HiKey board Chen Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151105145235.GL18409@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=dan.zhao@hisilicon.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=haojian.zhuang@outlook.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=lee.jones@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=peter.panshilin@hisilicon.com \
    --cc=puck.chen@hisilicon.com \
    --cc=qijiwen@hisilicon.com \
    --cc=robh+dt@kernel.org \
    --cc=saberlily.xia@hisilicon.com \
    --cc=sameo@linux.intel.com \
    --cc=w.f@huawei.com \
    --cc=weidong2@hisilicon.com \
    --cc=xuwei5@hisilicon.com \
    --cc=xuyiping@hisilicon.com \
    --cc=yudongbin@hisilicon.com \
    --cc=z.liuxinliang@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).