Commit c46a95f3 authored by James Kelly's avatar James Kelly Committed by Stefan Bader

ASoC: ssm2602: Replace reg_default_raw with reg_default

BugLink: http://bugs.launchpad.net/bugs/1768429

commit a01df75c upstream.

SSM2602 driver is broken on recent kernels (at least
since 4.9). User space applications such as amixer or
alsamixer get EIO when attempting to access codec
controls via the relevant IOCTLs.

Root cause of these failures is the regcache_hw_init
function in drivers/base/regmap/regcache.c, which
prevents regmap cache initalization from the
reg_defaults_raw element of the regmap_config structure
when registers are write only. It also disables the
regmap cache entirely when all registers are write only
or volatile as is the case for the SSM2602 driver.

Using the reg_defaults element of the regmap_config
structure rather than the reg_defaults_raw element to
initalize the regmap cache avoids the logic in the
regcache_hw_init function entirely. It also makes this
driver consistent with other ASoC codec drivers, as
this driver was the ONLY codec driver that used the
reg_defaults_raw element to initalize the cache.

Tested on Digilent Zybo Z7 development board which has
a SSM2603 codec chip connected to a Xilinx Zynq SoC.
Signed-off-by: default avatarJames Kelly <jamespeterkelly@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent a280f9a0
...@@ -54,10 +54,17 @@ struct ssm2602_priv { ...@@ -54,10 +54,17 @@ struct ssm2602_priv {
* using 2 wire for device control, so we cache them instead. * using 2 wire for device control, so we cache them instead.
* There is no point in caching the reset register * There is no point in caching the reset register
*/ */
static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = { static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = {
0x0097, 0x0097, 0x0079, 0x0079, { .reg = 0x00, .def = 0x0097 },
0x000a, 0x0008, 0x009f, 0x000a, { .reg = 0x01, .def = 0x0097 },
0x0000, 0x0000 { .reg = 0x02, .def = 0x0079 },
{ .reg = 0x03, .def = 0x0079 },
{ .reg = 0x04, .def = 0x000a },
{ .reg = 0x05, .def = 0x0008 },
{ .reg = 0x06, .def = 0x009f },
{ .reg = 0x07, .def = 0x000a },
{ .reg = 0x08, .def = 0x0000 },
{ .reg = 0x09, .def = 0x0000 }
}; };
...@@ -618,8 +625,8 @@ const struct regmap_config ssm2602_regmap_config = { ...@@ -618,8 +625,8 @@ const struct regmap_config ssm2602_regmap_config = {
.volatile_reg = ssm2602_register_volatile, .volatile_reg = ssm2602_register_volatile,
.cache_type = REGCACHE_RBTREE, .cache_type = REGCACHE_RBTREE,
.reg_defaults_raw = ssm2602_reg, .reg_defaults = ssm2602_reg,
.num_reg_defaults_raw = ARRAY_SIZE(ssm2602_reg), .num_reg_defaults = ARRAY_SIZE(ssm2602_reg),
}; };
EXPORT_SYMBOL_GPL(ssm2602_regmap_config); EXPORT_SYMBOL_GPL(ssm2602_regmap_config);
......
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