Merge branch 'topic/for-asoc'
This commit is contained in:
commit
f4388ca7f1
|
@ -27,21 +27,16 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
|
|
||||||
#include <linux/mfd/davinci_voicecodec.h>
|
#include <linux/mfd/davinci_voicecodec.h>
|
||||||
|
|
||||||
u32 davinci_vc_read(struct davinci_vc *davinci_vc, int reg)
|
static struct regmap_config davinci_vc_regmap = {
|
||||||
{
|
.reg_bits = 32,
|
||||||
return __raw_readl(davinci_vc->base + reg);
|
.val_bits = 32,
|
||||||
}
|
};
|
||||||
|
|
||||||
void davinci_vc_write(struct davinci_vc *davinci_vc,
|
|
||||||
int reg, u32 val)
|
|
||||||
{
|
|
||||||
__raw_writel(val, davinci_vc->base + reg);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init davinci_vc_probe(struct platform_device *pdev)
|
static int __init davinci_vc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +69,14 @@ static int __init davinci_vc_probe(struct platform_device *pdev)
|
||||||
goto fail;
|
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);
|
res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
dev_err(&pdev->dev, "no DMA resource\n");
|
dev_err(&pdev->dev, "no DMA resource\n");
|
||||||
|
|
|
@ -58,15 +58,9 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg)
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
/* Vibra control registers from cache */
|
ret = regmap_read(twl6040->regmap, reg, &val);
|
||||||
if (unlikely(reg == TWL6040_REG_VIBCTLL ||
|
if (ret < 0)
|
||||||
reg == TWL6040_REG_VIBCTLR)) {
|
return ret;
|
||||||
val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)];
|
|
||||||
} else {
|
|
||||||
ret = regmap_read(twl6040->regmap, reg, &val);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -77,9 +71,6 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = regmap_write(twl6040->regmap, reg, val);
|
ret = regmap_write(twl6040->regmap, reg, val);
|
||||||
/* Cache the vibra control registers */
|
|
||||||
if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR)
|
|
||||||
twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -456,9 +447,20 @@ EXPORT_SYMBOL(twl6040_get_sysclk);
|
||||||
/* Get the combined status of the vibra control register */
|
/* Get the combined status of the vibra control register */
|
||||||
int twl6040_get_vibralr_status(struct twl6040 *twl6040)
|
int twl6040_get_vibralr_status(struct twl6040 *twl6040)
|
||||||
{
|
{
|
||||||
|
unsigned int reg;
|
||||||
|
int ret;
|
||||||
u8 status;
|
u8 status;
|
||||||
|
|
||||||
status = twl6040->vibra_ctrl_cache[0] | twl6040->vibra_ctrl_cache[1];
|
ret = regmap_read(twl6040->regmap, TWL6040_REG_VIBCTLL, ®);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
|
status = reg;
|
||||||
|
|
||||||
|
ret = regmap_read(twl6040->regmap, TWL6040_REG_VIBCTLR, ®);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
|
status |= reg;
|
||||||
|
|
||||||
status &= (TWL6040_VIBENA | TWL6040_VIBSEL);
|
status &= (TWL6040_VIBENA | TWL6040_VIBSEL);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -485,12 +487,27 @@ static bool twl6040_readable_reg(struct device *dev, unsigned int reg)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool twl6040_volatile_reg(struct device *dev, unsigned int reg)
|
||||||
|
{
|
||||||
|
switch (reg) {
|
||||||
|
case TWL6040_REG_VIBCTLL:
|
||||||
|
case TWL6040_REG_VIBCTLR:
|
||||||
|
case TWL6040_REG_INTMR:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct regmap_config twl6040_regmap_config = {
|
static struct regmap_config twl6040_regmap_config = {
|
||||||
.reg_bits = 8,
|
.reg_bits = 8,
|
||||||
.val_bits = 8,
|
.val_bits = 8,
|
||||||
.max_register = TWL6040_REG_STATUS, /* 0x2e */
|
.max_register = TWL6040_REG_STATUS, /* 0x2e */
|
||||||
|
|
||||||
.readable_reg = twl6040_readable_reg,
|
.readable_reg = twl6040_readable_reg,
|
||||||
|
.volatile_reg = twl6040_volatile_reg,
|
||||||
|
|
||||||
|
.cache_type = REGCACHE_RBTREE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct regmap_irq twl6040_irqs[] = {
|
static const struct regmap_irq twl6040_irqs[] = {
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include <mach/hardware.h>
|
#include <mach/hardware.h>
|
||||||
|
|
||||||
|
struct regmap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register values.
|
* Register values.
|
||||||
*/
|
*/
|
||||||
|
@ -113,6 +115,7 @@ struct davinci_vc {
|
||||||
|
|
||||||
/* Memory resources */
|
/* Memory resources */
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
struct regmap *regmap;
|
||||||
|
|
||||||
/* MFD cells */
|
/* MFD cells */
|
||||||
struct mfd_cell cells[DAVINCI_VC_CELLS];
|
struct mfd_cell cells[DAVINCI_VC_CELLS];
|
||||||
|
|
|
@ -230,7 +230,6 @@ struct twl6040 {
|
||||||
int audpwron;
|
int audpwron;
|
||||||
int power_count;
|
int power_count;
|
||||||
int rev;
|
int rev;
|
||||||
u8 vibra_ctrl_cache[2];
|
|
||||||
|
|
||||||
/* PLL configuration */
|
/* PLL configuration */
|
||||||
int pll;
|
int pll;
|
||||||
|
|
Loading…
Reference in New Issue