Commit 18490cdb authored by Lee Jones's avatar Lee Jones
Browse files

Merge branches 'ib-mfd-drm-5.6' and 'ib-mfd-clk-gpio-regulator-rtc-5.6' into ibs-for-mfd-merged

parents 10f91676 c31f625d
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/leds/rohm,bd71828-leds.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ROHM BD71828 Power Management Integrated Circuit LED driver

maintainers:
  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

description: |
  This module is part of the ROHM BD71828 MFD device. For more details
  see Documentation/devicetree/bindings/mfd/rohm,bd71828-pmic.yaml.

  The LED controller is represented as a sub-node of the PMIC node on the device
  tree.

  The device has two LED outputs referred as GRNLED and AMBLED in data-sheet.

select: false

properties:
  compatible:
    const: rohm,bd71828-leds

patternProperties:
  "^led-[1-2]$":
    type: object
    description:
      Properties for a single LED.
    properties:
      #allOf:
        #- $ref: "common.yaml#"
      rohm,led-compatible:
        description: LED identification string
        allOf:
          - $ref: "/schemas/types.yaml#/definitions/string"
          - enum:
            - bd71828-ambled
            - bd71828-grnled
      function:
        description:
          Purpose of LED as defined in dt-bindings/leds/common.h
        $ref: "/schemas/types.yaml#/definitions/string"
      color:
        description:
          LED colour as defined in dt-bindings/leds/common.h
        $ref: "/schemas/types.yaml#/definitions/uint32"

required:
  - compatible
+193 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/mfd/rohm,bd71828-pmic.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: ROHM BD71828 Power Management Integrated Circuit bindings

maintainers:
  - Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

description: |
  BD71828GW is a single-chip power management IC for battery-powered portable
  devices. The IC integrates 7 buck converters, 7 LDOs, and a 1500 mA
  single-cell linear charger. Also included is a Coulomb counter, a real-time
  clock (RTC), and a 32.768 kHz clock gate.

properties:
  compatible:
    const: rohm,bd71828

  reg:
    description:
      I2C slave address.
    maxItems: 1

  interrupts:
    maxItems: 1

  gpio-controller: true

  "#gpio-cells":
    const: 2
    description: |
      The first cell is the pin number and the second cell is used to specify
      flags. See ../gpio/gpio.txt for more information.

  clocks:
    maxItems: 1

  "#clock-cells":
    const: 0

  rohm,charger-sense-resistor-ohms:
    minimum: 10000000
    maximum: 50000000
    description: |
      BD71827 and BD71828 have SAR ADC for measuring charging currents.
      External sense resistor (RSENSE in data sheet) should be used. If some
      other but 30MOhm resistor is used the resistance value should be given
      here in Ohms.

  regulators:
    $ref: ../regulator/rohm,bd71828-regulator.yaml
    description:
      List of child nodes that specify the regulators.

  leds:
    $ref: ../leds/rohm,bd71828-leds.yaml

  gpio-reserved-ranges:
    description: |
      Usage of BD71828 GPIO pins can be changed via OTP. This property can be
      used to mark the pins which should not be configured for GPIO. Please see
      the ../gpio/gpio.txt for more information.

