Skip to content
Closed
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
5 changes: 5 additions & 0 deletions arch/arm64/boot/dts/apple/t6000.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@
status = "okay";
};

/* The auxiliary DMA fault reporter shares venc_sys with the codec DARTs. */
&ave0_dma {
status = "okay";
};

&apr0_dart {
status = "okay";
};
Expand Down
34 changes: 31 additions & 3 deletions drivers/media/platform/apple/ave/apple-ave-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>

#define AVE_DMA_ERROR_STATUS 0x40
#define AVE_DMA_ERROR_PENDING BIT(31)
Expand Down Expand Up @@ -51,7 +52,7 @@ static irqreturn_t apple_ave_dma_irq(int irq, void *data)
static int apple_ave_dma_probe(struct platform_device *pdev)
{
struct apple_ave_dma *dma;
int irq;
int irq, ret;

dma = devm_kzalloc(&pdev->dev, sizeof(*dma), GFP_KERNEL);
if (!dma)
Expand All @@ -66,8 +67,35 @@ static int apple_ave_dma_probe(struct platform_device *pdev)
if (irq < 0)
return irq;

return devm_request_irq(&pdev->dev, irq, apple_ave_dma_irq,
IRQF_SHARED, dev_name(&pdev->dev), dma);
/*
* This reporter sits in the venc_sys power domain, which the encoder
* and its DARTs gate whenever the codec is idle. Enable runtime PM and
* leave it runtime-suspended so it does not vote the domain on; without
* this genpd treats the bound device as active and pins ps_venc_sys
* forever, defeating the encoder's idle power saving. A DMA fault can
* only be raised - and the interrupt it shares with the codec DARTs
* only asserted - while the encoder runs, so the handler always touches
* registers in a powered domain. The domain is live at bind (the codec
* DARTs are already up), so start active and drop the vote once the
* handler is in place.
*/
pm_runtime_get_noresume(&pdev->dev);
pm_runtime_set_active(&pdev->dev);
ret = devm_pm_runtime_enable(&pdev->dev);
if (ret) {
pm_runtime_put_noidle(&pdev->dev);
return ret;
}

ret = devm_request_irq(&pdev->dev, irq, apple_ave_dma_irq,
IRQF_SHARED, dev_name(&pdev->dev), dma);
if (ret) {
pm_runtime_put_noidle(&pdev->dev);
return ret;
}

pm_runtime_put(&pdev->dev);
return 0;
}

static const struct of_device_id apple_ave_dma_of_match[] = {
Expand Down
Loading