--- /dev/null
+/*
+ * AD1936/AD1937 audio driver
+ *
+ * Copyright 2014 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
+#include <linux/module.h>
+#include <linux/i2c.h>
+#include <linux/regmap.h>
+
+#include <sound/soc.h>
+
+#include "ad193x.h"
+
+static const struct i2c_device_id ad193x_id[] = {
+       { "ad1936", 0 },
+       { "ad1937", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, ad193x_id);
+
+static int ad193x_i2c_probe(struct i2c_client *client,
+                           const struct i2c_device_id *id)
+{
+       struct regmap_config config;
+
+       config = ad193x_regmap_config;
+       config.val_bits = 8;
+       config.reg_bits = 8;
+
+       return ad193x_probe(&client->dev, devm_regmap_init_i2c(client, &config));
+}
+
+static int ad193x_i2c_remove(struct i2c_client *client)
+{
+       snd_soc_unregister_codec(&client->dev);
+       return 0;
+}
+
+static struct i2c_driver ad193x_i2c_driver = {
+       .driver = {
+               .name = "ad193x",
+       },
+       .probe    = ad193x_i2c_probe,
+       .remove   = ad193x_i2c_remove,
+       .id_table = ad193x_id,
+};
+module_i2c_driver(ad193x_i2c_driver);
+
+MODULE_DESCRIPTION("ASoC AD1936/AD1937 audio CODEC driver");
+MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
+MODULE_LICENSE("GPL");
 
--- /dev/null
+/*
+ * AD1938/AD1939 audio driver
+ *
+ * Copyright 2014 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2.
+ */
+
+#include <linux/module.h>
+#include <linux/spi/spi.h>
+#include <linux/regmap.h>
+
+#include <sound/soc.h>
+
+#include "ad193x.h"
+
+static int ad193x_spi_probe(struct spi_device *spi)
+{
+       struct regmap_config config;
+
+       config = ad193x_regmap_config;
+       config.val_bits = 8;
+       config.reg_bits = 16;
+       config.read_flag_mask = 0x09;
+       config.write_flag_mask = 0x08;
+
+       return ad193x_probe(&spi->dev, devm_regmap_init_spi(spi, &config));
+}
+
+static int ad193x_spi_remove(struct spi_device *spi)
+{
+       snd_soc_unregister_codec(&spi->dev);
+       return 0;
+}
+
+static struct spi_driver ad193x_spi_driver = {
+       .driver = {
+               .name   = "ad193x",
+               .owner  = THIS_MODULE,
+       },
+       .probe          = ad193x_spi_probe,
+       .remove         = ad193x_spi_remove,
+};
+module_spi_driver(ad193x_spi_driver);
+
+MODULE_DESCRIPTION("ASoC AD1938/AD1939 audio CODEC driver");
+MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
+MODULE_LICENSE("GPL");
 
  * Licensed under the GPL-2 or later.
  */
 
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
-#include <linux/i2c.h>
-#include <linux/spi/spi.h>
+#include <linux/regmap.h>
 #include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/initval.h>
 #include <sound/soc.h>
 #include <sound/tlv.h>
+
 #include "ad193x.h"
 
 /* codec private data */
        .ops = &ad193x_dai_ops,
 };
 
-static int ad193x_probe(struct snd_soc_codec *codec)
+static int ad193x_codec_probe(struct snd_soc_codec *codec)
 {
        struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
        int ret;
 }
 
 static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
-       .probe =        ad193x_probe,
+       .probe = ad193x_codec_probe,
        .controls = ad193x_snd_controls,
        .num_controls = ARRAY_SIZE(ad193x_snd_controls),
        .dapm_widgets = ad193x_dapm_widgets,
        return false;
 }
 
