Commit 8ab418d3 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'topic/hda' into for-4.2

parents 782e50e0 0dd76f36
/*
* HD-audio controller (Azalia) registers and helpers
*
* For traditional reasons, we still use azx_ prefix here
*/
#ifndef __SOUND_HDA_REGISTER_H
#define __SOUND_HDA_REGISTER_H
#include <linux/io.h>
#include <sound/hdaudio.h>
#define AZX_REG_GCAP 0x00
#define AZX_GCAP_64OK (1 << 0) /* 64bit address support */
#define AZX_GCAP_NSDO (3 << 1) /* # of serial data out signals */
#define AZX_GCAP_BSS (31 << 3) /* # of bidirectional streams */
#define AZX_GCAP_ISS (15 << 8) /* # of input streams */
#define AZX_GCAP_OSS (15 << 12) /* # of output streams */
#define AZX_REG_VMIN 0x02
#define AZX_REG_VMAJ 0x03
#define AZX_REG_OUTPAY 0x04
#define AZX_REG_INPAY 0x06
#define AZX_REG_GCTL 0x08
#define AZX_GCTL_RESET (1 << 0) /* controller reset */
#define AZX_GCTL_FCNTRL (1 << 1) /* flush control */
#define AZX_GCTL_UNSOL (1 << 8) /* accept unsol. response enable */
#define AZX_REG_WAKEEN 0x0c
#define AZX_REG_STATESTS 0x0e
#define AZX_REG_GSTS 0x10
#define AZX_GSTS_FSTS (1 << 1) /* flush status */
#define AZX_REG_INTCTL 0x20
#define AZX_REG_INTSTS 0x24
#define AZX_REG_WALLCLK 0x30 /* 24Mhz source */
#define AZX_REG_OLD_SSYNC 0x34 /* SSYNC for old ICH */
#define AZX_REG_SSYNC 0x38
#define AZX_REG_CORBLBASE 0x40
#define AZX_REG_CORBUBASE 0x44
#define AZX_REG_CORBWP 0x48
#define AZX_REG_CORBRP 0x4a
#define AZX_CORBRP_RST (1 << 15) /* read pointer reset */
#define AZX_REG_CORBCTL 0x4c
#define AZX_CORBCTL_RUN (1 << 1) /* enable DMA */
#define AZX_CORBCTL_CMEIE (1 << 0) /* enable memory error irq */
#define AZX_REG_CORBSTS 0x4d
#define AZX_CORBSTS_CMEI (1 << 0) /* memory error indication */
#define AZX_REG_CORBSIZE 0x4e
#define AZX_REG_RIRBLBASE 0x50
#define AZX_REG_RIRBUBASE 0x54
#define AZX_REG_RIRBWP 0x58
#define AZX_RIRBWP_RST (1 << 15) /* write pointer reset */
#define AZX_REG_RINTCNT 0x5a
#define AZX_REG_RIRBCTL 0x5c
#define AZX_RBCTL_IRQ_EN (1 << 0) /* enable IRQ */
#define AZX_RBCTL_DMA_EN (1 << 1) /* enable DMA */
#define AZX_RBCTL_OVERRUN_EN (1 << 2) /* enable overrun irq */
#define AZX_REG_RIRBSTS 0x5d
#define AZX_RBSTS_IRQ (1 << 0) /* response irq */
#define AZX_RBSTS_OVERRUN (1 << 2) /* overrun irq */
#define AZX_REG_RIRBSIZE 0x5e
#define AZX_REG_IC 0x60
#define AZX_REG_IR 0x64
#define AZX_REG_IRS 0x68
#define AZX_IRS_VALID (1<<1)
#define AZX_IRS_BUSY (1<<0)
#define AZX_REG_DPLBASE 0x70
#define AZX_REG_DPUBASE 0x74
#define AZX_DPLBASE_ENABLE 0x1 /* Enable position buffer */
/* SD offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
/* stream register offsets from stream base */
#define AZX_REG_SD_CTL 0x00
#define AZX_REG_SD_STS 0x03
#define AZX_REG_SD_LPIB 0x04
#define AZX_REG_SD_CBL 0x08
#define AZX_REG_SD_LVI 0x0c
#define AZX_REG_SD_FIFOW 0x0e
#define AZX_REG_SD_FIFOSIZE 0x10
#define AZX_REG_SD_FORMAT 0x12
#define AZX_REG_SD_BDLPL 0x18
#define AZX_REG_SD_BDLPU 0x1c
/* PCI space */
#define AZX_PCIREG_TCSEL 0x44
/*
* other constants
*/
/* max number of fragments - we may use more if allocating more pages for BDL */
#define BDL_SIZE 4096
#define AZX_MAX_BDL_ENTRIES (BDL_SIZE / 16)
#define AZX_MAX_FRAG 32
/* max buffer size - no h/w limit, you can increase as you like */
#define AZX_MAX_BUF_SIZE (1024*1024*1024)
/* RIRB int mask: overrun[2], response[0] */
#define RIRB_INT_RESPONSE 0x01
#define RIRB_INT_OVERRUN 0x04
#define RIRB_INT_MASK 0x05
/* STATESTS int mask: S3,SD2,SD1,SD0 */
#define STATESTS_INT_MASK ((1 << HDA_MAX_CODECS) - 1)
/* SD_CTL bits */
#define SD_CTL_STREAM_RESET 0x01 /* stream reset bit */
#define SD_CTL_DMA_START 0x02 /* stream DMA start bit */
#define SD_CTL_STRIPE (3 << 16) /* stripe control */
#define SD_CTL_TRAFFIC_PRIO (1 << 18) /* traffic priority */
#define SD_CTL_DIR (1 << 19) /* bi-directional stream */
#define SD_CTL_STREAM_TAG_MASK (0xf << 20)
#define SD_CTL_STREAM_TAG_SHIFT 20
/* SD_CTL and SD_STS */
#define SD_INT_DESC_ERR 0x10 /* descriptor error interrupt */
#define SD_INT_FIFO_ERR 0x08 /* FIFO error interrupt */
#define SD_INT_COMPLETE 0x04 /* completion interrupt */
#define SD_INT_MASK (SD_INT_DESC_ERR|SD_INT_FIFO_ERR|\
SD_INT_COMPLETE)
/* SD_STS */
#define SD_STS_FIFO_READY 0x20 /* FIFO ready */
/* INTCTL and INTSTS */
#define AZX_INT_ALL_STREAM 0xff /* all stream interrupts */
#define AZX_INT_CTRL_EN 0x40000000 /* controller interrupt enable bit */
#define AZX_INT_GLOBAL_EN 0x80000000 /* global interrupt enable bit */
/* below are so far hardcoded - should read registers in future */
#define AZX_MAX_CORB_ENTRIES 256
#define AZX_MAX_RIRB_ENTRIES 256
/*
* helpers to read the stream position
*/
static inline unsigned int
snd_hdac_stream_get_pos_lpib(struct hdac_stream *stream)
{
return snd_hdac_stream_readl(stream, SD_LPIB);
}
static inline unsigned int
snd_hdac_stream_get_pos_posbuf(struct hdac_stream *stream)
{
return le32_to_cpu(*stream->posbuf);
}
#endif /* __SOUND_HDA_REGISTER_H */
This diff is collapsed.
config SND_HDA_CORE config SND_HDA_CORE
tristate tristate
select REGMAP select REGMAP
config SND_HDA_DSP_LOADER
bool
snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \ snd-hda-core-objs := hda_bus_type.o hdac_bus.o hdac_device.o hdac_sysfs.o \
hdac_regmap.o array.o hdac_regmap.o hdac_controller.o hdac_stream.o array.o
snd-hda-core-objs += trace.o snd-hda-core-objs += trace.o
CFLAGS_trace.o := -I$(src) CFLAGS_trace.o := -I$(src)
......
...@@ -11,21 +11,36 @@ ...@@ -11,21 +11,36 @@
static void process_unsol_events(struct work_struct *work); static void process_unsol_events(struct work_struct *work);
static const struct hdac_bus_ops default_ops = {
.command = snd_hdac_bus_send_cmd,
.get_response = snd_hdac_bus_get_response,
};
/** /**
* snd_hdac_bus_init - initialize a HD-audio bas bus * snd_hdac_bus_init - initialize a HD-audio bas bus
* @bus: the pointer to bus object * @bus: the pointer to bus object
* @ops: bus verb operators
* @io_ops: lowlevel I/O operators
* *
* Returns 0 if successful, or a negative error code. * Returns 0 if successful, or a negative error code.
*/ */
int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
const struct hdac_bus_ops *ops) const struct hdac_bus_ops *ops,
const struct hdac_io_ops *io_ops)
{ {
memset(bus, 0, sizeof(*bus)); memset(bus, 0, sizeof(*bus));
bus->dev = dev; bus->dev = dev;
bus->ops = ops; if (ops)
bus->ops = ops;
else
bus->ops = &default_ops;
bus->io_ops = io_ops;
INIT_LIST_HEAD(&bus->stream_list);
INIT_LIST_HEAD(&bus->codec_list); INIT_LIST_HEAD(&bus->codec_list);
INIT_WORK(&bus->unsol_work, process_unsol_events); INIT_WORK(&bus->unsol_work, process_unsol_events);
spin_lock_init(&bus->reg_lock);
mutex_init(&bus->cmd_mutex); mutex_init(&bus->cmd_mutex);
bus->irq = -1;
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(snd_hdac_bus_init); EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
...@@ -36,6 +51,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_init); ...@@ -36,6 +51,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_init);
*/ */
void snd_hdac_bus_exit(struct hdac_bus *bus) void snd_hdac_bus_exit(struct hdac_bus *bus)
{ {
WARN_ON(!list_empty(&bus->stream_list));
WARN_ON(!list_empty(&bus->codec_list)); WARN_ON(!list_empty(&bus->codec_list));
cancel_work_sync(&bus->unsol_work); cancel_work_sync(&bus->unsol_work);
} }
......
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <sound/hdaudio.h> #include <sound/hdaudio.h>
#include <sound/hda_regmap.h> #include <sound/hda_regmap.h>
#include <sound/pcm.h>
#include "local.h" #include "local.h"
static void setup_fg_nodes(struct hdac_device *codec); static void setup_fg_nodes(struct hdac_device *codec);
...@@ -597,3 +598,302 @@ static int get_codec_vendor_name(struct hdac_device *codec) ...@@ -597,3 +598,302 @@ static int get_codec_vendor_name(struct hdac_device *codec)
codec->vendor_name = kasprintf(GFP_KERNEL, "Generic %04x", vendor_id); codec->vendor_name = kasprintf(GFP_KERNEL, "Generic %04x", vendor_id);
return codec->vendor_name ? 0 : -ENOMEM; return codec->vendor_name ? 0 : -ENOMEM;
} }
/*
* stream formats
*/
struct hda_rate_tbl {
unsigned int hz;
unsigned int alsa_bits;
unsigned int hda_fmt;
};
/* rate = base * mult / div */
#define HDA_RATE(base, mult, div) \
(AC_FMT_BASE_##base##K | (((mult) - 1) << AC_FMT_MULT_SHIFT) | \
(((div) - 1) << AC_FMT_DIV_SHIFT))
static struct hda_rate_tbl rate_bits[] = {
/* rate in Hz, ALSA rate bitmask, HDA format value */
/* autodetected value used in snd_hda_query_supported_pcm */
{ 8000, SNDRV_PCM_RATE_8000, HDA_RATE(48, 1, 6) },
{ 11025, SNDRV_PCM_RATE_11025, HDA_RATE(44, 1, 4) },
{ 16000, SNDRV_PCM_RATE_16000, HDA_RATE(48, 1, 3) },
{ 22050, SNDRV_PCM_RATE_22050, HDA_RATE(44, 1, 2) },
{ 32000, SNDRV_PCM_RATE_32000, HDA_RATE(48, 2, 3) },
{ 44100, SNDRV_PCM_RATE_44100, HDA_RATE(44, 1, 1) },
{ 48000, SNDRV_PCM_RATE_48000, HDA_RATE(48, 1, 1) },
{ 88200, SNDRV_PCM_RATE_88200, HDA_RATE(44, 2, 1) },
{ 96000, SNDRV_PCM_RATE_96000, HDA_RATE(48, 2, 1) },
{ 176400, SNDRV_PCM_RATE_176400, HDA_RATE(44, 4, 1) },
{ 192000, SNDRV_PCM_RATE_192000, HDA_RATE(48, 4, 1) },
#define AC_PAR_PCM_RATE_BITS 11
/* up to bits 10, 384kHZ isn't supported properly */
/* not autodetected value */
{ 9600, SNDRV_PCM_RATE_KNOT, HDA_RATE(48, 1, 5) },
{ 0 } /* terminator */
};
/**
* snd_hdac_calc_stream_format - calculate the format bitset
* @rate: the sample rate
* @channels: the number of channels
* @format: the PCM format (SNDRV_PCM_FORMAT_XXX)
* @maxbps: the max. bps
* @spdif_ctls: HD-audio SPDIF status bits (0 if irrelevant)
*
* Calculate the format bitset from the given rate, channels and th PCM format.
*
* Return zero if invalid.
*/
unsigned int snd_hdac_calc_stream_format(unsigned int rate,
unsigned int channels,
unsigned int format,
unsigned int maxbps,
unsigned short spdif_ctls)
{
int i;
unsigned int val = 0;
for (i = 0; rate_bits[i].hz; i++)
if (rate_bits[i].hz == rate) {
val = rate_bits[i].hda_fmt;
break;
}
if (!rate_bits[i].hz)
return 0;
if (channels == 0 || channels > 8)
return 0;
val |= channels - 1;
switch (snd_pcm_format_width(format)) {
case 8:
val |= AC_FMT_BITS_8;
break;
case 16:
val |= AC_FMT_BITS_16;
break;
case 20:
case 24:
case 32:
if (maxbps >= 32 || format == SNDRV_PCM_FORMAT_FLOAT_LE)
val |= AC_FMT_BITS_32;
else if (maxbps >= 24)
val |= AC_FMT_BITS_24;
else
val |= AC_FMT_BITS_20;
break;
default:
return 0;
}
if (spdif_ctls & AC_DIG1_NONAUDIO)
val |= AC_FMT_TYPE_NON_PCM;
return val;
}
EXPORT_SYMBOL_GPL(snd_hdac_calc_stream_format);
static unsigned int query_pcm_param(struct hdac_device *codec, hda_nid_t nid)
{
unsigned int val = 0;
if (nid != codec->afg &&
(get_wcaps(codec, nid) & AC_WCAP_FORMAT_OVRD))
val = snd_hdac_read_parm(codec, nid, AC_PAR_PCM);
if (!val || val == -1)
val = snd_hdac_read_parm(codec, codec->afg, AC_PAR_PCM);
if (!val || val == -1)
return 0;
return val;
}
static unsigned int query_stream_param(struct hdac_device *codec, hda_nid_t nid)
{
unsigned int streams = snd_hdac_read_parm(codec, nid, AC_PAR_STREAM);
if (!streams || streams == -1)
streams = snd_hdac_read_parm(codec, codec->afg, AC_PAR_STREAM);
if (!streams || streams == -1)
return 0;
return streams;
}
/**
* snd_hdac_query_supported_pcm - query the supported PCM rates and formats
* @codec: the codec object
* @nid: NID to query
* @ratesp: the pointer to store the detected rate bitflags
* @formatsp: the pointer to store the detected formats
* @bpsp: the pointer to store the detected format widths
*
* Queries the supported PCM rates and formats. The NULL @ratesp, @formatsp
* or @bsps argument is ignored.
*
* Returns 0 if successful, otherwise a negative error code.
*/
int snd_hdac_query_supported_pcm(struct hdac_device *codec, hda_nid_t nid,
u32 *ratesp, u64 *formatsp, unsigned int *bpsp)
{
unsigned int i, val, wcaps;
wcaps = get_wcaps(codec, nid);
val = query_pcm_param(codec, nid);
if (ratesp) {
u32 rates = 0;
for (i = 0; i < AC_PAR_PCM_RATE_BITS; i++) {
if (val & (1 << i))
rates |= rate_bits[i].alsa_bits;
}
if (rates == 0) {
dev_err(&codec->dev,
"rates == 0 (nid=0x%x, val=0x%x, ovrd=%i)\n",
nid, val,
(wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0);
return -EIO;
}
*ratesp = rates;
}
if (formatsp || bpsp) {
u64 formats = 0;
unsigned int streams, bps;
streams = query_stream_param(codec, nid);
if (!streams)
return -EIO;
bps = 0;
if (streams & AC_SUPFMT_PCM) {
if (val & AC_SUPPCM_BITS_8) {
formats |= SNDRV_PCM_FMTBIT_U8;
bps = 8;
}
if (val & AC_SUPPCM_BITS_16) {
formats |= SNDRV_PCM_FMTBIT_S16_LE;
bps = 16;
}
if (wcaps & AC_WCAP_DIGITAL) {
if (val & AC_SUPPCM_BITS_32)
formats |= SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE;
if (val & (AC_SUPPCM_BITS_20|AC_SUPPCM_BITS_24))
formats |= SNDRV_PCM_FMTBIT_S32_LE;
if (val & AC_SUPPCM_BITS_24)
bps = 24;
else if (val & AC_SUPPCM_BITS_20)
bps = 20;
} else if (val & (AC_SUPPCM_BITS_20|AC_SUPPCM_BITS_24|
AC_SUPPCM_BITS_32)) {
formats |= SNDRV_PCM_FMTBIT_S32_LE;
if (val & AC_SUPPCM_BITS_32)
bps = 32;
else if (val & AC_SUPPCM_BITS_24)
bps = 24;
else if (val & AC_SUPPCM_BITS_20)
bps = 20;
}
}
#if 0 /* FIXME: CS4206 doesn't work, which is the only codec supporting float */
if (streams & AC_SUPFMT_FLOAT32) {
formats |= SNDRV_PCM_FMTBIT_FLOAT_LE;
if (!bps)
bps = 32;
}
#endif
if (streams == AC_SUPFMT_AC3) {
/* should be exclusive */
/* temporary hack: we have still no proper support
* for the direct AC3 stream...
*/
formats |= SNDRV_PCM_FMTBIT_U8;
bps = 8;
}
if (formats == 0) {
dev_err(&codec->dev,
"formats == 0 (nid=0x%x, val=0x%x, ovrd=%i, streams=0x%x)\n",
nid, val,
(wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0,
streams);
return -EIO;
}
if (formatsp)
*formatsp = formats;
if (bpsp)
*bpsp = bps;
}
return 0;
}
EXPORT_SYMBOL_GPL(snd_hdac_query_supported_pcm);
/**
* snd_hdac_is_supported_format - Check the validity of the format
* @codec: the codec object
* @nid: NID to check
* @format: the HD-audio format value to check
*
* Check whether the given node supports the format value.
*
* Returns true if supported, false if not.
*/
bool snd_hdac_is_supported_format(struct hdac_device *codec, hda_nid_t nid,
unsigned int format)
{
int i;
unsigned int val = 0, rate, stream;
val = query_pcm_param(codec, nid);
if (!val)
return false;
rate = format & 0xff00;
for (i = 0; i < AC_PAR_PCM_RATE_BITS; i++)
if (rate_bits[i].hda_fmt == rate) {
if (val & (1 << i))
break;
return false;
}
if (i >= AC_PAR_PCM_RATE_BITS)
return false;
stream = query_stream_param(codec, nid);
if (!stream)
return false;
if (stream & AC_SUPFMT_PCM) {
switch (format & 0xf0) {
case 0x00:
if (!(val & AC_SUPPCM_BITS_8))
return false;
break;
case 0x10:
if (!(val & AC_SUPPCM_BITS_16))
return false;
break;
case 0x20:
if (!(val & AC_SUPPCM_BITS_20))
return false;
break;
case 0x30:
if (!(val & AC_SUPPCM_BITS_24))
return false;
break;
case 0x40:
if (!(val & AC_SUPPCM_BITS_32))
return false;
break;
default:
return false;
}
} else {
/* FIXME: check for float32 and AC3? */
}
return true;
}
EXPORT_SYMBOL_GPL(snd_hdac_is_supported_format);
This diff is collapsed.
...@@ -38,9 +38,6 @@ config SND_HDA_TEGRA ...@@ -38,9 +38,6 @@ config SND_HDA_TEGRA
if SND_HDA if SND_HDA
config SND_HDA_DSP_LOADER
bool
config SND_HDA_PREALLOC_SIZE config SND_HDA_PREALLOC_SIZE
int "Pre-allocated buffer size for HD-audio driver" int "Pre-allocated buffer size for HD-audio driver"
range 0 32768 range 0 32768
......
snd-hda-intel-objs := hda_intel.o snd-hda-intel-objs := hda_intel.o
snd-hda-controller-objs := hda_controller.o
snd-hda-tegra-objs := hda_tegra.o snd-hda-tegra-objs := hda_tegra.o
# for haswell power well # for haswell power well
snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o snd-hda-intel-$(CONFIG_SND_HDA_I915) += hda_i915.o
snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o snd-hda-codec-y := hda_bind.o hda_codec.o hda_jack.o hda_auto_parser.o hda_sysfs.o
snd-hda-codec-y += hda_controller.o
snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
...@@ -27,7 +27,6 @@ snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o ...@@ -27,7 +27,6 @@ snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
# common driver # common driver
obj-$(CONFIG_SND_HDA) := snd-hda-codec.o obj-$(CONFIG_SND_HDA) := snd-hda-codec.o
obj-$(CONFIG_SND_HDA) += snd-hda-controller.o
# codec drivers # codec drivers
obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o obj-$(CONFIG_SND_HDA_GENERIC) += snd-hda-codec-generic.o
......
This diff is collapsed.
...@@ -40,32 +40,6 @@ struct hda_codec; ...@@ -40,32 +40,6 @@ struct hda_codec;
struct hda_pcm; struct hda_pcm;
struct hda_pcm_stream; struct hda_pcm_stream;
/* bus operators */
struct hda_bus_ops {
/* send a single command */
int (*command)(struct hda_bus *bus, unsigned int cmd);
/* get a response from the last command */
unsigned int (*get_response)(struct hda_bus *bus, unsigned int addr);
/* free the private data */
void (*private_free)(struct hda_bus *);
/* attach a PCM stream */
int (*attach_pcm)(struct hda_bus *bus, struct hda_codec *codec,
struct hda_pcm *pcm);
/* reset bus for retry verb */
void (*bus_reset)(struct hda_bus *bus);
#ifdef CONFIG_SND_HDA_DSP_LOADER
/* prepare DSP transfer */
int (*load_dsp_prepare)(struct hda_bus *bus, unsigned int format,
unsigned int byte_size,
struct snd_dma_buffer *bufp);
/* start/stop DSP transfer */
void (*load_dsp_trigger)(struct hda_bus *bus, bool start);
/* clean up DSP transfer */
void (*load_dsp_cleanup)(struct hda_bus *bus,
struct snd_dma_buffer *dmab);
#endif
};
/* /*
* codec bus * codec bus
* *
...@@ -77,10 +51,8 @@ struct hda_bus { ...@@ -77,10 +51,8 @@ struct hda_bus {
struct snd_card *card; struct snd_card *card;
void *private_data;
struct pci_dev *pci; struct pci_dev *pci;
const char *modelname; const char *modelname;
struct hda_bus_ops ops;
struct mutex prepare_mutex; struct mutex prepare_mutex;
...@@ -92,7 +64,6 @@ struct hda_bus { ...@@ -92,7 +64,6 @@ struct hda_bus {
unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */ unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */
/* status for codec/controller */ /* status for codec/controller */
unsigned int shutdown :1; /* being unloaded */ unsigned int shutdown :1; /* being unloaded */
unsigned int rirb_error:1; /* error in codec communication */
unsigned int response_reset:1; /* controller was reset */ unsigned int response_reset:1; /* controller was reset */
unsigned int in_reset:1; /* during reset operation */ unsigned int in_reset:1; /* during reset operation */
unsigned int no_response_fallback:1; /* don't fallback at RIRB error */ unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
...@@ -100,6 +71,9 @@ struct hda_bus { ...@@ -100,6 +71,9 @@ struct hda_bus {
int primary_dig_out_type; /* primary digital out PCM type */ int primary_dig_out_type; /* primary digital out PCM type */
}; };
/* from hdac_bus to hda_bus */
#define to_hda_bus(bus) container_of(bus, struct hda_bus, core)
/* /*
* codec preset * codec preset
* *
...@@ -328,7 +302,10 @@ struct hda_codec { ...@@ -328,7 +302,10 @@ struct hda_codec {
/* /*
* constructors * constructors
*/ */
int snd_hda_bus_new(struct snd_card *card, struct hda_bus **busp); int snd_hda_bus_new(struct snd_card *card,
const struct hdac_bus_ops *ops,
const struct hdac_io_ops *io_ops,
struct hda_bus **busp);
int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card, int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
unsigned int codec_addr, struct hda_codec **codecp); unsigned int codec_addr, struct hda_codec **codecp);
int snd_hda_codec_configure(struct hda_codec *codec); int snd_hda_codec_configure(struct hda_codec *codec);
...@@ -367,8 +344,6 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux, ...@@ -367,8 +344,6 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux,
hda_nid_t nid, int recursive); hda_nid_t nid, int recursive);
int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid, int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid,
u8 *dev_list, int max_devices); u8 *dev_list, int max_devices);
int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,
u32 *ratesp, u64 *formatsp, unsigned int *bpsp);
struct hda_verb { struct hda_verb {
hda_nid_t nid; hda_nid_t nid;
...@@ -460,17 +435,17 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, ...@@ -460,17 +435,17 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid,
int do_now); int do_now);
#define snd_hda_codec_cleanup_stream(codec, nid) \ #define snd_hda_codec_cleanup_stream(codec, nid) \
__snd_hda_codec_cleanup_stream(codec, nid, 0) __snd_hda_codec_cleanup_stream(codec, nid, 0)
unsigned int snd_hda_calc_stream_format(struct hda_codec *codec,
unsigned int rate, #define snd_hda_query_supported_pcm(codec, nid, ratesp, fmtsp, bpsp) \
unsigned int channels, snd_hdac_query_supported_pcm(&(codec)->core, nid, ratesp, fmtsp, bpsp)
unsigned int format, #define snd_hda_is_supported_format(codec, nid, fmt) \
unsigned int maxbps, snd_hdac_is_supported_format(&(codec)->core, nid, fmt)
unsigned short spdif_ctls);
int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
unsigned int format);
extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[]; extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[];
int snd_hda_attach_pcm_stream(struct hda_bus *_bus, struct hda_codec *codec,
struct hda_pcm *cpcm);
/* /*
* Misc * Misc
*/ */
...@@ -481,6 +456,7 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, ...@@ -481,6 +456,7 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
int snd_hda_lock_devices(struct hda_bus *bus); int snd_hda_lock_devices(struct hda_bus *bus);
void snd_hda_unlock_devices(struct hda_bus *bus); void snd_hda_unlock_devices(struct hda_bus *bus);
void snd_hda_bus_reset(struct hda_bus *bus); void snd_hda_bus_reset(struct hda_bus *bus);
void snd_hda_bus_reset_codecs(struct hda_bus *bus);
/* /*
* power management * power management
...@@ -526,24 +502,12 @@ int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf); ...@@ -526,24 +502,12 @@ int snd_hda_load_patch(struct hda_bus *bus, size_t size, const void *buf);
#endif #endif
#ifdef CONFIG_SND_HDA_DSP_LOADER #ifdef CONFIG_SND_HDA_DSP_LOADER
static inline int int snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format, unsigned int size,
unsigned int size, struct snd_dma_buffer *bufp);
struct snd_dma_buffer *bufp) void snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start);
{ void snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
return codec->bus->ops.load_dsp_prepare(codec->bus, format, size, bufp); struct snd_dma_buffer *dmab);
}
static inline void
snd_hda_codec_load_dsp_trigger(struct hda_codec *codec, bool start)
{
return codec->bus->ops.load_dsp_trigger(codec->bus, start);
}
static inline void
snd_hda_codec_load_dsp_cleanup(struct hda_codec *codec,
struct snd_dma_buffer *dmab)
{
return codec->bus->ops.load_dsp_cleanup(codec->bus, dmab);
}
#else #else
static inline int static inline int
snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format, snd_hda_codec_load_dsp_prepare(struct hda_codec *codec, unsigned int format,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -34,6 +34,7 @@ struct hda_intel { ...@@ -34,6 +34,7 @@ struct hda_intel {
/* extra flags */ /* extra flags */
unsigned int irq_pending_warned:1; unsigned int irq_pending_warned:1;
unsigned int probe_continued:1;
/* VGA-switcheroo setup */ /* VGA-switcheroo setup */
unsigned int use_vga_switcheroo:1; unsigned int use_vga_switcheroo:1;
......
...@@ -24,7 +24,7 @@ TRACE_EVENT(azx_pcm_trigger, ...@@ -24,7 +24,7 @@ TRACE_EVENT(azx_pcm_trigger,
TP_fast_assign( TP_fast_assign(
__entry->card = (chip)->card->number; __entry->card = (chip)->card->number;
__entry->idx = (dev)->index; __entry->idx = (dev)->core.index;
__entry->cmd = cmd; __entry->cmd = cmd;
), ),
...@@ -46,7 +46,7 @@ TRACE_EVENT(azx_get_position, ...@@ -46,7 +46,7 @@ TRACE_EVENT(azx_get_position,
TP_fast_assign( TP_fast_assign(
__entry->card = (chip)->card->number; __entry->card = (chip)->card->number;
__entry->idx = (dev)->index; __entry->idx = (dev)->core.index;
__entry->pos = pos; __entry->pos = pos;
__entry->delay = delay; __entry->delay = delay;
), ),
......
This diff is collapsed.
...@@ -2052,11 +2052,8 @@ static int dma_convert_to_hda_format(struct hda_codec *codec, ...@@ -2052,11 +2052,8 @@ static int dma_convert_to_hda_format(struct hda_codec *codec,
{ {
unsigned int format_val; unsigned int format_val;
format_val = snd_hda_calc_stream_format(codec, format_val = snd_hdac_calc_stream_format(sample_rate,
sample_rate, channels, SNDRV_PCM_FORMAT_S32_LE, 32, 0);
channels,
SNDRV_PCM_FORMAT_S32_LE,
32, 0);
if (hda_format) if (hda_format)
*hda_format = (unsigned short)format_val; *hda_format = (unsigned short)format_val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment