diff --git a/drivers/gpu/host1x-nvhost/nvhost.c b/drivers/gpu/host1x-nvhost/nvhost.c index 6e1e6250..d9043f84 100644 --- a/drivers/gpu/host1x-nvhost/nvhost.c +++ b/drivers/gpu/host1x-nvhost/nvhost.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -389,6 +390,27 @@ static int nvhost_syncpt_get_page_size(struct device_node *np, uint32_t *size) return -ENODEV; } +u32 nvhost_syncpt_unit_interface_get_byte_offset_ext(struct platform_device *pdev, + u32 syncpt_id) +{ + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct nvhost_syncpt_interface *syncpt_if = pdata->syncpt_unit_interface; + + if (WARN_ON(!syncpt_if)) + return 0; + + return syncpt_id * syncpt_if->page_size; +} +EXPORT_SYMBOL(nvhost_syncpt_unit_interface_get_byte_offset_ext); + +int nvhost_syncpt_unit_interface_get_aperture(struct platform_device *pdev, + u64 *base, size_t *size) +{ + return nvhost_syncpt_get_aperture(pdev->dev.parent->of_node, base, + size); +} +EXPORT_SYMBOL(nvhost_syncpt_unit_interface_get_aperture); + int nvhost_syncpt_unit_interface_init(struct platform_device *pdev) { struct nvhost_device_data *pdata = platform_get_drvdata(pdev); diff --git a/include/linux/nvhost_t194.h b/include/linux/nvhost_t194.h index f7b7dbde..29ac8617 100644 --- a/include/linux/nvhost_t194.h +++ b/include/linux/nvhost_t194.h @@ -24,6 +24,19 @@ int nvhost_syncpt_unit_interface_get_aperture( phys_addr_t *base, size_t *size); +#ifdef CONFIG_TEGRA_HOST1X +u32 nvhost_syncpt_unit_interface_get_byte_offset_ext( + struct platform_device *host_pdev, + u32 syncpt_id); +#else u32 nvhost_syncpt_unit_interface_get_byte_offset(u32 syncpt_id); +static inline u32 nvhost_syncpt_unit_interface_get_byte_offset_ext( + struct platform_device *host_pdev, + u32 syncpt_id) +{ + return nvhost_syncpt_unit_interface_get_byte_offset(syncpt_id); +} +#endif + #endif /* __LINUX_NVHOST_T194_H__ */