Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 153770ec authored by Konrad Leszczynski's avatar Konrad Leszczynski Committed by Dmitry Shmidt
Browse files

ANDROID: usb: gadget: f_audio_source: disable the CPU C-states upon playback



Due to the issue with the isoc transfers being interrupted
by the CPU going into the idle state, the C-states will be
disabled for the playback time.

Change-Id: If4e52673606923d7e33a1d1dbe0192b8ad24f78c
Signed-off-by: default avatarKonrad Leszczynski <konrad.leszczynski@intel.com>
Signed-off-by: default avatarRuss Weight <russell.h.weight@intel.com>
parent 6db5c3ea
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/device.h>
#include <linux/device.h>
#include <linux/usb/audio.h>
#include <linux/usb/audio.h>
#include <linux/wait.h>
#include <linux/wait.h>
#include <linux/pm_qos.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/pcm.h>
@@ -268,6 +269,8 @@ struct audio_dev {
	/* number of frames sent since start_time */
	/* number of frames sent since start_time */
	s64				frames_sent;
	s64				frames_sent;
	struct audio_source_config	*config;
	struct audio_source_config	*config;
	/* for creating and issuing QoS requests */
	struct pm_qos_request pm_qos;
};
};


static inline struct audio_dev *func_to_audio(struct usb_function *f)
static inline struct audio_dev *func_to_audio(struct usb_function *f)
@@ -740,6 +743,10 @@ static int audio_pcm_open(struct snd_pcm_substream *substream)
	runtime->hw.channels_max = 2;
	runtime->hw.channels_max = 2;


	audio->substream = substream;
	audio->substream = substream;

	/* Add the QoS request and set the latency to 0 */
	pm_qos_add_request(&audio->pm_qos, PM_QOS_CPU_DMA_LATENCY, 0);

	return 0;
	return 0;
}
}


@@ -749,6 +756,10 @@ static int audio_pcm_close(struct snd_pcm_substream *substream)
	unsigned long flags;
	unsigned long flags;


	spin_lock_irqsave(&audio->lock, flags);
	spin_lock_irqsave(&audio->lock, flags);

	/* Remove the QoS request */
	pm_qos_remove_request(&audio->pm_qos);

	audio->substream = NULL;
	audio->substream = NULL;
	spin_unlock_irqrestore(&audio->lock, flags);
	spin_unlock_irqrestore(&audio->lock, flags);