aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2013-09-02 04:31:08 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-09-02 04:31:08 -0400
commitf4388ca7f1e7c19a406700b3d1d3bfbf15d14115 (patch)
tree1edb8323d6cfe88620ac0c3f3c0f6c8e61134c7d
parent62282180645a94f8686680bca464afd418511510 (diff)
parentc6f39257c952bc7da974bf93255936ff2ece2c34 (diff)
Merge branch 'topic/for-asoc'
-rw-r--r--drivers/mfd/davinci_voicecodec.c23
-rw-r--r--drivers/mfd/twl6040.c43
-rw-r--r--include/linux/mfd/davinci_voicecodec.h3
-rw-r--r--include/linux/mfd/twl6040.h1
4 files changed, 46 insertions, 24 deletions
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c
index fb64398506e9..013ba8159dcd 100644
--- a/drivers/mfd/davinci_voicecodec.c
+++ b/drivers/mfd/davinci_voicecodec.c
@@ -27,21 +27,16 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/regmap.h>
30 31
31#include <sound/pcm.h> 32#include <sound/pcm.h>
32 33
33#include <linux/mfd/davinci_voicecodec.h> 34#include <linux/mfd/davinci_voicecodec.h>
34 35
35u32 davinci_vc_read(struct davinci_vc *davinci_vc, int reg) 36static struct regmap_config davinci_vc_regmap = {
36{ 37 .reg_bits = 32,
37 return __raw_readl(davinci_vc->base + reg); 38 .val_bits = 32,
38} 39};
39
40void davinci_vc_write(struct davinci_vc *davinci_vc,
41 int reg, u32 val)
42{
43 __raw_writel(val, davinci_vc->base + reg);
44}
45 40
46static int __init davinci_vc_probe(struct platform_device *pdev) 41static int __init davinci_vc_probe(struct platform_device *pdev)
47{ 42{
@@ -74,6 +69,14 @@ static int __init davinci_vc_probe(struct platform_device *pdev)
74 goto fail; 69 goto fail;
75 } 70 }
76 71
72 davinci_vc->regmap = devm_regmap_init_mmio(&pdev->dev,
73 davinci_vc->base,
74 &davinci_vc_regmap);
75 if (IS_ERR(davinci_vc->regmap)) {
76 ret = PTR_ERR(davinci_vc->regmap);
77 goto fail;
78 }
79
77 res = platform_get_resource(pdev, IORESOURCE_DMA, 0); 80 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
78 if (!res) { 81 if (!res) {
79 dev_err(&pdev->dev, "no DMA resource\n"); 82 dev_err(&pdev->dev, "no DMA resource\n");
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c
index 4d8d3b74d4e3..daf66942071c 100644
--- a/drivers/mfd/twl6040.c
+++ b/drivers/mfd/twl6040.c
@@ -58,15 +58,9 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
58 int ret; 58 int ret;
59 unsigned int val; 59 unsigned int val;
60 60
61 /* Vibra control registers from cache */ 61 ret = regmap_read(twl6040->regmap, reg, &val);
62 if (unlikely(reg == TWL6040_REG_VIBCTLL || 62 if (ret < 0)
63 reg == TWL6040_REG_VIBCTLR)) { 63 return ret;
64 val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
65 } else {
66 ret = regmap_read(twl6040->regmap, reg, &val);
67 if (ret < 0)
68 return ret;
69 }
70 64
71 return val; 65 return val;
72} 66}
@@ -77,9 +71,6 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)
77 int ret; 71 int ret;
78 72
79 ret = regmap_write(twl6040->regmap, reg, val); 73 ret = regmap_write(twl6040->regmap, reg, val);
80 /* Cache the vibra control registers */
81 if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
82 twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
83 74
84 return ret; 75 return ret;
85} 76}
@@ -456,9 +447,20 @@ EXPORT_SYMBOL(twl6040_get_sysclk);
456/* Get the combined status of the vibra control register */ 447/* Get the combined status of the vibra control register */
457int twl6040_get_vibralr_status(struct twl6040 *twl6040) 448int twl6040_get_vibralr_status(struct twl6040 *twl6040)
458{ 449{
450 unsigned int reg;
451 int ret;
459 u8 status; 452 u8 status;
460 453
461 status = twl6040->vibra_ctrl_cache[0] | twl6040->vibra_ctrl_cache[1]; 454 ret = regmap_read(twl6040->regmap, TWL6040_REG_VIBCTLL, &reg);
455 if (ret != 0)
456 return ret;
457 status = reg;
458
459 ret = regmap_read(twl6040->regmap, TWL6040_REG_VIBCTLR, &reg);
460 if (ret != 0)
461 return ret;
462 status |= reg;
463
462 status &= (TWL6040_VIBENA | TWL6040_VIBSEL); 464 status &= (TWL6040_VIBENA | TWL6040_VIBSEL);
463 465
464 return status; 466 return status;
@@ -485,12 +487,27 @@ static bool twl6040_readable_reg(struct device *dev, unsigned int reg)
485 return true; 487 return true;
486} 488}
487 489
490static bool twl6040_volatile_reg(struct device *dev, unsigned int reg)
491{
492 switch (reg) {
493 case TWL6040_REG_VIBCTLL:
494 case TWL6040_REG_VIBCTLR:
495 case TWL6040_REG_INTMR:
496 return false;
497 default:
498 return true;
499 }
500}
501
488static struct regmap_config twl6040_regmap_config = { 502static struct regmap_config twl6040_regmap_config = {
489 .reg_bits = 8, 503 .reg_bits = 8,
490 .val_bits = 8, 504 .val_bits = 8,
491 .max_register = TWL6040_REG_STATUS, /* 0x2e */ 505 .max_register = TWL6040_REG_STATUS, /* 0x2e */
492 506
493 .readable_reg = twl6040_readable_reg, 507 .readable_reg = twl6040_readable_reg,
508 .volatile_reg = twl6040_volatile_reg,
509
510 .cache_type = REGCACHE_RBTREE,
494}; 511};
495 512
496static const struct regmap_irq twl6040_irqs[] = { 513static const struct regmap_irq twl6040_irqs[] = {
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h
index 13a1ee95a233..5166935ce66d 100644
--- a/include/linux/mfd/davinci_voicecodec.h
+++ b/include/linux/mfd/davinci_voicecodec.h
@@ -30,6 +30,8 @@
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32 32
33struct regmap;
34
33/* 35/*
34 * Register values. 36 * Register values.
35 */ 37 */
@@ -113,6 +115,7 @@ struct davinci_vc {
113 115
114 /* Memory resources */ 116 /* Memory resources */
115 void __iomem *base; 117 void __iomem *base;
118 struct regmap *regmap;
116 119
117 /* MFD cells */ 120 /* MFD cells */
118 struct mfd_cell cells[DAVINCI_VC_CELLS]; 121 struct mfd_cell cells[DAVINCI_VC_CELLS];
diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h
index 6dd8893b2a56..81f639bc1ae6 100644
--- a/include/linux/mfd/twl6040.h
+++ b/include/linux/mfd/twl6040.h
@@ -230,7 +230,6 @@ struct twl6040 {
230 int audpwron; 230 int audpwron;
231 int power_count; 231 int power_count;
232 int rev; 232 int rev;
233 u8 vibra_ctrl_cache[2];
234 233
235 /* PLL configuration */ 234 /* PLL configuration */
236 int pll; 235 int pll;