Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'ib-mfd-input-regulator-6.11' into ibs-for-mfd-merged

+820
+76
Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/marvell,88pm886-a1.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Marvell 88PM886 PMIC core 8 + 9 + maintainers: 10 + - Karel Balej <balejk@matfyz.cz> 11 + 12 + description: 13 + Marvell 88PM886 is a PMIC providing several functions such as onkey, 14 + regulators or battery and charger. 15 + 16 + properties: 17 + compatible: 18 + const: marvell,88pm886-a1 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + interrupts: 24 + maxItems: 1 25 + 26 + wakeup-source: true 27 + 28 + regulators: 29 + type: object 30 + additionalProperties: false 31 + patternProperties: 32 + "^(ldo(1[0-6]|[1-9])|buck[1-5])$": 33 + type: object 34 + $ref: /schemas/regulator/regulator.yaml# 35 + description: LDO or buck regulator. 36 + unevaluatedProperties: false 37 + 38 + required: 39 + - compatible 40 + - reg 41 + - interrupts 42 + 43 + additionalProperties: false 44 + 45 + examples: 46 + - | 47 + #include <dt-bindings/interrupt-controller/irq.h> 48 + i2c { 49 + #address-cells = <1>; 50 + #size-cells = <0>; 51 + pmic@30 { 52 + compatible = "marvell,88pm886-a1"; 53 + reg = <0x30>; 54 + interrupts = <0 4 IRQ_TYPE_LEVEL_HIGH>; 55 + interrupt-parent = <&gic>; 56 + wakeup-source; 57 + 58 + regulators { 59 + ldo2: ldo2 { 60 + regulator-min-microvolt = <3100000>; 61 + regulator-max-microvolt = <3300000>; 62 + }; 63 + 64 + ldo15: ldo15 { 65 + regulator-min-microvolt = <3300000>; 66 + regulator-max-microvolt = <3300000>; 67 + }; 68 + 69 + buck2: buck2 { 70 + regulator-min-microvolt = <1800000>; 71 + regulator-max-microvolt = <1800000>; 72 + }; 73 + }; 74 + }; 75 + }; 76 + ...
+9
MAINTAINERS
··· 13312 13312 F: include/linux/dsa/mv88e6xxx.h 13313 13313 F: include/linux/platform_data/mv88e6xxx.h 13314 13314 13315 + MARVELL 88PM886 PMIC DRIVER 13316 + M: Karel Balej <balejk@matfyz.cz> 13317 + S: Maintained 13318 + F: Documentation/devicetree/bindings/mfd/marvell,88pm886-a1.yaml 13319 + F: drivers/input/misc/88pm886-onkey.c 13320 + F: drivers/mfd/88pm886.c 13321 + F: drivers/regulators/88pm886-regulator.c 13322 + F: include/linux/mfd/88pm886.h 13323 + 13315 13324 MARVELL ARMADA 3700 PHY DRIVERS 13316 13325 M: Miquel Raynal <miquel.raynal@bootlin.com> 13317 13326 S: Maintained
+98
drivers/input/misc/88pm886-onkey.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include <linux/input.h> 3 + #include <linux/interrupt.h> 4 + #include <linux/irq.h> 5 + #include <linux/platform_device.h> 6 + #include <linux/regmap.h> 7 + 8 + #include <linux/mfd/88pm886.h> 9 + 10 + struct pm886_onkey { 11 + struct input_dev *idev; 12 + struct pm886_chip *chip; 13 + }; 14 + 15 + static irqreturn_t pm886_onkey_irq_handler(int irq, void *data) 16 + { 17 + struct pm886_onkey *onkey = data; 18 + struct regmap *regmap = onkey->chip->regmap; 19 + struct input_dev *idev = onkey->idev; 20 + struct device *parent = idev->dev.parent; 21 + unsigned int val; 22 + int err; 23 + 24 + err = regmap_read(regmap, PM886_REG_STATUS1, &val); 25 + if (err) { 26 + dev_err(parent, "Failed to read status: %d\n", err); 27 + return IRQ_NONE; 28 + } 29 + val &= PM886_ONKEY_STS1; 30 + 31 + input_report_key(idev, KEY_POWER, val); 32 + input_sync(idev); 33 + 34 + return IRQ_HANDLED; 35 + } 36 + 37 + static int pm886_onkey_probe(struct platform_device *pdev) 38 + { 39 + struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent); 40 + struct device *dev = &pdev->dev; 41 + struct pm886_onkey *onkey; 42 + struct input_dev *idev; 43 + int irq, err; 44 + 45 + onkey = devm_kzalloc(dev, sizeof(*onkey), GFP_KERNEL); 46 + if (!onkey) 47 + return -ENOMEM; 48 + 49 + onkey->chip = chip; 50 + 51 + irq = platform_get_irq(pdev, 0); 52 + if (irq < 0) 53 + return dev_err_probe(dev, irq, "Failed to get IRQ\n"); 54 + 55 + idev = devm_input_allocate_device(dev); 56 + if (!idev) { 57 + dev_err(dev, "Failed to allocate input device\n"); 58 + return -ENOMEM; 59 + } 60 + onkey->idev = idev; 61 + 62 + idev->name = "88pm886-onkey"; 63 + idev->phys = "88pm886-onkey/input0"; 64 + idev->id.bustype = BUS_I2C; 65 + 66 + input_set_capability(idev, EV_KEY, KEY_POWER); 67 + 68 + err = devm_request_threaded_irq(dev, irq, NULL, pm886_onkey_irq_handler, 69 + IRQF_ONESHOT | IRQF_NO_SUSPEND, "onkey", 70 + onkey); 71 + if (err) 72 + return dev_err_probe(dev, err, "Failed to request IRQ\n"); 73 + 74 + err = input_register_device(idev); 75 + if (err) 76 + return dev_err_probe(dev, err, "Failed to register input device\n"); 77 + 78 + return 0; 79 + } 80 + 81 + static const struct platform_device_id pm886_onkey_id_table[] = { 82 + { "88pm886-onkey", }, 83 + { } 84 + }; 85 + MODULE_DEVICE_TABLE(platform, pm886_onkey_id_table); 86 + 87 + static struct platform_driver pm886_onkey_driver = { 88 + .driver = { 89 + .name = "88pm886-onkey", 90 + }, 91 + .probe = pm886_onkey_probe, 92 + .id_table = pm886_onkey_id_table, 93 + }; 94 + module_platform_driver(pm886_onkey_driver); 95 + 96 + MODULE_DESCRIPTION("Marvell 88PM886 onkey driver"); 97 + MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>"); 98 + MODULE_LICENSE("GPL");
+7
drivers/input/misc/Kconfig
··· 33 33 To compile this driver as a module, choose M here: the module 34 34 will be called 88pm80x_onkey. 35 35 36 + config INPUT_88PM886_ONKEY 37 + tristate "Marvell 88PM886 onkey support" 38 + depends on MFD_88PM886_PMIC 39 + help 40 + Support the onkey of Marvell 88PM886 PMIC as an input device 41 + reporting power button status. 42 + 36 43 config INPUT_AB8500_PONKEY 37 44 tristate "AB8500 Pon (PowerOn) Key" 38 45 depends on AB8500_CORE
+1
drivers/input/misc/Makefile
··· 7 7 8 8 obj-$(CONFIG_INPUT_88PM860X_ONKEY) += 88pm860x_onkey.o 9 9 obj-$(CONFIG_INPUT_88PM80X_ONKEY) += 88pm80x_onkey.o 10 + obj-$(CONFIG_INPUT_88PM886_ONKEY) += 88pm886-onkey.o 10 11 obj-$(CONFIG_INPUT_AB8500_PONKEY) += ab8500-ponkey.o 11 12 obj-$(CONFIG_INPUT_AD714X) += ad714x.o 12 13 obj-$(CONFIG_INPUT_AD714X_I2C) += ad714x-i2c.o
+148
drivers/mfd/88pm886.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include <linux/i2c.h> 3 + #include <linux/mfd/core.h> 4 + #include <linux/module.h> 5 + #include <linux/notifier.h> 6 + #include <linux/of.h> 7 + #include <linux/platform_device.h> 8 + #include <linux/reboot.h> 9 + #include <linux/regmap.h> 10 + 11 + #include <linux/mfd/88pm886.h> 12 + 13 + static const struct regmap_config pm886_regmap_config = { 14 + .reg_bits = 8, 15 + .val_bits = 8, 16 + .max_register = PM886_REG_RTC_SPARE6, 17 + }; 18 + 19 + static struct regmap_irq pm886_regmap_irqs[] = { 20 + REGMAP_IRQ_REG(PM886_IRQ_ONKEY, 0, PM886_INT_ENA1_ONKEY), 21 + }; 22 + 23 + static struct regmap_irq_chip pm886_regmap_irq_chip = { 24 + .name = "88pm886", 25 + .irqs = pm886_regmap_irqs, 26 + .num_irqs = ARRAY_SIZE(pm886_regmap_irqs), 27 + .num_regs = 4, 28 + .status_base = PM886_REG_INT_STATUS1, 29 + .ack_base = PM886_REG_INT_STATUS1, 30 + .unmask_base = PM886_REG_INT_ENA_1, 31 + }; 32 + 33 + static struct resource pm886_onkey_resources[] = { 34 + DEFINE_RES_IRQ_NAMED(PM886_IRQ_ONKEY, "88pm886-onkey"), 35 + }; 36 + 37 + static struct mfd_cell pm886_devs[] = { 38 + MFD_CELL_RES("88pm886-onkey", pm886_onkey_resources), 39 + MFD_CELL_NAME("88pm886-regulator"), 40 + }; 41 + 42 + static int pm886_power_off_handler(struct sys_off_data *sys_off_data) 43 + { 44 + struct pm886_chip *chip = sys_off_data->cb_data; 45 + struct regmap *regmap = chip->regmap; 46 + struct device *dev = &chip->client->dev; 47 + int err; 48 + 49 + err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG1, PM886_SW_PDOWN, PM886_SW_PDOWN); 50 + if (err) { 51 + dev_err(dev, "Failed to power off the device: %d\n", err); 52 + return NOTIFY_BAD; 53 + } 54 + return NOTIFY_DONE; 55 + } 56 + 57 + static int pm886_setup_irq(struct pm886_chip *chip, 58 + struct regmap_irq_chip_data **irq_data) 59 + { 60 + struct regmap *regmap = chip->regmap; 61 + struct device *dev = &chip->client->dev; 62 + int err; 63 + 64 + /* Set interrupt clearing mode to clear on write. */ 65 + err = regmap_update_bits(regmap, PM886_REG_MISC_CONFIG2, 66 + PM886_INT_INV | PM886_INT_CLEAR | PM886_INT_MASK_MODE, 67 + PM886_INT_WC); 68 + if (err) { 69 + dev_err(dev, "Failed to set interrupt clearing mode: %d\n", err); 70 + return err; 71 + } 72 + 73 + err = devm_regmap_add_irq_chip(dev, regmap, chip->client->irq, 74 + IRQF_ONESHOT, 0, &pm886_regmap_irq_chip, 75 + irq_data); 76 + if (err) { 77 + dev_err(dev, "Failed to request IRQ: %d\n", err); 78 + return err; 79 + } 80 + 81 + return 0; 82 + } 83 + 84 + static int pm886_probe(struct i2c_client *client) 85 + { 86 + struct regmap_irq_chip_data *irq_data; 87 + struct device *dev = &client->dev; 88 + struct pm886_chip *chip; 89 + struct regmap *regmap; 90 + unsigned int chip_id; 91 + int err; 92 + 93 + chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); 94 + if (!chip) 95 + return -ENOMEM; 96 + 97 + chip->client = client; 98 + chip->chip_id = (uintptr_t)device_get_match_data(dev); 99 + i2c_set_clientdata(client, chip); 100 + 101 + regmap = devm_regmap_init_i2c(client, &pm886_regmap_config); 102 + if (IS_ERR(regmap)) 103 + return dev_err_probe(dev, PTR_ERR(regmap), "Failed to initialize regmap\n"); 104 + chip->regmap = regmap; 105 + 106 + err = regmap_read(regmap, PM886_REG_ID, &chip_id); 107 + if (err) 108 + return dev_err_probe(dev, err, "Failed to read chip ID\n"); 109 + 110 + if (chip->chip_id != chip_id) 111 + return dev_err_probe(dev, -EINVAL, "Unsupported chip: 0x%x\n", chip_id); 112 + 113 + err = pm886_setup_irq(chip, &irq_data); 114 + if (err) 115 + return err; 116 + 117 + err = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, pm886_devs, ARRAY_SIZE(pm886_devs), 118 + NULL, 0, regmap_irq_get_domain(irq_data)); 119 + if (err) 120 + return dev_err_probe(dev, err, "Failed to add devices\n"); 121 + 122 + err = devm_register_power_off_handler(dev, pm886_power_off_handler, chip); 123 + if (err) 124 + return dev_err_probe(dev, err, "Failed to register power off handler\n"); 125 + 126 + device_init_wakeup(dev, device_property_read_bool(dev, "wakeup-source")); 127 + 128 + return 0; 129 + } 130 + 131 + static const struct of_device_id pm886_of_match[] = { 132 + { .compatible = "marvell,88pm886-a1", .data = (void *)PM886_A1_CHIP_ID }, 133 + { } 134 + }; 135 + MODULE_DEVICE_TABLE(of, pm886_of_match); 136 + 137 + static struct i2c_driver pm886_i2c_driver = { 138 + .driver = { 139 + .name = "88pm886", 140 + .of_match_table = pm886_of_match, 141 + }, 142 + .probe = pm886_probe, 143 + }; 144 + module_i2c_driver(pm886_i2c_driver); 145 + 146 + MODULE_DESCRIPTION("Marvell 88PM886 PMIC driver"); 147 + MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>"); 148 + MODULE_LICENSE("GPL");
+12
drivers/mfd/Kconfig
··· 794 794 select individual components like voltage regulators, RTC and 795 795 battery-charger under the corresponding menus. 796 796 797 + config MFD_88PM886_PMIC 798 + bool "Marvell 88PM886 PMIC" 799 + depends on I2C=y 800 + depends on OF 801 + select REGMAP_I2C 802 + select REGMAP_IRQ 803 + select MFD_CORE 804 + help 805 + This enables support for Marvell 88PM886 Power Management IC. 806 + This includes the I2C driver and the core APIs _only_, you have to 807 + select individual components like onkey under the corresponding menus. 808 + 797 809 config MFD_MAX14577 798 810 tristate "Maxim Semiconductor MAX14577/77836 MUIC + Charger Support" 799 811 depends on I2C
+1
drivers/mfd/Makefile
··· 7 7 obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o 8 8 obj-$(CONFIG_MFD_88PM800) += 88pm800.o 88pm80x.o 9 9 obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o 10 + obj-$(CONFIG_MFD_88PM886_PMIC) += 88pm886.o 10 11 obj-$(CONFIG_MFD_ACT8945A) += act8945a.o 11 12 obj-$(CONFIG_MFD_SM501) += sm501.o 12 13 obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o
+392
drivers/regulator/88pm886-regulator.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + #include <linux/i2c.h> 3 + #include <linux/module.h> 4 + #include <linux/platform_device.h> 5 + #include <linux/regmap.h> 6 + #include <linux/regulator/driver.h> 7 + 8 + #include <linux/mfd/88pm886.h> 9 + 10 + static const struct regmap_config pm886_regulator_regmap_config = { 11 + .reg_bits = 8, 12 + .val_bits = 8, 13 + .max_register = PM886_REG_BUCK5_VOUT, 14 + }; 15 + 16 + static const struct regulator_ops pm886_ldo_ops = { 17 + .list_voltage = regulator_list_voltage_table, 18 + .map_voltage = regulator_map_voltage_iterate, 19 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 20 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 21 + .enable = regulator_enable_regmap, 22 + .disable = regulator_disable_regmap, 23 + .is_enabled = regulator_is_enabled_regmap, 24 + }; 25 + 26 + static const struct regulator_ops pm886_buck_ops = { 27 + .list_voltage = regulator_list_voltage_linear_range, 28 + .map_voltage = regulator_map_voltage_linear_range, 29 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 30 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 31 + .enable = regulator_enable_regmap, 32 + .disable = regulator_disable_regmap, 33 + .is_enabled = regulator_is_enabled_regmap, 34 + }; 35 + 36 + static const unsigned int pm886_ldo_volt_table1[] = { 37 + 1700000, 1800000, 1900000, 2500000, 2800000, 2900000, 3100000, 3300000, 38 + }; 39 + 40 + static const unsigned int pm886_ldo_volt_table2[] = { 41 + 1200000, 1250000, 1700000, 1800000, 1850000, 1900000, 2500000, 2600000, 42 + 2700000, 2750000, 2800000, 2850000, 2900000, 3000000, 3100000, 3300000, 43 + }; 44 + 45 + static const unsigned int pm886_ldo_volt_table3[] = { 46 + 1700000, 1800000, 1900000, 2000000, 2100000, 2500000, 2700000, 2800000, 47 + }; 48 + 49 + static const struct linear_range pm886_buck_volt_ranges1[] = { 50 + REGULATOR_LINEAR_RANGE(600000, 0, 79, 12500), 51 + REGULATOR_LINEAR_RANGE(1600000, 80, 84, 50000), 52 + }; 53 + 54 + static const struct linear_range pm886_buck_volt_ranges2[] = { 55 + REGULATOR_LINEAR_RANGE(600000, 0, 79, 12500), 56 + REGULATOR_LINEAR_RANGE(1600000, 80, 114, 50000), 57 + }; 58 + 59 + static struct regulator_desc pm886_regulators[] = { 60 + { 61 + .name = "LDO1", 62 + .regulators_node = "regulators", 63 + .of_match = "ldo1", 64 + .ops = &pm886_ldo_ops, 65 + .type = REGULATOR_VOLTAGE, 66 + .enable_reg = PM886_REG_LDO_EN1, 67 + .enable_mask = BIT(0), 68 + .volt_table = pm886_ldo_volt_table1, 69 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1), 70 + .vsel_reg = PM886_REG_LDO1_VOUT, 71 + .vsel_mask = PM886_LDO_VSEL_MASK, 72 + }, 73 + { 74 + .name = "LDO2", 75 + .regulators_node = "regulators", 76 + .of_match = "ldo2", 77 + .ops = &pm886_ldo_ops, 78 + .type = REGULATOR_VOLTAGE, 79 + .enable_reg = PM886_REG_LDO_EN1, 80 + .enable_mask = BIT(1), 81 + .volt_table = pm886_ldo_volt_table1, 82 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1), 83 + .vsel_reg = PM886_REG_LDO2_VOUT, 84 + .vsel_mask = PM886_LDO_VSEL_MASK, 85 + }, 86 + { 87 + .name = "LDO3", 88 + .regulators_node = "regulators", 89 + .of_match = "ldo3", 90 + .ops = &pm886_ldo_ops, 91 + .type = REGULATOR_VOLTAGE, 92 + .enable_reg = PM886_REG_LDO_EN1, 93 + .enable_mask = BIT(2), 94 + .volt_table = pm886_ldo_volt_table1, 95 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table1), 96 + .vsel_reg = PM886_REG_LDO3_VOUT, 97 + .vsel_mask = PM886_LDO_VSEL_MASK, 98 + }, 99 + { 100 + .name = "LDO4", 101 + .regulators_node = "regulators", 102 + .of_match = "ldo4", 103 + .ops = &pm886_ldo_ops, 104 + .type = REGULATOR_VOLTAGE, 105 + .enable_reg = PM886_REG_LDO_EN1, 106 + .enable_mask = BIT(3), 107 + .volt_table = pm886_ldo_volt_table2, 108 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 109 + .vsel_reg = PM886_REG_LDO4_VOUT, 110 + .vsel_mask = PM886_LDO_VSEL_MASK, 111 + }, 112 + { 113 + .name = "LDO5", 114 + .regulators_node = "regulators", 115 + .of_match = "ldo5", 116 + .ops = &pm886_ldo_ops, 117 + .type = REGULATOR_VOLTAGE, 118 + .enable_reg = PM886_REG_LDO_EN1, 119 + .enable_mask = BIT(4), 120 + .volt_table = pm886_ldo_volt_table2, 121 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 122 + .vsel_reg = PM886_REG_LDO5_VOUT, 123 + .vsel_mask = PM886_LDO_VSEL_MASK, 124 + }, 125 + { 126 + .name = "LDO6", 127 + .regulators_node = "regulators", 128 + .of_match = "ldo6", 129 + .ops = &pm886_ldo_ops, 130 + .type = REGULATOR_VOLTAGE, 131 + .enable_reg = PM886_REG_LDO_EN1, 132 + .enable_mask = BIT(5), 133 + .volt_table = pm886_ldo_volt_table2, 134 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 135 + .vsel_reg = PM886_REG_LDO6_VOUT, 136 + .vsel_mask = PM886_LDO_VSEL_MASK, 137 + }, 138 + { 139 + .name = "LDO7", 140 + .regulators_node = "regulators", 141 + .of_match = "ldo7", 142 + .ops = &pm886_ldo_ops, 143 + .type = REGULATOR_VOLTAGE, 144 + .enable_reg = PM886_REG_LDO_EN1, 145 + .enable_mask = BIT(6), 146 + .volt_table = pm886_ldo_volt_table2, 147 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 148 + .vsel_reg = PM886_REG_LDO7_VOUT, 149 + .vsel_mask = PM886_LDO_VSEL_MASK, 150 + }, 151 + { 152 + .name = "LDO8", 153 + .regulators_node = "regulators", 154 + .of_match = "ldo8", 155 + .ops = &pm886_ldo_ops, 156 + .type = REGULATOR_VOLTAGE, 157 + .enable_reg = PM886_REG_LDO_EN1, 158 + .enable_mask = BIT(7), 159 + .volt_table = pm886_ldo_volt_table2, 160 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 161 + .vsel_reg = PM886_REG_LDO8_VOUT, 162 + .vsel_mask = PM886_LDO_VSEL_MASK, 163 + }, 164 + { 165 + .name = "LDO9", 166 + .regulators_node = "regulators", 167 + .of_match = "ldo9", 168 + .ops = &pm886_ldo_ops, 169 + .type = REGULATOR_VOLTAGE, 170 + .enable_reg = PM886_REG_LDO_EN2, 171 + .enable_mask = BIT(0), 172 + .volt_table = pm886_ldo_volt_table2, 173 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 174 + .vsel_reg = PM886_REG_LDO9_VOUT, 175 + .vsel_mask = PM886_LDO_VSEL_MASK, 176 + }, 177 + { 178 + .name = "LDO10", 179 + .regulators_node = "regulators", 180 + .of_match = "ldo10", 181 + .ops = &pm886_ldo_ops, 182 + .type = REGULATOR_VOLTAGE, 183 + .enable_reg = PM886_REG_LDO_EN2, 184 + .enable_mask = BIT(1), 185 + .volt_table = pm886_ldo_volt_table2, 186 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 187 + .vsel_reg = PM886_REG_LDO10_VOUT, 188 + .vsel_mask = PM886_LDO_VSEL_MASK, 189 + }, 190 + { 191 + .name = "LDO11", 192 + .regulators_node = "regulators", 193 + .of_match = "ldo11", 194 + .ops = &pm886_ldo_ops, 195 + .type = REGULATOR_VOLTAGE, 196 + .enable_reg = PM886_REG_LDO_EN2, 197 + .enable_mask = BIT(2), 198 + .volt_table = pm886_ldo_volt_table2, 199 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 200 + .vsel_reg = PM886_REG_LDO11_VOUT, 201 + .vsel_mask = PM886_LDO_VSEL_MASK, 202 + }, 203 + { 204 + .name = "LDO12", 205 + .regulators_node = "regulators", 206 + .of_match = "ldo12", 207 + .ops = &pm886_ldo_ops, 208 + .type = REGULATOR_VOLTAGE, 209 + .enable_reg = PM886_REG_LDO_EN2, 210 + .enable_mask = BIT(3), 211 + .volt_table = pm886_ldo_volt_table2, 212 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 213 + .vsel_reg = PM886_REG_LDO12_VOUT, 214 + .vsel_mask = PM886_LDO_VSEL_MASK, 215 + }, 216 + { 217 + .name = "LDO13", 218 + .regulators_node = "regulators", 219 + .of_match = "ldo13", 220 + .ops = &pm886_ldo_ops, 221 + .type = REGULATOR_VOLTAGE, 222 + .enable_reg = PM886_REG_LDO_EN2, 223 + .enable_mask = BIT(4), 224 + .volt_table = pm886_ldo_volt_table2, 225 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 226 + .vsel_reg = PM886_REG_LDO13_VOUT, 227 + .vsel_mask = PM886_LDO_VSEL_MASK, 228 + }, 229 + { 230 + .name = "LDO14", 231 + .regulators_node = "regulators", 232 + .of_match = "ldo14", 233 + .ops = &pm886_ldo_ops, 234 + .type = REGULATOR_VOLTAGE, 235 + .enable_reg = PM886_REG_LDO_EN2, 236 + .enable_mask = BIT(5), 237 + .volt_table = pm886_ldo_volt_table2, 238 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 239 + .vsel_reg = PM886_REG_LDO14_VOUT, 240 + .vsel_mask = PM886_LDO_VSEL_MASK, 241 + }, 242 + { 243 + .name = "LDO15", 244 + .regulators_node = "regulators", 245 + .of_match = "ldo15", 246 + .ops = &pm886_ldo_ops, 247 + .type = REGULATOR_VOLTAGE, 248 + .enable_reg = PM886_REG_LDO_EN2, 249 + .enable_mask = BIT(6), 250 + .volt_table = pm886_ldo_volt_table2, 251 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table2), 252 + .vsel_reg = PM886_REG_LDO15_VOUT, 253 + .vsel_mask = PM886_LDO_VSEL_MASK, 254 + }, 255 + { 256 + .name = "LDO16", 257 + .regulators_node = "regulators", 258 + .of_match = "ldo16", 259 + .ops = &pm886_ldo_ops, 260 + .type = REGULATOR_VOLTAGE, 261 + .enable_reg = PM886_REG_LDO_EN2, 262 + .enable_mask = BIT(7), 263 + .volt_table = pm886_ldo_volt_table3, 264 + .n_voltages = ARRAY_SIZE(pm886_ldo_volt_table3), 265 + .vsel_reg = PM886_REG_LDO16_VOUT, 266 + .vsel_mask = PM886_LDO_VSEL_MASK, 267 + }, 268 + { 269 + .name = "buck1", 270 + .regulators_node = "regulators", 271 + .of_match = "buck1", 272 + .ops = &pm886_buck_ops, 273 + .type = REGULATOR_VOLTAGE, 274 + .n_voltages = 85, 275 + .linear_ranges = pm886_buck_volt_ranges1, 276 + .n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges1), 277 + .vsel_reg = PM886_REG_BUCK1_VOUT, 278 + .vsel_mask = PM886_BUCK_VSEL_MASK, 279 + .enable_reg = PM886_REG_BUCK_EN, 280 + .enable_mask = BIT(0), 281 + }, 282 + { 283 + .name = "buck2", 284 + .regulators_node = "regulators", 285 + .of_match = "buck2", 286 + .ops = &pm886_buck_ops, 287 + .type = REGULATOR_VOLTAGE, 288 + .n_voltages = 115, 289 + .linear_ranges = pm886_buck_volt_ranges2, 290 + .n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2), 291 + .vsel_reg = PM886_REG_BUCK2_VOUT, 292 + .vsel_mask = PM886_BUCK_VSEL_MASK, 293 + .enable_reg = PM886_REG_BUCK_EN, 294 + .enable_mask = BIT(1), 295 + }, 296 + { 297 + .name = "buck3", 298 + .regulators_node = "regulators", 299 + .of_match = "buck3", 300 + .ops = &pm886_buck_ops, 301 + .type = REGULATOR_VOLTAGE, 302 + .n_voltages = 115, 303 + .linear_ranges = pm886_buck_volt_ranges2, 304 + .n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2), 305 + .vsel_reg = PM886_REG_BUCK3_VOUT, 306 + .vsel_mask = PM886_BUCK_VSEL_MASK, 307 + .enable_reg = PM886_REG_BUCK_EN, 308 + .enable_mask = BIT(2), 309 + }, 310 + { 311 + .name = "buck4", 312 + .regulators_node = "regulators", 313 + .of_match = "buck4", 314 + .ops = &pm886_buck_ops, 315 + .type = REGULATOR_VOLTAGE, 316 + .n_voltages = 115, 317 + .linear_ranges = pm886_buck_volt_ranges2, 318 + .n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2), 319 + .vsel_reg = PM886_REG_BUCK4_VOUT, 320 + .vsel_mask = PM886_BUCK_VSEL_MASK, 321 + .enable_reg = PM886_REG_BUCK_EN, 322 + .enable_mask = BIT(3), 323 + }, 324 + { 325 + .name = "buck5", 326 + .regulators_node = "regulators", 327 + .of_match = "buck5", 328 + .ops = &pm886_buck_ops, 329 + .type = REGULATOR_VOLTAGE, 330 + .n_voltages = 115, 331 + .linear_ranges = pm886_buck_volt_ranges2, 332 + .n_linear_ranges = ARRAY_SIZE(pm886_buck_volt_ranges2), 333 + .vsel_reg = PM886_REG_BUCK5_VOUT, 334 + .vsel_mask = PM886_BUCK_VSEL_MASK, 335 + .enable_reg = PM886_REG_BUCK_EN, 336 + .enable_mask = BIT(4), 337 + }, 338 + }; 339 + 340 + static int pm886_regulator_probe(struct platform_device *pdev) 341 + { 342 + struct pm886_chip *chip = dev_get_drvdata(pdev->dev.parent); 343 + struct regulator_config rcfg = { }; 344 + struct device *dev = &pdev->dev; 345 + struct regulator_desc *rdesc; 346 + struct regulator_dev *rdev; 347 + struct i2c_client *page; 348 + struct regmap *regmap; 349 + 350 + page = devm_i2c_new_dummy_device(dev, chip->client->adapter, 351 + chip->client->addr + PM886_PAGE_OFFSET_REGULATORS); 352 + if (IS_ERR(page)) 353 + return dev_err_probe(dev, PTR_ERR(page), 354 + "Failed to initialize regulators client\n"); 355 + 356 + regmap = devm_regmap_init_i2c(page, &pm886_regulator_regmap_config); 357 + if (IS_ERR(regmap)) 358 + return dev_err_probe(dev, PTR_ERR(regmap), 359 + "Failed to initialize regulators regmap\n"); 360 + rcfg.regmap = regmap; 361 + 362 + rcfg.dev = dev->parent; 363 + 364 + for (int i = 0; i < ARRAY_SIZE(pm886_regulators); i++) { 365 + rdesc = &pm886_regulators[i]; 366 + rdev = devm_regulator_register(dev, rdesc, &rcfg); 367 + if (IS_ERR(rdev)) 368 + return dev_err_probe(dev, PTR_ERR(rdev), 369 + "Failed to register %s\n", rdesc->name); 370 + } 371 + 372 + return 0; 373 + } 374 + 375 + static const struct platform_device_id pm886_regulator_id_table[] = { 376 + { "88pm886-regulator", }, 377 + { } 378 + }; 379 + MODULE_DEVICE_TABLE(platform, pm886_regulator_id_table); 380 + 381 + static struct platform_driver pm886_regulator_driver = { 382 + .driver = { 383 + .name = "88pm886-regulator", 384 + }, 385 + .probe = pm886_regulator_probe, 386 + .id_table = pm886_regulator_id_table, 387 + }; 388 + module_platform_driver(pm886_regulator_driver); 389 + 390 + MODULE_DESCRIPTION("Marvell 88PM886 PMIC regulator driver"); 391 + MODULE_AUTHOR("Karel Balej <balejk@matfyz.cz>"); 392 + MODULE_LICENSE("GPL");
+6
drivers/regulator/Kconfig
··· 91 91 help 92 92 This driver supports 88PM8607 voltage regulator chips. 93 93 94 + config REGULATOR_88PM886 95 + tristate "Marvell 88PM886 voltage regulators" 96 + depends on MFD_88PM886_PMIC 97 + help 98 + This driver implements support for Marvell 88PM886 voltage regulators. 99 + 94 100 config REGULATOR_ACT8865 95 101 tristate "Active-semi act8865 voltage regulator" 96 102 depends on I2C
+1
drivers/regulator/Makefile
··· 14 14 obj-$(CONFIG_REGULATOR_88PG86X) += 88pg86x.o 15 15 obj-$(CONFIG_REGULATOR_88PM800) += 88pm800-regulator.o 16 16 obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o 17 + obj-$(CONFIG_REGULATOR_88PM886) += 88pm886-regulator.o 17 18 obj-$(CONFIG_REGULATOR_CROS_EC) += cros-ec-regulator.o 18 19 obj-$(CONFIG_REGULATOR_CPCAP) += cpcap-regulator.o 19 20 obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o
+69
include/linux/mfd/88pm886.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #ifndef __MFD_88PM886_H 3 + #define __MFD_88PM886_H 4 + 5 + #include <linux/i2c.h> 6 + #include <linux/regmap.h> 7 + 8 + #define PM886_A1_CHIP_ID 0xa1 9 + 10 + #define PM886_IRQ_ONKEY 0 11 + 12 + #define PM886_PAGE_OFFSET_REGULATORS 1 13 + 14 + #define PM886_REG_ID 0x00 15 + 16 + #define PM886_REG_STATUS1 0x01 17 + #define PM886_ONKEY_STS1 BIT(0) 18 + 19 + #define PM886_REG_INT_STATUS1 0x05 20 + 21 + #define PM886_REG_INT_ENA_1 0x0a 22 + #define PM886_INT_ENA1_ONKEY BIT(0) 23 + 24 + #define PM886_REG_MISC_CONFIG1 0x14 25 + #define PM886_SW_PDOWN BIT(5) 26 + 27 + #define PM886_REG_MISC_CONFIG2 0x15 28 + #define PM886_INT_INV BIT(0) 29 + #define PM886_INT_CLEAR BIT(1) 30 + #define PM886_INT_RC 0x00 31 + #define PM886_INT_WC BIT(1) 32 + #define PM886_INT_MASK_MODE BIT(2) 33 + 34 + #define PM886_REG_RTC_SPARE6 0xef 35 + 36 + #define PM886_REG_BUCK_EN 0x08 37 + #define PM886_REG_LDO_EN1 0x09 38 + #define PM886_REG_LDO_EN2 0x0a 39 + #define PM886_REG_LDO1_VOUT 0x20 40 + #define PM886_REG_LDO2_VOUT 0x26 41 + #define PM886_REG_LDO3_VOUT 0x2c 42 + #define PM886_REG_LDO4_VOUT 0x32 43 + #define PM886_REG_LDO5_VOUT 0x38 44 + #define PM886_REG_LDO6_VOUT 0x3e 45 + #define PM886_REG_LDO7_VOUT 0x44 46 + #define PM886_REG_LDO8_VOUT 0x4a 47 + #define PM886_REG_LDO9_VOUT 0x50 48 + #define PM886_REG_LDO10_VOUT 0x56 49 + #define PM886_REG_LDO11_VOUT 0x5c 50 + #define PM886_REG_LDO12_VOUT 0x62 51 + #define PM886_REG_LDO13_VOUT 0x68 52 + #define PM886_REG_LDO14_VOUT 0x6e 53 + #define PM886_REG_LDO15_VOUT 0x74 54 + #define PM886_REG_LDO16_VOUT 0x7a 55 + #define PM886_REG_BUCK1_VOUT 0xa5 56 + #define PM886_REG_BUCK2_VOUT 0xb3 57 + #define PM886_REG_BUCK3_VOUT 0xc1 58 + #define PM886_REG_BUCK4_VOUT 0xcf 59 + #define PM886_REG_BUCK5_VOUT 0xdd 60 + 61 + #define PM886_LDO_VSEL_MASK 0x0f 62 + #define PM886_BUCK_VSEL_MASK 0x7f 63 + 64 + struct pm886_chip { 65 + struct i2c_client *client; 66 + unsigned int chip_id; 67 + struct regmap *regmap; 68 + }; 69 + #endif /* __MFD_88PM886_H */