[PATCH v4 3/5] clk: cix: Register the Sky1 AUDSS IRQ auxiliary device

Brian Masney masneyb at kernel.org
Wed Nov 18 17:42:47 PST 2026


Hi Jelly,

> Register an auxiliary IRQ device for CRU nodes declaring an interrupt
> controller, following the existing reset device pattern. Share a raw-lock
> regmap with the IRQ driver and preserve gate/reset context while powering
> down the CRU. Restore the parent before child IRQ delivery resumes using
> noirq system-sleep ordering.
> 
> The existing reset-sky1-audss.c is unchanged. Auxiliary child teardown must
> run before parent regmap/runtime-PM cleanup.
> 
> Signed-off-by: Jelly Jia <Jelly.Jia at cixtech.com>
> ---
>  drivers/clk/cix/clk-sky1-audss.c | 37 +++++++++++++++++++++++++++++---
>  1 file changed, 34 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/cix/clk-sky1-audss.c b/drivers/clk/cix/clk-sky1-audss.c
> index e096b8121df3..fa51cdf4f4bd 100644
> --- a/drivers/clk/cix/clk-sky1-audss.c
> +++ b/drivers/clk/cix/clk-sky1-audss.c
> @@ -2,6 +2,7 @@
>  // Copyright 2026 Cix Technology Group Co., Ltd.
>  
>  #include <linux/auxiliary_bus.h>
> +#include <linux/bits.h>

This doesn't appear to be needed.

>  #include <linux/clk.h>
>  #include <linux/clk-provider.h>
>  #include <linux/device.h>
> @@ -18,7 +19,9 @@
>  #define INFO_CLK_GATE				0x10
>  #define INFO_CLK_DIV				0x14
>  #define INFO_CLK_MUX				0x18
> +#define INFO_AP_IRQC				0x54
>  #define INFO_MCLK				0x70
> +#define INFO_SW_RESETN				0x78
>  
>  #define SKY1_AUDSS_CLK_PARENTS_CNT		4
>  #define SKY1_AUDSS_NUM_CLKS			(CLK_MCLK4 + 1)
> @@ -28,7 +31,9 @@ static u32 sky1_reg_save[][2] = {
>  	{ INFO_CLK_GATE,  0 },
>  	{ INFO_CLK_DIV, 0 },
>  	{ INFO_CLK_MUX, 0 },
> +	{ INFO_AP_IRQC, 0 },
>  	{ INFO_MCLK, 0 },
> +	{ INFO_SW_RESETN, 0 },

This, along with the defines should go in a separate commit.

>  };
>  
>  static const char * const sky1_audss_clk_names[SKY1_AUDSS_CLK_PARENTS_CNT] = {
> @@ -519,6 +524,7 @@ static const struct regmap_config sky1_audss_regmap_config = {
>  	.reg_bits = 32,
>  	.val_bits = 32,
>  	.reg_stride = 4,
> +	.use_raw_spinlock = true,
>  };
>  
>  struct sky1_audss_clks_priv {
> @@ -928,6 +934,21 @@ static int sky1_audss_clks_enable(struct sky1_audss_clks_priv *priv)
>  	return err;
>  }
>  
> +static int sky1_audss_irq_controller_register(struct device *dev)
> +{
> +	struct auxiliary_device *adev;
> +
> +	if (!IS_ENABLED(CONFIG_IRQ_SKY1_AUDSS) ||
> +	    !of_property_present(dev->of_node, "interrupt-controller"))
> +		return 0;
> +
> +	adev = devm_auxiliary_device_create(dev, "irq", NULL);
> +	if (!adev)
> +		return -ENODEV;
> +
> +	return 0;

The reset registration code currently has:

    #if IS_ENABLED(CONFIG_RESET_SKY1_AUDSS)

    static int sky1_audss_reset_controller_register(struct device *dev)
    {
    ...
    }
    #else
    static int sky1_audss_reset_controller_register(struct device *dev)
    {
    	return 0;
    }

I don't care which pattern you use but make it consistent within this
driver.

> +}
> +
>  static void sky1_audss_clks_disable(struct sky1_audss_clks_priv *priv)
>  {
>  	const struct sky1_audss_clks_devtype_data *devtype_data = priv->devtype_data;
> @@ -1110,6 +1131,13 @@ static int sky1_audss_clk_probe(struct platform_device *pdev)
>  		goto fail_pm;
>  	}
>  
> +	/* Remove auxiliary children before the parent runtime-PM cleanup. */
> +	ret = sky1_audss_irq_controller_register(dev);
> +	if (ret) {
> +		dev_err_probe(dev, ret, "failed to set up AUDSS DMA IRQs\n");
> +		goto fail_pm;
> +	}
> +
>  	pm_runtime_put_sync(dev);
>  
>  	return 0;
> @@ -1125,6 +1153,7 @@ static int __maybe_unused sky1_audss_clk_runtime_suspend(struct device *dev)
>  	const struct sky1_audss_clks_devtype_data *devtype_data = priv->devtype_data;
>  	unsigned long flags;
>  	int i;
> +	int ret;

The ret can be folded into the line above.

>  
>  	spin_lock_irqsave(&priv->lock, flags);
>  	for (i = 0; i < devtype_data->reg_save_size; i++)
> @@ -1132,7 +1161,9 @@ static int __maybe_unused sky1_audss_clk_runtime_suspend(struct device *dev)
>  			    devtype_data->reg_save[i][0], &devtype_data->reg_save[i][1]);
>  	spin_unlock_irqrestore(&priv->lock, flags);
>  
> -	reset_control_assert(priv->rst_noc);
> +	ret = reset_control_assert(priv->rst_noc);
> +	if (ret)
> +		return ret;

Should this be a separate patch?

>  
>  	sky1_audss_clks_disable(priv);
>  
> @@ -1170,8 +1201,8 @@ static int __maybe_unused sky1_audss_clk_runtime_resume(struct device *dev)
>  static const struct dev_pm_ops sky1_audss_clk_pm_ops = {
>  	SET_RUNTIME_PM_OPS(sky1_audss_clk_runtime_suspend,
>  			   sky1_audss_clk_runtime_resume, NULL)
> -	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> -				pm_runtime_force_resume)
> +	SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> +				      pm_runtime_force_resume)

The IRQ driver uses the new pm_ptr(). Please use that.

Brian

-- 
Brian Masney <masneyb at kernel.org>



More information about the linux-arm-kernel mailing list