Commit Graph

7 Commits

Author SHA1 Message Date
Jon Hunter
4b2fd8250d tegra: hwpm: Use conftest for 'struct class' changes
In Linux v6.2, the 'struct class.devnode()' function was updated to take
a 'const struct device *' instead of a 'struct device *'. A test has
been added to the conftest script to check for this and so instead of
relying on kernel version, use the definition generated by conftest to
select the appropriate function to use.

This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.

Bug 4119327

Change-Id: I751b7401adee7b337192e255253b974cbd803642
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2991966
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-10 11:54:25 -07:00
Vedashree Vidwans
8b861518c4 tegra: hwpm: update licenses for all files
Modify OS agnostic files in common, hal and include folder to use MIT
license. This will allow the files to be shared between different OSes.
Modify OS specific files in os/linux and uapi folders to add SPDX
identifier for GPLv2.

Jira THWPM-69

Change-Id: I4fef142354a46fc23b67616204ccf0712a99caec
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2797453
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-08 03:16:24 -08:00
Jon Hunter
5bd6255239 tegra: hwpm: Fix build for Linux v6.2
Upstream Linux kernel commit ff62b8e6588f ("driver core: make struct
class.devnode() take a const *") updated the 'devnode' function pointer
under the class structure to take a const device struct. This breaks
building the Tegra HWPM driver with Linux v6.2. Make the necessary
changes to the HWPM driver to fix the build breakage.

Bug 3936429

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I54b7bcefbd5a2e6e88c13b3714ea012cc2a73615
(cherry picked from commit de9dd40f6a4dc35e6ee9e6140cac148171bcd6e1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2847008
Tested-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-08 03:16:02 -08:00
Vedashree Vidwans
f010cf5956 tegra: hwpm: update dma vmap for kernel > 5.10
Kernel version beyond 5.10 introduces dma_buf_map structure (called
iosys_map in later versions). Kernel virtual address corresponding to a
dma_buf is stored in the dma_buf_map structure.
- This patch updates memory management function to use correct mem bytes
buffer kernel virtual address stored in the corresponding dma_buf_map
structure.
- Use dma_buf_map structure pointer to unmap kernel virtual address.
- During release, poll mem bytes buffer with finite timeout value.
- Add description for use of dma_set_mask_and_coherent.

Bug 3893741

Change-Id: I42ace2fe70b36d7d5d1a4c5fee21786826f24a07
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
(cherry picked from commit ce852be6b39ef39affccdee41ad436fc70bf86b5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2847007
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-02-08 03:15:58 -08:00
Vedashree Vidwans
b7d94cea88 tegra: hwpm: remove support-soc-tools dependency
Property support-soc-tools was added mainly to provide user's control to
enable/disable HWPM feature. Since, the same functionality can be
achieved using "status" in device node, support-soc-tools property is
redundant. Hence, this property is removed from HWPM device node.
Update HWPM driver probe to not depend on support-soc-tools property.

JIRA THWPM-48

Change-Id: Ieaa5c77e6c62a59e938832f886c5a82031139ac6
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-hwpm/+/2797449
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
2022-12-11 14:50:19 -08:00
Vedashree Vidwans
5166c3ab71 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
2022-12-11 14:50:01 -08:00
Vedashree Vidwans
7c1ae11f78 tegra: hwpm: move files to appropriate path
HWPM files are copied from the previous source in linux-nvidia repo
withgit history. Create folders and move files to obtain expected folder
structure.

Bug 3787076

Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
2022-10-05 16:05:20 -07:00