Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Documentation/devicetree/bindings/sound/apple,mca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ properties:
'#sound-dai-cells':
const: 1

apple,rx-bclk-inverted-clusters:
description:
Indices of clusters whose receive serializers sample on the opposite
bit clock edge to the one selected by the DAI format. The transmit
serializers keep the edge specified by the DAI format.
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 6
items:
maximum: 5

required:
- compatible
- reg
Expand Down
5 changes: 5 additions & 0 deletions arch/arm64/boot/dts/apple/t8122-j613.dts
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,11 @@
};
};

&mca {
/* Speaker-sense SDOUT is launched on the nominal RX sample edge. */
apple,rx-bclk-inverted-clusters = <2>;
};

/ {
sound {
compatible = "apple,j613-macaudio", "apple,j413-macaudio", "apple,macaudio";
Expand Down
12 changes: 12 additions & 0 deletions sound/soc/apple/mca.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct mca_cluster {
struct dma_chan *dma_chans[SNDRV_PCM_STREAM_LAST + 1];

bool clk_provider;
bool rx_bclk_inverted;

bool port_clk_started[SNDRV_PCM_STREAM_LAST + 1];
int port_clk_driver; /* The cluster driving this cluster's port */
Expand Down Expand Up @@ -594,6 +595,8 @@ static int mca_fe_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)

mca_modify(cl, CLUSTER_TX_OFF + REG_TX_SERDES_CONF,
SERDES_CONF_BCLK_POL, serdes_conf);
if (cl->rx_bclk_inverted)
serdes_conf ^= SERDES_CONF_BCLK_POL;
mca_modify(cl, CLUSTER_RX_OFF + REG_RX_SERDES_CONF,
SERDES_CONF_BCLK_POL, serdes_conf);
writel_relaxed(bitstart,
Expand Down Expand Up @@ -1307,6 +1310,7 @@ static int apple_mca_probe(struct platform_device *pdev)
struct snd_soc_dai_driver *dai_drivers;
struct resource *res;
void __iomem *base;
u32 rx_bclk_cluster;
int nclusters;
int ret, i;

Expand All @@ -1328,6 +1332,14 @@ static int apple_mca_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mca);
clusters = mca->clusters;

of_property_for_each_u32(pdev->dev.of_node, "apple,rx-bclk-inverted-clusters",
rx_bclk_cluster) {
if (rx_bclk_cluster >= nclusters)
return dev_err_probe(&pdev->dev, -EINVAL,
"invalid RX BCLK cluster %u\n", rx_bclk_cluster);
clusters[rx_bclk_cluster].rx_bclk_inverted = true;
}

mca->switch_base =
devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(mca->switch_base))
Expand Down
Loading