Skip to content

Commit e2fad74

Browse files
Fabrice Gasnierjic23
authored andcommitted
iio: adc: stm32-dfsdm: Add support for stm32mp1
Add support for DFSDM (Digital Filter For Sigma Delta Modulators) to STM32MP1. This variant is close to STM32H7 DFSDM, it implements 6 filter instances. Registers map is also increased. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent cbf73ae commit e2fad74

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ It is mainly targeted for:
88
- PDM microphones (audio digital microphone)
99

1010
It features up to 8 serial digital interfaces (SPI or Manchester) and
11-
up to 4 filters on stm32h7.
11+
up to 4 filters on stm32h7 or 6 filters on stm32mp1.
1212

1313
Each child node match with a filter instance.
1414

1515
Contents of a STM32 DFSDM root node:
1616
------------------------------------
1717
Required properties:
18-
- compatible: Should be "st,stm32h7-dfsdm".
18+
- compatible: Should be one of:
19+
"st,stm32h7-dfsdm"
20+
"st,stm32mp1-dfsdm"
1921
- reg: Offset and length of the DFSDM block register set.
2022
- clocks: IP and serial interfaces clocking. Should be set according
2123
to rcc clock ID and "clock-names".
@@ -45,6 +47,7 @@ Required properties:
4547
"st,stm32-dfsdm-adc" for sigma delta ADCs
4648
"st,stm32-dfsdm-dmic" for audio digital microphone.
4749
- reg: Specifies the DFSDM filter instance used.
50+
Valid values are from 0 to 3 on stm32h7, 0 to 5 on stm32mp1.
4851
- interrupts: IRQ lines connected to each DFSDM filter instance.
4952
- st,adc-channels: List of single-ended channels muxed for this ADC.
5053
valid values:

drivers/iio/adc/stm32-dfsdm-core.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ struct stm32_dfsdm_dev_data {
2525

2626
#define STM32H7_DFSDM_NUM_FILTERS 4
2727
#define STM32H7_DFSDM_NUM_CHANNELS 8
28+
#define STM32MP1_DFSDM_NUM_FILTERS 6
29+
#define STM32MP1_DFSDM_NUM_CHANNELS 8
2830

2931
static bool stm32_dfsdm_volatile_reg(struct device *dev, unsigned int reg)
3032
{
@@ -61,6 +63,21 @@ static const struct stm32_dfsdm_dev_data stm32h7_dfsdm_data = {
6163
.regmap_cfg = &stm32h7_dfsdm_regmap_cfg,
6264
};
6365

66+
static const struct regmap_config stm32mp1_dfsdm_regmap_cfg = {
67+
.reg_bits = 32,
68+
.val_bits = 32,
69+
.reg_stride = sizeof(u32),
70+
.max_register = 0x7fc,
71+
.volatile_reg = stm32_dfsdm_volatile_reg,
72+
.fast_io = true,
73+
};
74+
75+
static const struct stm32_dfsdm_dev_data stm32mp1_dfsdm_data = {
76+
.num_filters = STM32MP1_DFSDM_NUM_FILTERS,
77+
.num_channels = STM32MP1_DFSDM_NUM_CHANNELS,
78+
.regmap_cfg = &stm32mp1_dfsdm_regmap_cfg,
79+
};
80+
6481
struct dfsdm_priv {
6582
struct platform_device *pdev; /* platform device */
6683

@@ -248,6 +265,10 @@ static const struct of_device_id stm32_dfsdm_of_match[] = {
248265
.compatible = "st,stm32h7-dfsdm",
249266
.data = &stm32h7_dfsdm_data,
250267
},
268+
{
269+
.compatible = "st,stm32mp1-dfsdm",
270+
.data = &stm32mp1_dfsdm_data,
271+
},
251272
{}
252273
};
253274
MODULE_DEVICE_TABLE(of, stm32_dfsdm_of_match);

0 commit comments

Comments
 (0)