From 64a648c2204b0c750fe49828158751183d8b5f83 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 25 Jul 2011 11:15:15 +0100 Subject: ASoC: dapm - Add DAPM stream completion event. In preparation for Dynamic PCM (AKA DSP) support. This adds a callback function to be called at the completion of a DAPM stream event. This can be used by DSP components to perform calculations based on DAPM graphs after completion of stream events. Signed-off-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 2 ++ include/sound/soc.h | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index e0583b7769cb..350b1b395cac 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -524,6 +524,8 @@ struct snd_soc_dapm_context { enum snd_soc_bias_level target_bias_level; struct list_head list; + int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); + #ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dapm; #endif diff --git a/include/sound/soc.h b/include/sound/soc.h index aa19f5a32ba8..64a9dd5a69d6 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -634,6 +634,9 @@ struct snd_soc_codec_driver { void (*seq_notifier)(struct snd_soc_dapm_context *, enum snd_soc_dapm_type, int); + /* codec stream completion event */ + int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); + /* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; @@ -669,6 +672,9 @@ struct snd_soc_platform_driver { /* platform stream ops */ struct snd_pcm_ops *ops; + /* platform stream completion event */ + int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); + /* probe ordering - for components with runtime dependencies */ int probe_order; int remove_order; -- cgit v1.2.3 From 79ef0abcd85842bc12ffb3297b958565f060464c Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 1 Aug 2011 13:02:17 +0900 Subject: ASoC: Implement new DC servo readback mode for late WM8994 revisions Later WM8994 devices implement a new DC servo readback mode with the register used to access the offset moved to register 0x59. Implement support for this and enable it on the appropriate devices. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/linux/mfd/wm8994/registers.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h index f3ee84284670..61529143db57 100644 --- a/include/linux/mfd/wm8994/registers.h +++ b/include/linux/mfd/wm8994/registers.h @@ -72,6 +72,7 @@ #define WM8994_DC_SERVO_2 0x55 #define WM8994_DC_SERVO_4 0x57 #define WM8994_DC_SERVO_READBACK 0x58 +#define WM8994_DC_SERVO_4E 0x59 #define WM8994_ANALOGUE_HP_1 0x60 #define WM8958_MIC_DETECT_1 0xD0 #define WM8958_MIC_DETECT_2 0xD1 -- cgit v1.2.3 From be3ea3b9e8df64acb3606055c01291f0b58876a6 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 13 Jun 2011 19:35:29 +0100 Subject: ASoC: Use new register map API for ASoC generic physical I/O Remove all the ASoC specific physical I/O code and replace it with calls into the regmap API. The bulk write code can only be used safely if all regmap calls are locked with the CODEC lock, we need to add bulk support to the regmap API or replace the code with an open coded loop (though currently it has no users...). Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/sound/soc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index aa19f5a32ba8..4d04b4b86aa1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -576,6 +577,7 @@ struct snd_soc_codec { const void *reg_def_copy; const struct snd_soc_cache_ops *cache_ops; struct mutex cache_rw_mutex; + int val_bytes; /* dapm */ struct snd_soc_dapm_context dapm; -- cgit v1.2.3 From 0671da189c1d75eec5f6aba786d57d25209dd2bc Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 24 Jul 2011 12:23:37 +0100 Subject: ASoC: Add regmap as a control type Allow drivers to set up their own regmap API structures. This is mainly useful with MFDs where the core driver will have set up regmap at the minute, though it may make sense to push the existing regmap setup out of the core into the drivers. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/sound/soc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 4d04b4b86aa1..d02269437de3 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -261,6 +261,7 @@ extern struct snd_ac97_bus_ops soc_ac97_ops; enum snd_soc_control_type { SND_SOC_I2C = 1, SND_SOC_SPI, + SND_SOC_REGMAP, }; enum snd_soc_compress_type { -- cgit v1.2.3 From dd898b209577b83283bb62400c96426d7582e5a2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 20 Jul 2011 22:28:58 +0100 Subject: regmap: Add kerneldoc for struct regmap_config Signed-off-by: Mark Brown --- include/linux/regmap.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 60a65cd7e1a0..cf8e4cffd386 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -20,6 +20,12 @@ struct i2c_client; struct spi_device; +/** + * Configuration for the register map of a device. + * + * @reg_bits: Number of bits in a register address, mandatory. + * @val_bits: Number of bits in a register value, mandatory. + */ struct regmap_config { int reg_bits; int val_bits; -- cgit v1.2.3 From 2e2ae66df37a14c9b33889b243b0ae1352ada1dd Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 20 Jul 2011 22:33:39 +0100 Subject: regmap: Allow devices to specify which registers are accessible This is currently unused but we need to know which registers exist and their properties in order to implement diagnostics like register map dumps and the cache features. We use callbacks partly because properties can vary at runtime (eg, through access locks on registers) and partly because big switch statements are a good compromise between readable code and small data size for providing information on big register maps. Signed-off-by: Mark Brown --- include/linux/regmap.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index cf8e4cffd386..aef2b36a8ccf 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -25,10 +25,23 @@ struct spi_device; * * @reg_bits: Number of bits in a register address, mandatory. * @val_bits: Number of bits in a register value, mandatory. + * + * @max_register: Optional, specifies the maximum valid register index. + * @writeable_register: Optional callback returning true if the register + * can be written to. + * @readable_register: Optional callback returning true if the register + * can be read from. + * @volatile_register: Optional callback returning true if the register + * value can't be cached. */ struct regmap_config { int reg_bits; int val_bits; + + unsigned int max_register; + bool (*writeable_reg)(struct device *dev, unsigned int reg); + bool (*readable_reg)(struct device *dev, unsigned int reg); + bool (*volatile_reg)(struct device *dev, unsigned int reg); }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3 From 18694886bddb2d4d905535a0149aeef3b5f9c936 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 8 Aug 2011 15:40:22 +0900 Subject: regmap: Add precious registers to the driver interface Some devices are sensitive to reads on their registers, especially for things like clear on read interrupt status registers. Avoid creating problems with these with things like debugfs by allowing drivers to tell the core about them. If a register is marked as precious then the core will not internally generate any reads of it. Signed-off-by: Mark Brown --- include/linux/regmap.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index aef2b36a8ccf..c878a4bf717e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -33,6 +33,9 @@ struct spi_device; * can be read from. * @volatile_register: Optional callback returning true if the register * value can't be cached. + * @precious_register: Optional callback returning true if the rgister + * should not be read outside of a call from the driver + * (eg, a clear on read interrupt status register). */ struct regmap_config { int reg_bits; @@ -42,6 +45,7 @@ struct regmap_config { bool (*writeable_reg)(struct device *dev, unsigned int reg); bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); + bool (*precious_reg)(struct device *dev, unsigned int reg); }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3 From 3566cc9d90e3f774cea47de6986c59a09090ce2b Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 9 Aug 2011 10:23:22 +0900 Subject: regmap: Fix kerneldoc errors for regmap Field names didn't match between the documentation and the code. Signed-off-by: Mark Brown --- include/linux/regmap.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index c878a4bf717e..4de137bc16a7 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -27,15 +27,15 @@ struct spi_device; * @val_bits: Number of bits in a register value, mandatory. * * @max_register: Optional, specifies the maximum valid register index. - * @writeable_register: Optional callback returning true if the register - * can be written to. - * @readable_register: Optional callback returning true if the register - * can be read from. - * @volatile_register: Optional callback returning true if the register - * value can't be cached. - * @precious_register: Optional callback returning true if the rgister - * should not be read outside of a call from the driver - * (eg, a clear on read interrupt status register). + * @writeable_reg: Optional callback returning true if the register + * can be written to. + * @readable_reg: Optional callback returning true if the register + * can be read from. + * @volatile_reg: Optional callback returning true if the register + * value can't be cached. + * @precious_reg: Optional callback returning true if the rgister + * should not be read outside of a call from the driver + * (eg, a clear on read interrupt status register). */ struct regmap_config { int reg_bits; -- cgit v1.2.3 From c18eee31812d42ecd0aa5c39d21d41c15b30eaab Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 10 Aug 2011 19:25:40 +0900 Subject: ASoC: Add bitfield definitions for WM8958 MICBIAS registers Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/linux/mfd/wm8994/registers.h | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h index 61529143db57..64bf91e4dfa9 100644 --- a/include/linux/mfd/wm8994/registers.h +++ b/include/linux/mfd/wm8994/registers.h @@ -1921,6 +1921,44 @@ #define WM8994_LDO2_DISCH_SHIFT 0 /* LDO2_DISCH */ #define WM8994_LDO2_DISCH_WIDTH 1 /* LDO2_DISCH */ +/* + * R61 (0x3D) - MICBIAS1 + */ +#define WM8958_MICB1_RATE 0x0020 /* MICB1_RATE */ +#define WM8958_MICB1_RATE_MASK 0x0020 /* MICB1_RATE */ +#define WM8958_MICB1_RATE_SHIFT 5 /* MICB1_RATE */ +#define WM8958_MICB1_RATE_WIDTH 1 /* MICB1_RATE */ +#define WM8958_MICB1_MODE 0x0010 /* MICB1_MODE */ +#define WM8958_MICB1_MODE_MASK 0x0010 /* MICB1_MODE */ +#define WM8958_MICB1_MODE_SHIFT 4 /* MICB1_MODE */ +#define WM8958_MICB1_MODE_WIDTH 1 /* MICB1_MODE */ +#define WM8958_MICB1_LVL_MASK 0x000E /* MICB1_LVL - [3:1] */ +#define WM8958_MICB1_LVL_SHIFT 1 /* MICB1_LVL - [3:1] */ +#define WM8958_MICB1_LVL_WIDTH 3 /* MICB1_LVL - [3:1] */ +#define WM8958_MICB1_DISCH 0x0001 /* MICB1_DISCH */ +#define WM8958_MICB1_DISCH_MASK 0x0001 /* MICB1_DISCH */ +#define WM8958_MICB1_DISCH_SHIFT 0 /* MICB1_DISCH */ +#define WM8958_MICB1_DISCH_WIDTH 1 /* MICB1_DISCH */ + +/* + * R62 (0x3E) - MICBIAS2 + */ +#define WM8958_MICB2_RATE 0x0020 /* MICB2_RATE */ +#define WM8958_MICB2_RATE_MASK 0x0020 /* MICB2_RATE */ +#define WM8958_MICB2_RATE_SHIFT 5 /* MICB2_RATE */ +#define WM8958_MICB2_RATE_WIDTH 1 /* MICB2_RATE */ +#define WM8958_MICB2_MODE 0x0010 /* MICB2_MODE */ +#define WM8958_MICB2_MODE_MASK 0x0010 /* MICB2_MODE */ +#define WM8958_MICB2_MODE_SHIFT 4 /* MICB2_MODE */ +#define WM8958_MICB2_MODE_WIDTH 1 /* MICB2_MODE */ +#define WM8958_MICB2_LVL_MASK 0x000E /* MICB2_LVL - [3:1] */ +#define WM8958_MICB2_LVL_SHIFT 1 /* MICB2_LVL - [3:1] */ +#define WM8958_MICB2_LVL_WIDTH 3 /* MICB2_LVL - [3:1] */ +#define WM8958_MICB2_DISCH 0x0001 /* MICB2_DISCH */ +#define WM8958_MICB2_DISCH_MASK 0x0001 /* MICB2_DISCH */ +#define WM8958_MICB2_DISCH_SHIFT 0 /* MICB2_DISCH */ +#define WM8958_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */ + /* * R76 (0x4C) - Charge Pump (1) */ -- cgit v1.2.3 From 1ddc07d0f13a753f8e345e0538562e1899d2bc26 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Tue, 16 Aug 2011 10:08:48 +0900 Subject: ASoC: Add WM8958 noise gate support Signed-off-by: Mark Brown --- include/linux/mfd/wm8994/registers.h | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h index 64bf91e4dfa9..83ecdcd8aaf9 100644 --- a/include/linux/mfd/wm8994/registers.h +++ b/include/linux/mfd/wm8994/registers.h @@ -134,6 +134,8 @@ #define WM8994_AIF1_DAC1_FILTERS_2 0x421 #define WM8994_AIF1_DAC2_FILTERS_1 0x422 #define WM8994_AIF1_DAC2_FILTERS_2 0x423 +#define WM8958_AIF1_DAC1_NOISE_GATE 0x430 +#define WM8958_AIF1_DAC2_NOISE_GATE 0x431 #define WM8994_AIF1_DRC1_1 0x440 #define WM8994_AIF1_DRC1_2 0x441 #define WM8994_AIF1_DRC1_3 0x442 @@ -191,6 +193,7 @@ #define WM8994_AIF2_ADC_FILTERS 0x510 #define WM8994_AIF2_DAC_FILTERS_1 0x520 #define WM8994_AIF2_DAC_FILTERS_2 0x521 +#define WM8958_AIF2_DAC_NOISE_GATE 0x530 #define WM8994_AIF2_DRC_1 0x540 #define WM8994_AIF2_DRC_2 0x541 #define WM8994_AIF2_DRC_3 0x542 @@ -2987,6 +2990,34 @@ #define WM8994_AIF1DAC2_3D_ENA_SHIFT 8 /* AIF1DAC2_3D_ENA */ #define WM8994_AIF1DAC2_3D_ENA_WIDTH 1 /* AIF1DAC2_3D_ENA */ +/* + * R1072 (0x430) - AIF1 DAC1 Noise Gate + */ +#define WM8958_AIF1DAC1_NG_HLD_MASK 0x0060 /* AIF1DAC1_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC1_NG_HLD_SHIFT 5 /* AIF1DAC1_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC1_NG_HLD_WIDTH 2 /* AIF1DAC1_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC1_NG_THR_MASK 0x000E /* AIF1DAC1_NG_THR - [3:1] */ +#define WM8958_AIF1DAC1_NG_THR_SHIFT 1 /* AIF1DAC1_NG_THR - [3:1] */ +#define WM8958_AIF1DAC1_NG_THR_WIDTH 3 /* AIF1DAC1_NG_THR - [3:1] */ +#define WM8958_AIF1DAC1_NG_ENA 0x0001 /* AIF1DAC1_NG_ENA */ +#define WM8958_AIF1DAC1_NG_ENA_MASK 0x0001 /* AIF1DAC1_NG_ENA */ +#define WM8958_AIF1DAC1_NG_ENA_SHIFT 0 /* AIF1DAC1_NG_ENA */ +#define WM8958_AIF1DAC1_NG_ENA_WIDTH 1 /* AIF1DAC1_NG_ENA */ + +/* + * R1073 (0x431) - AIF1 DAC2 Noise Gate + */ +#define WM8958_AIF1DAC2_NG_HLD_MASK 0x0060 /* AIF1DAC2_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC2_NG_HLD_SHIFT 5 /* AIF1DAC2_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC2_NG_HLD_WIDTH 2 /* AIF1DAC2_NG_HLD - [6:5] */ +#define WM8958_AIF1DAC2_NG_THR_MASK 0x000E /* AIF1DAC2_NG_THR - [3:1] */ +#define WM8958_AIF1DAC2_NG_THR_SHIFT 1 /* AIF1DAC2_NG_THR - [3:1] */ +#define WM8958_AIF1DAC2_NG_THR_WIDTH 3 /* AIF1DAC2_NG_THR - [3:1] */ +#define WM8958_AIF1DAC2_NG_ENA 0x0001 /* AIF1DAC2_NG_ENA */ +#define WM8958_AIF1DAC2_NG_ENA_MASK 0x0001 /* AIF1DAC2_NG_ENA */ +#define WM8958_AIF1DAC2_NG_ENA_SHIFT 0 /* AIF1DAC2_NG_ENA */ +#define WM8958_AIF1DAC2_NG_ENA_WIDTH 1 /* AIF1DAC2_NG_ENA */ + /* * R1088 (0x440) - AIF1 DRC1 (1) */ @@ -3598,6 +3629,20 @@ #define WM8994_AIF2DAC_3D_ENA_SHIFT 8 /* AIF2DAC_3D_ENA */ #define WM8994_AIF2DAC_3D_ENA_WIDTH 1 /* AIF2DAC_3D_ENA */ +/* + * R1328 (0x530) - AIF2 DAC Noise Gate + */ +#define WM8958_AIF2DAC_NG_HLD_MASK 0x0060 /* AIF2DAC_NG_HLD - [6:5] */ +#define WM8958_AIF2DAC_NG_HLD_SHIFT 5 /* AIF2DAC_NG_HLD - [6:5] */ +#define WM8958_AIF2DAC_NG_HLD_WIDTH 2 /* AIF2DAC_NG_HLD - [6:5] */ +#define WM8958_AIF2DAC_NG_THR_MASK 0x000E /* AIF2DAC_NG_THR - [3:1] */ +#define WM8958_AIF2DAC_NG_THR_SHIFT 1 /* AIF2DAC_NG_THR - [3:1] */ +#define WM8958_AIF2DAC_NG_THR_WIDTH 3 /* AIF2DAC_NG_THR - [3:1] */ +#define WM8958_AIF2DAC_NG_ENA 0x0001 /* AIF2DAC_NG_ENA */ +#define WM8958_AIF2DAC_NG_ENA_MASK 0x0001 /* AIF2DAC_NG_ENA */ +#define WM8958_AIF2DAC_NG_ENA_SHIFT 0 /* AIF2DAC_NG_ENA */ +#define WM8958_AIF2DAC_NG_ENA_WIDTH 1 /* AIF2DAC_NG_ENA */ + /* * R1344 (0x540) - AIF2 DRC (1) */ -- cgit v1.2.3 From ddd7a26094c93a950f4b2e6b4d5865c93976372e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 15 Aug 2011 20:15:22 +0200 Subject: ASoC: Add ADAU1373 codec support This patch adds support for the Analog Devices ADAU1373 audio codec. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- include/sound/adau1373.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/sound/adau1373.h (limited to 'include') diff --git a/include/sound/adau1373.h b/include/sound/adau1373.h new file mode 100644 index 000000000000..1b19c7666574 --- /dev/null +++ b/include/sound/adau1373.h @@ -0,0 +1,34 @@ +/* + * Analog Devices ADAU1373 Audio Codec drive + * + * Copyright 2011 Analog Devices Inc. + * Author: Lars-Peter Clausen + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __SOUND_ADAU1373_H__ +#define __SOUND_ADAU1373_H__ + +enum adau1373_micbias_voltage { + ADAU1373_MICBIAS_2_9V = 0, + ADAU1373_MICBIAS_2_2V = 1, + ADAU1373_MICBIAS_2_6V = 2, + ADAU1373_MICBIAS_1_8V = 3, +}; + +#define ADAU1373_DRC_SIZE 13 + +struct adau1373_platform_data { + bool input_differential[4]; + bool lineout_differential; + bool lineout_ground_sense; + + unsigned int num_drc; + uint8_t drc_setting[3][ADAU1373_DRC_SIZE]; + + enum adau1373_micbias_voltage micbias1; + enum adau1373_micbias_voltage micbias2; +}; + +#endif -- cgit v1.2.3 From bd20eb541ebbb17a5e047cd20e74b9ccf19a4123 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 19 Aug 2011 18:09:38 +0900 Subject: regmap: Allow drivers to specify register defaults It is useful for the register cache code to be able to specify the default values for the device registers. The major use is when restoring the register cache after suspend, knowing the register defaults allows us to skip registers that are at their default values when we resume which can be a substantial win on larger modern devices. For some devices (mostly older ones) the hardware does not support readback so the only way we can know the values is from code and so initializing the cache with default values makes it much easier for drivers work with read/modify/write updates. Signed-off-by: Mark Brown --- include/linux/regmap.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 4de137bc16a7..e2200f21c602 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -20,13 +20,25 @@ struct i2c_client; struct spi_device; +/** + * Default value for a register. We use an array of structs rather + * than a simple array as many modern devices have very sparse + * register maps. + * + * @reg: Register address. + * @def: Register default value. + */ +struct reg_default { + unsigned int reg; + unsigned int def; +}; + /** * Configuration for the register map of a device. * * @reg_bits: Number of bits in a register address, mandatory. * @val_bits: Number of bits in a register value, mandatory. * - * @max_register: Optional, specifies the maximum valid register index. * @writeable_reg: Optional callback returning true if the register * can be written to. * @readable_reg: Optional callback returning true if the register @@ -36,16 +48,24 @@ struct spi_device; * @precious_reg: Optional callback returning true if the rgister * should not be read outside of a call from the driver * (eg, a clear on read interrupt status register). + * + * @max_register: Optional, specifies the maximum valid register index. + * @reg_defaults: Power on reset values for registers (for use with + * register cache support). + * @num_reg_defaults: Number of elements in reg_defaults. */ struct regmap_config { int reg_bits; int val_bits; - unsigned int max_register; bool (*writeable_reg)(struct device *dev, unsigned int reg); bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg); bool (*precious_reg)(struct device *dev, unsigned int reg); + + unsigned int max_register; + struct reg_default *reg_defaults; + int num_reg_defaults; }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3 From 33c5f969b969c277e96cd9e9bf8472c4b8709c25 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 22 Aug 2011 18:40:30 +0100 Subject: ASoC: Allow idle_bias_off to be specified in CODEC drivers If devices can unconditionally support idle_bias_off let them flag it in their driver structure. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/sound/soc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 3fe658eea28b..6da55a17fcfd 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -633,6 +633,7 @@ struct snd_soc_codec_driver { /* codec bias level */ int (*set_bias_level)(struct snd_soc_codec *, enum snd_soc_bias_level level); + bool idle_bias_off; void (*seq_notifier)(struct snd_soc_dapm_context *, enum snd_soc_dapm_type, int); -- cgit v1.2.3 From 4a8923ba99f559b078cf584f7caad901ada0e5be Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 24 Aug 2011 19:12:49 +0100 Subject: ASoC: Allow register defaults to be larger than unsigned short Devices that need this exist; obviously the newer regmap defaults mechanism will deal with this more happily. Signed-off-by: Mark Brown --- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 6da55a17fcfd..0fc8f15f1aca 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -622,7 +622,7 @@ struct snd_soc_codec_driver { int (*volatile_register)(struct snd_soc_codec *, unsigned int); int (*readable_register)(struct snd_soc_codec *, unsigned int); int (*writable_register)(struct snd_soc_codec *, unsigned int); - short reg_cache_size; + unsigned int reg_cache_size; short reg_cache_step; short reg_word_size; const void *reg_cache_default; -- cgit v1.2.3 From da1c6ea6cf85544292c30295c70a89e8555358bc Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Wed, 24 Aug 2011 20:09:01 +0100 Subject: ASoC: Allow source specification for CODEC level sysclk Similarly to PLLs/FLLs some modern CODECs provide selectable system clock sources. When the clock is the clock for a DAI we do not usually need to identify which clock is being configured so can use clk_id for the source clock but with CODEC wide system clocks we will need to specify both the clock being configured and the source. Add a source argument to the CODEC driver set_sysclk() operation to reflect this. As this operation is not as widely used as the DAI set_sysclk() operation the change is not very invasive. We probably ought to go and make the same alternation for DAIs at some point. Signed-off-by: Mark Brown --- include/sound/soc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/sound/soc.h b/include/sound/soc.h index 0fc8f15f1aca..24e17be38c19 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -276,7 +276,7 @@ enum snd_soc_pcm_subclass { }; int snd_soc_codec_set_sysclk(struct snd_soc_codec *codec, int clk_id, - unsigned int freq, int dir); + int source, unsigned int freq, int dir); int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source, unsigned int freq_in, unsigned int freq_out); @@ -610,7 +610,7 @@ struct snd_soc_codec_driver { /* codec wide operations */ int (*set_sysclk)(struct snd_soc_codec *codec, - int clk_id, unsigned int freq, int dir); + int clk_id, int source, unsigned int freq, int dir); int (*set_pll)(struct snd_soc_codec *codec, int pll_id, int source, unsigned int freq_in, unsigned int freq_out); -- cgit v1.2.3 From 069af897f9a3f70248d4a7ba3d3d439f7cd66d92 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Mon, 5 Sep 2011 20:46:32 +0200 Subject: regmap: Provide device read and write map interface for merging Add the externally visible interface introduced by Lars-Peter's commit 6f3064 (regmap: Add support for device specific write and read flag masks) separately in order to allow merge into other subsystems for integration with drivers. Drivers relying on this feature will not be functional until they are merged with the implementation. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- include/linux/regmap.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index e2200f21c602..003c05349ae5 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -53,6 +53,12 @@ struct reg_default { * @reg_defaults: Power on reset values for registers (for use with * register cache support). * @num_reg_defaults: Number of elements in reg_defaults. + * + * @read_flag_mask: Mask to be set in the top byte of the register when doing + * a read. + * @write_flag_mask: Mask to be set in the top byte of the register when doing + * a write. If both read_flag_mask and write_flag_mask are + * empty the regmap_bus default masks are used. */ struct regmap_config { int reg_bits; @@ -66,6 +72,9 @@ struct regmap_config { unsigned int max_register; struct reg_default *reg_defaults; int num_reg_defaults; + + u8 read_flag_mask; + u8 write_flag_mask; }; typedef int (*regmap_hw_write)(struct device *dev, const void *data, -- cgit v1.2.3 From da07ecd93b196819dcec488b7ebec69a71f3819e Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Sun, 11 Sep 2011 09:53:50 +0100 Subject: regulator: Implement deferred disable support It is a reasonably common pattern for hardware to require some delay after being quiesced before the disable has finalised, especially in mixed signal devices. For example, an active discharge may be required to ensure that the circuit starts up again in a known state. Avoid having to implement such delays in the regulator API by providing regulator_deferred_disable() which will do a regulator_disable() a specified number of milliseconds after it is called. Due to the reference counting done on regulators a deferred disable can be cancelled by doing another regulator_enable(). Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/linux/regulator/consumer.h | 7 +++++++ include/linux/regulator/driver.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'include') diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 26f6ea4444e3..6fae97a6ce7d 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -141,6 +141,7 @@ int regulator_enable(struct regulator *regulator); int regulator_disable(struct regulator *regulator); int regulator_force_disable(struct regulator *regulator); int regulator_is_enabled(struct regulator *regulator); +int regulator_disable_deferred(struct regulator *regulator, int ms); int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers); @@ -211,6 +212,12 @@ static inline int regulator_disable(struct regulator *regulator) return 0; } +static inline int regulator_disable_deferred(struct regulator *regulator, + int ms) +{ + return 0; +} + static inline int regulator_is_enabled(struct regulator *regulator) { return 1; diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 1a80bc77517d..12a1aa04b720 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -199,6 +199,9 @@ struct regulator_dev { struct regulation_constraints *constraints; struct regulator *supply; /* for tree */ + struct delayed_work disable_work; + int deferred_disables; + void *reg_data; /* regulator_dev data */ #ifdef CONFIG_DEBUG_FS -- cgit v1.2.3 From 76067540c642b1a14679ab74bd027a074c23e63b Mon Sep 17 00:00:00 2001 From: Dong Aisheng Date: Wed, 7 Sep 2011 20:51:50 +0800 Subject: ASoC: mxs-saif: add record function 1. add different clkmux mode handling SAIF can use two instances to implement full duplex (playback & recording) and record saif may work on EXTMASTER mode which is using other saif's BITCLK&LRCLK. The clkmux mode could be set in pdata->init() in mach-specific code. For generic saif driver, it only needs to know who is his master and the master id is also provided in mach-specific code. 2. support playback and capture simutaneously however the sample rates can not be different due to hw limitation. Signed-off-by: Dong Aisheng Acked-by: Wolfram Sang Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- include/sound/saif.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 include/sound/saif.h (limited to 'include') diff --git a/include/sound/saif.h b/include/sound/saif.h new file mode 100644 index 000000000000..d0e0de7984ec --- /dev/null +++ b/include/sound/saif.h @@ -0,0 +1,16 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved. + * + * 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 __SOUND_SAIF_H__ +#define __SOUND_SAIF_H__ + +struct mxs_saif_platform_data { + int (*init) (void); + int (*get_master_id) (unsigned int saif_id); +}; +#endif -- cgit v1.2.3 From a69882aec380512e5d6acff9bfc4336dc5162bb4 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Sep 2011 15:39:24 +0300 Subject: MFD: twl6040: Add accessor for revision ID For client driver to use, if they need chip resvision information. Signed-off-by: Peter Ujfalusi Acked-by: Samuel Ortiz Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- include/linux/mfd/twl6040.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index 4c806f6d663e..cb3b82207120 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h @@ -225,4 +225,9 @@ unsigned int twl6040_get_sysclk(struct twl6040 *twl6040); int twl6040_irq_init(struct twl6040 *twl6040); void twl6040_irq_exit(struct twl6040 *twl6040); +static inline int twl6040_get_revid(struct twl6040 *twl6040) +{ + return twl6040->rev; +} + #endif /* End of __TWL6040_CODEC_H__ */ -- cgit v1.2.3 From a52762eee97d42344691c190cf8786dd9edde4d7 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 15 Sep 2011 15:39:27 +0300 Subject: ASoC: twl6040: Chip initialization cleanup There is no need to write to the vio registers at probe time, since most them either read only, or shared with MFD or not used. On the other hand it is a good idea to updated the ASICREV register in the cache at this time. After power up we need to restore some registers. Clean up the list to contain only the registers we are going to restore. Signed-off-by: Peter Ujfalusi Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- include/linux/mfd/twl6040.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/mfd/twl6040.h b/include/linux/mfd/twl6040.h index cb3b82207120..ec1ec794fa23 100644 --- a/include/linux/mfd/twl6040.h +++ b/include/linux/mfd/twl6040.h @@ -70,9 +70,6 @@ #define TWL6040_CACHEREGNUM (TWL6040_REG_STATUS + 1) -#define TWL6040_VIOREGNUM 18 -#define TWL6040_VDDREGNUM 21 - /* INTID (0x03) fields */ #define TWL6040_THINT 0x01 -- cgit v1.2.3