Commit ab96d9d6 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/fsl-sai', 'asoc/topic/fsl-ssl',...

Merge remote-tracking branches 'asoc/topic/fsl-sai', 'asoc/topic/fsl-ssl', 'asoc/topic/hdac' and 'asoc/topic/max9867' into asoc-next
...@@ -5,15 +5,18 @@ Index Device Endianness properties ...@@ -5,15 +5,18 @@ Index Device Endianness properties
--------------------------------------------------- ---------------------------------------------------
1 BE 'big-endian' 1 BE 'big-endian'
2 LE 'little-endian' 2 LE 'little-endian'
3 Native 'native-endian'
For one device driver, which will run in different scenarios above For one device driver, which will run in different scenarios above
on different SoCs using the devicetree, we need one way to simplify on different SoCs using the devicetree, we need one way to simplify
this. this.
Required properties: Optional properties:
- {big,little}-endian: these are boolean properties, if absent - {big,little,native}-endian: these are boolean properties, if absent
meaning that the CPU and the Device are in the same endianness mode, then the implementation will choose a default based on the device
these properties are for register values and all the buffers only. being controlled. These properties are for register values and all
the buffers only. Native endian means that the CPU and device have
the same endianness.
Examples: Examples:
Scenario 1 : CPU in LE mode & device in LE mode. Scenario 1 : CPU in LE mode & device in LE mode.
......
max9867 codec
This device supports I2C mode only.
Required properties:
- compatible : "maxim,max9867"
- reg : The chip select number on the I2C bus
Example:
&i2c {
max9867: max9867@0x18 {
compatible = "maxim,max9867";
reg = <0x18>;
};
};
max98926 audio CODEC
This device supports I2C.
Required properties:
- compatible : "maxim,max98926"
- vmon-slot-no : slot number used to send voltage information
or in inteleave mode this will be used as
interleave slot.
- imon-slot-no : slot number used to send current information
- interleave-mode : When using two MAX98926 in a system it is
possible to create ADC data that that will
overflow the frame size. Digital Audio Interleave
mode provides a means to output VMON and IMON data
from two devices on a single DOUT line when running
smaller frames sizes such as 32 BCLKS per LRCLK or
48 BCLKS per LRCLK.
- reg : the I2C address of the device for I2C
Example:
codec: max98926@1a {
compatible = "maxim,max98926";
vmon-slot-no = <0>;
imon-slot-no = <2>;
reg = <0x1a>;
};
...@@ -74,7 +74,7 @@ uart0: serial@10000100 { ...@@ -74,7 +74,7 @@ uart0: serial@10000100 {
timer: timer@10000040 { timer: timer@10000040 {
compatible = "syscon"; compatible = "syscon";
reg = <0x10000040 0x2c>; reg = <0x10000040 0x2c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -54,7 +54,7 @@ ubus { ...@@ -54,7 +54,7 @@ ubus {
periph_cntl: syscon@10000000 { periph_cntl: syscon@10000000 {
compatible = "syscon"; compatible = "syscon";
reg = <0x10000000 0x14>; reg = <0x10000000 0x14>;
little-endian; native-endian;
}; };
reboot: syscon-reboot@10000008 { reboot: syscon-reboot@10000008 {
......
...@@ -98,7 +98,7 @@ upg_irq0_intc: upg_irq0_intc@406780 { ...@@ -98,7 +98,7 @@ upg_irq0_intc: upg_irq0_intc@406780 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7125-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7125-sun-top-ctrl", "syscon";
reg = <0x404000 0x60c>; reg = <0x404000 0x60c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -118,7 +118,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { ...@@ -118,7 +118,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7346-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7346-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -112,7 +112,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { ...@@ -112,7 +112,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7358-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7358-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -112,7 +112,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { ...@@ -112,7 +112,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7360-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7360-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -118,7 +118,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 { ...@@ -118,7 +118,7 @@ upg_aon_irq0_intc: upg_aon_irq0_intc@408b80 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7362-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7362-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -99,7 +99,7 @@ upg_irq0_intc: upg_irq0_intc@406780 { ...@@ -99,7 +99,7 @@ upg_irq0_intc: upg_irq0_intc@406780 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7420-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7420-sun-top-ctrl", "syscon";
reg = <0x404000 0x60c>; reg = <0x404000 0x60c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -100,7 +100,7 @@ upg_irq0_intc: upg_irq0_intc@406780 { ...@@ -100,7 +100,7 @@ upg_irq0_intc: upg_irq0_intc@406780 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -114,7 +114,7 @@ upg_irq0_intc: upg_irq0_intc@406780 { ...@@ -114,7 +114,7 @@ upg_irq0_intc: upg_irq0_intc@406780 {
sun_top_ctrl: syscon@404000 { sun_top_ctrl: syscon@404000 {
compatible = "brcm,bcm7425-sun-top-ctrl", "syscon"; compatible = "brcm,bcm7425-sun-top-ctrl", "syscon";
reg = <0x404000 0x51c>; reg = <0x404000 0x51c>;
little-endian; native-endian;
}; };
reboot { reboot {
......
...@@ -30,7 +30,7 @@ static int regcache_hw_init(struct regmap *map) ...@@ -30,7 +30,7 @@ static int regcache_hw_init(struct regmap *map)
int i, j; int i, j;
int ret; int ret;
int count; int count;
unsigned int val; unsigned int reg, val;
void *tmp_buf; void *tmp_buf;
if (!map->num_reg_defaults_raw) if (!map->num_reg_defaults_raw)
...@@ -67,27 +67,46 @@ static int regcache_hw_init(struct regmap *map) ...@@ -67,27 +67,46 @@ static int regcache_hw_init(struct regmap *map)
ret = regmap_raw_read(map, 0, tmp_buf, ret = regmap_raw_read(map, 0, tmp_buf,
map->num_reg_defaults_raw); map->num_reg_defaults_raw);
map->cache_bypass = cache_bypass; map->cache_bypass = cache_bypass;
if (ret < 0) if (ret == 0) {
goto err_cache_free; map->reg_defaults_raw = tmp_buf;
map->cache_free = 1;
map->reg_defaults_raw = tmp_buf; } else {
map->cache_free = 1; kfree(tmp_buf);
}
} }
/* fill the reg_defaults */ /* fill the reg_defaults */
for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) { for (i = 0, j = 0; i < map->num_reg_defaults_raw; i++) {
if (regmap_volatile(map, i * map->reg_stride)) reg = i * map->reg_stride;
if (!regmap_readable(map, reg))
continue; continue;
val = regcache_get_val(map, map->reg_defaults_raw, i);
map->reg_defaults[j].reg = i * map->reg_stride; if (regmap_volatile(map, reg))
continue;
if (map->reg_defaults_raw) {
val = regcache_get_val(map, map->reg_defaults_raw, i);
} else {
bool cache_bypass = map->cache_bypass;
map->cache_bypass = true;
ret = regmap_read(map, reg, &val);
map->cache_bypass = cache_bypass;
if (ret != 0) {
dev_err(map->dev, "Failed to read %d: %d\n",
reg, ret);
goto err_free;
}
}
map->reg_defaults[j].reg = reg;
map->reg_defaults[j].def = val; map->reg_defaults[j].def = val;
j++; j++;
} }
return 0; return 0;
err_cache_free:
kfree(tmp_buf);
err_free: err_free:
kfree(map->reg_defaults); kfree(map->reg_defaults);
......
...@@ -25,26 +25,14 @@ ...@@ -25,26 +25,14 @@
struct regmap_mmio_context { struct regmap_mmio_context {
void __iomem *regs; void __iomem *regs;
unsigned reg_bytes;
unsigned val_bytes; unsigned val_bytes;
unsigned pad_bytes;
struct clk *clk; struct clk *clk;
};
static inline void regmap_mmio_regsize_check(size_t reg_size) void (*reg_write)(struct regmap_mmio_context *ctx,
{ unsigned int reg, unsigned int val);
switch (reg_size) { unsigned int (*reg_read)(struct regmap_mmio_context *ctx,
case 1: unsigned int reg);
case 2: };
case 4:
#ifdef CONFIG_64BIT
case 8:
#endif
break;
default:
BUG();
}
}
static int regmap_mmio_regbits_check(size_t reg_bits) static int regmap_mmio_regbits_check(size_t reg_bits)
{ {
...@@ -88,72 +76,62 @@ static int regmap_mmio_get_min_stride(size_t val_bits) ...@@ -88,72 +76,62 @@ static int regmap_mmio_get_min_stride(size_t val_bits)
return min_stride; return min_stride;
} }
static inline void regmap_mmio_count_check(size_t count, u32 offset) static void regmap_mmio_write8(struct regmap_mmio_context *ctx,
unsigned int reg,
unsigned int val)
{
writeb(val, ctx->regs + reg);
}
static void regmap_mmio_write16le(struct regmap_mmio_context *ctx,
unsigned int reg,
unsigned int val)
{ {
BUG_ON(count <= offset); writew(val, ctx->regs + reg);
} }
static inline unsigned int static void regmap_mmio_write16be(struct regmap_mmio_context *ctx,
regmap_mmio_get_offset(const void *reg, size_t reg_size) unsigned int reg,
unsigned int val)
{ {
switch (reg_size) { iowrite16be(val, ctx->regs + reg);
case 1: }
return *(u8 *)reg;
case 2: static void regmap_mmio_write32le(struct regmap_mmio_context *ctx,
return *(u16 *)reg; unsigned int reg,
case 4: unsigned int val)
return *(u32 *)reg; {
writel(val, ctx->regs + reg);
}
static void regmap_mmio_write32be(struct regmap_mmio_context *ctx,
unsigned int reg,
unsigned int val)
{
iowrite32be(val, ctx->regs + reg);
}
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
case 8: static void regmap_mmio_write64le(struct regmap_mmio_context *ctx,
return *(u64 *)reg; unsigned int reg,
#endif unsigned int val)
default: {
BUG(); writeq(val, ctx->regs + reg);
}
} }
#endif
static int regmap_mmio_gather_write(void *context, static int regmap_mmio_write(void *context, unsigned int reg, unsigned int val)
const void *reg, size_t reg_size,
const void *val, size_t val_size)
{ {
struct regmap_mmio_context *ctx = context; struct regmap_mmio_context *ctx = context;
unsigned int offset;
int ret; int ret;
regmap_mmio_regsize_check(reg_size);
if (!IS_ERR(ctx->clk)) { if (!IS_ERR(ctx->clk)) {
ret = clk_enable(ctx->clk); ret = clk_enable(ctx->clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
offset = regmap_mmio_get_offset(reg, reg_size); ctx->reg_write(ctx, reg, val);
while (val_size) {
switch (ctx->val_bytes) {
case 1:
writeb(*(u8 *)val, ctx->regs + offset);
break;
case 2:
writew(*(u16 *)val, ctx->regs + offset);
break;
case 4:
writel(*(u32 *)val, ctx->regs + offset);
break;
#ifdef CONFIG_64BIT
case 8:
writeq(*(u64 *)val, ctx->regs + offset);
break;
#endif
default:
/* Should be caught by regmap_mmio_check_config */
BUG();
}
val_size -= ctx->val_bytes;
val += ctx->val_bytes;
offset += ctx->val_bytes;
}
if (!IS_ERR(ctx->clk)) if (!IS_ERR(ctx->clk))
clk_disable(ctx->clk); clk_disable(ctx->clk);
...@@ -161,59 +139,56 @@ static int regmap_mmio_gather_write(void *context, ...@@ -161,59 +139,56 @@ static int regmap_mmio_gather_write(void *context,
return 0; return 0;
} }
static int regmap_mmio_write(void *context, const void *data, size_t count) static unsigned int regmap_mmio_read8(struct regmap_mmio_context *ctx,
unsigned int reg)
{ {
struct regmap_mmio_context *ctx = context; return readb(ctx->regs + reg);
unsigned int offset = ctx->reg_bytes + ctx->pad_bytes; }
static unsigned int regmap_mmio_read16le(struct regmap_mmio_context *ctx,
unsigned int reg)
{
return readw(ctx->regs + reg);
}
static unsigned int regmap_mmio_read16be(struct regmap_mmio_context *ctx,
unsigned int reg)
{
return ioread16be(ctx->regs + reg);
}
static unsigned int regmap_mmio_read32le(struct regmap_mmio_context *ctx,
unsigned int reg)
{
return readl(ctx->regs + reg);
}
regmap_mmio_count_check(count, offset); static unsigned int regmap_mmio_read32be(struct regmap_mmio_context *ctx,
unsigned int reg)
{
return ioread32be(ctx->regs + reg);
}
return regmap_mmio_gather_write(context, data, ctx->reg_bytes, #ifdef CONFIG_64BIT
data + offset, count - offset); static unsigned int regmap_mmio_read64le(struct regmap_mmio_context *ctx,
unsigned int reg)
{
return readq(ctx->regs + reg);
} }
#endif
static int regmap_mmio_read(void *context, static int regmap_mmio_read(void *context, unsigned int reg, unsigned int *val)
const void *reg, size_t reg_size,
void *val, size_t val_size)
{ {
struct regmap_mmio_context *ctx = context; struct regmap_mmio_context *ctx = context;
unsigned int offset;
int ret; int ret;
regmap_mmio_regsize_check(reg_size);
if (!IS_ERR(ctx->clk)) { if (!IS_ERR(ctx->clk)) {
ret = clk_enable(ctx->clk); ret = clk_enable(ctx->clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
offset = regmap_mmio_get_offset(reg, reg_size); *val = ctx->reg_read(ctx, reg);
while (val_size) {
switch (ctx->val_bytes) {
case 1:
*(u8 *)val = readb(ctx->regs + offset);
break;
case 2:
*(u16 *)val = readw(ctx->regs + offset);
break;
case 4:
*(u32 *)val = readl(ctx->regs + offset);
break;
#ifdef CONFIG_64BIT
case 8:
*(u64 *)val = readq(ctx->regs + offset);
break;
#endif
default:
/* Should be caught by regmap_mmio_check_config */
BUG();
}
val_size -= ctx->val_bytes;
val += ctx->val_bytes;
offset += ctx->val_bytes;
}
if (!IS_ERR(ctx->clk)) if (!IS_ERR(ctx->clk))
clk_disable(ctx->clk); clk_disable(ctx->clk);
...@@ -232,14 +207,11 @@ static void regmap_mmio_free_context(void *context) ...@@ -232,14 +207,11 @@ static void regmap_mmio_free_context(void *context)
kfree(context); kfree(context);
} }
static struct regmap_bus regmap_mmio = { static const struct regmap_bus regmap_mmio = {
.fast_io = true, .fast_io = true,
.write = regmap_mmio_write, .reg_write = regmap_mmio_write,
.gather_write = regmap_mmio_gather_write, .reg_read = regmap_mmio_read,
.read = regmap_mmio_read,
.free_context = regmap_mmio_free_context, .free_context = regmap_mmio_free_context,
.reg_format_endian_default = REGMAP_ENDIAN_NATIVE,
.val_format_endian_default = REGMAP_ENDIAN_NATIVE,
}; };
static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
...@@ -265,24 +237,71 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev, ...@@ -265,24 +237,71 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
if (config->reg_stride < min_stride) if (config->reg_stride < min_stride)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
switch (config->reg_format_endian) {
case REGMAP_ENDIAN_DEFAULT:
case REGMAP_ENDIAN_NATIVE:
break;
default:
return ERR_PTR(-EINVAL);
}
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx) if (!ctx)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ctx->regs = regs; ctx->regs = regs;
ctx->val_bytes = config->val_bits / 8; ctx->val_bytes = config->val_bits / 8;
ctx->reg_bytes = config->reg_bits / 8;
ctx->pad_bytes = config->pad_bits / 8;
ctx->clk = ERR_PTR(-ENODEV); ctx->clk = ERR_PTR(-ENODEV);
switch (config->reg_format_endian) {
case REGMAP_ENDIAN_DEFAULT:
case REGMAP_ENDIAN_LITTLE:
#ifdef __LITTLE_ENDIAN
case REGMAP_ENDIAN_NATIVE:
#endif
switch (config->val_bits) {
case 8:
ctx->reg_read = regmap_mmio_read8;
ctx->reg_write = regmap_mmio_write8;
break;
case 16:
ctx->reg_read = regmap_mmio_read16le;
ctx->reg_write = regmap_mmio_write16le;
break;
case 32:
ctx->reg_read = regmap_mmio_read32le;
ctx->reg_write = regmap_mmio_write32le;
break;
#ifdef CONFIG_64BIT
case 64:
ctx->reg_read = regmap_mmio_read64le;
ctx->reg_write = regmap_mmio_write64le;
break;
#endif
default:
ret = -EINVAL;
goto err_free;
}
break;
case REGMAP_ENDIAN_BIG:
#ifdef __BIG_ENDIAN
case REGMAP_ENDIAN_NATIVE:
#endif
switch (config->val_bits) {
case 8:
ctx->reg_read = regmap_mmio_read8;
ctx->reg_write = regmap_mmio_write8;
break;
case 16:
ctx->reg_read = regmap_mmio_read16be;
ctx->reg_write = regmap_mmio_write16be;
break;
case 32:
ctx->reg_read = regmap_mmio_read32be;
ctx->reg_write = regmap_mmio_write32be;
break;
default:
ret = -EINVAL;
goto err_free;
}
break;
default:
ret = -EINVAL;
goto err_free;
}
if (clk_id == NULL) if (clk_id == NULL)
return ctx; return ctx;
......
...@@ -557,6 +557,8 @@ enum regmap_endian regmap_get_val_endian(struct device *dev, ...@@ -557,6 +557,8 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
endian = REGMAP_ENDIAN_BIG; endian = REGMAP_ENDIAN_BIG;
else if (of_property_read_bool(np, "little-endian")) else if (of_property_read_bool(np, "little-endian"))
endian = REGMAP_ENDIAN_LITTLE; endian = REGMAP_ENDIAN_LITTLE;
else if (of_property_read_bool(np, "native-endian"))
endian = REGMAP_ENDIAN_NATIVE;
/* If the endianness was specified in DT, use that */ /* If the endianness was specified in DT, use that */
if (endian != REGMAP_ENDIAN_DEFAULT) if (endian != REGMAP_ENDIAN_DEFAULT)
...@@ -2253,6 +2255,9 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, ...@@ -2253,6 +2255,9 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
WARN_ON(!map->bus); WARN_ON(!map->bus);
if (!map->bus || !map->bus->read)
return -EINVAL;
range = _regmap_range_lookup(map, reg); range = _regmap_range_lookup(map, reg);
if (range) { if (range) {
ret = _regmap_select_page(map, &reg, range, ret = _regmap_select_page(map, &reg, range,
......
...@@ -79,7 +79,9 @@ config SND_SOC_ALL_CODECS ...@@ -79,7 +79,9 @@ config SND_SOC_ALL_CODECS
select SND_SOC_MAX98090 if I2C select SND_SOC_MAX98090 if I2C
select SND_SOC_MAX98095 if I2C select SND_SOC_MAX98095 if I2C
select SND_SOC_MAX98357A if GPIOLIB select SND_SOC_MAX98357A if GPIOLIB
select SND_SOC_MAX9867 if I2C
select SND_SOC_MAX98925 if I2C select SND_SOC_MAX98925 if I2C
select SND_SOC_MAX98926 if I2C
select SND_SOC_MAX9850 if I2C select SND_SOC_MAX9850 if I2C
select SND_SOC_MAX9768 if I2C select SND_SOC_MAX9768 if I2C
select SND_SOC_MAX9877 if I2C select SND_SOC_MAX9877 if I2C
...@@ -518,9 +520,15 @@ config SND_SOC_MAX98095 ...@@ -518,9 +520,15 @@ config SND_SOC_MAX98095
config SND_SOC_MAX98357A config SND_SOC_MAX98357A
tristate tristate
config SND_SOC_MAX9867
tristate
config SND_SOC_MAX98925 config SND_SOC_MAX98925
tristate tristate
config SND_SOC_MAX98926
tristate
config SND_SOC_MAX9850 config SND_SOC_MAX9850
tristate tristate
......
...@@ -74,7 +74,9 @@ snd-soc-max98088-objs := max98088.o ...@@ -74,7 +74,9 @@ snd-soc-max98088-objs := max98088.o
snd-soc-max98090-objs := max98090.o snd-soc-max98090-objs := max98090.o
snd-soc-max98095-objs := max98095.o snd-soc-max98095-objs := max98095.o
snd-soc-max98357a-objs := max98357a.o snd-soc-max98357a-objs := max98357a.o
snd-soc-max9867-objs := max9867.o
snd-soc-max98925-objs := max98925.o snd-soc-max98925-objs := max98925.o
snd-soc-max98926-objs := max98926.o
snd-soc-max9850-objs := max9850.o snd-soc-max9850-objs := max9850.o
snd-soc-mc13783-objs := mc13783.o snd-soc-mc13783-objs := mc13783.o
snd-soc-ml26124-objs := ml26124.o snd-soc-ml26124-objs := ml26124.o
...@@ -280,7 +282,9 @@ obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o ...@@ -280,7 +282,9 @@ obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
obj-$(CONFIG_SND_SOC_MAX98090) += snd-soc-max98090.o obj-$(CONFIG_SND_SOC_MAX98090) += snd-soc-max98090.o
obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o
obj-$(CONFIG_SND_SOC_MAX98357A) += snd-soc-max98357a.o obj-$(CONFIG_SND_SOC_MAX98357A) += snd-soc-max98357a.o
obj-$(CONFIG_SND_SOC_MAX9867) += snd-soc-max9867.o
obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o obj-$(CONFIG_SND_SOC_MAX98925) += snd-soc-max98925.o
obj-$(CONFIG_SND_SOC_MAX98926) += snd-soc-max98926.o
obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o
obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o
......
...@@ -303,7 +303,6 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, ...@@ -303,7 +303,6 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac,
if (ret < 0) if (ret < 0)
return ret; return ret;
dip = (u8 *)&frame;
break; break;
case DRM_ELD_CONN_TYPE_DP: case DRM_ELD_CONN_TYPE_DP:
...@@ -332,9 +331,9 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, ...@@ -332,9 +331,9 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac,
/* Fill infoframe. Index auto-incremented */ /* Fill infoframe. Index auto-incremented */
hdac_hdmi_set_dip_index(hdac, pin_nid, 0x0, 0x0); hdac_hdmi_set_dip_index(hdac, pin_nid, 0x0, 0x0);
if (conn_type == DRM_ELD_CONN_TYPE_HDMI) { if (conn_type == DRM_ELD_CONN_TYPE_HDMI) {
for (i = 0; i < sizeof(frame); i++) for (i = 0; i < sizeof(buffer); i++)
snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, snd_hdac_codec_write(&hdac->hdac, pin_nid, 0,
AC_VERB_SET_HDMI_DIP_DATA, dip[i]); AC_VERB_SET_HDMI_DIP_DATA, buffer[i]);
} else { } else {
for (i = 0; i < sizeof(dp_ai); i++) for (i = 0; i < sizeof(dp_ai); i++)
snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, snd_hdac_codec_write(&hdac->hdac, pin_nid, 0,
......
This diff is collapsed.
/*
* max9867.h -- MAX9867 ALSA SoC Audio driver
*
* Copyright 2013-2015 Maxim Integrated Products
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _MAX9867_H
#define _MAX9867_H
/* MAX9867 register space */
#define MAX9867_STATUS 0x00
#define MAX9867_JACKSTATUS 0x01
#define MAX9867_AUXHIGH 0x02
#define MAX9867_AUXLOW 0x03
#define MAX9867_INTEN 0x04
#define MAX9867_SYSCLK 0x05
#define MAX9867_FREQ_MASK 0xF
#define MAX9867_PSCLK_SHIFT 0x4
#define MAX9867_PSCLK_WIDTH 0x2
#define MAX9867_PSCLK_MASK (0x03<<MAX9867_PSCLK_SHIFT)
#define MAX9867_PSCLK_10_20 0x1
#define MAX9867_PSCLK_20_40 0x2
#define MAX9867_PSCLK_40_60 0x3
#define MAX9867_AUDIOCLKHIGH 0x06
#define MAX9867_NI_HIGH_WIDTH 0x7
#define MAX9867_NI_HIGH_MASK 0x7F
#define MAX9867_NI_LOW_MASK 0x7F
#define MAX9867_NI_LOW_SHIFT 0x1
#define MAX9867_PLL (1<<7)
#define MAX9867_AUDIOCLKLOW 0x07
#define MAX9867_RAPID_LOCK 0x01
#define MAX9867_IFC1A 0x08
#define MAX9867_MASTER (1<<7)
#define MAX9867_I2S_DLY (1<<4)
#define MAX9867_SDOUT_HIZ (1<<3)
#define MAX9867_TDM_MODE (1<<2)
#define MAX9867_WCI_MODE (1<<6)
#define MAX9867_BCI_MODE (1<<5)
#define MAX9867_IFC1B 0x09
#define MAX9867_IFC1B_BCLK_MASK 7
#define MAX9867_IFC1B_32BIT 0x01
#define MAX9867_IFC1B_24BIT 0x02
#define MAX9867_IFC1B_PCLK_2 4
#define MAX9867_IFC1B_PCLK_4 5
#define MAX9867_IFC1B_PCLK_8 6
#define MAX9867_IFC1B_PCLK_16 7
#define MAX9867_CODECFLTR 0x0a
#define MAX9867_DACGAIN 0x0b
#define MAX9867_DACLEVEL 0x0c
#define MAX9867_DAC_MUTE_SHIFT 0x6
#define MAX9867_DAC_MUTE_WIDTH 0x1
#define MAX9867_DAC_MUTE_MASK (0x1<<MAX9867_DAC_MUTE_SHIFT)
#define MAX9867_ADCLEVEL 0x0d
#define MAX9867_LEFTLINELVL 0x0e
#define MAX9867_RIGTHLINELVL 0x0f
#define MAX9867_LEFTVOL 0x10
#define MAX9867_RIGHTVOL 0x11
#define MAX9867_LEFTMICGAIN 0x12
#define MAX9867_RIGHTMICGAIN 0x13
#define MAX9867_INPUTCONFIG 0x14
#define MAX9867_INPUT_SHIFT 0x6
#define MAX9867_MICCONFIG 0x15
#define MAX9867_MODECONFIG 0x16
#define MAX9867_PWRMAN 0x17
#define MAX9867_SHTDOWN_MASK (1<<7)
#define MAX9867_REVISION 0xff
#define MAX9867_CACHEREGNUM 10
/* codec private data */
struct max9867_priv {
struct regmap *regmap;
struct snd_soc_codec *codec;
unsigned int sysclk;
unsigned int pclk;
unsigned int master;
};
#endif
This diff is collapsed.
This diff is collapsed.
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/time.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/dmaengine_pcm.h> #include <sound/dmaengine_pcm.h>
#include <sound/pcm_params.h> #include <sound/pcm_params.h>
...@@ -919,7 +920,7 @@ static int fsl_sai_resume(struct device *dev) ...@@ -919,7 +920,7 @@ static int fsl_sai_resume(struct device *dev)
regcache_cache_only(sai->regmap, false); regcache_cache_only(sai->regmap, false);
regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR); regmap_write(sai->regmap, FSL_SAI_TCSR, FSL_SAI_CSR_SR);
regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR); regmap_write(sai->regmap, FSL_SAI_RCSR, FSL_SAI_CSR_SR);
msleep(1); usleep_range(1000, 2000);
regmap_write(sai->regmap, FSL_SAI_TCSR, 0); regmap_write(sai->regmap, FSL_SAI_TCSR, 0);
regmap_write(sai->regmap, FSL_SAI_RCSR, 0); regmap_write(sai->regmap, FSL_SAI_RCSR, 0);
return regcache_sync(sai->regmap); return regcache_sync(sai->regmap);
......
...@@ -112,20 +112,6 @@ struct fsl_ssi_rxtx_reg_val { ...@@ -112,20 +112,6 @@ struct fsl_ssi_rxtx_reg_val {
struct fsl_ssi_reg_val tx; struct fsl_ssi_reg_val tx;
}; };
static const struct reg_default fsl_ssi_reg_defaults[] = {
{CCSR_SSI_SCR, 0x00000000},
{CCSR_SSI_SIER, 0x00003003},
{CCSR_SSI_STCR, 0x00000200},
{CCSR_SSI_SRCR, 0x00000200},
{CCSR_SSI_STCCR, 0x00040000},
{CCSR_SSI_SRCCR, 0x00040000},
{CCSR_SSI_SACNT, 0x00000000},
{CCSR_SSI_STMSK, 0x00000000},
{CCSR_SSI_SRMSK, 0x00000000},
{CCSR_SSI_SACCEN, 0x00000000},
{CCSR_SSI_SACCDIS, 0x00000000},
};
static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg) static bool fsl_ssi_readable_reg(struct device *dev, unsigned int reg)
{ {
switch (reg) { switch (reg) {
...@@ -190,8 +176,7 @@ static const struct regmap_config fsl_ssi_regconfig = { ...@@ -190,8 +176,7 @@ static const struct regmap_config fsl_ssi_regconfig = {
.val_bits = 32, .val_bits = 32,
.reg_stride = 4, .reg_stride = 4,
.val_format_endian = REGMAP_ENDIAN_NATIVE, .val_format_endian = REGMAP_ENDIAN_NATIVE,
.reg_defaults = fsl_ssi_reg_defaults, .num_reg_defaults_raw = CCSR_SSI_SACCDIS / sizeof(uint32_t) + 1,
.num_reg_defaults = ARRAY_SIZE(fsl_ssi_reg_defaults),
.readable_reg = fsl_ssi_readable_reg, .readable_reg = fsl_ssi_readable_reg,
.volatile_reg = fsl_ssi_volatile_reg, .volatile_reg = fsl_ssi_volatile_reg,
.precious_reg = fsl_ssi_precious_reg, .precious_reg = fsl_ssi_precious_reg,
...@@ -201,6 +186,7 @@ static const struct regmap_config fsl_ssi_regconfig = { ...@@ -201,6 +186,7 @@ static const struct regmap_config fsl_ssi_regconfig = {
struct fsl_ssi_soc_data { struct fsl_ssi_soc_data {
bool imx; bool imx;
bool imx21regs; /* imx21-class SSI - no SACC{ST,EN,DIS} regs */
bool offline_config; bool offline_config;
u32 sisr_write_mask; u32 sisr_write_mask;
}; };
...@@ -303,6 +289,7 @@ static struct fsl_ssi_soc_data fsl_ssi_mpc8610 = { ...@@ -303,6 +289,7 @@ static struct fsl_ssi_soc_data fsl_ssi_mpc8610 = {
static struct fsl_ssi_soc_data fsl_ssi_imx21 = { static struct fsl_ssi_soc_data fsl_ssi_imx21 = {
.imx = true, .imx = true,
.imx21regs = true,
.offline_config = true, .offline_config = true,
.sisr_write_mask = 0, .sisr_write_mask = 0,
}; };
...@@ -586,8 +573,12 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private) ...@@ -586,8 +573,12 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi_private *ssi_private)
*/ */
regmap_write(regs, CCSR_SSI_SACNT, regmap_write(regs, CCSR_SSI_SACNT,
CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV); CCSR_SSI_SACNT_AC97EN | CCSR_SSI_SACNT_FV);
regmap_write(regs, CCSR_SSI_SACCDIS, 0xff);
regmap_write(regs, CCSR_SSI_SACCEN, 0x300); /* no SACC{ST,EN,DIS} regs on imx21-class SSI */
if (!ssi_private->soc->imx21regs) {
regmap_write(regs, CCSR_SSI_SACCDIS, 0xff);
regmap_write(regs, CCSR_SSI_SACCEN, 0x300);
}
/* /*
* Enable SSI, Transmit and Receive. AC97 has to communicate with the * Enable SSI, Transmit and Receive. AC97 has to communicate with the
...@@ -1397,6 +1388,7 @@ static int fsl_ssi_probe(struct platform_device *pdev) ...@@ -1397,6 +1388,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
void __iomem *iomem; void __iomem *iomem;
char name[64]; char name[64];
struct regmap_config regconfig = fsl_ssi_regconfig;
of_id = of_match_device(fsl_ssi_ids, &pdev->dev); of_id = of_match_device(fsl_ssi_ids, &pdev->dev);
if (!of_id || !of_id->data) if (!of_id || !of_id->data)
...@@ -1444,15 +1436,25 @@ static int fsl_ssi_probe(struct platform_device *pdev) ...@@ -1444,15 +1436,25 @@ static int fsl_ssi_probe(struct platform_device *pdev)
return PTR_ERR(iomem); return PTR_ERR(iomem);
ssi_private->ssi_phys = res->start; ssi_private->ssi_phys = res->start;
if (ssi_private->soc->imx21regs) {
/*
* According to datasheet imx21-class SSI
* don't have SACC{ST,EN,DIS} regs.
*/
regconfig.max_register = CCSR_SSI_SRMSK;
regconfig.num_reg_defaults_raw =
CCSR_SSI_SRMSK / sizeof(uint32_t) + 1;
}
ret = of_property_match_string(np, "clock-names", "ipg"); ret = of_property_match_string(np, "clock-names", "ipg");
if (ret < 0) { if (ret < 0) {
ssi_private->has_ipg_clk_name = false; ssi_private->has_ipg_clk_name = false;
ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem, ssi_private->regs = devm_regmap_init_mmio(&pdev->dev, iomem,
&fsl_ssi_regconfig); &regconfig);
} else { } else {
ssi_private->has_ipg_clk_name = true; ssi_private->has_ipg_clk_name = true;
ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev, ssi_private->regs = devm_regmap_init_mmio_clk(&pdev->dev,
"ipg", iomem, &fsl_ssi_regconfig); "ipg", iomem, &regconfig);
} }
if (IS_ERR(ssi_private->regs)) { if (IS_ERR(ssi_private->regs)) {
dev_err(&pdev->dev, "Failed to init register map\n"); dev_err(&pdev->dev, "Failed to init register map\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment