Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2014 MediaTek Inc. |
| 3 | * Author: Flora Fu, MediaTek |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/module.h> |
| 17 | #include <linux/of_device.h> |
| 18 | #include <linux/of_irq.h> |
| 19 | #include <linux/regmap.h> |
| 20 | #include <linux/mfd/core.h> |
| 21 | #include <linux/mfd/mt6397/core.h> |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 22 | #include <linux/mfd/mt6323/core.h> |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 23 | #include <linux/mfd/mt6397/registers.h> |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 24 | #include <linux/mfd/mt6323/registers.h> |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 25 | |
Eddie Huang | a5d7ea0 | 2015-05-06 15:23:40 +0800 | [diff] [blame] | 26 | #define MT6397_RTC_BASE 0xe000 |
| 27 | #define MT6397_RTC_SIZE 0x3e |
| 28 | |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 29 | #define MT6323_CID_CODE 0x23 |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 30 | #define MT6391_CID_CODE 0x91 |
| 31 | #define MT6397_CID_CODE 0x97 |
| 32 | |
Eddie Huang | a5d7ea0 | 2015-05-06 15:23:40 +0800 | [diff] [blame] | 33 | static const struct resource mt6397_rtc_resources[] = { |
| 34 | { |
| 35 | .start = MT6397_RTC_BASE, |
| 36 | .end = MT6397_RTC_BASE + MT6397_RTC_SIZE, |
| 37 | .flags = IORESOURCE_MEM, |
| 38 | }, |
| 39 | { |
| 40 | .start = MT6397_IRQ_RTC, |
| 41 | .end = MT6397_IRQ_RTC, |
| 42 | .flags = IORESOURCE_IRQ, |
| 43 | }, |
| 44 | }; |
| 45 | |
Chen Zhong | 55d1d15 | 2017-10-25 21:16:04 +0800 | [diff] [blame] | 46 | static const struct resource mt6323_keys_resources[] = { |
| 47 | DEFINE_RES_IRQ(MT6323_IRQ_STATUS_PWRKEY), |
| 48 | DEFINE_RES_IRQ(MT6323_IRQ_STATUS_FCHRKEY), |
| 49 | }; |
| 50 | |
| 51 | static const struct resource mt6397_keys_resources[] = { |
| 52 | DEFINE_RES_IRQ(MT6397_IRQ_PWRKEY), |
| 53 | DEFINE_RES_IRQ(MT6397_IRQ_HOMEKEY), |
| 54 | }; |
| 55 | |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 56 | static const struct mfd_cell mt6323_devs[] = { |
| 57 | { |
| 58 | .name = "mt6323-regulator", |
| 59 | .of_compatible = "mediatek,mt6323-regulator" |
Sean Wang | 040fc9b | 2017-03-20 14:47:27 +0800 | [diff] [blame] | 60 | }, { |
Sean Wang | 1cb8af8 | 2017-01-23 11:54:45 +0800 | [diff] [blame] | 61 | .name = "mt6323-led", |
| 62 | .of_compatible = "mediatek,mt6323-led" |
Chen Zhong | 55d1d15 | 2017-10-25 21:16:04 +0800 | [diff] [blame] | 63 | }, { |
| 64 | .name = "mtk-pmic-keys", |
| 65 | .num_resources = ARRAY_SIZE(mt6323_keys_resources), |
| 66 | .resources = mt6323_keys_resources, |
| 67 | .of_compatible = "mediatek,mt6323-keys" |
Sean Wang | 1cb8af8 | 2017-01-23 11:54:45 +0800 | [diff] [blame] | 68 | }, |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 69 | }; |
| 70 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 71 | static const struct mfd_cell mt6397_devs[] = { |
| 72 | { |
| 73 | .name = "mt6397-rtc", |
Eddie Huang | a5d7ea0 | 2015-05-06 15:23:40 +0800 | [diff] [blame] | 74 | .num_resources = ARRAY_SIZE(mt6397_rtc_resources), |
| 75 | .resources = mt6397_rtc_resources, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 76 | .of_compatible = "mediatek,mt6397-rtc", |
| 77 | }, { |
| 78 | .name = "mt6397-regulator", |
| 79 | .of_compatible = "mediatek,mt6397-regulator", |
| 80 | }, { |
| 81 | .name = "mt6397-codec", |
| 82 | .of_compatible = "mediatek,mt6397-codec", |
| 83 | }, { |
| 84 | .name = "mt6397-clk", |
| 85 | .of_compatible = "mediatek,mt6397-clk", |
Hongzhou Yang | cf55078 | 2015-05-27 02:10:35 -0700 | [diff] [blame] | 86 | }, { |
| 87 | .name = "mt6397-pinctrl", |
| 88 | .of_compatible = "mediatek,mt6397-pinctrl", |
Chen Zhong | 55d1d15 | 2017-10-25 21:16:04 +0800 | [diff] [blame] | 89 | }, { |
| 90 | .name = "mtk-pmic-keys", |
| 91 | .num_resources = ARRAY_SIZE(mt6397_keys_resources), |
| 92 | .resources = mt6397_keys_resources, |
| 93 | .of_compatible = "mediatek,mt6397-keys" |
| 94 | } |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | static void mt6397_irq_lock(struct irq_data *data) |
| 98 | { |
Jiang Liu | 1e84aa4 | 2015-07-13 20:44:56 +0000 | [diff] [blame] | 99 | struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 100 | |
| 101 | mutex_lock(&mt6397->irqlock); |
| 102 | } |
| 103 | |
| 104 | static void mt6397_irq_sync_unlock(struct irq_data *data) |
| 105 | { |
Jiang Liu | 1e84aa4 | 2015-07-13 20:44:56 +0000 | [diff] [blame] | 106 | struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 107 | |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 108 | regmap_write(mt6397->regmap, mt6397->int_con[0], |
| 109 | mt6397->irq_masks_cur[0]); |
| 110 | regmap_write(mt6397->regmap, mt6397->int_con[1], |
| 111 | mt6397->irq_masks_cur[1]); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 112 | |
| 113 | mutex_unlock(&mt6397->irqlock); |
| 114 | } |
| 115 | |
| 116 | static void mt6397_irq_disable(struct irq_data *data) |
| 117 | { |
Jiang Liu | 1e84aa4 | 2015-07-13 20:44:56 +0000 | [diff] [blame] | 118 | struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 119 | int shift = data->hwirq & 0xf; |
| 120 | int reg = data->hwirq >> 4; |
| 121 | |
| 122 | mt6397->irq_masks_cur[reg] &= ~BIT(shift); |
| 123 | } |
| 124 | |
| 125 | static void mt6397_irq_enable(struct irq_data *data) |
| 126 | { |
Jiang Liu | 1e84aa4 | 2015-07-13 20:44:56 +0000 | [diff] [blame] | 127 | struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(data); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 128 | int shift = data->hwirq & 0xf; |
| 129 | int reg = data->hwirq >> 4; |
| 130 | |
| 131 | mt6397->irq_masks_cur[reg] |= BIT(shift); |
| 132 | } |
| 133 | |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 134 | #ifdef CONFIG_PM_SLEEP |
| 135 | static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) |
| 136 | { |
| 137 | struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data); |
| 138 | int shift = irq_data->hwirq & 0xf; |
| 139 | int reg = irq_data->hwirq >> 4; |
| 140 | |
| 141 | if (on) |
| 142 | mt6397->wake_mask[reg] |= BIT(shift); |
| 143 | else |
| 144 | mt6397->wake_mask[reg] &= ~BIT(shift); |
| 145 | |
| 146 | return 0; |
| 147 | } |
| 148 | #else |
| 149 | #define mt6397_irq_set_wake NULL |
| 150 | #endif |
| 151 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 152 | static struct irq_chip mt6397_irq_chip = { |
| 153 | .name = "mt6397-irq", |
| 154 | .irq_bus_lock = mt6397_irq_lock, |
| 155 | .irq_bus_sync_unlock = mt6397_irq_sync_unlock, |
| 156 | .irq_enable = mt6397_irq_enable, |
| 157 | .irq_disable = mt6397_irq_disable, |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 158 | .irq_set_wake = mt6397_irq_set_wake, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 159 | }; |
| 160 | |
| 161 | static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg, |
| 162 | int irqbase) |
| 163 | { |
| 164 | unsigned int status; |
| 165 | int i, irq, ret; |
| 166 | |
| 167 | ret = regmap_read(mt6397->regmap, reg, &status); |
| 168 | if (ret) { |
| 169 | dev_err(mt6397->dev, "Failed to read irq status: %d\n", ret); |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | for (i = 0; i < 16; i++) { |
| 174 | if (status & BIT(i)) { |
| 175 | irq = irq_find_mapping(mt6397->irq_domain, irqbase + i); |
| 176 | if (irq) |
| 177 | handle_nested_irq(irq); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | regmap_write(mt6397->regmap, reg, status); |
| 182 | } |
| 183 | |
| 184 | static irqreturn_t mt6397_irq_thread(int irq, void *data) |
| 185 | { |
| 186 | struct mt6397_chip *mt6397 = data; |
| 187 | |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 188 | mt6397_irq_handle_reg(mt6397, mt6397->int_status[0], 0); |
| 189 | mt6397_irq_handle_reg(mt6397, mt6397->int_status[1], 16); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 190 | |
| 191 | return IRQ_HANDLED; |
| 192 | } |
| 193 | |
| 194 | static int mt6397_irq_domain_map(struct irq_domain *d, unsigned int irq, |
| 195 | irq_hw_number_t hw) |
| 196 | { |
| 197 | struct mt6397_chip *mt6397 = d->host_data; |
| 198 | |
| 199 | irq_set_chip_data(irq, mt6397); |
| 200 | irq_set_chip_and_handler(irq, &mt6397_irq_chip, handle_level_irq); |
| 201 | irq_set_nested_thread(irq, 1); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 202 | irq_set_noprobe(irq); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 203 | |
| 204 | return 0; |
| 205 | } |
| 206 | |
Krzysztof Kozlowski | 7ce7b26 | 2015-04-27 21:54:13 +0900 | [diff] [blame] | 207 | static const struct irq_domain_ops mt6397_irq_domain_ops = { |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 208 | .map = mt6397_irq_domain_map, |
| 209 | }; |
| 210 | |
| 211 | static int mt6397_irq_init(struct mt6397_chip *mt6397) |
| 212 | { |
| 213 | int ret; |
| 214 | |
| 215 | mutex_init(&mt6397->irqlock); |
| 216 | |
| 217 | /* Mask all interrupt sources */ |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 218 | regmap_write(mt6397->regmap, mt6397->int_con[0], 0x0); |
| 219 | regmap_write(mt6397->regmap, mt6397->int_con[1], 0x0); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 220 | |
| 221 | mt6397->irq_domain = irq_domain_add_linear(mt6397->dev->of_node, |
| 222 | MT6397_IRQ_NR, &mt6397_irq_domain_ops, mt6397); |
| 223 | if (!mt6397->irq_domain) { |
| 224 | dev_err(mt6397->dev, "could not create irq domain\n"); |
| 225 | return -ENOMEM; |
| 226 | } |
| 227 | |
| 228 | ret = devm_request_threaded_irq(mt6397->dev, mt6397->irq, NULL, |
| 229 | mt6397_irq_thread, IRQF_ONESHOT, "mt6397-pmic", mt6397); |
| 230 | if (ret) { |
| 231 | dev_err(mt6397->dev, "failed to register irq=%d; err: %d\n", |
| 232 | mt6397->irq, ret); |
| 233 | return ret; |
| 234 | } |
| 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 239 | #ifdef CONFIG_PM_SLEEP |
| 240 | static int mt6397_irq_suspend(struct device *dev) |
| 241 | { |
| 242 | struct mt6397_chip *chip = dev_get_drvdata(dev); |
| 243 | |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 244 | regmap_write(chip->regmap, chip->int_con[0], chip->wake_mask[0]); |
| 245 | regmap_write(chip->regmap, chip->int_con[1], chip->wake_mask[1]); |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 246 | |
| 247 | enable_irq_wake(chip->irq); |
| 248 | |
| 249 | return 0; |
| 250 | } |
| 251 | |
| 252 | static int mt6397_irq_resume(struct device *dev) |
| 253 | { |
| 254 | struct mt6397_chip *chip = dev_get_drvdata(dev); |
| 255 | |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 256 | regmap_write(chip->regmap, chip->int_con[0], chip->irq_masks_cur[0]); |
| 257 | regmap_write(chip->regmap, chip->int_con[1], chip->irq_masks_cur[1]); |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 258 | |
| 259 | disable_irq_wake(chip->irq); |
| 260 | |
| 261 | return 0; |
| 262 | } |
| 263 | #endif |
| 264 | |
| 265 | static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend, |
| 266 | mt6397_irq_resume); |
| 267 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 268 | static int mt6397_probe(struct platform_device *pdev) |
| 269 | { |
| 270 | int ret; |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 271 | unsigned int id; |
| 272 | struct mt6397_chip *pmic; |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 273 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 274 | pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL); |
| 275 | if (!pmic) |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 276 | return -ENOMEM; |
| 277 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 278 | pmic->dev = &pdev->dev; |
John Crispin | feec479 | 2016-01-27 12:47:36 +0100 | [diff] [blame] | 279 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 280 | /* |
| 281 | * mt6397 MFD is child device of soc pmic wrapper. |
| 282 | * Regmap is set from its parent. |
| 283 | */ |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 284 | pmic->regmap = dev_get_regmap(pdev->dev.parent, NULL); |
| 285 | if (!pmic->regmap) |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 286 | return -ENODEV; |
| 287 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 288 | platform_set_drvdata(pdev, pmic); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 289 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 290 | ret = regmap_read(pmic->regmap, MT6397_CID, &id); |
| 291 | if (ret) { |
| 292 | dev_err(pmic->dev, "Failed to read chip id: %d\n", ret); |
Henry Chen | 1387ff5 | 2016-04-15 16:30:29 +0800 | [diff] [blame] | 293 | return ret; |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 294 | } |
| 295 | |
Henry Chen | 1387ff5 | 2016-04-15 16:30:29 +0800 | [diff] [blame] | 296 | pmic->irq = platform_get_irq(pdev, 0); |
| 297 | if (pmic->irq <= 0) |
| 298 | return pmic->irq; |
| 299 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 300 | switch (id & 0xff) { |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 301 | case MT6323_CID_CODE: |
| 302 | pmic->int_con[0] = MT6323_INT_CON0; |
| 303 | pmic->int_con[1] = MT6323_INT_CON1; |
| 304 | pmic->int_status[0] = MT6323_INT_STATUS0; |
| 305 | pmic->int_status[1] = MT6323_INT_STATUS1; |
Henry Chen | 1387ff5 | 2016-04-15 16:30:29 +0800 | [diff] [blame] | 306 | ret = mt6397_irq_init(pmic); |
| 307 | if (ret) |
| 308 | return ret; |
| 309 | |
Laxman Dewangan | 08e380a | 2016-04-08 00:13:04 +0530 | [diff] [blame] | 310 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs, |
| 311 | ARRAY_SIZE(mt6323_devs), NULL, |
Chen Zhong | e695d3a | 2017-10-25 21:15:59 +0800 | [diff] [blame] | 312 | 0, pmic->irq_domain); |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 313 | break; |
| 314 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 315 | case MT6397_CID_CODE: |
| 316 | case MT6391_CID_CODE: |
| 317 | pmic->int_con[0] = MT6397_INT_CON0; |
| 318 | pmic->int_con[1] = MT6397_INT_CON1; |
| 319 | pmic->int_status[0] = MT6397_INT_STATUS0; |
| 320 | pmic->int_status[1] = MT6397_INT_STATUS1; |
Henry Chen | 1387ff5 | 2016-04-15 16:30:29 +0800 | [diff] [blame] | 321 | ret = mt6397_irq_init(pmic); |
| 322 | if (ret) |
| 323 | return ret; |
| 324 | |
Laxman Dewangan | 08e380a | 2016-04-08 00:13:04 +0530 | [diff] [blame] | 325 | ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs, |
| 326 | ARRAY_SIZE(mt6397_devs), NULL, |
Chen Zhong | e695d3a | 2017-10-25 21:15:59 +0800 | [diff] [blame] | 327 | 0, pmic->irq_domain); |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 328 | break; |
| 329 | |
| 330 | default: |
| 331 | dev_err(&pdev->dev, "unsupported chip: %d\n", id); |
| 332 | ret = -ENODEV; |
| 333 | break; |
| 334 | } |
| 335 | |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 336 | if (ret) { |
| 337 | irq_domain_remove(pmic->irq_domain); |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 338 | dev_err(&pdev->dev, "failed to add child devices: %d\n", ret); |
John Crispin | 1d2c25e | 2016-01-27 12:47:37 +0100 | [diff] [blame] | 339 | } |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 340 | |
| 341 | return ret; |
| 342 | } |
| 343 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 344 | static const struct of_device_id mt6397_of_match[] = { |
| 345 | { .compatible = "mediatek,mt6397" }, |
John Crispin | 44760cf | 2016-01-27 12:47:38 +0100 | [diff] [blame] | 346 | { .compatible = "mediatek,mt6323" }, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 347 | { } |
| 348 | }; |
| 349 | MODULE_DEVICE_TABLE(of, mt6397_of_match); |
| 350 | |
Javier Martinez Canillas | e1d9a10 | 2016-02-10 13:50:18 -0300 | [diff] [blame] | 351 | static const struct platform_device_id mt6397_id[] = { |
| 352 | { "mt6397", 0 }, |
| 353 | { }, |
| 354 | }; |
| 355 | MODULE_DEVICE_TABLE(platform, mt6397_id); |
| 356 | |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 357 | static struct platform_driver mt6397_driver = { |
| 358 | .probe = mt6397_probe, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 359 | .driver = { |
| 360 | .name = "mt6397", |
| 361 | .of_match_table = of_match_ptr(mt6397_of_match), |
Henry Chen | f3151ab | 2015-08-10 21:10:45 +0800 | [diff] [blame] | 362 | .pm = &mt6397_pm_ops, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 363 | }, |
Javier Martinez Canillas | e1d9a10 | 2016-02-10 13:50:18 -0300 | [diff] [blame] | 364 | .id_table = mt6397_id, |
Flora Fu | 6df8dd5 | 2015-02-22 13:15:29 +0100 | [diff] [blame] | 365 | }; |
| 366 | |
| 367 | module_platform_driver(mt6397_driver); |
| 368 | |
| 369 | MODULE_AUTHOR("Flora Fu, MediaTek"); |
| 370 | MODULE_DESCRIPTION("Driver for MediaTek MT6397 PMIC"); |
| 371 | MODULE_LICENSE("GPL"); |