diff --git a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c index 6d816d2f..6dcba37e 100644 --- a/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c +++ b/drivers/media/platform/tegra/camera/fusa-capture/capture-isp.c @@ -23,6 +23,12 @@ #include #include +/* + * The host1x-next.h header must be included before the nvhost.h + * header, as the nvhost.h header includes the host1x.h header, + * which is mutually exclusive with host1x-next.h. + */ +#include #include #include #include @@ -170,6 +176,8 @@ static int isp_capture_setup_syncpt( struct syncpoint_info *sp) { struct platform_device *pdev = chan->ndev; + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct host1x_syncpt *host1x_sp; uint32_t gos_index = GOS_INDEX_INVALID; uint32_t gos_offset = 0; int err; @@ -184,9 +192,13 @@ static int isp_capture_setup_syncpt( if (err) return err; - err = nvhost_syncpt_read_ext_check(pdev, sp->id, &sp->threshold); - if (err) + host1x_sp = host1x_syncpt_get_by_id_noref(pdata->host1x, sp->id); + if (!host1x_sp) { + err = -EINVAL; goto cleanup; + } + + sp->threshold = host1x_syncpt_read(host1x_sp); err = chan->ops->get_syncpt_gos_backing(pdev, sp->id, &sp->shim_addr, &gos_index, &gos_offset); @@ -314,17 +326,19 @@ static int isp_capture_read_syncpt( struct syncpoint_info *sp, uint32_t *val) { - int err; + struct platform_device *pdev = chan->ndev; + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct host1x_syncpt *host1x_sp; if (sp->id) { - err = nvhost_syncpt_read_ext_check(chan->ndev, - sp->id, val); - if (err < 0) { + host1x_sp = host1x_syncpt_get_by_id_noref(pdata->host1x, sp->id); + if (!host1x_sp) { dev_err(chan->isp_dev, "%s: get syncpt %i val failed\n", __func__, sp->id); return -EINVAL; } + *val = host1x_syncpt_read(host1x_sp); } return 0; diff --git a/drivers/video/tegra/host/isp/isp5.c b/drivers/video/tegra/host/isp/isp5.c index ba5e53eb..f8ac093b 100644 --- a/drivers/video/tegra/host/isp/isp5.c +++ b/drivers/video/tegra/host/isp/isp5.c @@ -1,9 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2017-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include #include +/* + * The host1x-next.h header must be included before the nvhost.h + * header, as the nvhost.h header includes the host1x.h header, + * which is mutually exclusive with host1x-next.h. + */ +#include #include #include #include @@ -49,13 +55,24 @@ static int isp5_alloc_syncpt(struct platform_device *pdev, uint32_t *syncpt_id) { uint32_t id; + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct host1x_syncpt *sp = NULL; if (syncpt_id == NULL) { dev_err(&pdev->dev, "%s: null argument\n", __func__); return -EINVAL; } - id = nvhost_get_syncpt_client_managed(pdev, name); + sp = host1x_syncpt_alloc(pdata->host1x, HOST1X_SYNCPT_CLIENT_MANAGED, + name ? name : dev_name(&pdev->dev)); + if (!sp) { + dev_err(&pdev->dev, + "%s: allocation of requested sync point failed (name=%s, size=%d)\n", + __func__, name ? name : "", GFP_KERNEL); + return -ENOMEM; + } + + id = host1x_syncpt_id(sp); if (id == 0) { dev_err(&pdev->dev, "%s: syncpt allocation failed\n", __func__); return -ENODEV; @@ -68,14 +85,35 @@ static int isp5_alloc_syncpt(struct platform_device *pdev, static void isp5_release_syncpt(struct platform_device *pdev, uint32_t id) { + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct host1x_syncpt *sp = NULL; + dev_dbg(&pdev->dev, "%s: id=%u\n", __func__, id); - nvhost_syncpt_put_ref_ext(pdev, id); + + sp = host1x_syncpt_get_by_id_noref(pdata->host1x, id); + if (WARN_ON(!sp)) + return; + + host1x_syncpt_put(sp); } static void isp5_fast_forward_syncpt(struct platform_device *pdev, uint32_t id, uint32_t threshold) { + struct nvhost_device_data *pdata = platform_get_drvdata(pdev); + struct host1x_syncpt *sp = NULL; + uint32_t cur; + dev_dbg(&pdev->dev, "%s: id=%u -> thresh=%u\n", __func__, id, threshold); - nvhost_syncpt_set_min_update(pdev, id, threshold); + + sp = host1x_syncpt_get_by_id_noref(pdata->host1x, id); + if (WARN_ON(!sp)) + return; + + cur = host1x_syncpt_read(sp); + while (cur++ != threshold) + host1x_syncpt_incr(sp); + + host1x_syncpt_read(sp); } static int isp5_get_syncpt_gos_backing(struct platform_device *pdev,