More minor SDCA changes
Subsystems (3)
Charles Keepax
maintainercover More minor SDCA changes
A small chain with some patches that seem to have got lost in the process. One small additional bug fix for the regmap callbacks, and one small feature addition for the control parsing.
Charles Keepax (2):
ASoC: SDCA: Fix some holes in the regmap readable/writeable helpers
ASoC: SDCA: Add support for -cn- value properties
include/sound/sdca_function.h | 14 ++--- sound/soc/sdca/sdca_functions.c | 99 +++++++++++++++++++++------------ sound/soc/sdca/sdca_regmap.c | 29 ++++++++-- 3 files changed, 92 insertions(+), 50 deletions(-)
Signature · 1 line
2.39.5
Charles Keepax
maintainerPATCH 1/2 ASoC: SDCA: Fix some holes in the regmap readable/writeable helpers
The current regmap readable/writeable helper functions always allow the Next flag and allows any Control Number. Mask the Next flag based on SDCA_ACCESS_MODE_DUAL which is the only Mode that supports it. Also check that the Control Number is valid for the given control.
--- sound/soc/sdca/sdca_regmap.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
sound/soc/sdca/sdca_regmap.c +14 -2
@@ -72,12 +72,18 @@ bool sdca_regmap_readable(struct sdca_function_data *function, unsigned int reg)if (!control)return false; +if (!(BIT (SDW_SDCA_CTL_CNUM (reg)) & control->cn_list)) +return false; +switch (control->mode) {case SDCA_ACCESS_MODE_RW :case SDCA_ACCESS_MODE_RO : -case SDCA_ACCESS_MODE_DUAL :case SDCA_ACCESS_MODE_RW1S :case SDCA_ACCESS_MODE_RW1C : +if (SDW_SDCA_NEXT_CTL (0 ) & reg) +return false; + fallthrough; +case SDCA_ACCESS_MODE_DUAL :/* No access to registers marked solely for device use */ return control->layers & ~SDCA_ACCESS_LAYER_DEVICE ;default :
@@ -104,11 +110,17 @@ bool sdca_regmap_writeable(struct sdca_function_data *function, unsigned int regif (!control)return false; +if (!(BIT (SDW_SDCA_CTL_CNUM (reg)) & control->cn_list)) +return false; +switch (control->mode) {case SDCA_ACCESS_MODE_RW : -case SDCA_ACCESS_MODE_DUAL :case SDCA_ACCESS_MODE_RW1S :case SDCA_ACCESS_MODE_RW1C : +if (SDW_SDCA_NEXT_CTL (0 ) & reg) +return false; + fallthrough; +case SDCA_ACCESS_MODE_DUAL :/* No access to registers marked solely for device use */ return control->layers & ~SDCA_ACCESS_LAYER_DEVICE ;default :
Signature · 1 line
2.39.5
Charles Keepax
maintainerPATCH 2/2 ASoC: SDCA: Add support for -cn- value properties
In reply to Charles KeepaxMany of the DisCo properties that specify Control values have an additional variant that specifies a separate value for each Control Number. Add support for these.
--- include/sound/sdca_function.h | 14 ++--- sound/soc/sdca/sdca_functions.c | 99 +++++++++++++++++++++------------ sound/soc/sdca/sdca_regmap.c | 13 +++-- 3 files changed, 78 insertions(+), 48 deletions(-)
include/sound/sdca_function.h +7 -7
@@ -742,14 +742,14 @@ struct sdca_control_range {* struct sdca_control - information for one SDCA Control * @label: Name for the Control, from SDCA Specification v1.0, section 7.1.7. * @sel: Identifier used for addressing. -* @value: Holds the Control value for constants and defaults. * @nbits: Number of bits used in the Control. -* @interrupt_position: SCDA interrupt line that will alert to changes on this -* Control. +* @values: Holds the Control value for constants and defaults. * @cn_list: A bitmask showing the valid Control Numbers within this Control, * Control Numbers typically represent channels. -* @range: Buffer describing valid range of values for the Control. +* @interrupt_position: SCDA interrupt line that will alert to changes on this +* Control. * @type: Format of the data in the Control. +* @range: Buffer describing valid range of values for the Control. * @mode: Access mode of the Control. * @layers: Bitmask of access layers of the Control. * @deferrable: Indicates if the access to the Control can be deferred.
@@ -760,13 +760,13 @@ struct sdca_control {const char *label;int sel; -int value;int nbits; -int interrupt_position; +int *values;u64 cn_list; +int interrupt_position; -struct sdca_control_range range;enum sdca_control_datatype type; +struct sdca_control_range range;enum sdca_access_mode mode;u8 layers;
sound/soc/sdca/sdca_functions.c +62 -37
140 lines not on this page · raw message
sound/soc/sdca/sdca_regmap.c +9 -4
@@ -253,7 +253,7 @@ int sdca_regmap_populate_constants(struct device *dev,struct sdca_function_data *function, struct reg_default *consts) { - int i, j, k; + int i, j, k, l;for (i =0 , k =0 ; i < function->num_entities; i++) {struct sdca_entity *entity = &function->entities[i];
@@ -265,13 +265,15 @@ int sdca_regmap_populate_constants(struct device *dev,if (control->mode !=SDCA_ACCESS_MODE_DC )continue ; + l =0 ;for_each_set_bit (cn, (unsigned long *)&control->cn_list,BITS_PER_TYPE (control->cn_list)) { consts[k].reg =SDW_SDCA_CTL (function->desc->adr, entity->id, control->sel, cn); - consts[k].def = control->value; + consts[k].def = control->values[l]; k++; + l++; } } }
@@ -295,7 +297,7 @@ EXPORT_SYMBOL_NS(sdca_regmap_populate_constants, "SND_SOC_SDCA");int sdca_regmap_write_defaults (struct device *dev,struct regmap *regmap,struct sdca_function_data *function) { -int i, j; +int i, j, k;int ret;for (i =0 ; i < function->num_entities; i++) {
@@ -311,6 +313,7 @@ int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap,if (!control->has_default && !control->has_fixed)continue ; + k =0 ;for_each_set_bit (cn, (unsigned long *)&control->cn_list,BITS_PER_TYPE (control->cn_list)) {unsigned int reg;
@@ -318,9 +321,11 @@ int sdca_regmap_write_defaults(struct device *dev, struct regmap *regmap, reg =SDW_SDCA_CTL (function->desc->adr, entity->id, control->sel, cn); - ret =regmap_write (regmap, reg, control->value); + ret =regmap_write (regmap, reg, control->values[k]);if (ret)return ret; + + k++; } } }
Signature · 1 line
2.39.5
Mark Brown
maintainerQuoted 9 lines · Charles Keepax
A small chain with some patches that seem to have got lost in the process. One small additional bug fix for the regmap callbacks, and one small feature addition for the control parsing.
Charles Keepax (2):
ASoC: SDCA: Fix some holes in the regmap readable/writeable helpers
ASoC: SDCA: Add support for -cn- value properties[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: SDCA: Fix some holes in the regmap readable/writeable helpers
commit: 061fade7a67f6cdfe918a675270d84107abbef61
[2/2] ASoC: SDCA: Add support for -cn- value properties
commit: 50a479527ef01f9b36dde1803a7e81741a222509All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark