]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ASoC: renesas: fsi: Move fsi_clk_init()
authorbui duc phuc <phucduc.bui@gmail.com>
Tue, 9 Jun 2026 11:38:31 +0000 (18:38 +0700)
committerMark Brown <broonie@kernel.org>
Tue, 9 Jun 2026 23:33:48 +0000 (00:33 +0100)
Move fsi_clk_init() after set_rate() functions to prepare for subsequent
refactoring.

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260609113836.45079-7-phucduc.bui@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/renesas/fsi.c

index 3e3c6fd7c56b80a7d5f55c6e4cf30e334aaf59a6..1df7dc014363054292948116b49f0b41e6acd7a6 100644 (file)
@@ -717,70 +717,6 @@ static void fsi_spdif_clk_ctrl(struct fsi_priv *fsi, int enable)
 /*
  *             clock function
  */
-static int fsi_clk_init(struct device *dev,
-                       struct fsi_priv *fsi,
-                       int xck,
-                       int ick,
-                       int div,
-                       int (*set_rate)(struct device *dev,
-                                       struct fsi_priv *fsi))
-{
-       struct fsi_clk *clock = &fsi->clock;
-       int is_porta = fsi_is_port_a(fsi);
-
-       clock->xck      = NULL;
-       clock->ick      = NULL;
-       clock->div      = NULL;
-       clock->rate     = 0;
-       clock->count    = 0;
-       clock->set_rate = set_rate;
-
-       clock->own = devm_clk_get(dev, NULL);
-       if (IS_ERR(clock->own))
-               return -EINVAL;
-
-       /* external clock */
-       if (xck) {
-               clock->xck = devm_clk_get(dev, is_porta ? "xcka" : "xckb");
-               if (IS_ERR(clock->xck)) {
-                       dev_err(dev, "can't get xck clock\n");
-                       return -EINVAL;
-               }
-               if (clock->xck == clock->own) {
-                       dev_err(dev, "cpu doesn't support xck clock\n");
-                       return -EINVAL;
-               }
-       }
-
-       /* FSIACLK/FSIBCLK */
-       if (ick) {
-               clock->ick = devm_clk_get(dev,  is_porta ? "icka" : "ickb");
-               if (IS_ERR(clock->ick)) {
-                       dev_err(dev, "can't get ick clock\n");
-                       return -EINVAL;
-               }
-               if (clock->ick == clock->own) {
-                       dev_err(dev, "cpu doesn't support ick clock\n");
-                       return -EINVAL;
-               }
-       }
-
-       /* FSI-DIV */
-       if (div) {
-               clock->div = devm_clk_get(dev,  is_porta ? "diva" : "divb");
-               if (IS_ERR(clock->div)) {
-                       dev_err(dev, "can't get div clock\n");
-                       return -EINVAL;
-               }
-               if (clock->div == clock->own) {
-                       dev_err(dev, "cpu doesn't support div clock\n");
-                       return -EINVAL;
-               }
-       }
-
-       return 0;
-}
-
 #define fsi_clk_invalid(fsi) fsi_clk_valid(fsi, 0)
 static void fsi_clk_valid(struct fsi_priv *fsi, unsigned long rate)
 {
@@ -1034,6 +970,70 @@ static int fsi_clk_set_rate_cpg(struct device *dev,
        return ret;
 }
 
+static int fsi_clk_init(struct device *dev,
+                       struct fsi_priv *fsi,
+                       int xck,
+                       int ick,
+                       int div,
+                       int (*set_rate)(struct device *dev,
+                                       struct fsi_priv *fsi))
+{
+       struct fsi_clk *clock = &fsi->clock;
+       int is_porta = fsi_is_port_a(fsi);
+
+       clock->xck      = NULL;
+       clock->ick      = NULL;
+       clock->div      = NULL;
+       clock->rate     = 0;
+       clock->count    = 0;
+       clock->set_rate = set_rate;
+
+       clock->own = devm_clk_get(dev, NULL);
+       if (IS_ERR(clock->own))
+               return -EINVAL;
+
+       /* external clock */
+       if (xck) {
+               clock->xck = devm_clk_get(dev, is_porta ? "xcka" : "xckb");
+               if (IS_ERR(clock->xck)) {
+                       dev_err(dev, "can't get xck clock\n");
+                       return -EINVAL;
+               }
+               if (clock->xck == clock->own) {
+                       dev_err(dev, "cpu doesn't support xck clock\n");
+                       return -EINVAL;
+               }
+       }
+
+       /* FSIACLK/FSIBCLK */
+       if (ick) {
+               clock->ick = devm_clk_get(dev,  is_porta ? "icka" : "ickb");
+               if (IS_ERR(clock->ick)) {
+                       dev_err(dev, "can't get ick clock\n");
+                       return -EINVAL;
+               }
+               if (clock->ick == clock->own) {
+                       dev_err(dev, "cpu doesn't support ick clock\n");
+                       return -EINVAL;
+               }
+       }
+
+       /* FSI-DIV */
+       if (div) {
+               clock->div = devm_clk_get(dev,  is_porta ? "diva" : "divb");
+               if (IS_ERR(clock->div)) {
+                       dev_err(dev, "can't get div clock\n");
+                       return -EINVAL;
+               }
+               if (clock->div == clock->own) {
+                       dev_err(dev, "cpu doesn't support div clock\n");
+                       return -EINVAL;
+               }
+       }
+
+       return 0;
+}
+
 static void fsi_pointer_update(struct fsi_stream *io, int size)
 {
        io->buff_sample_pos += size;