mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-24 02:07:34 +03:00
tegra: hwpm: add clk-rst HALs, update HAL validation
- Make clock reset functions into HALs. This way we can control clock-reset logic for any chip. Set clock-reset HAL pointers to appropriate functions. - Remove clock-reset function wrappers as these will not be required and corresponding HAL pointers will be used. - As clock reset init is defined as a HAL, modify probe logic to initialize chip info before invoking any HALs. - Move common/primary HAL validation logic to common code and implement new HAL to validate chip specific HALs. This way we can ensure that HAL pointers are set as expected. - Keep only one definition for t234_hwpm_init_chip_info as t234 should always be initialized and hence only single definition should be available. - Expected return value of 0 indicates success and any other value (mostly negative in current logic) indicates error, compare function returns with 0 to print error in tegra_hwpm_release(). - Since a build can support both ACPI and device tree, update init_chip_info() to retrieve chip information from ACPI and device tree in case of failure. Jira THWPM-41 Bug 3583624 Change-Id: I03fefae0b3b0c8ce46d175d39e4fdbb45e2bb22f Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2789668 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2797445
This commit is contained in:
committed by
mobile promotions
parent
913f1b0697
commit
5166c3ab71
@@ -36,19 +36,16 @@ static struct hwpm_soc_chip_info chip_info = {
|
||||
};
|
||||
static bool chip_info_initialized;
|
||||
|
||||
#if (!defined(CONFIG_ACPI))
|
||||
const struct hwpm_soc_chip_info t234_chip_info = {
|
||||
.chip_id = 0x23,
|
||||
.chip_id_rev = 0x4,
|
||||
.platform = PLAT_SI,
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This function should be invoked only once before retrieving soc chip info */
|
||||
int tegra_hwpm_init_chip_info(struct tegra_hwpm_os_linux *hwpm_linux)
|
||||
{
|
||||
struct device *dev = hwpm_linux->dev;
|
||||
struct tegra_soc_hwpm *hwpm = &hwpm_linux->hwpm;
|
||||
#if defined(CONFIG_ACPI)
|
||||
const struct acpi_device_id *id;
|
||||
#endif
|
||||
@@ -56,19 +53,19 @@ int tegra_hwpm_init_chip_info(struct tegra_hwpm_os_linux *hwpm_linux)
|
||||
if (chip_info_initialized) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ACPI)
|
||||
/* Get device node info from ACPI table */
|
||||
id = acpi_match_device(dev->driver->acpi_match_table, dev);
|
||||
if (!id) {
|
||||
tegra_hwpm_err(hwpm, "Couldn't find matching ACPI device");
|
||||
return -ENODEV;
|
||||
if (id) {
|
||||
chip_info.chip_id = (id->driver_data >> 8) & 0xff;
|
||||
chip_info.chip_id_rev = (id->driver_data >> 4) & 0xf;
|
||||
chip_info.platform = (id->driver_data >> 20) & 0xf;
|
||||
|
||||
goto complete;
|
||||
}
|
||||
|
||||
chip_info.chip_id = (id->driver_data >> 8) & 0xff;
|
||||
chip_info.chip_id_rev = (id->driver_data >> 4) & 0xf;
|
||||
chip_info.platform = (id->driver_data >> 20) & 0xf;
|
||||
|
||||
goto complete;
|
||||
#else /* !CONFIG_ACPI */
|
||||
#endif
|
||||
/* Get device node info from device tree */
|
||||
if (of_machine_is_compatible("nvidia,tegra234")) {
|
||||
chip_info.chip_id = t234_chip_info.chip_id;
|
||||
chip_info.chip_id_rev = t234_chip_info.chip_id_rev;
|
||||
@@ -87,8 +84,7 @@ int tegra_hwpm_init_chip_info(struct tegra_hwpm_os_linux *hwpm_linux)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_ACPI */
|
||||
return -EINVAL;
|
||||
return -ENODEV;
|
||||
complete:
|
||||
chip_info_initialized = true;
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user