[PATCH 05/16] mfd: madera: Register map tables for Cirrus Logic CS47L90/91
Regmap configuration tables for Cirrus Logic CS47L90 and CS47L91 codecs. Signed-off-by: Nikesh OswalSigned-off-by: Richard Fitzgerald Signed-off-by: Charles Keepax --- drivers/mfd/Kconfig |6 + drivers/mfd/Makefile |3 + drivers/mfd/cs47l90-tables.c | 2830 ++ 3 files changed, 2839 insertions(+) create mode 100644 drivers/mfd/cs47l90-tables.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 6618972..f7cb99c 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -238,6 +238,12 @@ config MFD_CS47L85 help Support for Cirrus Logic CS47L85 Smart Codec +config MFD_CS47L90 + bool "Cirrus Logic CS47L90/91" + depends on MFD_MADERA + help + Support for Cirrus Logic CS47L90 and CS47L91 Smart Codecs + config MFD_ASIC3 bool "Compaq ASIC3" depends on GPIOLIB && ARM diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9fdca9a..542da6d 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -79,6 +79,9 @@ endif ifeq ($(CONFIG_MFD_CS47L85),y) obj-$(CONFIG_MFD_MADERA) += cs47l85-tables.o endif +ifeq ($(CONFIG_MFD_CS47L90),y) +obj-$(CONFIG_MFD_MADERA) += cs47l90-tables.o +endif obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o diff --git a/drivers/mfd/cs47l90-tables.c b/drivers/mfd/cs47l90-tables.c new file mode 100644 index 000..52ce50f --- /dev/null +++ b/drivers/mfd/cs47l90-tables.c @@ -0,0 +1,2830 @@ +/* + * Regmap tables for CS47L90 codec + * + * Copyright 2015-2016 Cirrus Logic + * + * Author: Nikesh Oswal + * + * 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. + */ + +#include +#include +#include + +#include +#include + +#include "madera.h" + +static const struct reg_sequence cs47l90_reva_16_patch[] = { + { 0x8A, 0x }, + { 0x8A, 0x }, + { 0x4CF, 0x0700 }, + { 0x171, 0x0003 }, + { 0x101, 0x0444 }, + { 0x159, 0x0002 }, + { 0x120, 0x0444 }, + { 0x1D1, 0x0004 }, + { 0x1E0, 0xC084 }, + { 0x159, 0x }, + { 0x120, 0x0404 }, + { 0x101, 0x0404 }, + { 0x171, 0x0002 }, + { 0x17A, 0x2906 }, + { 0x19A, 0x2906 }, + { 0x441, 0xC750 }, + { 0x340, 0x0001 }, + { 0x112, 0x0405 }, + { 0x124, 0x0C49 }, + { 0x1300, 0x050E }, + { 0x1302, 0x0101 }, + { 0x1380, 0x0425 }, + { 0x1381, 0xF6D8 }, + { 0x1382, 0x0632 }, + { 0x1383, 0xFEC8 }, + { 0x1390, 0x042F }, + { 0x1391, 0xF6CA }, + { 0x1392, 0x0637 }, + { 0x1393, 0xFEC8 }, + { 0x281, 0x }, + { 0x282, 0x }, + { 0x4EA, 0x0100 }, + { 0x8A, 0x }, + { 0x8A, 0x }, +}; + +int cs47l90_patch(struct madera *madera) +{ + int ret; + + ret = regmap_register_patch(madera->regmap, + cs47l90_reva_16_patch, + ARRAY_SIZE(cs47l90_reva_16_patch)); + if (ret < 0) { + dev_err(madera->dev, + "Error in applying 16-bit patch: %d\n", ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(cs47l90_patch); + +static const struct reg_default cs47l90_reg_default[] = { + { 0x0020, 0x }, /* R32 (0x20) - Tone Generator 1 */ + { 0x0021, 0x1000 }, /* R33 (0x21) - Tone Generator 2 */ + { 0x0022, 0x }, /* R34 (0x22) - Tone Generator 3 */ + { 0x0023, 0x1000 }, /* R35 (0x23) - Tone Generator 4 */ + { 0x0024, 0x }, /* R36 (0x24) - Tone Generator 5 */ + { 0x0030, 0x }, /* R48 (0x30) - PWM Drive 1 */ + { 0x0031, 0x0100 }, /* R49 (0x31) - PWM Drive 2 */ + { 0x0032, 0x0100 }, /* R50 (0x32) - PWM Drive 3 */ + { 0x0061, 0x01ff }, /* R97 (0x61) - Sample Rate Sequence Select 1 */ + { 0x0062, 0x01ff }, /* R98 (0x62) - Sample Rate Sequence Select 2 */ + { 0x0063, 0x01ff }, /* R99 (0x63) - Sample Rate Sequence Select 3 */ + { 0x0064, 0x01ff }, /* R100 (0x64) - Sample Rate Sequence Select 4 */ + { 0x0066, 0x01ff }, /* R102 (0x66) - Always On Triggers Sequence Select 1 */ + { 0x0067, 0x01ff }, /* R103 (0x67) - Always On Triggers Sequence Select 2 */ + { 0x0090, 0x }, /* R144 (0x90) - Haptics Control 1 */ + { 0x0091, 0x7fff }, /* R145 (0x91) - Haptics Control 2 */ + { 0x0092, 0x }, /* R146 (0x92) - Haptics phase 1 intensity */ + { 0x0093, 0x }, /* R147 (0x93) - Haptics phase 1 duration */ + { 0x0094, 0x
[PATCH 05/16] mfd: madera: Register map tables for Cirrus Logic CS47L90/91
Regmap configuration tables for Cirrus Logic CS47L90 and CS47L91 codecs. Signed-off-by: Nikesh Oswal Signed-off-by: Richard Fitzgerald Signed-off-by: Charles Keepax --- drivers/mfd/Kconfig |6 + drivers/mfd/Makefile |3 + drivers/mfd/cs47l90-tables.c | 2830 ++ 3 files changed, 2839 insertions(+) create mode 100644 drivers/mfd/cs47l90-tables.c diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 6618972..f7cb99c 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -238,6 +238,12 @@ config MFD_CS47L85 help Support for Cirrus Logic CS47L85 Smart Codec +config MFD_CS47L90 + bool "Cirrus Logic CS47L90/91" + depends on MFD_MADERA + help + Support for Cirrus Logic CS47L90 and CS47L91 Smart Codecs + config MFD_ASIC3 bool "Compaq ASIC3" depends on GPIOLIB && ARM diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9fdca9a..542da6d 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -79,6 +79,9 @@ endif ifeq ($(CONFIG_MFD_CS47L85),y) obj-$(CONFIG_MFD_MADERA) += cs47l85-tables.o endif +ifeq ($(CONFIG_MFD_CS47L90),y) +obj-$(CONFIG_MFD_MADERA) += cs47l90-tables.o +endif obj-$(CONFIG_MFD_MADERA_I2C) += madera-i2c.o obj-$(CONFIG_MFD_MADERA_SPI) += madera-spi.o diff --git a/drivers/mfd/cs47l90-tables.c b/drivers/mfd/cs47l90-tables.c new file mode 100644 index 000..52ce50f --- /dev/null +++ b/drivers/mfd/cs47l90-tables.c @@ -0,0 +1,2830 @@ +/* + * Regmap tables for CS47L90 codec + * + * Copyright 2015-2016 Cirrus Logic + * + * Author: Nikesh Oswal + * + * 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. + */ + +#include +#include +#include + +#include +#include + +#include "madera.h" + +static const struct reg_sequence cs47l90_reva_16_patch[] = { + { 0x8A, 0x }, + { 0x8A, 0x }, + { 0x4CF, 0x0700 }, + { 0x171, 0x0003 }, + { 0x101, 0x0444 }, + { 0x159, 0x0002 }, + { 0x120, 0x0444 }, + { 0x1D1, 0x0004 }, + { 0x1E0, 0xC084 }, + { 0x159, 0x }, + { 0x120, 0x0404 }, + { 0x101, 0x0404 }, + { 0x171, 0x0002 }, + { 0x17A, 0x2906 }, + { 0x19A, 0x2906 }, + { 0x441, 0xC750 }, + { 0x340, 0x0001 }, + { 0x112, 0x0405 }, + { 0x124, 0x0C49 }, + { 0x1300, 0x050E }, + { 0x1302, 0x0101 }, + { 0x1380, 0x0425 }, + { 0x1381, 0xF6D8 }, + { 0x1382, 0x0632 }, + { 0x1383, 0xFEC8 }, + { 0x1390, 0x042F }, + { 0x1391, 0xF6CA }, + { 0x1392, 0x0637 }, + { 0x1393, 0xFEC8 }, + { 0x281, 0x }, + { 0x282, 0x }, + { 0x4EA, 0x0100 }, + { 0x8A, 0x }, + { 0x8A, 0x }, +}; + +int cs47l90_patch(struct madera *madera) +{ + int ret; + + ret = regmap_register_patch(madera->regmap, + cs47l90_reva_16_patch, + ARRAY_SIZE(cs47l90_reva_16_patch)); + if (ret < 0) { + dev_err(madera->dev, + "Error in applying 16-bit patch: %d\n", ret); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(cs47l90_patch); + +static const struct reg_default cs47l90_reg_default[] = { + { 0x0020, 0x }, /* R32 (0x20) - Tone Generator 1 */ + { 0x0021, 0x1000 }, /* R33 (0x21) - Tone Generator 2 */ + { 0x0022, 0x }, /* R34 (0x22) - Tone Generator 3 */ + { 0x0023, 0x1000 }, /* R35 (0x23) - Tone Generator 4 */ + { 0x0024, 0x }, /* R36 (0x24) - Tone Generator 5 */ + { 0x0030, 0x }, /* R48 (0x30) - PWM Drive 1 */ + { 0x0031, 0x0100 }, /* R49 (0x31) - PWM Drive 2 */ + { 0x0032, 0x0100 }, /* R50 (0x32) - PWM Drive 3 */ + { 0x0061, 0x01ff }, /* R97 (0x61) - Sample Rate Sequence Select 1 */ + { 0x0062, 0x01ff }, /* R98 (0x62) - Sample Rate Sequence Select 2 */ + { 0x0063, 0x01ff }, /* R99 (0x63) - Sample Rate Sequence Select 3 */ + { 0x0064, 0x01ff }, /* R100 (0x64) - Sample Rate Sequence Select 4 */ + { 0x0066, 0x01ff }, /* R102 (0x66) - Always On Triggers Sequence Select 1 */ + { 0x0067, 0x01ff }, /* R103 (0x67) - Always On Triggers Sequence Select 2 */ + { 0x0090, 0x }, /* R144 (0x90) - Haptics Control 1 */ + { 0x0091, 0x7fff }, /* R145 (0x91) - Haptics Control 2 */ + { 0x0092, 0x }, /* R146 (0x92) - Haptics phase 1 intensity */ + { 0x0093, 0x }, /* R147 (0x93) - Haptics phase 1 duration */ + { 0x0094, 0x }, /* R148 (0x94) - Haptics phase 2 intensity */ + { 0x0095, 0x }, /* R149 (0x95) - Haptics phase 2 duration */ + {