-#if defined(CONFIG_SPI_MASTER)
-
-static const struct regmap_config ad193x_spi_regmap_config = {
-       .val_bits = 8,
-       .reg_bits = 16,
-       .read_flag_mask = 0x09,
-       .write_flag_mask = 0x08,
-
+const struct regmap_config ad193x_regmap_config = {
        .max_register = AD193X_NUM_REGS - 1,
        .volatile_reg = adau193x_reg_volatile,
 };
+EXPORT_SYMBOL_GPL(ad193x_regmap_config);
 
-static int ad193x_spi_probe(struct spi_device *spi)
+int ad193x_probe(struct device *dev, struct regmap *regmap)
 {
        struct ad193x_priv *ad193x;
 
-       ad193x = devm_kzalloc(&spi->dev, sizeof(struct ad193x_priv),
-                             GFP_KERNEL);
-       if (ad193x == NULL)
-               return -ENOMEM;
-
-       ad193x->regmap = devm_regmap_init_spi(spi, &ad193x_spi_regmap_config);
-       if (IS_ERR(ad193x->regmap))
-               return PTR_ERR(ad193x->regmap);
-
-       spi_set_drvdata(spi, ad193x);
-
-       return snd_soc_register_codec(&spi->dev, &soc_codec_dev_ad193x,
-                       &ad193x_dai, 1);
-}
-
-static int ad193x_spi_remove(struct spi_device *spi)
-{
-       snd_soc_unregister_codec(&spi->dev);
-       return 0;
-}
-
-static struct spi_driver ad193x_spi_driver = {
-       .driver = {
-               .name   = "ad193x",
-               .owner  = THIS_MODULE,
-       },
-       .probe          = ad193x_spi_probe,
-       .remove         = ad193x_spi_remove,
-};
-#endif
-
-#if IS_ENABLED(CONFIG_I2C)
-
-static const struct regmap_config ad193x_i2c_regmap_config = {
-       .val_bits = 8,
-       .reg_bits = 8,
-
-       .max_register = AD193X_NUM_REGS - 1,
-       .volatile_reg = adau193x_reg_volatile,
-};
-
-static const struct i2c_device_id ad193x_id[] = {
-       { "ad1936", 0 },
-       { "ad1937", 0 },
-       { }
-};
-MODULE_DEVICE_TABLE(i2c, ad193x_id);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
 
-static int ad193x_i2c_probe(struct i2c_client *client,
-                           const struct i2c_device_id *id)
-{
-       struct ad193x_priv *ad193x;
-
-       ad193x = devm_kzalloc(&client->dev, sizeof(struct ad193x_priv),
-                             GFP_KERNEL);
+       ad193x = devm_kzalloc(dev, sizeof(*ad193x), GFP_KERNEL);
        if (ad193x == NULL)
                return -ENOMEM;
 
-       ad193x->regmap = devm_regmap_init_i2c(client, &ad193x_i2c_regmap_config);
-       if (IS_ERR(ad193x->regmap))
-               return PTR_ERR(ad193x->regmap);
-
-       i2c_set_clientdata(client, ad193x);
-
-       return snd_soc_register_codec(&client->dev, &soc_codec_dev_ad193x,
-                       &ad193x_dai, 1);
-}
-
-static int ad193x_i2c_remove(struct i2c_client *client)
-{
-       snd_soc_unregister_codec(&client->dev);
-       return 0;
-}
+       ad193x->regmap = regmap;
 
-static struct i2c_driver ad193x_i2c_driver = {
-       .driver = {
-               .name = "ad193x",
-       },
-       .probe    = ad193x_i2c_probe,
-       .remove   = ad193x_i2c_remove,
-       .id_table = ad193x_id,
-};
-#endif
-
-static int __init ad193x_modinit(void)
-{
-       int ret;
-
-#if IS_ENABLED(CONFIG_I2C)
-       ret =  i2c_add_driver(&ad193x_i2c_driver);
-       if (ret != 0) {
-               printk(KERN_ERR "Failed to register AD193X I2C driver: %d\n",
-                               ret);
-       }
-#endif
-
-#if defined(CONFIG_SPI_MASTER)
-       ret = spi_register_driver(&ad193x_spi_driver);
-       if (ret != 0) {
-               printk(KERN_ERR "Failed to register AD193X SPI driver: %d\n",
-                               ret);
-       }
-#endif
-       return ret;
-}
-module_init(ad193x_modinit);
-
-static void __exit ad193x_modexit(void)
-{
-#if defined(CONFIG_SPI_MASTER)
-       spi_unregister_driver(&ad193x_spi_driver);
-#endif
+       dev_set_drvdata(dev, ad193x);
 
-#if IS_ENABLED(CONFIG_I2C)
-       i2c_del_driver(&ad193x_i2c_driver);
-#endif
+       return snd_soc_register_codec(dev, &soc_codec_dev_ad193x,
+               &ad193x_dai, 1);
 }
-module_exit(ad193x_modexit);
+EXPORT_SYMBOL_GPL(ad193x_probe);
 
 MODULE_DESCRIPTION("ASoC ad193x driver");
 MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");