linux/drivers/crypto/intel/qat/qat_common/adf_clock.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2023 Intel Corporation */

#include <linux/delay.h>
#include <linux/dev_printk.h>
#include <linux/export.h>
#include <linux/math.h>
#include <linux/minmax.h>
#include <linux/time64.h>
#include <linux/types.h>
#include <linux/units.h>
#include <asm/errno.h>
#include "adf_admin.h"
#include "adf_accel_devices.h"
#include "adf_clock.h"
#include "adf_common_drv.h"

#define MEASURE_CLOCK_RETRIES
#define MEASURE_CLOCK_DELAY_US
#define ME_CLK_DIVIDER
#define MEASURE_CLOCK_DELTA_THRESHOLD_US

static inline u64 timespec_to_us(const struct timespec64 *ts)
{}

static inline u64 timespec_to_ms(const struct timespec64 *ts)
{}

u64 adf_clock_get_current_time(void)
{}

static int measure_clock(struct adf_accel_dev *accel_dev, u32 *frequency)
{}

/**
 * adf_dev_measure_clock() - measures device clock frequency
 * @accel_dev: Pointer to acceleration device.
 * @frequency: Pointer to variable where result will be stored
 * @min: Minimal allowed frequency value
 * @max: Maximal allowed frequency value
 *
 * If the measurement result will go beyond the min/max thresholds the value
 * will take the value of the crossed threshold.
 *
 * This algorithm compares the device firmware timestamp with the kernel
 * timestamp. So we can't expect too high accuracy from this measurement.
 *
 * Return:
 * * 0 - measurement succeed
 * * -ETIMEDOUT - measurement failed
 */
int adf_dev_measure_clock(struct adf_accel_dev *accel_dev,
			  u32 *frequency, u32 min, u32 max)
{}
EXPORT_SYMBOL_GPL();