/* * PC-Speaker driver for Linux * * Copyright (C) 1993-1997 Michael Beck * Copyright (C) 1997-2001 David Woodhouse * Copyright (C) 2001-2008 Stas Sergeev */ #ifndef __PCSP_H__ #define __PCSP_H__ #include #include #include #define PCSP_SOUND_VERSION 0x400 /* read 4.00 */ #define PCSP_DEBUG 0 /* default timer freq for PC-Speaker: 18643 Hz */ #define DIV_18KHZ 64 #define MAX_DIV DIV_18KHZ #define CALC_DIV(d) (MAX_DIV >> (d)) #define CUR_DIV() CALC_DIV(chip->treble) #define PCSP_MAX_TREBLE 1 /* unfortunately, with hrtimers 37KHz does not work very well :( */ #define PCSP_DEFAULT_TREBLE 0 #define MIN_DIV (MAX_DIV >> PCSP_MAX_TREBLE) /* wild guess */ #define PCSP_MIN_LPJ 1000000 #define PCSP_DEFAULT_SDIV (DIV_18KHZ >> 1) #define PCSP_DEFAULT_SRATE (PIT_TICK_RATE / PCSP_DEFAULT_SDIV) #define PCSP_INDEX_INC() (1 << (PCSP_MAX_TREBLE - chip->treble)) #define PCSP_CALC_RATE(i) (PIT_TICK_RATE / CALC_DIV(i)) #define PCSP_RATE() PCSP_CALC_RATE(chip->treble) #define PCSP_MIN_RATE__1 MAX_DIV/PIT_TICK_RATE #define PCSP_MAX_RATE__1 MIN_DIV/PIT_TICK_RATE #define PCSP_MAX_PERIOD_NS (1000000000ULL * PCSP_MIN_RATE__1) #define PCSP_MIN_PERIOD_NS (1000000000ULL * PCSP_MAX_RATE__1) #define PCSP_CALC_NS(div) ({ \ u64 __val = 1000000000ULL * (div); \ do_div(__val, PIT_TICK_RATE); \ __val; \ }) #define PCSP_PERIOD_NS() PCSP_CALC_NS(CUR_DIV()) #define PCSP_MAX_PERIOD_SIZE (64*1024) #define PCSP_MAX_PERIODS 512 #define PCSP_BUFFER_SIZE (128*1024) struct snd_pcsp { struct snd_card *card; struct snd_pcm *pcm; struct input_dev *input_dev; struct hrtimer timer; unsigned short port, irq, dma; spinlock_t substream_lock; struct snd_pcm_substream *playback_substream; unsigned int fmt_size; unsigned int is_signed; size_t playback_ptr; size_t period_ptr; atomic_t timer_active; int thalf; u64 ns_rem; unsigned char val61; int enable; int max_treble; int treble; int pcspkr; }; extern struct snd_pcsp pcsp_chip; extern enum hrtimer_restart pcsp_do_timer(struct hrtimer *handle); extern void pcsp_sync_stop(struct snd_pcsp *chip); extern int snd_pcsp_new_pcm(struct snd_pcsp *chip); extern int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm); #endif '>commitdiff
diff options
context:
space:
mode:
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2017-02-03 14:18:39 -0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-02-04 00:11:08 +0100
commit6e978b22efa1db9f6e71b24440b5f1d93e968ee3 (patch)
treec666f7a26b860674848949e39a610222b0723f89 /sound/soc/blackfin/bfin-eval-adau1701.c
parent3c223c19aea85d3dda1416c187915f4a30b04b1f (diff)
cpufreq: intel_pstate: Disable energy efficiency optimization
Some Kabylake desktop processors may not reach max turbo when running in HWP mode, even if running under sustained 100% utilization. This occurs when the HWP.EPP (Energy Performance Preference) is set to "balance_power" (0x80) -- the default on most systems. It occurs because the platform BIOS may erroneously enable an energy-efficiency setting -- MSR_IA32_POWER_CTL BIT-EE, which is not recommended to be enabled on this SKU. On the failing systems, this BIOS issue was not discovered when the desktop motherboard was tested with Windows, because the BIOS also neglects to provide the ACPI/CPPC table, that Windows requires to enable HWP, and so Windows runs in legacy P-state mode, where this setting has no effect. Linux' intel_pstate driver does not require ACPI/CPPC to enable HWP, and so it runs in HWP mode, exposing this incorrect BIOS configuration. There are several ways to address this problem. First, Linux can also run in legacy P-state mode on this system. As intel_pstate is how Linux enables HWP, booting with "intel_pstate=disable" will run in acpi-cpufreq/ondemand legacy p-state mode. Or second, the "performance" governor can be used with intel_pstate, which will modify HWP.EPP to 0. Or third, starting in 4.10, the /sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference attribute in can be updated from "balance_power" to "performance". Or fourth, apply this patch, which fixes the erroneous setting of MSR_IA32_POWER_CTL BIT_EE on this model, allowing the default configuration to function as designed. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Len Brown <len.brown@intel.com> Cc: 4.6+ <stable@vger.kernel.org> # 4.6+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'sound/soc/blackfin/bfin-eval-adau1701.c')