// SPDX-License-Identifier: GPL-2.0-only
// Copyright 2026 Cix Technology Group Co., Ltd.
#include <linux/auxiliary_bus.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <dt-bindings/clock/cix,sky1-audss-cru.h>
#define INFO_HIFI0 0x00
#define INFO_CLK_GATE 0x10
#define INFO_CLK_DIV 0x14
#define INFO_CLK_MUX 0x18
#define INFO_MCLK 0x70
#define SKY1_AUDSS_CLK_PARENTS_CNT 4
#define SKY1_AUDSS_NUM_CLKS (CLK_MCLK4 + 1)
static u32 sky1_reg_save[][2] = {
{ INFO_HIFI0, 0 },
{ INFO_CLK_GATE, 0 },
{ INFO_CLK_DIV, 0 },
{ INFO_CLK_MUX, 0 },
{ INFO_MCLK, 0 },
};
static const char * const sky1_audss_clk_names[SKY1_AUDSS_CLK_PARENTS_CNT] = {
"x8k", "x11k", "sys", "48m",
};
static const u32 sky1_clk_rate_default[SKY1_AUDSS_CLK_PARENTS_CNT] = {
294912000,
270950400,
800000000,
48000000,
};
static const char * const dsp_clk_parent[] = {
"audio_clk4"
};
static const char * const dsp_bclk_parent[] = {
"audio_clk4_div2"
};
static const char * const dsp_pbclk_parent[] = {
"audio_clk4_div4"
};
static const char * const sram_axi_parent[] = {
"audio_clk4_div2"
};
static const char * const hda_sys_parent[] = {
"audio_clk4_div2"
};
static const char * const hda_hda_parent[] = {
"audio_clk5"
};
static const char * const dmac_axi_parent[] = {
"audio_clk4_div2"
};
static const char * const wdg_apb_parent[] = {
"audio_clk5_div2"
};
static const char * const wdg_wdg_parent[] = {
"audio_clk5_div2"
};
static const char * const timer_apb_parent[] = {
"audio_clk4_div4"
};
static const char * const timer_timer_parent[] = {
"audio_clk5_div2"
};
static const char * const mailbox_apb_parent[] = {
"audio_clk4_div4"
};
static const char * const i2s_apb_parent[] = {
"audio_clk4_div4"
};
static const char * const i2s0_parents[] = {
"audio_clk0", "audio_clk2"
};
static const char * const i2s1_parents[] = {
"audio_clk0", "audio_clk2"
};
static const char * const i2s2_parents[] = {
"audio_clk0", "audio_clk2"
};
static const char * const i2s3_parents[] = {
"audio_clk0", "audio_clk2"
};
static const char * const i2s4_parents[] = {
"audio_clk0", "audio_clk2"
};
static const char