// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2016, NVIDIA CORPORATION. All rights reserved. */ #include <linux/module.h> #include <linux/platform_device.h> #include <soc/tegra/fuse.h> #include "soctherm.h" #define NOMINAL_CALIB_FT … #define NOMINAL_CALIB_CP … #define FUSE_TSENSOR_CALIB_CP_TS_BASE_MASK … #define FUSE_TSENSOR_CALIB_FT_TS_BASE_MASK … #define FUSE_TSENSOR_CALIB_FT_TS_BASE_SHIFT … #define FUSE_TSENSOR_COMMON … /* * Tegra210: Layout of bits in FUSE_TSENSOR_COMMON: * 3 2 1 0 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | BASE_FT | BASE_CP | SHFT_FT | SHIFT_CP | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * Tegra12x, etc: * In chips prior to Tegra210, this fuse was incorrectly sized as 26 bits, * and didn't hold SHIFT_CP in [31:26]. Therefore these missing six bits * were obtained via the FUSE_SPARE_REALIGNMENT_REG register [5:0]. * * FUSE_TSENSOR_COMMON: * 3 2 1 0 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |-----------| SHFT_FT | BASE_FT | BASE_CP | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * * FUSE_SPARE_REALIGNMENT_REG: * 3 2 1 0 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * |---------------------------------------------------| SHIFT_CP | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ #define CALIB_COEFFICIENT … /** * div64_s64_precise() - wrapper for div64_s64() * @a: the dividend * @b: the divisor * * Implements division with fairly accurate rounding instead of truncation by * shifting the dividend to the left by 16 so that the quotient has a * much higher precision. * * Return: the quotient of a / b. */ static s64 div64_s64_precise(s64 a, s32 b) { … } int tegra_calc_shared_calib(const struct tegra_soctherm_fuse *tfuse, struct tsensor_shared_calib *shared) { … } int tegra_calc_tsensor_calib(const struct tegra_tsensor *sensor, const struct tsensor_shared_calib *shared, u32 *calibration) { … } MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;