ASoC: dt-bindings: max98396: Document data monitor properties
Subsystems (4)
PATCH v2 1/2 ASoC: dt-bindings: max98396: Document data monitor properties
This device features a data monitor that puts the device in software reset upon a configurable set of events.
---
v1 -> v2: fix a typo and remove a stray blank line
.../bindings/sound/adi,max98396.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+)
Documentation/devicetree/bindings/sound/adi,max98396.yaml +37 -0
@@ -78,6 +78,43 @@ properties: interleaved on a single output channel. type: boolean + adi,dmon-stuck-enable: + description: + Enables the "data monitor stuck" feature. Once the data monitor is + enabled, it actively monitors the selected input data (from DIN) to the + speaker amplifier. Once a data error is detected, the data monitor + automatically places the device into software shutdown. + type: boolean + + adi,dmon-stuck-threshold-bits: + description: + Sets the threshold for the "data monitor stuck" feature, in bits. + $ref: "/schemas/types.yaml#/definitions/uint32" + enum: [9, 11, 13, 15] + default: 15 + + adi,dmon-magnitude-enable: + description: + Enables the "data monitor magnitude" feature. Once the data monitor is + enabled, it actively monitors the selected input data (from DIN) to the + speaker amplifier. Once a data error is detected, the data monitor + automatically places the device into software shutdown. + type: boolean + + adi,dmon-magnitude-threshold-bits: + description: + Sets the threshold for the "data monitor magnitude" feature, in bits. + $ref: "/schemas/types.yaml#/definitions/uint32" + enum: [2, 3, 4, 5] + default: 5 + + adi,dmon-duration-msecs: + description: + Sets the duration for the "data monitor" feature, in milliseconds. + $ref: "/schemas/types.yaml#/definitions/uint32" + enum: [64, 256, 1024, 4096] + default: 64 + reset-gpios: maxItems: 1
Signature · 1 line
2.37.2
PATCH v2 2/2 ASoC: max98396: Make data monitor features configurable
Allow the data monitor features to be enabled explicitly, and enable control over their details.
--- sound/soc/codecs/max98396.c | 102 ++++++++++++++++++++++++++++++++++++ sound/soc/codecs/max98396.h | 14 +++++ 2 files changed, 116 insertions(+)
sound/soc/codecs/max98396.c +102 -0
@@ -1486,6 +1486,87 @@ static int max98396_probe(struct snd_soc_component *component)MAX98396_CLK_MON_AUTO_RESTART_MASK , MAX98396_CLK_MON_AUTO_RESTART_MASK); +regmap_update_bits (max98396->regmap, +MAX98396_R203F_ENABLE_CTRLS , +MAX98396_CTRL_DMON_STUCK_EN_MASK , + max98396->dmon_stuck_enable ? +MAX98396_CTRL_DMON_STUCK_EN_MASK :0 ); + +regmap_update_bits (max98396->regmap, +MAX98396_R203F_ENABLE_CTRLS , +MAX98396_CTRL_DMON_MAG_EN_MASK , + max98396->dmon_mag_enable ? +MAX98396_CTRL_DMON_MAG_EN_MASK :0 ); + +switch (max98396->dmon_duration) { +case 64 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_DURATION_MASK ,0 ); +break ; +case 256 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_DURATION_MASK ,1 ); +break ; +case 1024 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_DURATION_MASK ,2 ); +break ; +case 4096 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_DURATION_MASK ,3 ); +break ; +default : +dev_err (component->dev,"Invalid DMON duration %d\n" , + max98396->dmon_duration); + } + +switch (max98396->dmon_stuck_threshold) { +case 15 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_STUCK_THRESH_MASK , +0 <<MAX98396_DMON_STUCK_THRESH_SHIFT ); +break ; +case 13 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_STUCK_THRESH_MASK , +1 <<MAX98396_DMON_STUCK_THRESH_SHIFT ); +break ; +case 22 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_STUCK_THRESH_MASK , +2 <<MAX98396_DMON_STUCK_THRESH_SHIFT ); +break ; +case 9 : +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_STUCK_THRESH_MASK , +3 <<MAX98396_DMON_STUCK_THRESH_SHIFT ); +break ; +default : +dev_err (component->dev,"Invalid DMON stuck threshold %d\n" , + max98396->dmon_stuck_threshold); + } + +switch (max98396->dmon_mag_threshold) { + case 2 ... 5: +regmap_update_bits (max98396->regmap, +MAX98396_R2039_DATA_MON_CTRL , +MAX98396_DMON_STUCK_THRESH_MASK , + (5 - max98396->dmon_mag_threshold) + <<MAX98396_DMON_MAG_THRESH_SHIFT ); +break ; +default : +dev_err (component->dev,"Invalid DMON magnitude threshold %d\n" , + max98396->dmon_mag_threshold); + } +/* Speaker Amplifier PCM RX Enable by default */ regmap_update_bits(max98396->regmap, MAX98396_R205E_PCM_RX_EN,
@@ -1619,6 +1700,27 @@ static void max98396_read_device_property(struct device *dev, max98396->bypass_slot = value &0xF ; else max98396->bypass_slot = 0; + + max98396->dmon_stuck_enable = +device_property_read_bool (dev,"adi,dmon-stuck-enable" ); + +if (!device_property_read_u32 (dev,"adi,dmon-stuck-threshold-bits" , &value)) + max98396->dmon_stuck_threshold = value; +else + max98396->dmon_stuck_threshold =15 ; + + max98396->dmon_mag_enable = +device_property_read_bool (dev,"adi,dmon-magnitude-enable" ); + +if (!device_property_read_u32 (dev,"adi,dmon-magnitude-threshold-bits" , &value)) + max98396->dmon_mag_threshold = value; +else + max98396->dmon_mag_threshold =5 ; + +if (!device_property_read_u32 (dev,"adi,dmon-duration-msecs" , &value)) + max98396->dmon_duration = value; +else + max98396->dmon_duration =64 ; }static void max98396_core_supplies_disable (void *priv)
sound/soc/codecs/max98396.h +14 -0
@@ -212,8 +212,17 @@#define MAX98396_CLK_MON_AUTO_RESTART_MASK (0x1 << 0)#define MAX98396_CLK_MON_AUTO_RESTART_SHIFT (0) +/* MAX98396_R2039_DATA_MON_CTRL */ +#define MAX98396_DMON_MAG_THRESH_SHIFT (4) +#define MAX98396_DMON_MAG_THRESH_MASK (0x3 << MAX98396_DMON_MAG_THRESH_SHIFT) +#define MAX98396_DMON_STUCK_THRESH_SHIFT (2) +#define MAX98396_DMON_STUCK_THRESH_MASK (0x3 << MAX98396_DMON_STUCK_THRESH_SHIFT) +#define MAX98396_DMON_DURATION_MASK (0x3) +/* MAX98396_R203F_ENABLE_CTRLS */ #define MAX98396_CTRL_CMON_EN_SHIFT (0) +#define MAX98396_CTRL_DMON_STUCK_EN_MASK (0x1 << 1) +#define MAX98396_CTRL_DMON_MAG_EN_MASK (0x1 << 2)/* MAX98396_R2041_PCM_MODE_CFG */ #define MAX98396_PCM_MODE_CFG_FORMAT_MASK (0x7 << 3)
@@ -305,6 +314,11 @@ struct max98396_priv {unsigned int i_slot;unsigned int spkfb_slot;unsigned int bypass_slot; +bool dmon_stuck_enable; +unsigned int dmon_stuck_threshold; +bool dmon_mag_enable; +unsigned int dmon_mag_threshold; +unsigned int dmon_duration;bool interleave_mode;bool tdm_mode;int tdm_max_samplerate;
Signature · 1 line
2.37.2
Rob Herring
maintainerQuoted 10 lines · Daniel Mack
This device features a data monitor that puts the device in software reset upon a configurable set of events.
Signed-off-by Daniel Mack <[email protected]>---
v1 -> v2: fix a typo and remove a stray blank line.../bindings/sound/adi,max98396.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/adi,max98396.yaml: properties:adi,dmon-stuck-threshold-bits: '$ref' should not be valid under {'const': '$ref'}
hint: Standard unit suffix properties don't need a type $ref
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/adi,max98396.yaml: properties:adi,dmon-magnitude-threshold-bits: '$ref' should not be valid under {'const': '$ref'}
hint: Standard unit suffix properties don't need a type $ref
from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/sound/adi,max98396.yaml: ignoring, error in schema: properties: adi,dmon-stuck-threshold-bits Documentation/devicetree/bindings/sound/adi,max98396.example.dtb:0:0: /example-0/i2c/amplifier@39: failed to match any schema with compatible: ['adi,max98396']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.