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

mfd: tps65090: add DT support for tps65090

Add device tree support for the TI PMIC TPS65090.
The device can be registered through platform or DT.

Add device tree binding document for this device.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Laxman Dewangan and committed by
Samuel Ortiz
40719314 5f384c1f

+141 -3
+122
Documentation/devicetree/bindings/regulator/tps65090.txt
··· 1 + TPS65090 regulators 2 + 3 + Required properties: 4 + - compatible: "ti,tps65090" 5 + - reg: I2C slave address 6 + - interrupts: the interrupt outputs of the controller 7 + - regulators: A node that houses a sub-node for each regulator within the 8 + device. Each sub-node is identified using the node's name, with valid 9 + values listed below. The content of each sub-node is defined by the 10 + standard binding for regulators; see regulator.txt. 11 + dcdc[1-3], fet[1-7] and ldo[1-2] respectively. 12 + - vsys[1-3]-supply: The input supply for DCDC[1-3] respectively. 13 + - infet[1-7]-supply: The input supply for FET[1-7] respectively. 14 + - vsys-l[1-2]-supply: The input supply for LDO[1-2] respectively. 15 + 16 + Optional properties: 17 + - ti,enable-ext-control: This is applicable for DCDC1, DCDC2 and DCDC3. 18 + If DCDCs are externally controlled then this property should be there. 19 + - "dcdc-ext-control-gpios: This is applicable for DCDC1, DCDC2 and DCDC3. 20 + If DCDCs are externally controlled and if it is from GPIO then GPIO 21 + number should be provided. If it is externally controlled and no GPIO 22 + entry then driver will just configure this rails as external control 23 + and will not provide any enable/disable APIs. 24 + 25 + Each regulator is defined using the standard binding for regulators. 26 + 27 + Example: 28 + 29 + tps65090@48 { 30 + compatible = "ti,tps65090"; 31 + reg = <0x48>; 32 + interrupts = <0 88 0x4>; 33 + 34 + vsys1-supply = <&some_reg>; 35 + vsys2-supply = <&some_reg>; 36 + vsys3-supply = <&some_reg>; 37 + infet1-supply = <&some_reg>; 38 + infet2-supply = <&some_reg>; 39 + infet3-supply = <&some_reg>; 40 + infet4-supply = <&some_reg>; 41 + infet5-supply = <&some_reg>; 42 + infet6-supply = <&some_reg>; 43 + infet7-supply = <&some_reg>; 44 + vsys_l1-supply = <&some_reg>; 45 + vsys_l2-supply = <&some_reg>; 46 + 47 + regulators { 48 + dcdc1 { 49 + regulator-name = "dcdc1"; 50 + regulator-boot-on; 51 + regulator-always-on; 52 + ti,enable-ext-control; 53 + dcdc-ext-control-gpios = <&gpio 10 0>; 54 + }; 55 + 56 + dcdc2 { 57 + regulator-name = "dcdc2"; 58 + regulator-boot-on; 59 + regulator-always-on; 60 + }; 61 + 62 + dcdc3 { 63 + regulator-name = "dcdc3"; 64 + regulator-boot-on; 65 + regulator-always-on; 66 + }; 67 + 68 + fet1 { 69 + regulator-name = "fet1"; 70 + regulator-boot-on; 71 + regulator-always-on; 72 + }; 73 + 74 + fet2 { 75 + regulator-name = "fet2"; 76 + regulator-boot-on; 77 + regulator-always-on; 78 + }; 79 + 80 + fet3 { 81 + regulator-name = "fet3"; 82 + regulator-boot-on; 83 + regulator-always-on; 84 + }; 85 + 86 + fet4 { 87 + regulator-name = "fet4"; 88 + regulator-boot-on; 89 + regulator-always-on; 90 + }; 91 + 92 + fet5 { 93 + regulator-name = "fet5"; 94 + regulator-boot-on; 95 + regulator-always-on; 96 + }; 97 + 98 + fet6 { 99 + regulator-name = "fet6"; 100 + regulator-boot-on; 101 + regulator-always-on; 102 + }; 103 + 104 + fet7 { 105 + regulator-name = "fet7"; 106 + regulator-boot-on; 107 + regulator-always-on; 108 + }; 109 + 110 + ldo1 { 111 + regulator-name = "ldo1"; 112 + regulator-boot-on; 113 + regulator-always-on; 114 + }; 115 + 116 + ldo2 { 117 + regulator-name = "ldo2"; 118 + regulator-boot-on; 119 + regulator-always-on; 120 + }; 121 + }; 122 + };
+19 -3
drivers/mfd/tps65090.c
··· 25 25 #include <linux/i2c.h> 26 26 #include <linux/mfd/core.h> 27 27 #include <linux/mfd/tps65090.h> 28 + #include <linux/of.h> 29 + #include <linux/of_device.h> 28 30 #include <linux/err.h> 29 31 30 32 #define NUM_INT_REG 2 ··· 150 148 .volatile_reg = is_volatile_reg, 151 149 }; 152 150 151 + #ifdef CONFIG_OF 152 + static const struct of_device_id tps65090_of_match[] = { 153 + { .compatible = "ti,tps65090",}, 154 + {}, 155 + }; 156 + MODULE_DEVICE_TABLE(of, tps65090_of_match); 157 + #endif 158 + 153 159 static int tps65090_i2c_probe(struct i2c_client *client, 154 160 const struct i2c_device_id *id) 155 161 { 156 162 struct tps65090_platform_data *pdata = client->dev.platform_data; 163 + int irq_base = 0; 157 164 struct tps65090 *tps65090; 158 165 int ret; 159 166 160 - if (!pdata) { 161 - dev_err(&client->dev, "tps65090 requires platform data\n"); 167 + if (!pdata && !client->dev.of_node) { 168 + dev_err(&client->dev, 169 + "tps65090 requires platform data or of_node\n"); 162 170 return -EINVAL; 163 171 } 172 + 173 + if (pdata) 174 + irq_base = pdata->irq_base; 164 175 165 176 tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL); 166 177 if (!tps65090) { ··· 193 178 194 179 if (client->irq) { 195 180 ret = regmap_add_irq_chip(tps65090->rmap, client->irq, 196 - IRQF_ONESHOT | IRQF_TRIGGER_LOW, pdata->irq_base, 181 + IRQF_ONESHOT | IRQF_TRIGGER_LOW, irq_base, 197 182 &tps65090_irq_chip, &tps65090->irq_data); 198 183 if (ret) { 199 184 dev_err(&client->dev, ··· 262 247 .driver = { 263 248 .name = "tps65090", 264 249 .owner = THIS_MODULE, 250 + .of_match_table = of_match_ptr(tps65090_of_match), 265 251 .pm = &tps65090_pm_ops, 266 252 }, 267 253 .probe = tps65090_i2c_probe,