camera: Use conftest for finding tegra264_io_pad_power_* available

Use conftest for finding whether APIs tegra264_io_pad_power_*
are available or not before using it.

Bug 4911768

Change-Id: Ic8df4a0109a270d5a486a67900ed7fe4c57b79be
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
Laxman Dewangan
2024-10-24 05:21:28 +00:00
committed by Jon Hunter
parent 09d2e16146
commit 055bd73cbb
3 changed files with 28 additions and 0 deletions

View File

@@ -4,6 +4,9 @@
* *
* Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved.
*/ */
#include <nvidia/conftest.h>
#include <linux/types.h> #include <linux/types.h>
#include <media/tegra-v4l2-camera.h> #include <media/tegra-v4l2-camera.h>
#include <media/camera_common.h> #include <media/camera_common.h>
@@ -875,12 +878,17 @@ void camera_common_dpd_disable(struct camera_common_data *s_data)
} }
if (atomic_inc_return( if (atomic_inc_return(
&camera_common_csi_io_pads[io_idx].ref) == 1) { &camera_common_csi_io_pads[io_idx].ref) == 1) {
#if defined(NV_TEGRA264_IO_PAD_POWER_ENABLE_PRESENT)
if (__tegra_get_chip_id() == TEGRA264) if (__tegra_get_chip_id() == TEGRA264)
tegra264_io_pad_power_enable(s_data->dev, tegra264_io_pad_power_enable(s_data->dev,
TEGRA_IO_PAD_CSIA + io_idx); TEGRA_IO_PAD_CSIA + io_idx);
else else
tegra_io_pad_power_enable( tegra_io_pad_power_enable(
TEGRA_IO_PAD_CSIA + io_idx); TEGRA_IO_PAD_CSIA + io_idx);
#else
tegra_io_pad_power_enable(
TEGRA_IO_PAD_CSIA + io_idx);
#endif
} }
dev_dbg(s_data->dev, dev_dbg(s_data->dev,
@@ -906,12 +914,17 @@ void camera_common_dpd_enable(struct camera_common_data *s_data)
} }
if (atomic_dec_return( if (atomic_dec_return(
&camera_common_csi_io_pads[io_idx].ref) == 0) { &camera_common_csi_io_pads[io_idx].ref) == 0) {
#if defined(NV_TEGRA264_IO_PAD_POWER_ENABLE_PRESENT)
if (__tegra_get_chip_id() == TEGRA264) if (__tegra_get_chip_id() == TEGRA264)
tegra264_io_pad_power_disable(s_data->dev, tegra264_io_pad_power_disable(s_data->dev,
TEGRA_IO_PAD_CSIA + io_idx); TEGRA_IO_PAD_CSIA + io_idx);
else else
tegra_io_pad_power_disable( tegra_io_pad_power_disable(
TEGRA_IO_PAD_CSIA + io_idx); TEGRA_IO_PAD_CSIA + io_idx);
#else
tegra_io_pad_power_disable(
TEGRA_IO_PAD_CSIA + io_idx);
#endif
} }
dev_dbg(s_data->dev, dev_dbg(s_data->dev,

View File

@@ -187,6 +187,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_driver_struct_remove_return_type_int
NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect NV_CONFTEST_FUNCTION_COMPILE_TESTS += spi_get_chipselect
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra264_chip_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra264_chip_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra264_io_pad_power_enable
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_use_ivc_ext_driver NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_use_ivc_ext_driver

View File

@@ -8143,6 +8143,20 @@ compile_test() {
compile_check_conftest "$CODE" "NV_TEGRA264_CHIP_ID_PRESENT" "" "types" compile_check_conftest "$CODE" "NV_TEGRA264_CHIP_ID_PRESENT" "" "types"
;; ;;
tegra264_io_pad_power_enable)
#
# Determine if tegra264_io_pad_power_enable() exists or not
#
CODE="
#include <soc/tegra/pmc.h>
int conftest_tegra264_io_pad_power_enable(void) {
tegra264_io_pad_power_enable();
}
"
compile_check_conftest "$CODE" "NV_TEGRA264_IO_PAD_POWER_ENABLE_PRESENT" "" "functions"
;;
tegra_ivc_struct_has_iosys_map) tegra_ivc_struct_has_iosys_map)
# #
# Determine if the 'tegra_ivc' structure has the 'map' argument. # Determine if the 'tegra_ivc' structure has the 'map' argument.