Skip to content

Commit

Permalink
driver: ssp: update Intel SSP DAI driver to support dynamic SSP link …
Browse files Browse the repository at this point in the history
…management

This commit refactors the Intel SSP DAI driver to support dynamic
management of SSP links. The changes include the introduction of a new
structure `intel_ssp_link` to encapsulate SSP link-specific data.

Key changes:
- Add new static functions to manage SSP link power.
- Update the DAI SSP configuration functions to use the new link
  management approach.
- Update device tree bindings and instances to reflect the new SSP link
  management mechanism.

The new approach allows for more flexible and maintainable management of
SSP links.

Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
  • Loading branch information
dnikodem committed Mar 28, 2024
1 parent 36ad49b commit e90b5c7
Show file tree
Hide file tree
Showing 8 changed files with 630 additions and 337 deletions.
665 changes: 385 additions & 280 deletions drivers/dai/intel/ssp/ssp.c

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions drivers/dai/intel/ssp/ssp.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,24 +330,33 @@ struct dai_intel_ssp_plat_data {
struct dai_intel_ssp_mn *mn_inst;
struct dai_intel_ssp_freq_table *ftable;
uint32_t *fsources;
uint32_t clk_active;
};

struct dai_intel_ssp_pdata {
uint32_t sscr0;
uint32_t sscr1;
uint32_t psp;
uint32_t state[2];
uint32_t clk_active;
struct dai_config config;
struct dai_properties props;
};

struct intel_ssp_link {
uint32_t link_index;
int acquire_count;
bool is_initialized;
bool is_power_en;
struct dai_intel_ssp_plat_data ssp_plat_data;
struct dai_intel_ipc3_ssp_params params;
};

struct dai_intel_ssp {
uint32_t index; /**< index */
uint32_t dai_index;
uint32_t link_index;
uint32_t state[2];
struct k_spinlock lock; /**< locking mechanism */
int sref; /**< simple ref counter, guarded by lock */
struct dai_intel_ssp_plat_data plat_data;
struct intel_ssp_link *ssp_link;
void *priv_data;
};

Expand Down
20 changes: 4 additions & 16 deletions dts/bindings/i2s/intel,ssp-dai.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Copyright (c) 2022 Intel Corporation
#
# Copyright (c) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

description: Intel SSP DAI controller
description: Intel SSP DAI node

compatible: "intel,ssp-dai"

Expand All @@ -12,17 +11,6 @@ properties:
reg:
required: true

interrupts:
link:
type: int
required: true

interrupt-parent:
required: true

dmas:
required: true

dma-names:
required: true

i2svss:
type: array
32 changes: 32 additions & 0 deletions dts/bindings/i2s/intel,ssp-link.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright (c) 2024 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0

description: Intel SSP DAI controller

compatible: "intel,ssp-link"

include: base.yaml

properties:
reg:
required: true

link:
type: int
required: true

interrupts:
required: true

interrupt-parent:
required: true

dmas:
required: true

dma-names:
required: true

i2svss:
type: array
78 changes: 66 additions & 12 deletions dts/xtensa/intel/intel_adsp_ace15_mtpm.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@
status = "okay";
};

ssp0: ssp@28000 {
compatible = "intel,ssp-dai";
ssplink0: ssp-link@28000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "intel,ssp-link";
link = <0>;
reg = <0x00028000 0x1000
0x00079C00 0x200>;
interrupts = <0x00 0 0>;
Expand All @@ -262,10 +263,11 @@
reg = <0x28800 0x1000>;
};

ssp1: ssp@29000 {
compatible = "intel,ssp-dai";
ssplink1: ssp-link@29000 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <1>;
reg = <0x00029000 0x1000
0x00079C00 0x200>;
interrupts = <0x01 0 0>;
Expand All @@ -277,10 +279,11 @@
status = "okay";
};

ssp2: ssp@2a000 {
compatible = "intel,ssp-dai";
ssplink2: ssp-link@2a000 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <2>;
reg = <0x0002a000 0x1000
0x00079C00 0x200>;
interrupts = <0x02 0 0>;
Expand All @@ -292,10 +295,11 @@
status = "okay";
};

ssp3: ssp@2b000 {
compatible = "intel,ssp-dai";
ssplink3: ssp-link@2b000 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <3>;
reg = <0x0002b000 0x1000
0x00079C00 0x200>;
interrupts = <0x03 0 0>;
Expand All @@ -307,10 +311,11 @@
status = "okay";
};

ssp4: ssp@2c000 {
compatible = "intel,ssp-dai";
ssplink4: ssp-link@2c000 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <4>;
reg = <0x0002c000 0x1000
0x00079C00 0x200>;
interrupts = <0x04 0 0>;
Expand All @@ -322,10 +327,11 @@
status = "okay";
};

