Add driver for SAMA7G5's PDMC
Merge series from Codrin Ciubotariu <codrin.ciubotariu@microchip.com>: This patch series adds support for Pulse Density Microphone Controller (PDMC), present on Microchip's SAMA7G5. The PDMC interfaces up to 4 digital microphones having Pulse Density Modulated (PDM) outputs. It generates a single clock line and samples 1 or 2 data lines. The signal path includes an audio grade programmable decimation filter and outputs 24-bit audio words. The source of each channel can be independently defined as PDMC_DS0 or PDMC_DS1, sampled at the rising or falling edge of PDMC_CLK. The patch series starts with a fix on the ASoC DMA engine support. Then continues with the bindings and the driver of PDMC. It is followed by the DT nodes for SAMA7G5 and SAMA7G5-EK. In the end, the drivers for PDMC and PDM microphones are enabled in sama7_defconfig.
This commit is contained in:
commit
6b1b0f7d7d
100
Documentation/devicetree/bindings/sound/microchip,pdmc.yaml
Normal file
100
Documentation/devicetree/bindings/sound/microchip,pdmc.yaml
Normal file
@ -0,0 +1,100 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/sound/microchip,pdmc.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Microchip Pulse Density Microphone Controller
|
||||
|
||||
maintainers:
|
||||
- Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
|
||||
|
||||
description:
|
||||
The Microchip Pulse Density Microphone Controller (PDMC) interfaces up to 4
|
||||
digital microphones having Pulse Density Modulated (PDM) outputs.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: microchip,sama7g5-pdmc
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
"#sound-dai-cells":
|
||||
const: 0
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
items:
|
||||
- description: Peripheral Bus Clock
|
||||
- description: Generic Clock
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: pclk
|
||||
- const: gclk
|
||||
|
||||
dmas:
|
||||
description: RX DMA Channel
|
||||
maxItems: 1
|
||||
|
||||
dma-names:
|
||||
const: rx
|
||||
|
||||
microchip,mic-pos:
|
||||
description: |
|
||||
Position of PDM microphones on the DS line and the sampling edge (rising
|
||||
or falling) of the CLK line. A microphone is represented as a pair of DS
|
||||
line and the sampling edge. The first microphone is mapped to channel 0,
|
||||
the second to channel 1, etc.
|
||||
$ref: /schemas/types.yaml#/definitions/uint32-matrix
|
||||
items:
|
||||
items:
|
||||
- description: value for DS line
|
||||
- description: value for sampling edge
|
||||
anyOf:
|
||||
- enum:
|
||||
- [0, 0]
|
||||
- [0, 1]
|
||||
- [1, 0]
|
||||
- [1, 1]
|
||||
minItems: 1
|
||||
maxItems: 4
|
||||
uniqueItems: true
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- "#sound-dai-cells"
|
||||
- interrupts
|
||||
- clocks
|
||||
- clock-names
|
||||
- dmas
|
||||
- dma-names
|
||||
- microchip,mic-pos
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/clock/at91.h>
|
||||
#include <dt-bindings/dma/at91.h>
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/sound/microchip,pdmc.h>
|
||||
|
||||
pdmc: sound@e1608000 {
|
||||
compatible = "microchip,sama7g5-pdmc";
|
||||
reg = <0xe1608000 0x4000>;
|
||||
#sound-dai-cells = <0>;
|
||||
interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
|
||||
dmas = <&dma0 AT91_XDMAC_DT_PERID(37)>;
|
||||
dma-names = "rx";
|
||||
clocks = <&pmc PMC_TYPE_PERIPHERAL 68>, <&pmc PMC_TYPE_GCK 68>;
|
||||
clock-names = "pclk", "gclk";
|
||||
microchip,mic-pos = <MCHP_PDMC_DS0 MCHP_PDMC_CLK_POSITIVE>,
|
||||
<MCHP_PDMC_DS0 MCHP_PDMC_CLK_NEGATIVE>,
|
||||
<MCHP_PDMC_DS1 MCHP_PDMC_CLK_POSITIVE>,
|
||||
<MCHP_PDMC_DS1 MCHP_PDMC_CLK_NEGATIVE>;
|
||||
};
|
13
include/dt-bindings/sound/microchip,pdmc.h
Normal file
13
include/dt-bindings/sound/microchip,pdmc.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __DT_BINDINGS_MICROCHIP_PDMC_H__
|
||||
#define __DT_BINDINGS_MICROCHIP_PDMC_H__
|
||||
|
||||
/* PDM microphone's pin placement */
|
||||
#define MCHP_PDMC_DS0 0
|
||||
#define MCHP_PDMC_DS1 1
|
||||
|
||||
/* PDM microphone clock edge sampling */
|
||||
#define MCHP_PDMC_CLK_POSITIVE 0
|
||||
#define MCHP_PDMC_CLK_NEGATIVE 1
|
||||
|
||||
#endif /* __DT_BINDINGS_MICROCHIP_PDMC_H__ */
|
@ -160,4 +160,20 @@ config SND_MCHP_SOC_SPDIFRX
|
||||
|
||||
This S/PDIF RX driver is compliant with IEC-60958 standard and
|
||||
includes programmable User Data and Channel Status fields.
|
||||
|
||||
config SND_MCHP_SOC_PDMC
|
||||
tristate "Microchip ASoC driver for boards using PDMC"
|
||||
depends on OF && (ARCH_AT91 || COMPILE_TEST)
|
||||
select SND_SOC_GENERIC_DMAENGINE_PCM
|
||||
select REGMAP_MMIO
|
||||
help
|
||||
Say Y or M if you want to add support for Microchip ASoC PDMC driver on the
|
||||
following Microchip platforms:
|
||||
- sama7g5
|
||||
|
||||
The Pulse Density Microphone Controller (PDMC) interfaces up to 4 digital
|
||||
microphones PDM outputs. It generates a single clock line and samples 1 or
|
||||
2 data lines. The signal path includes an audio grade programmable
|
||||
decimation filter and outputs 24-bit audio words.
|
||||
|
||||
endif
|
||||
|
@ -7,6 +7,7 @@ snd-soc-atmel-i2s-objs := atmel-i2s.o
|
||||
snd-soc-mchp-i2s-mcc-objs := mchp-i2s-mcc.o
|
||||
snd-soc-mchp-spdiftx-objs := mchp-spdiftx.o
|
||||
snd-soc-mchp-spdifrx-objs := mchp-spdifrx.o
|
||||
snd-soc-mchp-pdmc-objs := mchp-pdmc.o
|
||||
|
||||
# pdc and dma need to both be built-in if any user of
|
||||
# ssc is built-in.
|
||||
@ -21,6 +22,7 @@ obj-$(CONFIG_SND_ATMEL_SOC_I2S) += snd-soc-atmel-i2s.o
|
||||
obj-$(CONFIG_SND_MCHP_SOC_I2S_MCC) += snd-soc-mchp-i2s-mcc.o
|
||||
obj-$(CONFIG_SND_MCHP_SOC_SPDIFTX) += snd-soc-mchp-spdiftx.o
|
||||
obj-$(CONFIG_SND_MCHP_SOC_SPDIFRX) += snd-soc-mchp-spdifrx.o
|
||||
obj-$(CONFIG_SND_MCHP_SOC_PDMC) += snd-soc-mchp-pdmc.o
|
||||
|
||||
# AT91 Machine Support
|
||||
snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
|
||||
|
1084
sound/soc/atmel/mchp-pdmc.c
Normal file
1084
sound/soc/atmel/mchp-pdmc.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -86,10 +86,10 @@ static int dmaengine_pcm_hw_params(struct snd_soc_component *component,
|
||||
|
||||
memset(&slave_config, 0, sizeof(slave_config));
|
||||
|
||||
if (!pcm->config)
|
||||
prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
|
||||
else
|
||||
if (pcm->config && pcm->config->prepare_slave_config)
|
||||
prepare_slave_config = pcm->config->prepare_slave_config;
|
||||
else
|
||||
prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config;
|
||||
|
||||
if (prepare_slave_config) {
|
||||
int ret = prepare_slave_config(substream, params, &slave_config);
|
||||
|
Loading…
Reference in New Issue
Block a user