mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-23 01:31:30 +03:00
host: capture-support: Deprecate nvhost APIs
Deprecate the use of nvhost API calls. Implement equivalent functionality for host1x_<readl, writel> by copying parts of nvhost_client_device_get_resources to the driver. Bug 4922171 Change-Id: I2b0a40303767a6630b6212063d66954ed4c16466 Signed-off-by: Akihiro Mizusawa <amizusawa@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3301460 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Chinniah Poosapadi <cpoosapadi@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com>
This commit is contained in:
committed by
Jon Hunter
parent
5193e86207
commit
1fac2c49e1
@@ -8,7 +8,7 @@
|
|||||||
#include <nvidia/conftest.h>
|
#include <nvidia/conftest.h>
|
||||||
|
|
||||||
#include "capture-support.h"
|
#include "capture-support.h"
|
||||||
|
#include <linux/host1x-next.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
@@ -28,18 +28,20 @@
|
|||||||
#include <uapi/linux/tegra-soc-hwpm-uapi.h>
|
#include <uapi/linux/tegra-soc-hwpm-uapi.h>
|
||||||
#include <linux/tegra-camera-rtcpu.h>
|
#include <linux/tegra-camera-rtcpu.h>
|
||||||
|
|
||||||
|
struct host_capture_data {
|
||||||
|
void __iomem *reg_base;
|
||||||
|
};
|
||||||
|
|
||||||
static int tegra_cam_hwpm_ip_pm(void *ip_dev, bool disable)
|
static int tegra_cam_hwpm_ip_pm(void *ip_dev, bool disable)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_MEDIA_SUPPORT
|
#if defined(CONFIG_MEDIA_SUPPORT) && !defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK)
|
||||||
#ifndef CONFIG_TEGRA_SYSTEM_TYPE_ACK
|
|
||||||
// check if rtcpu is powered on
|
// check if rtcpu is powered on
|
||||||
bool is_powered_on = tegra_camrtc_is_rtcpu_powered();
|
bool is_powered_on = tegra_camrtc_is_rtcpu_powered();
|
||||||
|
|
||||||
if (!is_powered_on)
|
if (!is_powered_on)
|
||||||
err = -EIO;
|
err = -EIO;
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@@ -50,18 +52,28 @@ static int tegra_cam_hwpm_ip_reg_op(void *ip_dev,
|
|||||||
u32 inst_element_index, u64 reg_offset, u32 *reg_data)
|
u32 inst_element_index, u64 reg_offset, u32 *reg_data)
|
||||||
{
|
{
|
||||||
struct platform_device *dev = (struct platform_device *)ip_dev;
|
struct platform_device *dev = (struct platform_device *)ip_dev;
|
||||||
|
struct nvhost_device_data *info;
|
||||||
|
struct host_capture_data *capture_data;
|
||||||
|
void __iomem *addr;
|
||||||
|
|
||||||
if (reg_offset > UINT_MAX)
|
if (reg_offset > UINT_MAX)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
info = (struct nvhost_device_data *)platform_get_drvdata(dev);
|
||||||
|
|
||||||
|
if (!info)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
capture_data = (struct host_capture_data *)(info->private_data);
|
||||||
|
|
||||||
|
addr = capture_data->reg_base + (reg_offset);
|
||||||
|
|
||||||
dev_err(&dev->dev, "%s:reg_op %d reg_offset %llu", __func__, reg_op, reg_offset);
|
dev_err(&dev->dev, "%s:reg_op %d reg_offset %llu", __func__, reg_op, reg_offset);
|
||||||
|
|
||||||
if (reg_op == TEGRA_SOC_HWPM_IP_REG_OP_READ)
|
if (reg_op == TEGRA_SOC_HWPM_IP_REG_OP_READ)
|
||||||
*reg_data = host1x_readl(dev,
|
*reg_data = readl(addr);
|
||||||
(unsigned int)reg_offset);
|
|
||||||
else if (reg_op == TEGRA_SOC_HWPM_IP_REG_OP_WRITE)
|
else if (reg_op == TEGRA_SOC_HWPM_IP_REG_OP_WRITE)
|
||||||
host1x_writel(dev, (unsigned int)reg_offset,
|
writel(*reg_data, addr);
|
||||||
*reg_data);
|
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -76,8 +88,10 @@ static int capture_support_probe(struct platform_device *pdev)
|
|||||||
#ifdef CONFIG_TEGRA_HWPM_CAM
|
#ifdef CONFIG_TEGRA_HWPM_CAM
|
||||||
struct tegra_soc_hwpm_ip_ops hwpm_ip_ops;
|
struct tegra_soc_hwpm_ip_ops hwpm_ip_ops;
|
||||||
uint64_t base_address;
|
uint64_t base_address;
|
||||||
#endif
|
struct host_capture_data *capture_data;
|
||||||
|
struct resource *r;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
info = (void *)of_device_get_match_data(dev);
|
info = (void *)of_device_get_match_data(dev);
|
||||||
if (WARN_ON(info == NULL))
|
if (WARN_ON(info == NULL))
|
||||||
@@ -89,24 +103,6 @@ static int capture_support_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
(void) dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(39));
|
(void) dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(39));
|
||||||
|
|
||||||
err = nvhost_client_device_get_resources(pdev);
|
|
||||||
if (err)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
err = nvhost_module_init(pdev);
|
|
||||||
if (err)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
err = nvhost_client_device_init(pdev);
|
|
||||||
if (err) {
|
|
||||||
nvhost_module_deinit(pdev);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = nvhost_syncpt_unit_interface_init(pdev);
|
|
||||||
if (err)
|
|
||||||
goto device_release;
|
|
||||||
|
|
||||||
#ifdef CONFIG_TEGRA_HWPM_CAM
|
#ifdef CONFIG_TEGRA_HWPM_CAM
|
||||||
err = of_property_read_u64(dev->of_node, "reg", &base_address);
|
err = of_property_read_u64(dev->of_node, "reg", &base_address);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -114,6 +110,22 @@ static int capture_support_probe(struct platform_device *pdev)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
capture_data = (struct host_capture_data *) devm_kzalloc(dev,
|
||||||
|
sizeof(*capture_data), GFP_KERNEL);
|
||||||
|
if (!capture_data) {
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
capture_data->reg_base = devm_ioremap_resource(&pdev->dev, r);
|
||||||
|
if (IS_ERR(capture_data->reg_base)) {
|
||||||
|
err = PTR_ERR(capture_data->reg_base);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
info->private_data = capture_data;
|
||||||
|
|
||||||
hwpm_ip_ops.ip_dev = (void *)pdev;
|
hwpm_ip_ops.ip_dev = (void *)pdev;
|
||||||
hwpm_ip_ops.ip_base_address = base_address;
|
hwpm_ip_ops.ip_base_address = base_address;
|
||||||
if ((strcmp(info->devfs_name, "vi0-thi") == 0U) ||
|
if ((strcmp(info->devfs_name, "vi0-thi") == 0U) ||
|
||||||
@@ -131,7 +143,7 @@ static int capture_support_probe(struct platform_device *pdev)
|
|||||||
} else {
|
} else {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
dev_err(dev, "%s: hwpm: invalid resource name: %s\n", __func__, info->devfs_name);
|
dev_err(dev, "%s: hwpm: invalid resource name: %s\n", __func__, info->devfs_name);
|
||||||
goto device_release;
|
goto error;
|
||||||
}
|
}
|
||||||
hwpm_ip_ops.hwpm_ip_pm = &tegra_cam_hwpm_ip_pm;
|
hwpm_ip_ops.hwpm_ip_pm = &tegra_cam_hwpm_ip_pm;
|
||||||
hwpm_ip_ops.hwpm_ip_reg_op = &tegra_cam_hwpm_ip_reg_op;
|
hwpm_ip_ops.hwpm_ip_reg_op = &tegra_cam_hwpm_ip_reg_op;
|
||||||
@@ -140,12 +152,12 @@ static int capture_support_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
device_release:
|
#ifdef CONFIG_TEGRA_HWPM_CAM
|
||||||
nvhost_client_device_release(pdev);
|
|
||||||
error:
|
error:
|
||||||
if (err != -EPROBE_DEFER)
|
if (err != -EPROBE_DEFER)
|
||||||
dev_err(dev, "probe failed: %d\n", err);
|
dev_err(dev, "probe failed: %d\n", err);
|
||||||
return err;
|
return err;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int capture_support_remove(struct platform_device *pdev)
|
static int capture_support_remove(struct platform_device *pdev)
|
||||||
|
|||||||
Reference in New Issue
Block a user