ssp5: ssp@2d000 {
compatible = "intel,ssp-dai";
ssplink5: ssp-link@2d000 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <5>;
reg = <0x0002d000 0x1000
0x00079C00 0x200>;
interrupts = <0x04 0 0>;
Expand Down Expand Up @@ -689,4 +695,52 @@
reg = <0x12>;
};
};

ssps {
#address-cells = <1>;
#size-cells = <0>;

ssp00: ssp@0 {
compatible = "intel,ssp-dai";
reg = <0x0>;
link = <0>;
status = "okay";
};

ssp10: ssp@10 {
compatible = "intel,ssp-dai";
reg = <0x10>;
link = <1>;
status = "okay";
};

ssp20: ssp@20 {
compatible = "intel,ssp-dai";
reg = <0x20>;
link = <2>;
status = "okay";
};

ssp30: ssp@30 {
compatible = "intel,ssp-dai";
reg = <0x30>;
link = <3>;
status = "okay";
};

ssp40: ssp@40 {
compatible = "intel,ssp-dai";
reg = <0x40>;
link = <4>;
status = "okay";
};

ssp50: ssp@50 {
compatible = "intel,ssp-dai";
reg = <0x50>;
link = <5>;
status = "okay";
};

};
};
76 changes: 64 additions & 12 deletions dts/xtensa/intel/intel_adsp_ace20_lnl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,11 @@
status = "okay";
};

ssp0: ssp@28100 {
compatible = "intel,ssp-dai";
ssplink0: ssp-link@28100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <0>;
reg = <0x00028100 0x1000
0x00079C00 0x200>;
i2svss = <0x00028C00 0x1000>;
Expand All @@ -192,10 +193,11 @@
status = "okay";
};

ssp1: ssp@29100 {
compatible = "intel,ssp-dai";
ssplink1: ssp-link@29100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <1>;
reg = <0x00029100 0x1000
0x00079C00 0x200>;
i2svss = <0x00029C00 0x1000>;
Expand All @@ -208,10 +210,11 @@
status = "okay";
};

ssp2: ssp@2a100 {
compatible = "intel,ssp-dai";
ssplink2: ssp-link@2a100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <2>;
reg = <0x0002a100 0x1000
0x00079C00 0x200>;
i2svss = <0x0002AC00 0x1000>;
Expand All @@ -224,10 +227,11 @@
status = "okay";
};

ssp3: ssp@2b100 {
compatible = "intel,ssp-dai";
ssplink3: ssp-link@2b100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <3>;
reg = <0x0002b100 0x1000
0x00079C00 0x200>;
i2svss = <0x0002BC00 0x1000>;
Expand All @@ -240,10 +244,11 @@
status = "okay";
};

ssp4: ssp@2c100 {
compatible = "intel,ssp-dai";
ssplink4: ssp-link@2c100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <4>;
reg = <0x0002c100 0x1000
0x00079C00 0x200>;
i2svss = <0x0002CC00 0x1000>;
Expand All @@ -256,10 +261,11 @@
status = "okay";
};

ssp5: ssp@2d100 {
compatible = "intel,ssp-dai";
ssplink5: ssp-link@2d100 {
compatible = "intel,ssp-link";
#address-cells = <1>;
#size-cells = <0>;
link = <5>;
reg = <0x0002d100 0x1000
0x00079C00 0x200>;
i2svss = <0x0002DC00 0x1000>;
Expand Down Expand Up @@ -549,4 +555,50 @@
reg = <0x12>;
};
};

ssps {
#address-cells = <1>;
#size-cells = <0>;
ssp00: ssp@0 {
compatible = "intel,ssp-dai";
reg = <0x0>;
link = <0>;
status = "okay";
};

ssp10: ssp@10 {
compatible = "intel,ssp-dai";
reg = <0x10>;
link = <1>;
status = "okay";
};

ssp20: ssp@20 {
compatible = "intel,ssp-dai";
reg = <0x20>;
link = <2>;
status = "okay";
};

ssp30: ssp@30 {
compatible = "intel,ssp-dai";
reg = <0x30>;
link = <3>;
status = "okay";
};

ssp40: ssp@40 {
compatible = "intel,ssp-dai";
reg = <0x40>;
link = <4>;
status = "okay";
};

ssp50: ssp@50 {
compatible = "intel,ssp-dai";
reg = <0x50>;
link = <5>;
status = "okay";
};
};
};
Loading

0 comments on commit e90b5c7

Please sign in to comment.