Files
linux/drivers/gpu/drm/panthor/panthor_hw.h
Karunika Choo c27787f2b7 drm/panthor: Introduce panthor_pwr API and power control framework
Add the new panthor_pwr module, which provides basic power control
management for Mali-G1 GPUs. The initial implementation includes
infrastructure for initializing the PWR_CONTROL block, requesting and
handling its IRQ, and checking for PWR_CONTROL support based on GPU
architecture.

The patch also integrates panthor_pwr with the device lifecycle (init,
suspend, resume, and unplug) through the new API functions. It also
registers the IRQ handler under the 'gpu' IRQ as the PWR_CONTROL block
is located within the GPU_CONTROL block.

Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Karunika Choo <karunika.choo@arm.com>
Link: https://patch.msgid.link/20251125125548.3282320-4-karunika.choo@arm.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
2025-11-26 10:56:18 +01:00

57 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 or MIT */
/* Copyright 2025 ARM Limited. All rights reserved. */
#ifndef __PANTHOR_HW_H__
#define __PANTHOR_HW_H__
#include "panthor_device.h"
#include "panthor_regs.h"
/**
* struct panthor_hw_ops - HW operations that are specific to a GPU
*/
struct panthor_hw_ops {
/** @soft_reset: Soft reset function pointer */
int (*soft_reset)(struct panthor_device *ptdev);
/** @l2_power_off: L2 power off function pointer */
void (*l2_power_off)(struct panthor_device *ptdev);
/** @l2_power_on: L2 power on function pointer */
int (*l2_power_on)(struct panthor_device *ptdev);
};
/**
* struct panthor_hw - GPU specific register mapping and functions
*/
struct panthor_hw {
/** @features: Bitmap containing panthor_hw_feature */
/** @ops: Panthor HW specific operations */
struct panthor_hw_ops ops;
};
int panthor_hw_init(struct panthor_device *ptdev);
static inline int panthor_hw_soft_reset(struct panthor_device *ptdev)
{
return ptdev->hw->ops.soft_reset(ptdev);
}
static inline int panthor_hw_l2_power_on(struct panthor_device *ptdev)
{
return ptdev->hw->ops.l2_power_on(ptdev);
}
static inline void panthor_hw_l2_power_off(struct panthor_device *ptdev)
{
ptdev->hw->ops.l2_power_off(ptdev);
}
static inline bool panthor_hw_has_pwr_ctrl(struct panthor_device *ptdev)
{
return GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id) >= 14;
}
#endif /* __PANTHOR_HW_H__ */