devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Liam Girdwood <lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Boris BREZILLON
	<boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Maxime Ripard
	<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Carlo Caione <carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH RESEND v6 4/6] regulator: axp20x: add support for AXP22X regulators
Date: Wed, 13 May 2015 16:30:44 +0100	[thread overview]
Message-ID: <20150513153044.GF3394@x1> (raw)
In-Reply-To: <1428638946-24890-5-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>

On Fri, 10 Apr 2015, Chen-Yu Tsai wrote:

> From: Boris BREZILLON <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> 
> Add AXP22X regulator definitions and variant id associations.
> This introduces a new "switch" type output for one of the regulators.
> It is a switchable secondary output of one regulator, with the same
> voltage level as the primary output.
> 
> Signed-off-by: Boris BREZILLON <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> [wens-jdAy2FN1RRM@public.gmane.org: Moved variant choosing to multi family support patch]
> [wens-jdAy2FN1RRM@public.gmane.org: Add dc-dc work frequency range]
> [wens-jdAy2FN1RRM@public.gmane.org: Add "switch" type output regulator DC1SW]
> Signed-off-by: Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>
> Reviewed-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> 
> Hi Mark,
>     
> This patch depends on the previous patch "regulator: axp20x: prepare
> support for multiple AXP chip families" and the mfd header from the
> first patch "mfd: axp20x: add AXP22x PMIC support".
> 
> Could we merge both regulator patches through the mfd tree, with the
> other patches in the series? There are no other external dependencies.
> 
> ChenYu
> 
> ---
>  drivers/regulator/axp20x-regulator.c | 96 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 96 insertions(+)

Applied, thanks.

> diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
> index 50ae0b5f2c0c..646829132b59 100644
> --- a/drivers/regulator/axp20x-regulator.c
> +++ b/drivers/regulator/axp20x-regulator.c
> @@ -27,8 +27,12 @@
>  #define AXP20X_IO_ENABLED		0x03
>  #define AXP20X_IO_DISABLED		0x07
>  
> +#define AXP22X_IO_ENABLED		0x04
> +#define AXP22X_IO_DISABLED		0x03
> +
>  #define AXP20X_WORKMODE_DCDC2_MASK	BIT(2)
>  #define AXP20X_WORKMODE_DCDC3_MASK	BIT(1)
> +#define AXP22X_WORKMODE_DCDCX_MASK(x)	BIT(x)
>  
>  #define AXP20X_FREQ_DCDC_MASK		0x0f
>  
> @@ -74,6 +78,26 @@
>  		.ops		= &axp20x_ops,					\
>  	}
>  
> +#define AXP_DESC_SW(_family, _id, _match, _supply, _min, _max, _step, _vreg,	\
> +		    _vmask, _ereg, _emask) 					\
> +	[_family##_##_id] = {							\
> +		.name		= #_id,						\
> +		.supply_name	= (_supply),					\
> +		.of_match	= of_match_ptr(_match),				\
> +		.regulators_node = of_match_ptr("regulators"),			\
> +		.type		= REGULATOR_VOLTAGE,				\
> +		.id		= _family##_##_id,				\
> +		.n_voltages	= (((_max) - (_min)) / (_step) + 1),		\
> +		.owner		= THIS_MODULE,					\
> +		.min_uV		= (_min) * 1000,				\
> +		.uV_step	= (_step) * 1000,				\
> +		.vsel_reg	= (_vreg),					\
> +		.vsel_mask	= (_vmask),					\
> +		.enable_reg	= (_ereg),					\
> +		.enable_mask	= (_emask),					\
> +		.ops		= &axp20x_ops_sw,				\
> +	}
> +
>  #define AXP_DESC_FIXED(_family, _id, _match, _supply, _volt)			\
>  	[_family##_##_id] = {							\
>  		.name		= #_id,						\
> @@ -135,6 +159,14 @@ static struct regulator_ops axp20x_ops = {
>  	.is_enabled		= regulator_is_enabled_regmap,
>  };
>  
> +static struct regulator_ops axp20x_ops_sw = {
> +	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
> +	.list_voltage		= regulator_list_voltage_linear,
> +	.enable			= regulator_enable_regmap,
> +	.disable		= regulator_disable_regmap,
> +	.is_enabled		= regulator_is_enabled_regmap,
> +};
> +
>  static const struct regulator_desc axp20x_regulators[] = {
>  	AXP_DESC(AXP20X, DCDC2, "dcdc2", "vin2", 700, 2275, 25,
>  		 AXP20X_DCDC2_V_OUT, 0x3f, AXP20X_PWR_OUT_CTRL, 0x10),
> @@ -152,6 +184,52 @@ static const struct regulator_desc axp20x_regulators[] = {
>  		    AXP20X_IO_ENABLED, AXP20X_IO_DISABLED),
>  };
>  
> +static const struct regulator_desc axp22x_regulators[] = {
> +	AXP_DESC(AXP22X, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
> +		 AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)),
> +	AXP_DESC(AXP22X, DCDC2, "dcdc2", "vin2", 600, 1540, 20,
> +		 AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)),
> +	AXP_DESC(AXP22X, DCDC3, "dcdc3", "vin3", 600, 1860, 20,
> +		 AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
> +	AXP_DESC(AXP22X, DCDC4, "dcdc4", "vin4", 600, 1540, 20,
> +		 AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)),
> +	AXP_DESC(AXP22X, DCDC5, "dcdc5", "vin5", 1000, 2550, 50,
> +		 AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(4)),
> +	/* secondary switchable output of DCDC1 */
> +	AXP_DESC_SW(AXP22X, DC1SW, "dc1sw", "dcdc1", 1600, 3400, 100,
> +		    AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(7)),
> +	/* LDO regulator internally chained to DCDC5 */
> +	AXP_DESC(AXP22X, DC5LDO, "dc5ldo", "dcdc5", 700, 1400, 100,
> +		 AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)),
> +	AXP_DESC(AXP22X, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)),
> +	AXP_DESC(AXP22X, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)),
> +	AXP_DESC(AXP22X, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
> +		 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
> +	AXP_DESC(AXP22X, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
> +	AXP_DESC(AXP22X, DLDO2, "dldo2", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)),
> +	AXP_DESC(AXP22X, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
> +	AXP_DESC(AXP22X, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
> +		 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
> +	AXP_DESC(AXP22X, ELDO1, "eldo1", "eldoin", 700, 3300, 100,
> +		 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
> +	AXP_DESC(AXP22X, ELDO2, "eldo2", "eldoin", 700, 3300, 100,
> +		 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
> +	AXP_DESC(AXP22X, ELDO3, "eldo3", "eldoin", 700, 3300, 100,
> +		 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
> +	AXP_DESC_IO(AXP22X, LDO_IO0, "ldo_io0", "ips", 1800, 3300, 100,
> +		    AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_IO(AXP22X, LDO_IO1, "ldo_io1", "ips", 1800, 3300, 100,
> +		    AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
> +		    AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
> +	AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000),
> +};
> +
>  static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
>  {
>  	struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> @@ -165,6 +243,12 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
>  		def = 1500;
>  		step = 75;
>  		break;
> +	case AXP221_ID:
> +		min = 1800;
> +		max = 4050;
> +		def = 3000;
> +		step = 150;
> +		break;
>  	default:
>  		dev_err(&pdev->dev,
>  			"Setting DCDC frequency for unsupported AXP variant\n");
> @@ -237,6 +321,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
>  		workmode <<= ffs(mask) - 1;
>  		break;
>  
> +	case AXP221_ID:
> +		if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5)
> +			return -EINVAL;
> +
> +		mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP22X_DCDC1);
> +		workmode <<= id - AXP22X_DCDC1;
> +		break;
> +
>  	default:
>  		/* should not happen */
>  		WARN_ON(1);
> @@ -265,6 +357,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
>  		regulators = axp20x_regulators;
>  		nregulators = AXP20X_REG_ID_MAX;
>  		break;
> +	case AXP221_ID:
> +		regulators = axp22x_regulators;
> +		nregulators = AXP22X_REG_ID_MAX;
> +		break;
>  	default:
>  		dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
>  			axp20x->variant);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

-- 
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/d/optout.

  parent reply	other threads:[~2015-05-13 15:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10  4:09 [PATCH RESEND v6 0/6] mfd: axp20x: add AXP221 PMIC support Chen-Yu Tsai
     [not found] ` <1428638946-24890-1-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-04-10  4:09   ` [PATCH RESEND v6 1/6] mfd: axp20x: add AXP22x " Chen-Yu Tsai
     [not found]     ` <1428638946-24890-2-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-04-10  9:25       ` Lee Jones
2015-05-13 15:30       ` Lee Jones
2015-04-10  4:09   ` [PATCH RESEND v6 2/6] mfd: axp20x: update DT bindings with AXP22x compatibles Chen-Yu Tsai
     [not found]     ` <1428638946-24890-3-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-05-13 15:30       ` Lee Jones
2015-04-10  4:09   ` [PATCH RESEND v6 3/6] regulator: axp20x: prepare support for multiple AXP chip families Chen-Yu Tsai
     [not found]     ` <1428638946-24890-4-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-05-13 15:30       ` Lee Jones
2015-04-10  4:09   ` [PATCH RESEND v6 4/6] regulator: axp20x: add support for AXP22X regulators Chen-Yu Tsai
     [not found]     ` <1428638946-24890-5-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-04-10 15:48       ` Mark Brown
     [not found]         ` <20150410154809.GN6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-14  6:45           ` Lee Jones
2015-04-29 12:36           ` Lee Jones
2015-05-13 15:30       ` Lee Jones [this message]
2015-04-10  4:09   ` [PATCH RESEND v6 5/6] mfd: axp20x: Add AXP22x regulator information to DT bindings Chen-Yu Tsai
     [not found]     ` <1428638946-24890-6-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-05-13 15:30       ` Lee Jones
2015-04-10  4:09   ` [PATCH RESEND v6 6/6] mfd: axp20x: Enable AXP22X regulators Chen-Yu Tsai
     [not found]     ` <1428638946-24890-7-git-send-email-wens-jdAy2FN1RRM@public.gmane.org>
2015-05-13 15:31       ` Lee Jones
2015-05-13 15:41   ` [PATCH RESEND v6 0/6] mfd: axp20x: add AXP221 PMIC support Lee Jones

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=20150513153044.GF3394@x1 \
    --to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=carlo-KA+7E9HrN00dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=lgirdwood-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.org \
    /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).