mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
ASoC: tegra-alt: Set device data before initialising RPM
The device data for a given driver must be set before enabling runtime-pm otherwise this could results in a crash if the runtime-pm callback is called before the device data is set where it is expected that the device data has been initialised. Furthermore, most drivers will directly call the runtime-pm callback to power-up the device if runtime-pm is not enabled in the kernel config and so many drivers would crash if runtime-pm is not enabled. Fix this by setting the device data early in the driver probe. Bug 2478690 Change-Id: I5beb1607aa4715651cf4b9ac8e8068e7f8e3a2a7 Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com> (cherry picked from commit 9d656fcc96e85d38d120a430f83f2b734e19fe07) Reviewed-on: https://git-master.nvidia.com/r/1991204 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
5e0682c2e7
commit
eabaeedaa6
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra186_arad_alt.c - Tegra186 ARAD driver
|
||||
*
|
||||
* Copyright (c) 2015-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -799,9 +799,10 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
arad_dev = &pdev->dev;
|
||||
|
||||
arad_dev = &pdev->dev;
|
||||
arad->soc_data = soc_data;
|
||||
dev_set_drvdata(&pdev->dev, arad);
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!mem) {
|
||||
@@ -862,8 +863,6 @@ static int tegra186_arad_platform_probe(struct platform_device *pdev)
|
||||
TEGRA186_AHC_ARAD1_CB, &pdev->dev);
|
||||
#endif
|
||||
#endif
|
||||
dev_set_drvdata(&pdev->dev, arad);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra186_asrc_alt.c - Tegra186 ASRC driver
|
||||
*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -1142,6 +1142,7 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
||||
|
||||
asrc->soc_data = soc_data;
|
||||
asrc->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, asrc);
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!mem) {
|
||||
@@ -1220,8 +1221,6 @@ static int tegra186_asrc_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, asrc);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_admaif_alt.c - Tegra ADMAIF driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -1135,9 +1135,9 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
|
||||
admaif->refcnt = 0;
|
||||
admaif->dev = &pdev->dev;
|
||||
|
||||
admaif->soc_data = (struct tegra_admaif_soc_data *)match->data;
|
||||
admaif->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, admaif);
|
||||
|
||||
admaif->capture_dma_data = devm_kzalloc(&pdev->dev,
|
||||
sizeof(struct tegra_alt_pcm_dma_params) *
|
||||
@@ -1300,9 +1300,6 @@ static int tegra_admaif_probe(struct platform_device *pdev)
|
||||
goto err_unregister_codec;
|
||||
}
|
||||
|
||||
/* Driver data should be set before any reg r/w operation */
|
||||
dev_set_drvdata(&pdev->dev, admaif);
|
||||
|
||||
regmap_update_bits(admaif->regmap,
|
||||
admaif->soc_data->reg_offsets.global_enable, 1, 1);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_adx_alt.c - Tegra210 ADX driver
|
||||
*
|
||||
* Copyright (c) 2014-2017 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -653,6 +653,7 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
||||
|
||||
adx->soc_data = soc_data;
|
||||
adx->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, adx);
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!mem) {
|
||||
@@ -709,8 +710,6 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, adx);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_amx_alt.c - Tegra210 AMX driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -932,6 +932,7 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
||||
amx->is_shutdown = false;
|
||||
memset(amx->map, 0, sizeof(amx->map));
|
||||
memset(amx->byte_mask, 0, sizeof(amx->byte_mask));
|
||||
dev_set_drvdata(&pdev->dev, amx);
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!mem) {
|
||||
@@ -995,8 +996,6 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, amx);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_dmic_alt.c - Tegra210 DMIC driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -703,6 +703,7 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
dmic->soc_data = soc_data;
|
||||
dmic->is_shutdown = false;
|
||||
dmic->prod_name = NULL;
|
||||
dev_set_drvdata(&pdev->dev, dmic);
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
dmic->clk_dmic = devm_clk_get(&pdev->dev, NULL);
|
||||
@@ -826,8 +827,6 @@ static int tegra210_dmic_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
err_dap:
|
||||
dev_set_drvdata(&pdev->dev, dmic);
|
||||
|
||||
pdev_bkp[pdev->dev.id] = pdev;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_i2s.c - Tegra210 I2S driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -1098,6 +1098,7 @@ static int tegra210_i2s_platform_probe(struct platform_device *pdev)
|
||||
i2s->loopback = 0;
|
||||
i2s->is_shutdown = false;
|
||||
i2s->prod_name = NULL;
|
||||
dev_set_drvdata(&pdev->dev, i2s);
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
i2s->clk_i2s = devm_clk_get(&pdev->dev, NULL);
|
||||
@@ -1261,8 +1262,6 @@ err_dap:
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, i2s);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_iqc.c - Tegra210 IQC driver
|
||||
*
|
||||
* Copyright (c) 2014-2017 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -347,6 +347,7 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
iqc->soc_data = soc_data;
|
||||
dev_set_drvdata(&pdev->dev, iqc);
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
iqc->clk_iqc = devm_clk_get(&pdev->dev, NULL);
|
||||
@@ -428,8 +429,6 @@ static int tegra210_iqc_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, iqc);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_mixer_alt.c - Tegra210 MIXER driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -750,6 +750,7 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
||||
mixer->gain_coeff[11] = 0;
|
||||
mixer->gain_coeff[12] = 0x400;
|
||||
mixer->gain_coeff[13] = 0x8000000;
|
||||
dev_set_drvdata(&pdev->dev, mixer);
|
||||
|
||||
for (i = 0; i < TEGRA210_MIXER_AXBAR_RX_MAX; i++)
|
||||
mixer->gain_value[i] = 0x10000;
|
||||
@@ -809,8 +810,6 @@ static int tegra210_mixer_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, mixer);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_mvc_alt.c - Tegra210 MVC driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -674,6 +674,7 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
||||
|
||||
mvc->soc_data = soc_data;
|
||||
mvc->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, mvc);
|
||||
|
||||
mvc->poly_n1 = 16;
|
||||
mvc->poly_n2 = 63;
|
||||
@@ -746,8 +747,6 @@ static int tegra210_mvc_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, mvc);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_sfc_alt.c - Tegra210 SFC driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -899,6 +899,8 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
||||
/* initialize default output srate */
|
||||
sfc->srate_out = TEGRA210_SFC_FS48;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, sfc);
|
||||
|
||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!mem) {
|
||||
dev_err(&pdev->dev, "No memory resource\n");
|
||||
@@ -954,8 +956,6 @@ static int tegra210_sfc_platform_probe(struct platform_device *pdev)
|
||||
goto err_suspend;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, sfc);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* tegra210_spdif_alt.c - Tegra210 SPDIF driver
|
||||
*
|
||||
* Copyright (c) 2014-2018 NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2019 NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -479,6 +479,8 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
|
||||
spdif->soc_data = soc_data;
|
||||
spdif->is_shutdown = false;
|
||||
dev_set_drvdata(&pdev->dev, spdif);
|
||||
|
||||
if (!(tegra_platform_is_unit_fpga() || tegra_platform_is_fpga())) {
|
||||
spdif->clk_pll_a_out0 = devm_clk_get(&pdev->dev, "pll_a_out0");
|
||||
if (IS_ERR(spdif->clk_pll_a_out0)) {
|
||||
@@ -604,8 +606,6 @@ static int tegra210_spdif_platform_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
err_dap:
|
||||
dev_set_drvdata(&pdev->dev, spdif);
|
||||
|
||||
return 0;
|
||||
|
||||
err_suspend:
|
||||
|
||||
Reference in New Issue
Block a user