public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Grzeschik <mgr@pengutronix.de>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	David Dajun Chen <dchen@diasemi.com>,
	Ashish Jangam <ashish.jangam@kpitcummins.com>,
	Liam Girdwood <lrg@ti.com>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH 3/4] regulator: da9052: Use apply_[reg|bit] with regmap based voltage_sel operations
Date: Wed, 2 Oct 2013 12:15:00 +0200	[thread overview]
Message-ID: <20131002101500.GD25376@pengutronix.de> (raw)
In-Reply-To: <1355794372.5681.5.camel@phoenix>

Hi Axel, Mark,

we should not play to much with generous functions for this pmics. With this
patch we loose the fix_io code path from da9052_reg_update.

include/linux/mfd/da9052.h
...
        if (da9052->fix_io) {
                ret = da9052->fix_io(da9052, reg);
                if (ret < 0)
                        return ret;
...

This fix_io used in drivers/mfd/da9052-i2c.c

/*
 * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC
 * gets lockup up or fails to respond following a system reset.
 * This fix is to follow any read or write with a dummy read to a safe
 * register.
 */
static int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg)
{
        int val;

        switch (da9052->chip_id) {
        case DA9052:
        case DA9053_AA:
        case DA9053_BA:
        case DA9053_BB:
                /* A dummy read to a safe register address. */
        if (!i2c_safe_reg(reg))
                        return regmap_read(da9052->regmap,
                                           DA9052_PARK_REGISTER,
                                           &val);
                break;
        default:
                /*
                 * For other chips parking of I2C register
                 * to a safe place is not required.
                 */
                break;
        }

        return 0;
}

I suggest that Mark queue the revert of this patch.

Thanks,
Michael

On Tue, Dec 18, 2012 at 09:32:52AM +0800, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/regulator/da9052-regulator.c |   41 +++++-----------------------------
>  1 file changed, 6 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
> index d096309..c6d8651 100644
> --- a/drivers/regulator/da9052-regulator.c
> +++ b/drivers/regulator/da9052-regulator.c
> @@ -70,7 +70,6 @@ struct da9052_regulator_info {
>  	int step_uV;
>  	int min_uV;
>  	int max_uV;
> -	unsigned char activate_bit;
>  };
>  
>  struct da9052_regulator {
> @@ -210,36 +209,6 @@ static int da9052_map_voltage(struct regulator_dev *rdev,
>  	return sel;
>  }
>  
> -static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev,
> -					    unsigned int selector)
> -{
> -	struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
> -	struct da9052_regulator_info *info = regulator->info;
> -	int id = rdev_get_id(rdev);
> -	int ret;
> -
> -	ret = da9052_reg_update(regulator->da9052, rdev->desc->vsel_reg,
> -				rdev->desc->vsel_mask, selector);
> -	if (ret < 0)
> -		return ret;
> -
> -	/* Some LDOs and DCDCs are DVC controlled which requires enabling of
> -	 * the activate bit to implment the changes on the output.
> -	 */
> -	switch (id) {
> -	case DA9052_ID_BUCK1:
> -	case DA9052_ID_BUCK2:
> -	case DA9052_ID_BUCK3:
> -	case DA9052_ID_LDO2:
> -	case DA9052_ID_LDO3:
> -		ret = da9052_reg_update(regulator->da9052, DA9052_SUPPLY_REG,
> -					info->activate_bit, info->activate_bit);
> -		break;
> -	}
> -
> -	return ret;
> -}
> -
>  static struct regulator_ops da9052_dcdc_ops = {
>  	.get_current_limit = da9052_dcdc_get_current_limit,
>  	.set_current_limit = da9052_dcdc_set_current_limit,
> @@ -247,7 +216,7 @@ static struct regulator_ops da9052_dcdc_ops = {
>  	.list_voltage = da9052_list_voltage,
>  	.map_voltage = da9052_map_voltage,
>  	.get_voltage_sel = regulator_get_voltage_sel_regmap,
> -	.set_voltage_sel = da9052_regulator_set_voltage_sel,
> +	.set_voltage_sel = regulator_set_voltage_sel_regmap,
>  	.is_enabled = regulator_is_enabled_regmap,
>  	.enable = regulator_enable_regmap,
>  	.disable = regulator_disable_regmap,
> @@ -257,7 +226,7 @@ static struct regulator_ops da9052_ldo_ops = {
>  	.list_voltage = da9052_list_voltage,
>  	.map_voltage = da9052_map_voltage,
>  	.get_voltage_sel = regulator_get_voltage_sel_regmap,
> -	.set_voltage_sel = da9052_regulator_set_voltage_sel,
> +	.set_voltage_sel = regulator_set_voltage_sel_regmap,
>  	.is_enabled = regulator_is_enabled_regmap,
>  	.enable = regulator_enable_regmap,
>  	.disable = regulator_disable_regmap,
> @@ -274,13 +243,14 @@ static struct regulator_ops da9052_ldo_ops = {
>  		.owner = THIS_MODULE,\
>  		.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
>  		.vsel_mask = (1 << (sbits)) - 1,\
> +		.apply_reg = DA9052_SUPPLY_REG, \
> +		.apply_bit = (abits), \
>  		.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
>  		.enable_mask = 1 << (ebits),\
>  	},\
>  	.min_uV = (min) * 1000,\
>  	.max_uV = (max) * 1000,\
>  	.step_uV = (step) * 1000,\
> -	.activate_bit = (abits),\
>  }
>  
>  #define DA9052_DCDC(_id, step, min, max, sbits, ebits, abits) \
> @@ -294,13 +264,14 @@ static struct regulator_ops da9052_ldo_ops = {
>  		.owner = THIS_MODULE,\
>  		.vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
>  		.vsel_mask = (1 << (sbits)) - 1,\
> +		.apply_reg = DA9052_SUPPLY_REG, \
> +		.apply_bit = (abits), \
>  		.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
>  		.enable_mask = 1 << (ebits),\
>  	},\
>  	.min_uV = (min) * 1000,\
>  	.max_uV = (max) * 1000,\
>  	.step_uV = (step) * 1000,\
> -	.activate_bit = (abits),\
>  }
>  
>  static struct da9052_regulator_info da9052_regulator_info[] = {
> -- 
> 1.7.9.5




-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2013-10-02 10:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18  1:30 [PATCH 1/4] regulator: core: Allow specify apply_[reg|bit] for regmap based voltage_sel operations Axel Lin
2012-12-18  1:31 ` [PATCH 2/4] regulator: 88pm8607: Use apply_[reg|bit] with " Axel Lin
2012-12-21 15:58   ` Haojian Zhuang
2012-12-18  1:32 ` [PATCH 3/4] regulator: da9052: " Axel Lin
2013-10-02 10:15   ` Michael Grzeschik [this message]
2013-10-02 11:28     ` Mark Brown
2012-12-18  1:34 ` [PATCH 4/4] regulator: tps6586x: " Axel Lin
2012-12-21 15:53 ` [PATCH 1/4] regulator: core: Allow specify apply_[reg|bit] for " Haojian Zhuang
2012-12-24 16:34 ` Mark Brown
2012-12-25  0:38   ` Haojian Zhuang

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=20131002101500.GD25376@pengutronix.de \
    --to=mgr@pengutronix.de \
    --cc=ashish.jangam@kpitcummins.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dchen@diasemi.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.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