platform: dce: remove use of of_irq_xxx

of_irq_xxx faimly of functions are not exported by Kernel.
use platform_irq_count and platform_get_irq APIs instead.

This patch also moves dce_platform_data elements to dce_device
struct to keep dce_platform_data constant.

Bug 3581824

Signed-off-by: Mahesh Kumar <mahkumar@nvidia.com>
Change-Id: I5ea13ea039ef1464e678f0604a045a6ab67bc16f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755141
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Mahesh Kumar
2022-03-24 16:50:09 +05:30
committed by Laxman Dewangan
parent df0f2d1a74
commit 5aa80075ad
2 changed files with 29 additions and 45 deletions

View File

@@ -44,33 +44,17 @@ __weak const struct of_device_id tegra_dce_of_match[] = {
{ },
};
/**
* dce_set_pdata_dce - inline function to set the tegra_dce pointer in
* pdata point to actual tegra_dce data structure.
*
* @pdev : Pointer to the platform device data structure.
* @d : Pointer pointing to actual tegra_dce data structure.
*
* Return : Void.
*/
static inline void dce_set_pdata_dce(struct platform_device *pdev,
struct tegra_dce *d)
{
((struct dce_platform_data *)dev_get_drvdata(&pdev->dev))->d = d;
}
/**
* dce_get_pdata_dce - inline function to get the tegra_dce pointer
* from platform devicve.
*
* @pdev : Pointer to the platform device data structure.
* @d : Pointer pointing to actual tegra_dce data structure.
*
* Return : Void.
* Return : Pointer pointing to tegra_dce data structure.
*/
static inline struct tegra_dce *dce_get_pdata_dce(struct platform_device *pdev)
{
return (((struct dce_platform_data *)dev_get_drvdata(&pdev->dev))->d);
return (&((struct dce_device *)dev_get_drvdata(&pdev->dev))->d);
}
/**
@@ -83,7 +67,7 @@ static inline struct tegra_dce *dce_get_pdata_dce(struct platform_device *pdev)
*
* Return : 0 if success else the corresponding error value.
*/
static int dce_init_dev_data(struct platform_device *pdev)
static int dce_init_dev_data(struct platform_device *pdev, struct dce_platform_data *pdata)
{
struct device *dev = &pdev->dev;
struct dce_device *d_dev = NULL;
@@ -92,17 +76,18 @@ static int dce_init_dev_data(struct platform_device *pdev)
if (!d_dev)
return -ENOMEM;
dce_set_pdata_dce(pdev, &d_dev->d);
d_dev->dev = dev;
d_dev->pdata = pdata;
d_dev->regs = of_iomap(dev->of_node, 0);
if (!d_dev->regs) {
dev_err(dev, "failed to map dce cluster IO space\n");
return -EINVAL;
}
dev_set_drvdata(dev, d_dev);
return 0;
}
/**
* dce_isr - Handles dce interrupts
*/
@@ -119,12 +104,12 @@ static void dce_set_irqs(struct platform_device *pdev, bool en)
{
int i = 0;
struct tegra_dce *d;
struct dce_platform_data *pdata = NULL;
struct dce_device *d_dev = NULL;
pdata = dev_get_drvdata(&pdev->dev);
d = pdata->d;
d_dev = dev_get_drvdata(&pdev->dev);
d = dce_get_pdata_dce(pdev);
for (i = 0; i < pdata->max_cpu_irqs; i++) {
for (i = 0; i < d_dev->max_cpu_irqs; i++) {
if (en)
enable_irq(d->irq[i]);
else
@@ -145,11 +130,12 @@ static int dce_req_interrupts(struct platform_device *pdev)
int ret = 0;
int no_ints = 0;
struct tegra_dce *d;
struct dce_platform_data *pdata = NULL;
struct dce_device *d_dev = NULL;
pdata = dev_get_drvdata(&pdev->dev);
d = pdata->d;
no_ints = of_irq_count(pdev->dev.of_node);
d_dev = dev_get_drvdata(&pdev->dev);
d = dce_get_pdata_dce(pdev);
no_ints = platform_irq_count(pdev);
if (no_ints == 0) {
dev_err(&pdev->dev,
"Invalid number of interrupts configured = %d",
@@ -157,10 +143,10 @@ static int dce_req_interrupts(struct platform_device *pdev)
return -EINVAL;
}
pdata->max_cpu_irqs = no_ints;
d_dev->max_cpu_irqs = no_ints;
for (i = 0; i < no_ints; i++) {
ret = of_irq_get(pdev->dev.of_node, i);
ret = platform_get_irq(pdev, i);
if (ret < 0) {
dev_err(&pdev->dev,
"Getting dce intr lines failed with ret = %d",
@@ -203,9 +189,8 @@ static int tegra_dce_probe(struct platform_device *pdev)
err = -ENODATA;
goto err_get_pdata;
}
dev_set_drvdata(dev, pdata);
err = dce_init_dev_data(pdev);
err = dce_init_dev_data(pdev, pdata);
if (err) {
dev_err(dev, "failed to init device data with err = %d\n",
err);
@@ -219,7 +204,7 @@ static int tegra_dce_probe(struct platform_device *pdev)
goto req_intr_err;
}
d = pdata->d;
d = dce_get_pdata_dce(pdev);
/**
* TODO: Get HSP_ID from DT

View File

@@ -66,16 +66,6 @@ struct tegra_dce;
* cluster data.
*/
struct dce_platform_data {
/**
* @d : Pointer to OS agnostic dce struct. Stores all runitme info
* for dce cluster elements.
*/
struct tegra_dce *d;
/**
* @max_cpu_irqs : stores maximum no. os irqs from DCE cluster to CPU
* for this platform.
*/
u8 max_cpu_irqs;
/**
* @fw_dce_addr : Stores the firmware address that DCE sees before being
* converted by AST.
@@ -228,6 +218,15 @@ struct dce_device {
* @dev : Pointer to DCE Cluster's Linux device struct.
*/
struct device *dev;
/**
* @pdata : Pointer to dce platform data struct.
*/
struct dce_platform_data *pdata;
/**
* @max_cpu_irqs : stores maximum no. os irqs from DCE cluster to CPU
* for this platform.
*/
u8 max_cpu_irqs;
/**
* @regs : Stores the cpu-mapped base address of DCE Cluster. Will be
* used for MMIO transactions to DCE elements.
@@ -275,7 +274,7 @@ static inline struct device *dev_from_dce(struct tegra_dce *d)
*/
static inline struct dce_platform_data *pdata_from_dce(struct tegra_dce *d)
{
return dev_get_drvdata(dev_from_dce(d));
return ((struct dce_device *)dev_get_drvdata(dev_from_dce(d)))->pdata;
}
/**