Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * wm8994-core.c  --  Device access for Wolfson WM8994
0004  *
0005  * Copyright 2009 Wolfson Microelectronics PLC.
0006  *
0007  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
0008  */
0009 
0010 #include <linux/kernel.h>
0011 #include <linux/module.h>
0012 #include <linux/slab.h>
0013 #include <linux/i2c.h>
0014 #include <linux/err.h>
0015 #include <linux/delay.h>
0016 #include <linux/mfd/core.h>
0017 #include <linux/of.h>
0018 #include <linux/of_device.h>
0019 #include <linux/pm_runtime.h>
0020 #include <linux/regmap.h>
0021 #include <linux/regulator/consumer.h>
0022 #include <linux/regulator/machine.h>
0023 
0024 #include <linux/mfd/wm8994/core.h>
0025 #include <linux/mfd/wm8994/pdata.h>
0026 #include <linux/mfd/wm8994/registers.h>
0027 
0028 #include "wm8994.h"
0029 
0030 static const struct mfd_cell wm8994_regulator_devs[] = {
0031     {
0032         .name = "wm8994-ldo",
0033         .id = 0,
0034         .pm_runtime_no_callbacks = true,
0035     },
0036     {
0037         .name = "wm8994-ldo",
0038         .id = 1,
0039         .pm_runtime_no_callbacks = true,
0040     },
0041 };
0042 
0043 static const struct resource wm8994_codec_resources[] = {
0044     {
0045         .start = WM8994_IRQ_TEMP_SHUT,
0046         .end   = WM8994_IRQ_TEMP_WARN,
0047         .flags = IORESOURCE_IRQ,
0048     },
0049 };
0050 
0051 static const struct resource wm8994_gpio_resources[] = {
0052     {
0053         .start = WM8994_IRQ_GPIO(1),
0054         .end   = WM8994_IRQ_GPIO(11),
0055         .flags = IORESOURCE_IRQ,
0056     },
0057 };
0058 
0059 static const struct mfd_cell wm8994_devs[] = {
0060     {
0061         .name = "wm8994-codec",
0062         .num_resources = ARRAY_SIZE(wm8994_codec_resources),
0063         .resources = wm8994_codec_resources,
0064     },
0065 
0066     {
0067         .name = "wm8994-gpio",
0068         .num_resources = ARRAY_SIZE(wm8994_gpio_resources),
0069         .resources = wm8994_gpio_resources,
0070         .pm_runtime_no_callbacks = true,
0071     },
0072 };
0073 
0074 /*
0075  * Supplies for the main bulk of CODEC; the LDO supplies are ignored
0076  * and should be handled via the standard regulator API supply
0077  * management.
0078  */
0079 static const char *wm1811_main_supplies[] = {
0080     "DBVDD1",
0081     "DBVDD2",
0082     "DBVDD3",
0083     "DCVDD",
0084     "AVDD1",
0085     "AVDD2",
0086     "CPVDD",
0087     "SPKVDD1",
0088     "SPKVDD2",
0089 };
0090 
0091 static const char *wm8994_main_supplies[] = {
0092     "DBVDD",
0093     "DCVDD",
0094     "AVDD1",
0095     "AVDD2",
0096     "CPVDD",
0097     "SPKVDD1",
0098     "SPKVDD2",
0099 };
0100 
0101 static const char *wm8958_main_supplies[] = {
0102     "DBVDD1",
0103     "DBVDD2",
0104     "DBVDD3",
0105     "DCVDD",
0106     "AVDD1",
0107     "AVDD2",
0108     "CPVDD",
0109     "SPKVDD1",
0110     "SPKVDD2",
0111 };
0112 
0113 #ifdef CONFIG_PM
0114 static int wm8994_suspend(struct device *dev)
0115 {
0116     struct wm8994 *wm8994 = dev_get_drvdata(dev);
0117     int ret;
0118 
0119     /* Don't actually go through with the suspend if the CODEC is
0120      * still active for accessory detect. */
0121     switch (wm8994->type) {
0122     case WM8958:
0123     case WM1811:
0124         ret = wm8994_reg_read(wm8994, WM8958_MIC_DETECT_1);
0125         if (ret < 0) {
0126             dev_err(dev, "Failed to read power status: %d\n", ret);
0127         } else if (ret & WM8958_MICD_ENA) {
0128             dev_dbg(dev, "CODEC still active, ignoring suspend\n");
0129             return 0;
0130         }
0131         break;
0132     default:
0133         break;
0134     }
0135 
0136     /* Disable LDO pulldowns while the device is suspended if we
0137      * don't know that something will be driving them. */
0138     if (!wm8994->ldo_ena_always_driven)
0139         wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
0140                 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
0141                 WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD);
0142 
0143     /* Explicitly put the device into reset in case regulators
0144      * don't get disabled in order to ensure consistent restart.
0145      */
0146     wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
0147              wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
0148 
0149     regcache_mark_dirty(wm8994->regmap);
0150 
0151     /* Restore GPIO registers to prevent problems with mismatched
0152      * pin configurations.
0153      */
0154     ret = regcache_sync_region(wm8994->regmap, WM8994_GPIO_1,
0155                    WM8994_GPIO_11);
0156     if (ret != 0)
0157         dev_err(dev, "Failed to restore GPIO registers: %d\n", ret);
0158 
0159     /* In case one of the GPIOs is used as a wake input. */
0160     ret = regcache_sync_region(wm8994->regmap,
0161                    WM8994_INTERRUPT_STATUS_1_MASK,
0162                    WM8994_INTERRUPT_STATUS_1_MASK);
0163     if (ret != 0)
0164         dev_err(dev, "Failed to restore interrupt mask: %d\n", ret);
0165 
0166     regcache_cache_only(wm8994->regmap, true);
0167     wm8994->suspended = true;
0168 
0169     ret = regulator_bulk_disable(wm8994->num_supplies,
0170                      wm8994->supplies);
0171     if (ret != 0) {
0172         dev_err(dev, "Failed to disable supplies: %d\n", ret);
0173         return ret;
0174     }
0175 
0176     return 0;
0177 }
0178 
0179 static int wm8994_resume(struct device *dev)
0180 {
0181     struct wm8994 *wm8994 = dev_get_drvdata(dev);
0182     int ret;
0183 
0184     /* We may have lied to the PM core about suspending */
0185     if (!wm8994->suspended)
0186         return 0;
0187 
0188     ret = regulator_bulk_enable(wm8994->num_supplies,
0189                     wm8994->supplies);
0190     if (ret != 0) {
0191         dev_err(dev, "Failed to enable supplies: %d\n", ret);
0192         return ret;
0193     }
0194 
0195     regcache_cache_only(wm8994->regmap, false);
0196     ret = regcache_sync(wm8994->regmap);
0197     if (ret != 0) {
0198         dev_err(dev, "Failed to restore register map: %d\n", ret);
0199         goto err_enable;
0200     }
0201 
0202     /* Disable LDO pulldowns while the device is active */
0203     wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
0204             WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD,
0205             0);
0206 
0207     wm8994->suspended = false;
0208 
0209     return 0;
0210 
0211 err_enable:
0212     regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies);
0213 
0214     return ret;
0215 }
0216 #endif
0217 
0218 #ifdef CONFIG_REGULATOR
0219 static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
0220 {
0221     struct wm8994_ldo_pdata *ldo_pdata;
0222 
0223     if (!pdata)
0224         return 0;
0225 
0226     ldo_pdata = &pdata->ldo[ldo];
0227 
0228     if (!ldo_pdata->init_data)
0229         return 0;
0230 
0231     return ldo_pdata->init_data->num_consumer_supplies != 0;
0232 }
0233 #else
0234 static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo)
0235 {
0236     return 0;
0237 }
0238 #endif
0239 
0240 static const struct reg_sequence wm8994_revc_patch[] = {
0241     { 0x102, 0x3 },
0242     { 0x56, 0x3 },
0243     { 0x817, 0x0 },
0244     { 0x102, 0x0 },
0245 };
0246 
0247 static const struct reg_sequence wm8958_reva_patch[] = {
0248     { 0x102, 0x3 },
0249     { 0xcb, 0x81 },
0250     { 0x817, 0x0 },
0251     { 0x102, 0x0 },
0252 };
0253 
0254 static const struct reg_sequence wm1811_reva_patch[] = {
0255     { 0x102, 0x3 },
0256     { 0x56, 0xc07 },
0257     { 0x5d, 0x7e },
0258     { 0x5e, 0x0 },
0259     { 0x102, 0x0 },
0260 };
0261 
0262 #ifdef CONFIG_OF
0263 static int wm8994_set_pdata_from_of(struct wm8994 *wm8994)
0264 {
0265     struct device_node *np = wm8994->dev->of_node;
0266     struct wm8994_pdata *pdata = &wm8994->pdata;
0267     int i;
0268 
0269     if (!np)
0270         return 0;
0271 
0272     if (of_property_read_u32_array(np, "wlf,gpio-cfg", pdata->gpio_defaults,
0273                        ARRAY_SIZE(pdata->gpio_defaults)) >= 0) {
0274         for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
0275             if (wm8994->pdata.gpio_defaults[i] == 0)
0276                 pdata->gpio_defaults[i]
0277                     = WM8994_CONFIGURE_GPIO;
0278         }
0279     }
0280 
0281     of_property_read_u32_array(np, "wlf,micbias-cfg", pdata->micbias,
0282                    ARRAY_SIZE(pdata->micbias));
0283 
0284     pdata->lineout1_diff = true;
0285     pdata->lineout2_diff = true;
0286     if (of_find_property(np, "wlf,lineout1-se", NULL))
0287         pdata->lineout1_diff = false;
0288     if (of_find_property(np, "wlf,lineout2-se", NULL))
0289         pdata->lineout2_diff = false;
0290 
0291     if (of_find_property(np, "wlf,lineout1-feedback", NULL))
0292         pdata->lineout1fb = true;
0293     if (of_find_property(np, "wlf,lineout2-feedback", NULL))
0294         pdata->lineout2fb = true;
0295 
0296     if (of_find_property(np, "wlf,ldoena-always-driven", NULL))
0297         pdata->lineout2fb = true;
0298 
0299     pdata->spkmode_pu = of_property_read_bool(np, "wlf,spkmode-pu");
0300 
0301     pdata->csnaddr_pd = of_property_read_bool(np, "wlf,csnaddr-pd");
0302 
0303     return 0;
0304 }
0305 #else
0306 static int wm8994_set_pdata_from_of(struct wm8994 *wm8994)
0307 {
0308     return 0;
0309 }
0310 #endif
0311 
0312 /*
0313  * Instantiate the generic non-control parts of the device.
0314  */
0315 static int wm8994_device_init(struct wm8994 *wm8994, int irq)
0316 {
0317     struct wm8994_pdata *pdata;
0318     struct regmap_config *regmap_config;
0319     const struct reg_sequence *regmap_patch = NULL;
0320     const char *devname;
0321     int ret, i, patch_regs = 0;
0322     int pulls = 0;
0323 
0324     if (dev_get_platdata(wm8994->dev)) {
0325         pdata = dev_get_platdata(wm8994->dev);
0326         wm8994->pdata = *pdata;
0327     }
0328     pdata = &wm8994->pdata;
0329 
0330     ret = wm8994_set_pdata_from_of(wm8994);
0331     if (ret != 0)
0332         return ret;
0333 
0334     dev_set_drvdata(wm8994->dev, wm8994);
0335 
0336     /* Add the on-chip regulators first for bootstrapping */
0337     ret = mfd_add_devices(wm8994->dev, 0,
0338                   wm8994_regulator_devs,
0339                   ARRAY_SIZE(wm8994_regulator_devs),
0340                   NULL, 0, NULL);
0341     if (ret != 0) {
0342         dev_err(wm8994->dev, "Failed to add children: %d\n", ret);
0343         goto err;
0344     }
0345 
0346     switch (wm8994->type) {
0347     case WM1811:
0348         wm8994->num_supplies = ARRAY_SIZE(wm1811_main_supplies);
0349         break;
0350     case WM8994:
0351         wm8994->num_supplies = ARRAY_SIZE(wm8994_main_supplies);
0352         break;
0353     case WM8958:
0354         wm8994->num_supplies = ARRAY_SIZE(wm8958_main_supplies);
0355         break;
0356     default:
0357         BUG();
0358         goto err;
0359     }
0360 
0361     wm8994->supplies = devm_kcalloc(wm8994->dev,
0362                     wm8994->num_supplies,
0363                     sizeof(struct regulator_bulk_data),
0364                     GFP_KERNEL);
0365     if (!wm8994->supplies) {
0366         ret = -ENOMEM;
0367         goto err;
0368     }
0369 
0370     switch (wm8994->type) {
0371     case WM1811:
0372         for (i = 0; i < ARRAY_SIZE(wm1811_main_supplies); i++)
0373             wm8994->supplies[i].supply = wm1811_main_supplies[i];
0374         break;
0375     case WM8994:
0376         for (i = 0; i < ARRAY_SIZE(wm8994_main_supplies); i++)
0377             wm8994->supplies[i].supply = wm8994_main_supplies[i];
0378         break;
0379     case WM8958:
0380         for (i = 0; i < ARRAY_SIZE(wm8958_main_supplies); i++)
0381             wm8994->supplies[i].supply = wm8958_main_supplies[i];
0382         break;
0383     default:
0384         BUG();
0385         goto err;
0386     }
0387 
0388     /*
0389      * Can't use devres helper here as some of the supplies are provided by
0390      * wm8994->dev's children (regulators) and those regulators are
0391      * unregistered by the devres core before the supplies are freed.
0392      */
0393     ret = regulator_bulk_get(wm8994->dev, wm8994->num_supplies,
0394                  wm8994->supplies);
0395     if (ret != 0) {
0396         if (ret != -EPROBE_DEFER)
0397             dev_err(wm8994->dev, "Failed to get supplies: %d\n",
0398                 ret);
0399         goto err;
0400     }
0401 
0402     ret = regulator_bulk_enable(wm8994->num_supplies, wm8994->supplies);
0403     if (ret != 0) {
0404         dev_err(wm8994->dev, "Failed to enable supplies: %d\n", ret);
0405         goto err_regulator_free;
0406     }
0407 
0408     ret = wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET);
0409     if (ret < 0) {
0410         dev_err(wm8994->dev, "Failed to read ID register\n");
0411         goto err_enable;
0412     }
0413     switch (ret) {
0414     case 0x1811:
0415         devname = "WM1811";
0416         if (wm8994->type != WM1811)
0417             dev_warn(wm8994->dev, "Device registered as type %d\n",
0418                  wm8994->type);
0419         wm8994->type = WM1811;
0420         break;
0421     case 0x8994:
0422         devname = "WM8994";
0423         if (wm8994->type != WM8994)
0424             dev_warn(wm8994->dev, "Device registered as type %d\n",
0425                  wm8994->type);
0426         wm8994->type = WM8994;
0427         break;
0428     case 0x8958:
0429         devname = "WM8958";
0430         if (wm8994->type != WM8958)
0431             dev_warn(wm8994->dev, "Device registered as type %d\n",
0432                  wm8994->type);
0433         wm8994->type = WM8958;
0434         break;
0435     default:
0436         dev_err(wm8994->dev, "Device is not a WM8994, ID is %x\n",
0437             ret);
0438         ret = -EINVAL;
0439         goto err_enable;
0440     }
0441 
0442     ret = wm8994_reg_read(wm8994, WM8994_CHIP_REVISION);
0443     if (ret < 0) {
0444         dev_err(wm8994->dev, "Failed to read revision register: %d\n",
0445             ret);
0446         goto err_enable;
0447     }
0448     wm8994->revision = ret & WM8994_CHIP_REV_MASK;
0449     wm8994->cust_id = (ret & WM8994_CUST_ID_MASK) >> WM8994_CUST_ID_SHIFT;
0450 
0451     switch (wm8994->type) {
0452     case WM8994:
0453         switch (wm8994->revision) {
0454         case 0:
0455         case 1:
0456             dev_warn(wm8994->dev,
0457                  "revision %c not fully supported\n",
0458                  'A' + wm8994->revision);
0459             break;
0460         case 2:
0461         case 3:
0462         default:
0463             regmap_patch = wm8994_revc_patch;
0464             patch_regs = ARRAY_SIZE(wm8994_revc_patch);
0465             break;
0466         }
0467         break;
0468 
0469     case WM8958:
0470         switch (wm8994->revision) {
0471         case 0:
0472             regmap_patch = wm8958_reva_patch;
0473             patch_regs = ARRAY_SIZE(wm8958_reva_patch);
0474             break;
0475         default:
0476             break;
0477         }
0478         break;
0479 
0480     case WM1811:
0481         /* Revision C did not change the relevant layer */
0482         if (wm8994->revision > 1)
0483             wm8994->revision++;
0484 
0485         regmap_patch = wm1811_reva_patch;
0486         patch_regs = ARRAY_SIZE(wm1811_reva_patch);
0487         break;
0488 
0489     default:
0490         break;
0491     }
0492 
0493     dev_info(wm8994->dev, "%s revision %c CUST_ID %02x\n", devname,
0494          'A' + wm8994->revision, wm8994->cust_id);
0495 
0496     switch (wm8994->type) {
0497     case WM1811:
0498         regmap_config = &wm1811_regmap_config;
0499         break;
0500     case WM8994:
0501         regmap_config = &wm8994_regmap_config;
0502         break;
0503     case WM8958:
0504         regmap_config = &wm8958_regmap_config;
0505         break;
0506     default:
0507         dev_err(wm8994->dev, "Unknown device type %d\n", wm8994->type);
0508         ret = -EINVAL;
0509         goto err_enable;
0510     }
0511 
0512     ret = regmap_reinit_cache(wm8994->regmap, regmap_config);
0513     if (ret != 0) {
0514         dev_err(wm8994->dev, "Failed to reinit register cache: %d\n",
0515             ret);
0516         goto err_enable;
0517     }
0518 
0519     /* Explicitly put the device into reset in case regulators
0520      * don't get disabled in order to ensure we know the device
0521      * state.
0522      */
0523     ret = wm8994_reg_write(wm8994, WM8994_SOFTWARE_RESET,
0524                    wm8994_reg_read(wm8994, WM8994_SOFTWARE_RESET));
0525     if (ret != 0) {
0526         dev_err(wm8994->dev, "Failed to reset device: %d\n", ret);
0527         goto err_enable;
0528     }
0529 
0530     if (regmap_patch) {
0531         ret = regmap_register_patch(wm8994->regmap, regmap_patch,
0532                         patch_regs);
0533         if (ret != 0) {
0534             dev_err(wm8994->dev, "Failed to register patch: %d\n",
0535                 ret);
0536             goto err_enable;
0537         }
0538     }
0539 
0540     wm8994->irq_base = pdata->irq_base;
0541     wm8994->gpio_base = pdata->gpio_base;
0542 
0543     /* GPIO configuration is only applied if it's non-zero */
0544     for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
0545         if (pdata->gpio_defaults[i]) {
0546             wm8994_set_bits(wm8994, WM8994_GPIO_1 + i,
0547                     0xffff, pdata->gpio_defaults[i]);
0548         }
0549     }
0550 
0551     wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven;
0552 
0553     if (pdata->spkmode_pu)
0554         pulls |= WM8994_SPKMODE_PU;
0555     if (pdata->csnaddr_pd)
0556         pulls |= WM8994_CSNADDR_PD;
0557 
0558     /* Disable unneeded pulls */
0559     wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,
0560             WM8994_LDO1ENA_PD | WM8994_LDO2ENA_PD |
0561             WM8994_SPKMODE_PU | WM8994_CSNADDR_PD,
0562             pulls);
0563 
0564     /* In some system designs where the regulators are not in use,
0565      * we can achieve a small reduction in leakage currents by
0566      * floating LDO outputs.  This bit makes no difference if the
0567      * LDOs are enabled, it only affects cases where the LDOs were
0568      * in operation and are then disabled.
0569      */
0570     for (i = 0; i < WM8994_NUM_LDO_REGS; i++) {
0571         if (wm8994_ldo_in_use(pdata, i))
0572             wm8994_set_bits(wm8994, WM8994_LDO_1 + i,
0573                     WM8994_LDO1_DISCH, WM8994_LDO1_DISCH);
0574         else
0575             wm8994_set_bits(wm8994, WM8994_LDO_1 + i,
0576                     WM8994_LDO1_DISCH, 0);
0577     }
0578 
0579     wm8994_irq_init(wm8994);
0580 
0581     ret = mfd_add_devices(wm8994->dev, -1,
0582                   wm8994_devs, ARRAY_SIZE(wm8994_devs),
0583                   NULL, 0, NULL);
0584     if (ret != 0) {
0585         dev_err(wm8994->dev, "Failed to add children: %d\n", ret);
0586         goto err_irq;
0587     }
0588 
0589     pm_runtime_set_active(wm8994->dev);
0590     pm_runtime_enable(wm8994->dev);
0591     pm_runtime_idle(wm8994->dev);
0592 
0593     return 0;
0594 
0595 err_irq:
0596     wm8994_irq_exit(wm8994);
0597 err_enable:
0598     regulator_bulk_disable(wm8994->num_supplies,
0599                    wm8994->supplies);
0600 err_regulator_free:
0601     regulator_bulk_free(wm8994->num_supplies, wm8994->supplies);
0602 err:
0603     mfd_remove_devices(wm8994->dev);
0604     return ret;
0605 }
0606 
0607 static void wm8994_device_exit(struct wm8994 *wm8994)
0608 {
0609     pm_runtime_get_sync(wm8994->dev);
0610     pm_runtime_disable(wm8994->dev);
0611     pm_runtime_put_noidle(wm8994->dev);
0612     wm8994_irq_exit(wm8994);
0613     regulator_bulk_disable(wm8994->num_supplies, wm8994->supplies);
0614     regulator_bulk_free(wm8994->num_supplies, wm8994->supplies);
0615     mfd_remove_devices(wm8994->dev);
0616 }
0617 
0618 static const struct of_device_id wm8994_of_match[] = {
0619     { .compatible = "wlf,wm1811", .data = (void *)WM1811 },
0620     { .compatible = "wlf,wm8994", .data = (void *)WM8994 },
0621     { .compatible = "wlf,wm8958", .data = (void *)WM8958 },
0622     { }
0623 };
0624 MODULE_DEVICE_TABLE(of, wm8994_of_match);
0625 
0626 static int wm8994_i2c_probe(struct i2c_client *i2c,
0627                       const struct i2c_device_id *id)
0628 {
0629     const struct of_device_id *of_id;
0630     struct wm8994 *wm8994;
0631     int ret;
0632 
0633     wm8994 = devm_kzalloc(&i2c->dev, sizeof(struct wm8994), GFP_KERNEL);
0634     if (wm8994 == NULL)
0635         return -ENOMEM;
0636 
0637     i2c_set_clientdata(i2c, wm8994);
0638     wm8994->dev = &i2c->dev;
0639     wm8994->irq = i2c->irq;
0640 
0641     if (i2c->dev.of_node) {
0642         of_id = of_match_device(wm8994_of_match, &i2c->dev);
0643         if (of_id)
0644             wm8994->type = (enum wm8994_type)of_id->data;
0645     } else {
0646         wm8994->type = id->driver_data;
0647     }
0648 
0649     wm8994->regmap = devm_regmap_init_i2c(i2c, &wm8994_base_regmap_config);
0650     if (IS_ERR(wm8994->regmap)) {
0651         ret = PTR_ERR(wm8994->regmap);
0652         dev_err(wm8994->dev, "Failed to allocate register map: %d\n",
0653             ret);
0654         return ret;
0655     }
0656 
0657     return wm8994_device_init(wm8994, i2c->irq);
0658 }
0659 
0660 static int wm8994_i2c_remove(struct i2c_client *i2c)
0661 {
0662     struct wm8994 *wm8994 = i2c_get_clientdata(i2c);
0663 
0664     wm8994_device_exit(wm8994);
0665 
0666     return 0;
0667 }
0668 
0669 static const struct i2c_device_id wm8994_i2c_id[] = {
0670     { "wm1811", WM1811 },
0671     { "wm1811a", WM1811 },
0672     { "wm8994", WM8994 },
0673     { "wm8958", WM8958 },
0674     { }
0675 };
0676 MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id);
0677 
0678 static const struct dev_pm_ops wm8994_pm_ops = {
0679     SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL)
0680 };
0681 
0682 static struct i2c_driver wm8994_i2c_driver = {
0683     .driver = {
0684         .name = "wm8994",
0685         .pm = &wm8994_pm_ops,
0686         .of_match_table = wm8994_of_match,
0687     },
0688     .probe = wm8994_i2c_probe,
0689     .remove = wm8994_i2c_remove,
0690     .id_table = wm8994_i2c_id,
0691 };
0692 
0693 module_i2c_driver(wm8994_i2c_driver);
0694 
0695 MODULE_DESCRIPTION("Core support for the WM8994 audio CODEC");
0696 MODULE_LICENSE("GPL");
0697 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
0698 MODULE_SOFTDEP("pre: wm8994_regulator");