Lines Matching refs:sai

47 	struct stm32_sai_data *sai = dev_get_drvdata(dev);  in stm32_sai_pclk_disable()  local
49 clk_disable_unprepare(sai->pclk); in stm32_sai_pclk_disable()
56 struct stm32_sai_data *sai = dev_get_drvdata(dev); in stm32_sai_pclk_enable() local
59 ret = clk_prepare_enable(sai->pclk); in stm32_sai_pclk_enable()
61 dev_err(&sai->pdev->dev, "failed to enable clock: %d\n", ret); in stm32_sai_pclk_enable()
68 static int stm32_sai_sync_conf_client(struct stm32_sai_data *sai, int synci) in stm32_sai_sync_conf_client() argument
73 ret = stm32_sai_pclk_enable(&sai->pdev->dev); in stm32_sai_sync_conf_client()
77 writel_relaxed(FIELD_PREP(SAI_GCR_SYNCIN_MASK, (synci - 1)), sai->base); in stm32_sai_sync_conf_client()
79 stm32_sai_pclk_disable(&sai->pdev->dev); in stm32_sai_sync_conf_client()
84 static int stm32_sai_sync_conf_provider(struct stm32_sai_data *sai, int synco) in stm32_sai_sync_conf_provider() argument
90 ret = stm32_sai_pclk_enable(&sai->pdev->dev); in stm32_sai_sync_conf_provider()
94 dev_dbg(&sai->pdev->dev, "Set %pOFn%s as synchro provider\n", in stm32_sai_sync_conf_provider()
95 sai->pdev->dev.of_node, in stm32_sai_sync_conf_provider()
98 prev_synco = FIELD_GET(SAI_GCR_SYNCOUT_MASK, readl_relaxed(sai->base)); in stm32_sai_sync_conf_provider()
100 dev_err(&sai->pdev->dev, "%pOFn%s already set as sync provider\n", in stm32_sai_sync_conf_provider()
101 sai->pdev->dev.of_node, in stm32_sai_sync_conf_provider()
103 stm32_sai_pclk_disable(&sai->pdev->dev); in stm32_sai_sync_conf_provider()
107 writel_relaxed(FIELD_PREP(SAI_GCR_SYNCOUT_MASK, synco), sai->base); in stm32_sai_sync_conf_provider()
109 stm32_sai_pclk_disable(&sai->pdev->dev); in stm32_sai_sync_conf_provider()
153 struct stm32_sai_data *sai; in stm32_sai_probe() local
159 sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); in stm32_sai_probe()
160 if (!sai) in stm32_sai_probe()
163 sai->base = devm_platform_ioremap_resource(pdev, 0); in stm32_sai_probe()
164 if (IS_ERR(sai->base)) in stm32_sai_probe()
165 return PTR_ERR(sai->base); in stm32_sai_probe()
169 memcpy(&sai->conf, (const struct stm32_sai_conf *)of_id->data, in stm32_sai_probe()
174 if (!STM_SAI_IS_F4(sai)) { in stm32_sai_probe()
175 sai->pclk = devm_clk_get(&pdev->dev, "pclk"); in stm32_sai_probe()
176 if (IS_ERR(sai->pclk)) in stm32_sai_probe()
177 return dev_err_probe(&pdev->dev, PTR_ERR(sai->pclk), in stm32_sai_probe()
181 sai->clk_x8k = devm_clk_get(&pdev->dev, "x8k"); in stm32_sai_probe()
182 if (IS_ERR(sai->clk_x8k)) in stm32_sai_probe()
183 return dev_err_probe(&pdev->dev, PTR_ERR(sai->clk_x8k), in stm32_sai_probe()
186 sai->clk_x11k = devm_clk_get(&pdev->dev, "x11k"); in stm32_sai_probe()
187 if (IS_ERR(sai->clk_x11k)) in stm32_sai_probe()
188 return dev_err_probe(&pdev->dev, PTR_ERR(sai->clk_x11k), in stm32_sai_probe()
192 sai->irq = platform_get_irq(pdev, 0); in stm32_sai_probe()
193 if (sai->irq < 0) in stm32_sai_probe()
194 return sai->irq; in stm32_sai_probe()
207 ret = clk_prepare_enable(sai->pclk); in stm32_sai_probe()
214 readl_relaxed(sai->base + STM_SAI_IDR)); in stm32_sai_probe()
216 val = readl_relaxed(sai->base + STM_SAI_HWCFGR); in stm32_sai_probe()
217 sai->conf.fifo_size = FIELD_GET(SAI_HWCFGR_FIFO_SIZE, val); in stm32_sai_probe()
218 sai->conf.has_spdif_pdm = !!FIELD_GET(SAI_HWCFGR_SPDIF_PDM, in stm32_sai_probe()
221 val = readl_relaxed(sai->base + STM_SAI_VERR); in stm32_sai_probe()
222 sai->conf.version = val; in stm32_sai_probe()
228 clk_disable_unprepare(sai->pclk); in stm32_sai_probe()
230 sai->pdev = pdev; in stm32_sai_probe()
231 sai->set_sync = &stm32_sai_set_sync; in stm32_sai_probe()
232 platform_set_drvdata(pdev, sai); in stm32_sai_probe()
245 struct stm32_sai_data *sai = dev_get_drvdata(dev); in stm32_sai_suspend() local
252 sai->gcr = readl_relaxed(sai->base); in stm32_sai_suspend()
260 struct stm32_sai_data *sai = dev_get_drvdata(dev); in stm32_sai_resume() local
267 writel_relaxed(sai->gcr, sai->base); in stm32_sai_resume()