};
use crate::{
- file::File,
+ file::TyrDrmFileData,
gem::TyrObject,
gpu,
gpu::GpuInfo,
pub(crate) type IoMem = kernel::io::mem::IoMem<SZ_2M>;
+pub(crate) struct TyrDrmDriver;
+
/// Convenience type alias for the DRM device type for this driver.
-pub(crate) type TyrDevice = drm::Device<TyrDriver>;
+pub(crate) type TyrDrmDevice = drm::Device<TyrDrmDriver>;
#[pin_data(PinnedDrop)]
-pub(crate) struct TyrDriver {
- _device: ARef<TyrDevice>,
+pub(crate) struct TyrPlatformDriverData {
+ _device: ARef<TyrDrmDevice>,
}
#[pin_data(PinnedDrop)]
-pub(crate) struct TyrData {
+pub(crate) struct TyrDrmDeviceData {
pub(crate) pdev: ARef<platform::Device>,
#[pin]
// that it will be removed in a future patch.
//
// SAFETY: This will be removed in a future patch.
-unsafe impl Send for TyrData {}
+unsafe impl Send for TyrDrmDeviceData {}
// SAFETY: This will be removed in a future patch.
-unsafe impl Sync for TyrData {}
+unsafe impl Sync for TyrDrmDeviceData {}
fn issue_soft_reset(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result {
regs::GPU_CMD.write(dev, iomem, regs::GPU_CMD_SOFT_RESET)?;
kernel::of_device_table!(
OF_TABLE,
MODULE_OF_TABLE,
- <TyrDriver as platform::Driver>::IdInfo,
+ <TyrPlatformDriverData as platform::Driver>::IdInfo,
[
(of::DeviceId::new(c"rockchip,rk3588-mali"), ()),
(of::DeviceId::new(c"arm,mali-valhall-csf"), ())
]
);
-impl platform::Driver for TyrDriver {
+impl platform::Driver for TyrPlatformDriverData {
type IdInfo = ();
const OF_ID_TABLE: Option<of::IdTable<Self::IdInfo>> = Some(&OF_TABLE);
let platform: ARef<platform::Device> = pdev.into();
- let data = try_pin_init!(TyrData {
+ let data = try_pin_init!(TyrDrmDeviceData {
pdev: platform.clone(),
clks <- new_mutex!(Clocks {
core: core_clk,
gpu_info,
});
- let tdev: ARef<TyrDevice> = drm::Device::new(pdev.as_ref(), data)?;
- drm::driver::Registration::new_foreign_owned(&tdev, pdev.as_ref(), 0)?;
+ let ddev: ARef<TyrDrmDevice> = drm::Device::new(pdev.as_ref(), data)?;
+ drm::driver::Registration::new_foreign_owned(&ddev, pdev.as_ref(), 0)?;
- let driver = TyrDriver { _device: tdev };
+ let driver = TyrPlatformDriverData { _device: ddev };
// We need this to be dev_info!() because dev_dbg!() does not work at
// all in Rust for now, and we need to see whether probe succeeded.
}
#[pinned_drop]
-impl PinnedDrop for TyrDriver {
+impl PinnedDrop for TyrPlatformDriverData {
fn drop(self: Pin<&mut Self>) {}
}
#[pinned_drop]
-impl PinnedDrop for TyrData {
+impl PinnedDrop for TyrDrmDeviceData {
fn drop(self: Pin<&mut Self>) {
// TODO: the type-state pattern for Clks will fix this.
let clks = self.clks.lock();
};
#[vtable]
-impl drm::Driver for TyrDriver {
- type Data = TyrData;
- type File = File;
+impl drm::Driver for TyrDrmDriver {
+ type Data = TyrDrmDeviceData;
+ type File = TyrDrmFileData;
type Object = drm::gem::Object<TyrObject>;
const INFO: drm::DriverInfo = INFO;
kernel::declare_drm_ioctls! {
- (PANTHOR_DEV_QUERY, drm_panthor_dev_query, ioctl::RENDER_ALLOW, File::dev_query),
+ (PANTHOR_DEV_QUERY, drm_panthor_dev_query, ioctl::RENDER_ALLOW, TyrDrmFileData::dev_query),
}
}
uapi, //
};
-use crate::{
- driver::TyrDevice,
- TyrDriver, //
-};
+use crate::driver::TyrDrmDriver;
#[pin_data]
-pub(crate) struct File {}
+pub(crate) struct TyrDrmFileData {}
/// Convenience type alias for our DRM `File` type
-pub(crate) type DrmFile = drm::file::File<File>;
+pub(crate) type TyrDrmFile = drm::file::File<TyrDrmFileData>;
-impl drm::file::DriverFile for File {
- type Driver = TyrDriver;
+impl drm::file::DriverFile for TyrDrmFileData {
+ type Driver = TyrDrmDriver;
fn open(_dev: &drm::Device<Self::Driver>) -> Result<Pin<KBox<Self>>> {
KBox::try_pin_init(try_pin_init!(Self {}), GFP_KERNEL)
}
}
-impl File {
+impl TyrDrmFileData {
pub(crate) fn dev_query(
- tdev: &TyrDevice,
+ ddev: &drm::Device<TyrDrmDriver>,
devquery: &mut uapi::drm_panthor_dev_query,
- _file: &DrmFile,
+ _file: &TyrDrmFile,
) -> Result<u32> {
if devquery.pointer == 0 {
match devquery.type_ {
uapi::drm_panthor_dev_query_type_DRM_PANTHOR_DEV_QUERY_GPU_INFO => {
- devquery.size = core::mem::size_of_val(&tdev.gpu_info) as u32;
+ devquery.size = core::mem::size_of_val(&ddev.gpu_info) as u32;
Ok(0)
}
_ => Err(EINVAL),
)
.writer();
- writer.write(&tdev.gpu_info)?;
+ writer.write(&ddev.gpu_info)?;
Ok(0)
}