mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-04-15 05:43:05 +00:00
intel_th: Add global activate/deactivate callbacks for the glue layers
A glue layer may want to install its own hooks into trace capture start and stop paths to apply workarounds. This adds optional callbacks. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
This commit is contained in:
parent
3321371b5d
commit
29e15e83a9
@ -226,6 +226,7 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
|
|||||||
{
|
{
|
||||||
struct intel_th_driver *thdrv =
|
struct intel_th_driver *thdrv =
|
||||||
to_intel_th_driver_or_null(thdev->dev.driver);
|
to_intel_th_driver_or_null(thdev->dev.driver);
|
||||||
|
struct intel_th *th = to_intel_th(thdev);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!thdrv)
|
if (!thdrv)
|
||||||
@ -236,15 +237,28 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
|
|||||||
|
|
||||||
pm_runtime_get_sync(&thdev->dev);
|
pm_runtime_get_sync(&thdev->dev);
|
||||||
|
|
||||||
|
if (th->activate)
|
||||||
|
ret = th->activate(th);
|
||||||
|
if (ret)
|
||||||
|
goto fail_put;
|
||||||
|
|
||||||
if (thdrv->activate)
|
if (thdrv->activate)
|
||||||
ret = thdrv->activate(thdev);
|
ret = thdrv->activate(thdev);
|
||||||
else
|
else
|
||||||
intel_th_trace_enable(thdev);
|
intel_th_trace_enable(thdev);
|
||||||
|
|
||||||
if (ret) {
|
if (ret)
|
||||||
|
goto fail_deactivate;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fail_deactivate:
|
||||||
|
if (th->deactivate)
|
||||||
|
th->deactivate(th);
|
||||||
|
|
||||||
|
fail_put:
|
||||||
pm_runtime_put(&thdev->dev);
|
pm_runtime_put(&thdev->dev);
|
||||||
module_put(thdrv->driver.owner);
|
module_put(thdrv->driver.owner);
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -253,6 +267,7 @@ static void intel_th_output_deactivate(struct intel_th_device *thdev)
|
|||||||
{
|
{
|
||||||
struct intel_th_driver *thdrv =
|
struct intel_th_driver *thdrv =
|
||||||
to_intel_th_driver_or_null(thdev->dev.driver);
|
to_intel_th_driver_or_null(thdev->dev.driver);
|
||||||
|
struct intel_th *th = to_intel_th(thdev);
|
||||||
|
|
||||||
if (!thdrv)
|
if (!thdrv)
|
||||||
return;
|
return;
|
||||||
@ -262,6 +277,9 @@ static void intel_th_output_deactivate(struct intel_th_device *thdev)
|
|||||||
else
|
else
|
||||||
intel_th_trace_disable(thdev);
|
intel_th_trace_disable(thdev);
|
||||||
|
|
||||||
|
if (th->deactivate)
|
||||||
|
th->deactivate(th);
|
||||||
|
|
||||||
pm_runtime_put(&thdev->dev);
|
pm_runtime_put(&thdev->dev);
|
||||||
module_put(thdrv->driver.owner);
|
module_put(thdrv->driver.owner);
|
||||||
}
|
}
|
||||||
|
@ -263,6 +263,8 @@ struct intel_th {
|
|||||||
struct intel_th_drvdata *drvdata;
|
struct intel_th_drvdata *drvdata;
|
||||||
|
|
||||||
struct resource *resource;
|
struct resource *resource;
|
||||||
|
int (*activate)(struct intel_th *);
|
||||||
|
void (*deactivate)(struct intel_th *);
|
||||||
unsigned int num_thdevs;
|
unsigned int num_thdevs;
|
||||||
unsigned int num_resources;
|
unsigned int num_resources;
|
||||||
int irq;
|
int irq;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user