Skip to content

Commit 9931d28

Browse files
TE-N-ShengjiuWangbroonie
authored andcommitted
ASoC: fsl_mqs: Distinguish different modules by system manager indices
On i.MX94, the MQS2 also needs to be configured by SCMI interface, add sm_index variable in struct fsl_mqs_soc_data to distinguish the MQS1 and MQS2 on this platform. Add the system manager indices for i.MX94 in the header file. Signed-off-by: Shengjiu Wang <[email protected]> Reviewed-by: Peng Fan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b27a58e commit 9931d28

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

include/linux/firmware/imx/sm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
#define SCMI_IMX_CTRL_SAI4_MCLK 4 /* WAKE SAI4 MCLK */
1919
#define SCMI_IMX_CTRL_SAI5_MCLK 5 /* WAKE SAI5 MCLK */
2020

21+
#define SCMI_IMX94_CTRL_PDM_CLK_SEL 0U /*!< AON PDM clock sel */
22+
#define SCMI_IMX94_CTRL_MQS1_SETTINGS 1U /*!< AON MQS settings */
23+
#define SCMI_IMX94_CTRL_MQS2_SETTINGS 2U /*!< WAKE MQS settings */
24+
#define SCMI_IMX94_CTRL_SAI1_MCLK 3U /*!< AON SAI1 MCLK */
25+
#define SCMI_IMX94_CTRL_SAI2_MCLK 4U /*!< WAKE SAI2 MCLK */
26+
#define SCMI_IMX94_CTRL_SAI3_MCLK 5U /*!< WAKE SAI3 MCLK */
27+
#define SCMI_IMX94_CTRL_SAI4_MCLK 6U /*!< WAKE SAI4 MCLK */
28+
2129
int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
2230
int scmi_imx_misc_ctrl_set(u32 id, u32 val);
2331

sound/soc/fsl/fsl_mqs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ enum reg_type {
3939
* struct fsl_mqs_soc_data - soc specific data
4040
*
4141
* @type: control register space type
42+
* @sm_index: index from definition in system manager
4243
* @ctrl_off: control register offset
4344
* @en_mask: enable bit mask
4445
* @en_shift: enable bit shift
@@ -51,6 +52,7 @@ enum reg_type {
5152
*/
5253
struct fsl_mqs_soc_data {
5354
enum reg_type type;
55+
int sm_index;
5456
int ctrl_off;
5557
int en_mask;
5658
int en_shift;
@@ -82,7 +84,7 @@ static int fsl_mqs_sm_read(void *context, unsigned int reg, unsigned int *val)
8284

8385
if (IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV) &&
8486
mqs_priv->soc->ctrl_off == reg)
85-
return scmi_imx_misc_ctrl_get(SCMI_IMX_CTRL_MQS1_SETTINGS, &num, val);
87+
return scmi_imx_misc_ctrl_get(mqs_priv->soc->sm_index, &num, val);
8688

8789
return -EINVAL;
8890
};
@@ -93,7 +95,7 @@ static int fsl_mqs_sm_write(void *context, unsigned int reg, unsigned int val)
9395

9496
if (IS_ENABLED(CONFIG_IMX_SCMI_MISC_DRV) &&
9597
mqs_priv->soc->ctrl_off == reg)
96-
return scmi_imx_misc_ctrl_set(SCMI_IMX_CTRL_MQS1_SETTINGS, val);
98+
return scmi_imx_misc_ctrl_set(mqs_priv->soc->sm_index, val);
9799

98100
return -EINVAL;
99101
};
@@ -386,6 +388,7 @@ static const struct fsl_mqs_soc_data fsl_mqs_imx93_data = {
386388

387389
static const struct fsl_mqs_soc_data fsl_mqs_imx95_aon_data = {
388390
.type = TYPE_REG_SM,
391+
.sm_index = SCMI_IMX_CTRL_MQS1_SETTINGS,
389392
.ctrl_off = 0x88,
390393
.en_mask = BIT(1),
391394
.en_shift = 1,
@@ -412,6 +415,7 @@ static const struct fsl_mqs_soc_data fsl_mqs_imx95_netc_data = {
412415

413416
static const struct fsl_mqs_soc_data fsl_mqs_imx943_aon_data = {
414417
.type = TYPE_REG_SM,
418+
.sm_index = SCMI_IMX94_CTRL_MQS1_SETTINGS,
415419
.ctrl_off = 0x88,
416420
.en_mask = BIT(1),
417421
.en_shift = 1,
@@ -424,7 +428,8 @@ static const struct fsl_mqs_soc_data fsl_mqs_imx943_aon_data = {
424428
};
425429

426430
static const struct fsl_mqs_soc_data fsl_mqs_imx943_wakeup_data = {
427-
.type = TYPE_REG_GPR,
431+
.type = TYPE_REG_SM,
432+
.sm_index = SCMI_IMX94_CTRL_MQS2_SETTINGS,
428433
.ctrl_off = 0x10,
429434
.en_mask = BIT(1),
430435
.en_shift = 1,

0 commit comments

Comments
 (0)