required:
  - compatible
  - reg
  - interrupts
  - clocks
  - "#clock-cells"
  - regulators
  - gpio-controller
  - "#gpio-cells"

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/leds/common.h>
    i2c {
        #address-cells = <1>;
        #size-cells = <0>;
        pmic: pmic@4b {
            compatible = "rohm,bd71828";
            reg = <0x4b>;

            interrupt-parent = <&gpio1>;
            interrupts = <29 IRQ_TYPE_LEVEL_LOW>;

            clocks = <&osc 0>;
            #clock-cells = <0>;
            clock-output-names = "bd71828-32k-out";

            gpio-controller;
            #gpio-cells = <2>;
            gpio-reserved-ranges = <0 1>, <2 1>;

            rohm,charger-sense-resistor-ohms = <10000000>;

            regulators {
                buck1: BUCK1 {
                    regulator-name = "buck1";
                    regulator-min-microvolt = <500000>;
                    regulator-max-microvolt = <2000000>;
                    regulator-ramp-delay = <2500>;
                };
                buck2: BUCK2 {
                    regulator-name = "buck2";
                    regulator-min-microvolt = <500000>;
                    regulator-max-microvolt = <2000000>;
                    regulator-ramp-delay = <2500>;
                };
                buck3: BUCK3 {
                    regulator-name = "buck3";
                    regulator-min-microvolt = <1200000>;
                    regulator-max-microvolt = <2000000>;
                };
                buck4: BUCK4 {
                    regulator-name = "buck4";
                    regulator-min-microvolt = <1000000>;
                    regulator-max-microvolt = <1800000>;
                };
                buck5: BUCK5 {
                    regulator-name = "buck5";
                    regulator-min-microvolt = <2500000>;
                    regulator-max-microvolt = <3300000>;
                };
                buck6: BUCK6 {
                    regulator-name = "buck6";
                    regulator-min-microvolt = <500000>;
                    regulator-max-microvolt = <2000000>;
                    regulator-ramp-delay = <2500>;
                };
                buck7: BUCK7 {
                    regulator-name = "buck7";
                    regulator-min-microvolt = <500000>;
                    regulator-max-microvolt = <2000000>;
                    regulator-ramp-delay = <2500>;
                };
                ldo1: LDO1 {
                    regulator-name = "ldo1";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
                ldo2: LDO2 {
                    regulator-name = "ldo2";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
                ldo3: LDO3 {
                    regulator-name = "ldo3";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
                ldo4: LDO4 {
                    regulator-name = "ldo4";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
                ldo5: LDO5 {
                    regulator-name = "ldo5";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
                ldo6: LDO6 {
                    regulator-name = "ldo6";
                    regulator-min-microvolt = <1800000>;
                    regulator-max-microvolt = <1800000>;
                };
                ldo7_reg: LDO7 {
                    regulator-name = "ldo7";
                    regulator-min-microvolt = <800000>;
                    regulator-max-microvolt = <3300000>;
                };
            };

            leds {
                compatible = "rohm,bd71828-leds";

                led-1 {
                    rohm,led-compatible = "bd71828-grnled";
                    function = LED_FUNCTION_INDICATOR;
                    color = <LED_COLOR_ID_GREEN>;
                };
                led-2 {
                    rohm,led-compatible = "bd71828-ambled";
                    function = LED_FUNCTION_CHARGING;
                    color = <LED_COLOR_ID_AMBER>;
                };
            };
        };
    };
+3 −3
Original line number Diff line number Diff line
@@ -305,10 +305,10 @@ config COMMON_CLK_MMP2
	  Support for Marvell MMP2 and MMP3 SoC clocks

config COMMON_CLK_BD718XX
	tristate "Clock driver for ROHM BD718x7 PMIC"
	depends on MFD_ROHM_BD718XX || MFD_ROHM_BD70528
	tristate "Clock driver for 32K clk gates on ROHM PMICs"
	depends on MFD_ROHM_BD718XX || MFD_ROHM_BD70528 || MFD_ROHM_BD71828
	help
	  This driver supports ROHM BD71837, ROHM BD71847 and
	  This driver supports ROHM BD71837, ROHM BD71847, ROHM BD71828 and
	  ROHM BD70528 PMICs clock gates.

config COMMON_CLK_FIXED_MMIO
+39 −11
Original line number Diff line number Diff line
@@ -7,12 +7,25 @@
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/mfd/rohm-bd718x7.h>
#include <linux/mfd/rohm-bd70528.h>
#include <linux/mfd/rohm-generic.h>
#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/regmap.h>

/* clk control registers */
/* BD70528 */
#define BD70528_REG_OUT32K	0x2c
/* BD71828 */
#define BD71828_REG_OUT32K	0x4B
/* BD71837 and BD71847 */
#define BD718XX_REG_OUT32K	0x2E

/*
 * BD71837, BD71847, BD70528 and BD71828 all use bit [0] to clk output control
 */
#define CLK_OUT_EN_MASK		BIT(0)


struct bd718xx_clk {
	struct clk_hw hw;
	u8 reg;
@@ -21,10 +34,8 @@ struct bd718xx_clk {
	struct rohm_regmap_dev *mfd;
};

static int bd71837_clk_set(struct clk_hw *hw, int status)
static int bd71837_clk_set(struct bd718xx_clk *c, unsigned int status)
{
	struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);

	return regmap_update_bits(c->mfd->regmap, c->reg, c->mask, status);
}

@@ -33,14 +44,16 @@ static void bd71837_clk_disable(struct clk_hw *hw)
	int rv;
	struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);

	rv = bd71837_clk_set(hw, 0);
	rv = bd71837_clk_set(c, 0);
	if (rv)
		dev_dbg(&c->pdev->dev, "Failed to disable 32K clk (%d)\n", rv);
}

static int bd71837_clk_enable(struct clk_hw *hw)
{
	return bd71837_clk_set(hw, 1);
	struct bd718xx_clk *c = container_of(hw, struct bd718xx_clk, hw);

	return bd71837_clk_set(c, 0xffffffff);
}

static int bd71837_clk_is_enabled(struct clk_hw *hw)
@@ -74,6 +87,7 @@ static int bd71837_clk_probe(struct platform_device *pdev)
		.name = "bd718xx-32k-out",
		.ops = &bd71837_clk_ops,
	};
	enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data;

	c = devm_kzalloc(&pdev->dev, sizeof(*c), GFP_KERNEL);
	if (!c)
@@ -87,15 +101,19 @@ static int bd71837_clk_probe(struct platform_device *pdev)
		dev_err(&pdev->dev, "No parent clk found\n");
		return -EINVAL;
	}
	switch (mfd->chip_type) {
	switch (chip) {
	case ROHM_CHIP_TYPE_BD71837:
	case ROHM_CHIP_TYPE_BD71847:
		c->reg = BD718XX_REG_OUT32K;
		c->mask = BD718XX_OUT32K_EN;
		c->mask = CLK_OUT_EN_MASK;
		break;
	case ROHM_CHIP_TYPE_BD71828:
		c->reg = BD71828_REG_OUT32K;
		c->mask = CLK_OUT_EN_MASK;
		break;
	case ROHM_CHIP_TYPE_BD70528:
		c->reg = BD70528_REG_CLK_OUT;
		c->mask = BD70528_CLK_OUT_EN_MASK;
		c->reg = BD70528_REG_OUT32K;
		c->mask = CLK_OUT_EN_MASK;
		break;
	default:
		dev_err(&pdev->dev, "Unknown clk chip\n");
@@ -121,11 +139,21 @@ static int bd71837_clk_probe(struct platform_device *pdev)
	return rval;
}

static const struct platform_device_id bd718x7_clk_id[] = {
	{ "bd71837-clk", ROHM_CHIP_TYPE_BD71837 },
	{ "bd71847-clk", ROHM_CHIP_TYPE_BD71847 },
	{ "bd70528-clk", ROHM_CHIP_TYPE_BD70528 },
	{ "bd71828-clk", ROHM_CHIP_TYPE_BD71828 },
	{ },
};
MODULE_DEVICE_TABLE(platform, bd718x7_clk_id);

static struct platform_driver bd71837_clk = {
	.driver = {
		.name = "bd718xx-clk",
	},
	.probe = bd71837_clk_probe,
	.id_table = bd718x7_clk_id,
};

module_platform_driver(bd71837_clk);
+12 −0
Original line number Diff line number Diff line
@@ -1021,6 +1021,18 @@ config GPIO_BD70528
	  This driver can also be built as a module. If so, the module
	  will be called gpio-bd70528.

config GPIO_BD71828
	tristate "ROHM BD71828 GPIO support"
	depends on MFD_ROHM_BD71828
	help
	  Support for GPIOs on ROHM BD71828 PMIC. There are three GPIOs
	  available on the ROHM PMIC in total. The GPIOs are limited to
	  outputs only and pins must be configured to GPIO outputs by
	  OTP. Enable this only if you want to use these pins as outputs.

	  This driver can also be built as a module. If so, the module
	  will be called gpio-bd71828.

config GPIO_BD9571MWV
	tristate "ROHM BD9571 GPIO support"
	depends on MFD_BD9571MWV
Loading