mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drm/tegra: Fix genpd support for Linux v6.13
In Linux v6.13, commit d6caca30a548 ("OPP: Drop redundant
*_opp_attach|detach_genpd()") removed devm_pm_opp_attach_genpd(). This
has been replaced by devm_pm_domain_attach_list(). Use conftest to
detect the presence of devm_pm_domain_attach_list() and update the Tegra
DRM driver accordingly.
Bug 4991705
Change-Id: I5a3bd258d3fce5b09fd4ba84adad166e4cf47cfb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261693
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
This commit is contained in:
@@ -49,6 +49,9 @@ struct gr3d {
|
||||
unsigned int nclocks;
|
||||
struct reset_control_bulk_data resets[RST_GR3D_MAX];
|
||||
unsigned int nresets;
|
||||
#if defined(NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT) /* Linux v6.13 */
|
||||
struct dev_pm_domain_list *pd_list;
|
||||
#endif
|
||||
|
||||
DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS);
|
||||
};
|
||||
@@ -372,13 +375,21 @@ static int gr3d_power_up_legacy_domain(struct device *dev, const char *name,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT) /* Linux v6.13 */
|
||||
static void gr3d_del_link(void *link)
|
||||
{
|
||||
device_link_del(link);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
{
|
||||
#if defined(NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT) /* Linux v6.13 */
|
||||
struct dev_pm_domain_attach_data pd_data = {
|
||||
.pd_names = (const char *[]) { "3d0", "3d1" },
|
||||
.num_pd_names = 2,
|
||||
};
|
||||
#else
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
|
||||
static const char * const opp_genpd_names[] = { "3d0", "3d1", NULL };
|
||||
#else
|
||||
@@ -388,6 +399,7 @@ static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
struct device **opp_virt_devs, *pd_dev;
|
||||
struct device_link *link;
|
||||
unsigned int i;
|
||||
#endif
|
||||
int err;
|
||||
|
||||
err = of_count_phandle_with_args(dev->of_node, "power-domains",
|
||||
@@ -421,6 +433,11 @@ static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
if (dev->pm_domain)
|
||||
return 0;
|
||||
|
||||
#if defined(NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT) /* Linux v6.13 */
|
||||
err = devm_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#else
|
||||
err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -443,6 +460,7 @@ static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_dev_profile_has_is_cooling_device
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devfreq_has_freq_table
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += device_add_disk_has_int_return_type
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_pm_domain_attach_list
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
|
||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change
|
||||
|
||||
@@ -6884,6 +6884,19 @@ compile_test() {
|
||||
compile_check_conftest "$CODE" "NV_PWM_CHIP_STRUCT_HAS_STRUCT_DEVICE" "" "types"
|
||||
;;
|
||||
|
||||
devm_pm_domain_attach_list)
|
||||
#
|
||||
# Determine whether devm_pm_domain_attach_list is present.
|
||||
#
|
||||
CODE="
|
||||
#include <linux/pm_domain.h>
|
||||
void conftest_devm_pm_domain_attach_list(void) {
|
||||
devm_pm_domain_attach_list();
|
||||
}"
|
||||
|
||||
compile_check_conftest "$CODE" "NV_DEVM_PM_DOMAIN_ATTACH_LIST_PRESENT" "" "functions"
|
||||
;;
|
||||
|
||||
devm_tegra_core_dev_init_opp_table_common)
|
||||
#
|
||||
# Determine whether devm_tegra_core_dev_init_opp_table_common is
|
||||
|
||||
Reference in New Issue
Block a user