From 3b643835f94a8744ed6cb0db210741cd8a7c5c73 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 Jan 2017 11:48:22 +0100 Subject: [PATCH] audio: Disable support for IRQ affinity by default Change-Id: I410f0037747149471a1d5fe7cf38720121938822 --- audio/audio_hw.c | 6 ++++++ audio/include/samsung_audio.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index e77c1679..b19020b4 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -2750,6 +2750,7 @@ static int out_set_volume(struct audio_stream_out *stream, float left, return -ENOSYS; } +#if SUPPORTS_IRQ_AFFINITY static int fast_set_affinity(pid_t tid) { cpu_set_t cpu_set; int cpu_num; @@ -2772,6 +2773,7 @@ static int fast_set_affinity(pid_t tid) { CPU_SET(cpu_num, &cpu_set); return sched_setaffinity(tid, sizeof(cpu_set), &cpu_set); } +#endif static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, size_t bytes) @@ -2795,6 +2797,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, lock_output_stream(out); +#if SUPPORTS_IRQ_AFFINITY if (out->usecase == USECASE_AUDIO_PLAYBACK && !out->is_fastmixer_affinity_set) { tid = gettid(); err = fast_set_affinity(tid); @@ -2803,6 +2806,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, } out->is_fastmixer_affinity_set = true; } +#endif if (out->standby) { #ifdef PREPROCESSING_ENABLED @@ -3362,6 +3366,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer, /* no need to acquire adev->lock_inputs because API contract prevents a close */ lock_input_stream(in); +#if SUPPORTS_IRQ_AFFINITY if (in->usecase == USECASE_AUDIO_CAPTURE && !in->is_fastcapture_affinity_set) { tid = gettid(); err = fast_set_affinity(tid); @@ -3370,6 +3375,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer, } in->is_fastcapture_affinity_set = true; } +#endif if (in->standby) { pthread_mutex_unlock(&in->lock); diff --git a/audio/include/samsung_audio.h b/audio/include/samsung_audio.h index 46fe9898..8b8aeac9 100644 --- a/audio/include/samsung_audio.h +++ b/audio/include/samsung_audio.h @@ -51,4 +51,10 @@ */ #define SWAP_SPEAKER_ON_SCREEN_ROTATION 0 +/* + * You can that this to 1 if your kernel supports irq affinity for + * fast mode. See /proc/asound/irq_affinity + */ +#define SUPPORTS_IRQ_AFFINITY 0 + #endif // SAMSUNG_AUDIO_H