mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-15 17:43:59 +00:00
a778028cc5
Expose timestamp information supported by the GPU with a new device query. Mali uses an external timer as GPU system time. On ARM, this is wired to the generic arch timer so we wire cntfrq_el0 as device frequency. This new uAPI will be used in Mesa to implement timestamp queries and VK_KHR_calibrated_timestamps. Since this extends the uAPI and because userland needs a way to advertise those features conditionally, this also bumps the driver minor version. v2: - Rewrote to use GPU timestamp register - Added timestamp_offset to drm_panthor_timestamp_info - Add missing include for arch_timer_get_cntfrq - Rework commit message v3: - Add panthor_gpu_read_64bit_counter - Change panthor_gpu_read_timestamp to use panthor_gpu_read_64bit_counter v4: - Fix multiple typos in uAPI documentation - Mention behavior when the timestamp frequency is unknown - Use u64 instead of unsigned long long for panthor_gpu_read_timestamp - Apply r-b from Mihail Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Reviewed-by: Mihail Atanassov <mihail.atanassov@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240830080349.24736-2-mary.guillemard@collabora.com
57 lines
1.8 KiB
C
57 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 or MIT */
|
|
/* Copyright 2018 Marty E. Plummer <hanetzer@startmail.com> */
|
|
/* Copyright 2019 Collabora ltd. */
|
|
|
|
#ifndef __PANTHOR_GPU_H__
|
|
#define __PANTHOR_GPU_H__
|
|
|
|
#include <linux/types.h>
|
|
|
|
struct panthor_device;
|
|
|
|
int panthor_gpu_init(struct panthor_device *ptdev);
|
|
void panthor_gpu_unplug(struct panthor_device *ptdev);
|
|
void panthor_gpu_suspend(struct panthor_device *ptdev);
|
|
void panthor_gpu_resume(struct panthor_device *ptdev);
|
|
|
|
int panthor_gpu_block_power_on(struct panthor_device *ptdev,
|
|
const char *blk_name,
|
|
u32 pwron_reg, u32 pwrtrans_reg,
|
|
u32 rdy_reg, u64 mask, u32 timeout_us);
|
|
int panthor_gpu_block_power_off(struct panthor_device *ptdev,
|
|
const char *blk_name,
|
|
u32 pwroff_reg, u32 pwrtrans_reg,
|
|
u64 mask, u32 timeout_us);
|
|
|
|
/**
|
|
* panthor_gpu_power_on() - Power on the GPU block.
|
|
*
|
|
* Return: 0 on success, a negative error code otherwise.
|
|
*/
|
|
#define panthor_gpu_power_on(ptdev, type, mask, timeout_us) \
|
|
panthor_gpu_block_power_on(ptdev, #type, \
|
|
type ## _PWRON_LO, \
|
|
type ## _PWRTRANS_LO, \
|
|
type ## _READY_LO, \
|
|
mask, timeout_us)
|
|
|
|
/**
|
|
* panthor_gpu_power_off() - Power off the GPU block.
|
|
*
|
|
* Return: 0 on success, a negative error code otherwise.
|
|
*/
|
|
#define panthor_gpu_power_off(ptdev, type, mask, timeout_us) \
|
|
panthor_gpu_block_power_off(ptdev, #type, \
|
|
type ## _PWROFF_LO, \
|
|
type ## _PWRTRANS_LO, \
|
|
mask, timeout_us)
|
|
|
|
int panthor_gpu_l2_power_on(struct panthor_device *ptdev);
|
|
int panthor_gpu_flush_caches(struct panthor_device *ptdev,
|
|
u32 l2, u32 lsc, u32 other);
|
|
int panthor_gpu_soft_reset(struct panthor_device *ptdev);
|
|
u64 panthor_gpu_read_timestamp(struct panthor_device *ptdev);
|
|
u64 panthor_gpu_read_timestamp_offset(struct panthor_device *ptdev);
|
|
|
|
#endif
|