mbox series

[v3,0/8] Add Support for MediaTek PMIC MT6359

Message ID 1606103290-15034-1-git-send-email-hsin-hsiung.wang@mediatek.com
Headers show
Series Add Support for MediaTek PMIC MT6359 | expand

Message

Hsin-Hsiung Wang Nov. 23, 2020, 3:48 a.m. UTC
This patchset includes refactoring interrupt and adding support to MT6359 PMIC.
This patchset includes refactoring interrupt and adding support to MT6359 PMIC.
MT6359 is the primary PMIC for MT6779 and probably other SOCs.
The series[1] sent by Wen will continue to upstream in this patchset afterwards.
The series[1] sent by Wen will continue to upstream in this patchset afterwards.

The series[1] sent by Wen will continue to upstream in this patchset afterwards.

[1] https://patchwork.kernel.org/project/linux-mediatek/list/?series=306579

changes since v2:
- update binding document in DT schema format.
- remove unused compatible name.
- update correct registers for VBBCK and VA09.

Hsin-Hsiung Wang (6):
  mfd: mt6358: refine interrupt code
  dt-bindings: mfd: Add compatible for the MediaTek MT6359 PMIC
  dt-bindings: regulator: Add document for MT6359 regulator
  mfd: Add support for the MediaTek MT6359 PMIC
  regulator: mt6359: Set the enable time for LDOs
  regulator: mt6359: Add support for MT6359P regulator

Wen Su (2):
  regulator: mt6359: Add support for MT6359 regulator
  arm64: dts: mt6359: add PMIC MT6359 related nodes

 .../devicetree/bindings/mfd/mt6397.txt        |    8 +-
 .../bindings/regulator/mt6359-regulator.yaml  |  145 +++
 arch/arm64/boot/dts/mediatek/mt6359.dtsi      |  295 +++++
 drivers/mfd/mt6358-irq.c                      |   89 +-
 drivers/mfd/mt6397-core.c                     |   23 +
 drivers/regulator/Kconfig                     |    9 +
 drivers/regulator/Makefile                    |    1 +
 drivers/regulator/mt6359-regulator.c          | 1136 +++++++++++++++++
 include/linux/mfd/mt6358/core.h               |    8 +-
 include/linux/mfd/mt6358/core.h               |    8 +-
 include/linux/mfd/mt6359/core.h               |  133 ++
 include/linux/mfd/mt6359/registers.h          |  529 ++++++++
 include/linux/mfd/mt6359p/registers.h         |  249 ++++
 include/linux/mfd/mt6397/core.h               |    1 +
 include/linux/regulator/mt6359-regulator.h    |   59 +
 14 files changed, 2652 insertions(+), 33 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/regulator/mt6359-regulator.yaml
 create mode 100644 arch/arm64/boot/dts/mediatek/mt6359.dtsi
 create mode 100644 drivers/regulator/mt6359-regulator.c
 create mode 100644 include/linux/mfd/mt6359/core.h
 create mode 100644 include/linux/mfd/mt6359/registers.h
 create mode 100644 include/linux/mfd/mt6359p/registers.h
 create mode 100644 include/linux/regulator/mt6359-regulator.h

Comments

Mark Brown Nov. 24, 2020, 5:07 p.m. UTC | #1
On Mon, Nov 23, 2020 at 11:48:07AM +0800, Hsin-Hsiung Wang wrote:

> +static int mt6359_get_linear_voltage_sel(struct regulator_dev *rdev)

> +{

> +	struct mt6359_regulator_info *info = rdev_get_drvdata(rdev);

> +	int ret, regval;

> +

> +	ret = regmap_read(rdev->regmap, info->da_vsel_reg, &regval);

> +	if (ret != 0) {

> +		dev_err(&rdev->dev,

> +			"Failed to get mt6359 Buck %s vsel reg: %d\n",

> +			info->desc.name, ret);

> +		return ret;

> +	}

> +

> +	ret = (regval >> info->da_vsel_shift) & info->da_vsel_mask;

> +

> +	return ret;

> +}


This looks like it could just be regmap_get_voltage_sel_regmap()?
Otherwise the driver looks good.
Hsin-Hsiung Wang Dec. 15, 2020, 9:23 a.m. UTC | #2
Hi,

On Tue, 2020-11-24 at 17:07 +0000, Mark Brown wrote:
> On Mon, Nov 23, 2020 at 11:48:07AM +0800, Hsin-Hsiung Wang wrote:

> 

> > +static int mt6359_get_linear_voltage_sel(struct regulator_dev *rdev)

> > +{

> > +	struct mt6359_regulator_info *info = rdev_get_drvdata(rdev);

> > +	int ret, regval;

> > +

> > +	ret = regmap_read(rdev->regmap, info->da_vsel_reg, &regval);

> > +	if (ret != 0) {

> > +		dev_err(&rdev->dev,

> > +			"Failed to get mt6359 Buck %s vsel reg: %d\n",

> > +			info->desc.name, ret);

> > +		return ret;

> > +	}

> > +

> > +	ret = (regval >> info->da_vsel_shift) & info->da_vsel_mask;

> > +

> > +	return ret;

> > +}

> 

> This looks like it could just be regmap_get_voltage_sel_regmap()?

> Otherwise the driver looks good.


Thanks for the review.
MT6359 regulator has sel_reg and status_reg, so we use
mt6359_get_linear_voltage_sel for status_reg instead of
regmap_get_voltage_sel_regmap() which uses sel_reg.

Thanks.
Mark Brown Dec. 15, 2020, 11:56 a.m. UTC | #3
On Tue, Dec 15, 2020 at 05:23:08PM +0800, Hsin-hsiung Wang wrote:
> On Tue, 2020-11-24 at 17:07 +0000, Mark Brown wrote:


> > This looks like it could just be regmap_get_voltage_sel_regmap()?

> > Otherwise the driver looks good.


> Thanks for the review.

> MT6359 regulator has sel_reg and status_reg, so we use

> mt6359_get_linear_voltage_sel for status_reg instead of

> regmap_get_voltage_sel_regmap() which uses sel_reg.


Is the selector register not readable?  In general the rule is that the
get should be reporting what was configured, the actual status should be
reported separately if it can be read separately.  We don't currently
have a mechanism for doing that with voltage but one could be added.
Hsin-Hsiung Wang Dec. 16, 2020, 3:24 a.m. UTC | #4
Hi,
On Tue, 2020-12-15 at 11:56 +0000, Mark Brown wrote:
> On Tue, Dec 15, 2020 at 05:23:08PM +0800, Hsin-hsiung Wang wrote:

> > On Tue, 2020-11-24 at 17:07 +0000, Mark Brown wrote:

> 

> > > This looks like it could just be regmap_get_voltage_sel_regmap()?

> > > Otherwise the driver looks good.

> 

> > Thanks for the review.

> > MT6359 regulator has sel_reg and status_reg, so we use

> > mt6359_get_linear_voltage_sel for status_reg instead of

> > regmap_get_voltage_sel_regmap() which uses sel_reg.

> 

> Is the selector register not readable?  In general the rule is that the

> get should be reporting what was configured, the actual status should be

> reported separately if it can be read separately.  We don't currently

> have a mechanism for doing that with voltage but one could be added.


Thanks for your comments. The select register is readable, and I will
update it in next patch.