mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
ASoC: tlv320adcx140: Configure PDM sampling edge
Configure the PDM sampling edges based on the values from the firmware. Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200514123338.20392-3-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
75b0adbb08
commit
79fc48e41e
@ -760,6 +760,10 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
|
||||
int sleep_cfg_val = ADCX140_WAKE_DEV;
|
||||
u8 bias_source;
|
||||
u8 vref_source;
|
||||
int pdm_count;
|
||||
u32 pdm_edges[ADCX140_NUM_PDM_EDGES];
|
||||
u32 pdm_edge_val = 0;
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
ret = device_property_read_u8(adcx140->dev, "ti,mic-bias-source",
|
||||
@ -786,6 +790,24 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
|
||||
|
||||
bias_source |= vref_source;
|
||||
|
||||
pdm_count = device_property_count_u32(adcx140->dev,
|
||||
"ti,pdm-edge-select");
|
||||
if (pdm_count <= ADCX140_NUM_PDM_EDGES && pdm_count > 0) {
|
||||
ret = device_property_read_u32_array(adcx140->dev,
|
||||
"ti,pdm-edge-select",
|
||||
pdm_edges, pdm_count);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < pdm_count; i++)
|
||||
pdm_edge_val |= pdm_edges[i] << (ADCX140_PDM_EDGE_SHIFT - i);
|
||||
|
||||
ret = regmap_write(adcx140->regmap, ADCX140_PDM_CFG,
|
||||
pdm_edge_val);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = adcx140_reset(adcx140);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
@ -128,4 +128,7 @@
|
||||
|
||||
#define ADCX140_TX_OFFSET_MASK GENMASK(4, 0)
|
||||
|
||||
#define ADCX140_NUM_PDM_EDGES 4
|
||||
#define ADCX140_PDM_EDGE_SHIFT 7
|
||||
|
||||
#endif /* _TLV320ADCX140_ */
|
||||
|
Loading…
Reference in New Issue
Block a user