Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 8af2f717 authored by junwen.ye's avatar junwen.ye Committed by Michael Bestas
Browse files

[ALM:10872982] [FP4]:update tof calibration

 &&&%%%comment:[FP4]:update tof calibration
 &&&%%%bug number:10872982
 &&&%%%product name:sm7225_r_fp4
 &&&%%%root cause:coding
 &&&%%%Bug category:T2M
 &&&%%%Module_Impact:kernel
 &&&%%%Test_Suggestion:NA
 &&&%%%Solution:NA
 &&&%%%Test_Report:ok in native
 &&&%%%VAL Can Test:NA
parent 76e27cee
Loading
Loading
Loading
Loading
+68 −17
Original line number Diff line number Diff line

// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/******************************************************************************
/*******************************************************************************
 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved

 This file is part of VL53L1 and is dual licensed,
 either GPL-2.0+
 This file is part of VL53L1 Core and is dual licensed,
 either 'STMicroelectronics
 Proprietary license'
 or 'BSD 3-clause "New" or "Revised" License' , at your option.
 ******************************************************************************

********************************************************************************

 'STMicroelectronics Proprietary license'

********************************************************************************

 License terms: STMicroelectronics Proprietary in accordance with licensing
 terms at www.st.com/sla0081

 STMicroelectronics confidential
 Reproduction and Communication of this document is strictly prohibited unless
 specifically authorized in writing by STMicroelectronics.


********************************************************************************

 Alternatively, VL53L1 Core may be distributed under the terms of
 'BSD 3-clause "New" or "Revised" License', in which case the following
 provisions apply instead of the ones
 mentioned above :

********************************************************************************

 License terms: BSD 3-clause "New" or "Revised" License.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

 1. Redistributions of source code must retain the above copyright notice, this
 list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.

 3. Neither the name of the copyright holder nor the names of its contributors
 may be used to endorse or promote products derived from this software
 without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


********************************************************************************

*/


@@ -2082,7 +2135,7 @@ VL53L1_Error VL53L1_run_hist_xtalk_extraction(
				status =
				VL53L1_clear_interrupt_and_enable_next_range(
					Dev, measurement_mode);

		}

		if (status == VL53L1_ERROR_NONE)
			status =
@@ -2091,14 +2144,12 @@ VL53L1_Error VL53L1_run_hist_xtalk_extraction(
				&(pdev->xtalk_extract),
				&(pdev->xtalk_cal),
				&(pdev->xtalk_shapes.xtalk_shape));
			if (status != VL53L1_ERROR_NONE)
				goto LOOPOUT;
		if (status == VL53L1_ERROR_NONE) {
			pXC->algo__xtalk_cpo_HistoMerge_kcps[k * MaxId] =
			pXC->algo__crosstalk_compensation_plane_offset_kcps;
		}
	}

LOOPOUT:

	VL53L1_stop_range(Dev);

+82 −21
Original line number Diff line number Diff line

// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
/******************************************************************************
/*******************************************************************************
 * Copyright (c) 2020, STMicroelectronics - All Rights Reserved

 This file is part of VL53L1 and is dual licensed,
 either GPL-2.0+
 This file is part of VL53L1 Core and is dual licensed,
 either 'STMicroelectronics
 Proprietary license'
 or 'BSD 3-clause "New" or "Revised" License' , at your option.
 ******************************************************************************

********************************************************************************

 'STMicroelectronics Proprietary license'

********************************************************************************

 License terms: STMicroelectronics Proprietary in accordance with licensing
 terms at www.st.com/sla0081

 STMicroelectronics confidential
 Reproduction and Communication of this document is strictly prohibited unless
 specifically authorized in writing by STMicroelectronics.


********************************************************************************

 Alternatively, VL53L1 Core may be distributed under the terms of
 'BSD 3-clause "New" or "Revised" License', in which case the following
 provisions apply instead of the ones
 mentioned above :

********************************************************************************

 License terms: BSD 3-clause "New" or "Revised" License.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:

 1. Redistributions of source code must retain the above copyright notice, this
 list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright notice,
 this list of conditions and the following disclaimer in the documentation
 and/or other materials provided with the distribution.

 3. Neither the name of the copyright holder nor the names of its contributors
 may be used to endorse or promote products derived from this software
 without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


********************************************************************************

*/


@@ -2395,14 +2448,26 @@ VL53L1_Error VL53L1_hist_xtalk_extract_calc_rate_per_spad(



	if (pxtalk_data->signal_events_sum > 0) {

	tmp64_1 =
		(uint64_t)pxtalk_data->effective_spad_count_sum *
		(uint64_t)pxtalk_data->peak_duration_us_sum;

	if (pxtalk_data->signal_events_sum < 0) {
		pxtalk_data->signal_events_sum = 0;

		tmp64_0 =
		((uint64_t)pxtalk_data->sample_count *
		 (uint64_t)pxtalk_data->event_scaler_avg * 256U) << 9U;
		if (tmp64_0 > 0) {
			pxtalk_data->signal_events_sum = (int32_t)
			do_division_u((50U * tmp64_1), tmp64_0);
		}
	}
	tmp64_0 =
		((uint64_t)pxtalk_data->signal_events_sum *
		 (uint64_t)pxtalk_data->sample_count *
		 (uint64_t)pxtalk_data->event_scaler_avg * 256U) << 9U;
		tmp64_1 =
			(uint64_t)pxtalk_data->effective_spad_count_sum *
			(uint64_t)pxtalk_data->peak_duration_us_sum;



@@ -2414,10 +2479,6 @@ VL53L1_Error VL53L1_hist_xtalk_extract_calc_rate_per_spad(
		xtalk_per_spad = (uint64_t)tmp64_0;
	}

	} else {
		status = VL53L1_ERROR_XTALK_EXTRACTION_SIGMA_LIMIT_FAIL;
	}

	pxtalk_data->xtalk_rate_kcps_per_spad = (uint32_t)xtalk_per_spad;

	LOG_FUNCTION_END(status);