#include <linux/moduleparam.h>
#include <sound/hda_register.h>
#include <sound/pcm_params.h>
#include <trace/events/sof_intel.h>
#include "../sof-audio.h"
#include "../ops.h"
#include "hda.h"
#define SDnFMT_BASE(x) …
#define SDnFMT_MULT(x) …
#define SDnFMT_DIV(x) …
#define SDnFMT_BITS(x) …
#define SDnFMT_CHAN(x) …
static bool hda_always_enable_dmi_l1;
module_param_named(always_enable_dmi_l1, hda_always_enable_dmi_l1, bool, 0444);
MODULE_PARM_DESC(…) …;
static bool hda_disable_rewinds;
module_param_named(disable_rewinds, hda_disable_rewinds, bool, 0444);
MODULE_PARM_DESC(…) …;
u32 hda_dsp_get_mult_div(struct snd_sof_dev *sdev, int rate)
{
switch (rate) {
case 8000:
return SDnFMT_DIV(6);
case 9600:
return SDnFMT_DIV(5);
case 11025:
return SDnFMT_BASE(1) | SDnFMT_DIV(4);
case 16000:
return SDnFMT_DIV(3);
case 22050:
return SDnFMT_BASE(1) | SDnFMT_DIV(2);
case 32000:
return SDnFMT_DIV(3) | SDnFMT_MULT(2);
case 44100:
return SDnFMT_BASE(1);
case 48000:
return 0;
case 88200:
return SDnFMT_BASE(1) | SDnFMT_MULT(2);
case 96000:
return SDnFMT_MULT(2);
case 176400:
return SDnFMT_BASE(1) | SDnFMT_MULT(4);
case 192000:
return SDnFMT_MULT(4);
default:
dev_warn(sdev->dev, "can't find div rate %d using 48kHz\n",
rate);
return 0;
}
};
u32 hda_dsp_get_bits(struct snd_sof_dev *sdev, int sample_bits)
{
switch (sample_bits) {
case 8:
return SDnFMT_BITS(0);
case 16:
return SDnFMT_BITS(1);
case 20:
return SDnFMT_BITS(2);
case 24:
return SDnFMT_BITS(3);
case 32:
return SDnFMT_BITS(4);
default:
dev_warn(sdev->dev, "can't find %d bits using 16bit\n",
sample_bits);
return SDnFMT_BITS(1);
}
};
int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_sof_platform_stream_params *platform_params)
{ … }
EXPORT_SYMBOL_NS(…);
int hda_dsp_pcm_ack(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream)
{ … }
EXPORT_SYMBOL_NS(…);
int hda_dsp_pcm_trigger(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream, int cmd)
{ … }
EXPORT_SYMBOL_NS(…);
snd_pcm_uframes_t hda_dsp_pcm_pointer(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream)
{ … }
EXPORT_SYMBOL_NS(…);
int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream)
{ … }
EXPORT_SYMBOL_NS(…);
int hda_dsp_pcm_close(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream)
{ … }
EXPORT_SYMBOL_NS(…);