162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Library for common functions for Intel SpeedStep v.1 and v.2 support
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *  BIG FAT DISCLAIMER: Work in progress code. Possibly *dangerous*
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* processors */
1362306a36Sopenharmony_cienum speedstep_processor {
1462306a36Sopenharmony_ci	SPEEDSTEP_CPU_PIII_C_EARLY = 0x00000001,  /* Coppermine core */
1562306a36Sopenharmony_ci	SPEEDSTEP_CPU_PIII_C	   = 0x00000002,  /* Coppermine core */
1662306a36Sopenharmony_ci	SPEEDSTEP_CPU_PIII_T	   = 0x00000003,  /* Tualatin core */
1762306a36Sopenharmony_ci	SPEEDSTEP_CPU_P4M	   = 0x00000004,  /* P4-M  */
1862306a36Sopenharmony_ci/* the following processors are not speedstep-capable and are not auto-detected
1962306a36Sopenharmony_ci * in speedstep_detect_processor(). However, their speed can be detected using
2062306a36Sopenharmony_ci * the speedstep_get_frequency() call. */
2162306a36Sopenharmony_ci	SPEEDSTEP_CPU_PM	   = 0xFFFFFF03,  /* Pentium M  */
2262306a36Sopenharmony_ci	SPEEDSTEP_CPU_P4D	   = 0xFFFFFF04,  /* desktop P4  */
2362306a36Sopenharmony_ci	SPEEDSTEP_CPU_PCORE	   = 0xFFFFFF05,  /* Core */
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/* speedstep states -- only two of them */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci#define SPEEDSTEP_HIGH	0x00000000
2962306a36Sopenharmony_ci#define SPEEDSTEP_LOW	0x00000001
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci/* detect a speedstep-capable processor */
3362306a36Sopenharmony_ciextern enum speedstep_processor speedstep_detect_processor(void);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* detect the current speed (in khz) of the processor */
3662306a36Sopenharmony_ciextern unsigned int speedstep_get_frequency(enum speedstep_processor processor);
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci/* detect the low and high speeds of the processor. The callback
4062306a36Sopenharmony_ci * set_state"'s first argument is either SPEEDSTEP_HIGH or
4162306a36Sopenharmony_ci * SPEEDSTEP_LOW; the second argument is zero so that no
4262306a36Sopenharmony_ci * cpufreq_notify_transition calls are initiated.
4362306a36Sopenharmony_ci */
4462306a36Sopenharmony_ciextern unsigned int speedstep_get_freqs(enum speedstep_processor processor,
4562306a36Sopenharmony_ci	unsigned int *low_speed,
4662306a36Sopenharmony_ci	unsigned int *high_speed,
4762306a36Sopenharmony_ci	unsigned int *transition_latency,
4862306a36Sopenharmony_ci	void (*set_state) (unsigned int state));
49