]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: clocking-wizard: Allow changing of parent rate for single output
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Wed, 24 Feb 2021 13:10:36 +0000 (18:40 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Mar 2021 08:25:30 +0000 (09:25 +0100)
If there is only one output then allow changing of the parent rate.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/1614172241-17326-5-git-send-email-shubhrajyoti.datta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c

index 9cc2f6d0751ad24332ceb67a692a868e9a23e3ac..e08fc2fcc4915e3df769498defdd97653c20549e 100644 (file)
@@ -138,6 +138,7 @@ static int clk_wzrd_probe(struct platform_device *pdev)
        void __iomem *ctrl_reg;
        struct clk_wzrd *clk_wzrd;
        struct device_node *np = pdev->dev.of_node;
+       int nr_outputs;
        unsigned long flags = 0;
 
        clk_wzrd = devm_kzalloc(&pdev->dev, sizeof(*clk_wzrd), GFP_KERNEL);
@@ -201,6 +202,14 @@ static int clk_wzrd_probe(struct platform_device *pdev)
                goto err_disable_clk;
        }
 
+       ret = of_property_read_u32(np, "nr-outputs", &nr_outputs);
+       if (ret || nr_outputs > WZRD_NUM_OUTPUTS) {
+               ret = -EINVAL;
+               goto err_disable_clk;
+       }
+       if (nr_outputs == 1)
+               flags = CLK_SET_RATE_PARENT;
+
        clk_wzrd->clks_internal[wzrd_clk_mul] = clk_register_fixed_factor
                        (&pdev->dev, clk_name,
                         __clk_get_name(clk_wzrd->clk_in1),