Lines Matching full:dfsdm

3  * This file is part the core part STM32 DFSDM driver
20 #include "stm32-dfsdm.h"
86 struct stm32_dfsdm dfsdm; /* common data exported for all instances */ member
91 struct clk *clk; /* DFSDM clock */
95 static inline struct dfsdm_priv *to_stm32_dfsdm_priv(struct stm32_dfsdm *dfsdm) in to_stm32_dfsdm_priv() argument
97 return container_of(dfsdm, struct dfsdm_priv, dfsdm); in to_stm32_dfsdm_priv()
100 static int stm32_dfsdm_clk_prepare_enable(struct stm32_dfsdm *dfsdm) in stm32_dfsdm_clk_prepare_enable() argument
102 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_clk_prepare_enable()
116 static void stm32_dfsdm_clk_disable_unprepare(struct stm32_dfsdm *dfsdm) in stm32_dfsdm_clk_disable_unprepare() argument
118 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_clk_disable_unprepare()
125 * stm32_dfsdm_start_dfsdm - start global dfsdm interface.
128 * @dfsdm: Handle used to retrieve dfsdm context.
130 int stm32_dfsdm_start_dfsdm(struct stm32_dfsdm *dfsdm) in stm32_dfsdm_start_dfsdm() argument
132 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_start_dfsdm()
142 /* select clock source, e.g. 0 for "dfsdm" or 1 for "audio" */ in stm32_dfsdm_start_dfsdm()
144 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), in stm32_dfsdm_start_dfsdm()
151 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), in stm32_dfsdm_start_dfsdm()
157 /* Global enable of DFSDM interface */ in stm32_dfsdm_start_dfsdm()
158 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), in stm32_dfsdm_start_dfsdm()
180 * stm32_dfsdm_stop_dfsdm - stop global DFSDM interface.
183 * @dfsdm: Handle used to retrieve dfsdm context.
185 int stm32_dfsdm_stop_dfsdm(struct stm32_dfsdm *dfsdm) in stm32_dfsdm_stop_dfsdm() argument
187 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_stop_dfsdm()
191 /* Global disable of DFSDM interface */ in stm32_dfsdm_stop_dfsdm()
192 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), in stm32_dfsdm_stop_dfsdm()
199 ret = regmap_update_bits(dfsdm->regmap, DFSDM_CHCFGR1(0), in stm32_dfsdm_stop_dfsdm()
226 priv->dfsdm.base = devm_platform_get_and_ioremap_resource(pdev, 0, in stm32_dfsdm_parse_of()
228 if (IS_ERR(priv->dfsdm.base)) in stm32_dfsdm_parse_of()
229 return PTR_ERR(priv->dfsdm.base); in stm32_dfsdm_parse_of()
231 priv->dfsdm.phys_base = res->start; in stm32_dfsdm_parse_of()
234 * "dfsdm" clock is mandatory for DFSDM peripheral clocking. in stm32_dfsdm_parse_of()
235 * "dfsdm" or "audio" clocks can be used as source clock for in stm32_dfsdm_parse_of()
239 priv->clk = devm_clk_get(&pdev->dev, "dfsdm"); in stm32_dfsdm_parse_of()
274 priv->dfsdm.spi_master_freq = clk_freq / (priv->spi_clk_out_div + 1); in stm32_dfsdm_parse_of()
287 .compatible = "st,stm32h7-dfsdm",
291 .compatible = "st,stm32mp1-dfsdm",
302 struct stm32_dfsdm *dfsdm; in stm32_dfsdm_probe() local
313 dfsdm = &priv->dfsdm; in stm32_dfsdm_probe()
314 dfsdm->fl_list = devm_kcalloc(&pdev->dev, dev_data->num_filters, in stm32_dfsdm_probe()
315 sizeof(*dfsdm->fl_list), GFP_KERNEL); in stm32_dfsdm_probe()
316 if (!dfsdm->fl_list) in stm32_dfsdm_probe()
319 dfsdm->num_fls = dev_data->num_filters; in stm32_dfsdm_probe()
320 dfsdm->ch_list = devm_kcalloc(&pdev->dev, dev_data->num_channels, in stm32_dfsdm_probe()
321 sizeof(*dfsdm->ch_list), in stm32_dfsdm_probe()
323 if (!dfsdm->ch_list) in stm32_dfsdm_probe()
325 dfsdm->num_chs = dev_data->num_channels; in stm32_dfsdm_probe()
331 dfsdm->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "dfsdm", in stm32_dfsdm_probe()
332 dfsdm->base, in stm32_dfsdm_probe()
334 if (IS_ERR(dfsdm->regmap)) { in stm32_dfsdm_probe()
335 ret = PTR_ERR(dfsdm->regmap); in stm32_dfsdm_probe()
341 platform_set_drvdata(pdev, dfsdm); in stm32_dfsdm_probe()
343 ret = stm32_dfsdm_clk_prepare_enable(dfsdm); in stm32_dfsdm_probe()
365 stm32_dfsdm_clk_disable_unprepare(dfsdm); in stm32_dfsdm_probe()
372 struct stm32_dfsdm *dfsdm = platform_get_drvdata(pdev); in stm32_dfsdm_core_remove() local
379 stm32_dfsdm_clk_disable_unprepare(dfsdm); in stm32_dfsdm_core_remove()
386 struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev); in stm32_dfsdm_core_suspend() local
387 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_core_suspend()
402 struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev); in stm32_dfsdm_core_resume() local
403 struct dfsdm_priv *priv = to_stm32_dfsdm_priv(dfsdm); in stm32_dfsdm_core_resume()
419 struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev); in stm32_dfsdm_core_runtime_suspend() local
421 stm32_dfsdm_clk_disable_unprepare(dfsdm); in stm32_dfsdm_core_runtime_suspend()
428 struct stm32_dfsdm *dfsdm = dev_get_drvdata(dev); in stm32_dfsdm_core_runtime_resume() local
430 return stm32_dfsdm_clk_prepare_enable(dfsdm); in stm32_dfsdm_core_runtime_resume()
444 .name = "stm32-dfsdm",
453 MODULE_DESCRIPTION("STMicroelectronics STM32 dfsdm driver");