mfd: davinci_voicecodec: Provide a regmap for register I/O
authorMark Brown <broonie@linaro.org>
Sat, 31 Aug 2013 13:08:56 +0000 (14:08 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 2 Sep 2013 08:27:49 +0000 (10:27 +0200)
This will be used to support refactoring of the ASoC CODEC driver to use
a regmap.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/davinci_voicecodec.c
include/linux/mfd/davinci_voicecodec.h

index a292d71c397c133f675960b02141be0faa1de5bd..013ba8159dcda339a8f71729976afeffd9516873 100644 (file)
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/regmap.h>
 
 #include <sound/pcm.h>
 
 #include <linux/mfd/davinci_voicecodec.h>
 
+static struct regmap_config davinci_vc_regmap = {
+       .reg_bits = 32,
+       .val_bits = 32,
+};
+
 static int __init davinci_vc_probe(struct platform_device *pdev)
 {
        struct davinci_vc *davinci_vc;
@@ -63,6 +69,14 @@ static int __init davinci_vc_probe(struct platform_device *pdev)
                goto fail;
        }
 
+       davinci_vc->regmap = devm_regmap_init_mmio(&pdev->dev,
+                                                  davinci_vc->base,
+                                                  &davinci_vc_regmap);
+       if (IS_ERR(davinci_vc->regmap)) {
+               ret = PTR_ERR(davinci_vc->regmap);
+               goto fail;
+       }
+
        res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
        if (!res) {
                dev_err(&pdev->dev, "no DMA resource\n");
index 13a1ee95a2334bdda6fed40c3e8dbf36a9784012..5166935ce66df46748e1b173ad8cfc2b6379b011 100644 (file)
@@ -30,6 +30,8 @@
 
 #include <mach/hardware.h>
 
+struct regmap;
+
 /*
  * Register values.
  */
@@ -113,6 +115,7 @@ struct davinci_vc {
 
        /* Memory resources */
        void __iomem *base;
+       struct regmap *regmap;
 
        /* MFD cells */
        struct mfd_cell cells[DAVINCI_VC_CELLS];