Skip to content

Commit

Permalink
Merge branch 'for-next' into for-linus
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwai committed May 16, 2016
2 parents 84add30 + 639db59 commit 581abba
Show file tree
Hide file tree
Showing 62 changed files with 1,437 additions and 1,035 deletions.
26 changes: 8 additions & 18 deletions Documentation/sound/alsa/HD-Audio.txt
Original file line number Diff line number Diff line change
Expand Up @@ -655,17 +655,6 @@ development branches in general while the development for the current
and next kernels are found in for-linus and for-next branches,
respectively.

If you are using the latest Linus tree, it'd be better to pull the
above GIT tree onto it. If you are using the older kernels, an easy
way to try the latest ALSA code is to build from the snapshot
tarball. There are daily tarballs and the latest snapshot tarball.
All can be built just like normal alsa-driver release packages, that
is, installed via the usual spells: configure, make and make
install(-modules). See INSTALL in the package. The snapshot tarballs
are found at:

- ftp://ftp.suse.com/pub/people/tiwai/snapshot/


Sending a Bug Report
~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -699,7 +688,12 @@ problems.
alsa-info
~~~~~~~~~
The script `alsa-info.sh` is a very useful tool to gather the audio
device information. You can fetch the latest version from:
device information. It's included in alsa-utils package. The latest
version can be found on git repository:

- git://git.alsa-project.org/alsa-utils.git

The script can be fetched directly from the following URL, too:

- http://www.alsa-project.org/alsa-info.sh

Expand Down Expand Up @@ -836,15 +830,11 @@ can get a proc-file dump at the current state, get a list of control
(mixer) elements, set/get the control element value, simulate the PCM
operation, the jack plugging simulation, etc.

The package is found in:

- ftp://ftp.suse.com/pub/people/tiwai/misc/

A git repository is available:
The program is found in the git repository below:

- git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git

See README file in the tarball for more details about hda-emu
See README file in the repository for more details about hda-emu
program.


Expand Down
4 changes: 2 additions & 2 deletions Documentation/sound/alsa/compress_offload.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Gapless Playback
================
When playing thru an album, the decoders have the ability to skip the encoder
delay and padding and directly move from one track content to another. The end
user can perceive this as gapless playback as we dont have silence while
user can perceive this as gapless playback as we don't have silence while
switching from one track to another

Also, there might be low-intensity noises due to encoding. Perfect gapless is
Expand Down Expand Up @@ -184,7 +184,7 @@ Sequence flow for gapless would be:
- Fill data of the first track
- Trigger start
- User-space finished sending all,
- Indicaite next track data by sending set_next_track
- Indicate next track data by sending set_next_track
- Set metadata of the next track
- then call partial_drain to flush most of buffer in DSP
- Fill data of the next track
Expand Down
2 changes: 1 addition & 1 deletion Documentation/sound/alsa/soc/dapm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ SOC_DAPM_SINGLE("HiFi Playback Switch", WM8731_APANA, 4, 1, 0),
SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, wm8731_output_mixer_controls,
ARRAY_SIZE(wm8731_output_mixer_controls)),

If you dont want the mixer elements prefixed with the name of the mixer widget,
If you don't want the mixer elements prefixed with the name of the mixer widget,
you can use SND_SOC_DAPM_MIXER_NAMED_CTL instead. the parameters are the same
as for SND_SOC_DAPM_MIXER.

Expand Down
2 changes: 1 addition & 1 deletion Documentation/sound/alsa/soc/overview.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ multiple re-usable component drivers :-
and any audio DSP drivers for that platform.

* Machine class driver: The machine driver class acts as the glue that
decribes and binds the other component drivers together to form an ALSA
describes and binds the other component drivers together to form an ALSA
"sound card device". It handles any machine specific controls and
machine level audio events (e.g. turning on an amp at start of playback).

Expand Down
2 changes: 1 addition & 1 deletion Documentation/sound/alsa/timestamping.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ will be required to issue multiple queries and perform an
interpolation of the results

In some hardware-specific configuration, the system timestamp is
latched by a low-level audio subsytem, and the information provided
latched by a low-level audio subsystem, and the information provided
back to the driver. Due to potential delays in the communication with
the hardware, there is a risk of misalignment with the avail and delay
information. To make sure applications are not confused, a
Expand Down
2 changes: 2 additions & 0 deletions include/sound/hda_chmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct hdac_chmap_ops {
int (*chmap_validate)(struct hdac_chmap *hchmap, int ca,
int channels, unsigned char *chmap);

int (*get_spk_alloc)(struct hdac_device *hdac, int pcm_idx);

void (*get_chmap)(struct hdac_device *hdac, int pcm_idx,
unsigned char *chmap);
void (*set_chmap)(struct hdac_device *hdac, int pcm_idx,
Expand Down
10 changes: 5 additions & 5 deletions include/sound/hda_i915.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
int snd_hdac_display_power(struct hdac_bus *bus, bool enable);
void snd_hdac_i915_set_bclk(struct hdac_bus *bus);
int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate);
int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid,
int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int rate);
int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
bool *audio_enabled, char *buffer, int max_bytes);
int snd_hdac_i915_init(struct hdac_bus *bus);
int snd_hdac_i915_exit(struct hdac_bus *bus);
Expand All @@ -28,12 +28,12 @@ static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
static inline void snd_hdac_i915_set_bclk(struct hdac_bus *bus)
{
}
static inline int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid,
int rate)
static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec,
hda_nid_t nid, int rate)
{
return 0;
}
static inline int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid,
static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
bool *audio_enabled, char *buffer,
int max_bytes)
{
Expand Down
2 changes: 1 addition & 1 deletion include/uapi/sound/asound.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ enum {

/* global timers (device member) */
#define SNDRV_TIMER_GLOBAL_SYSTEM 0
#define SNDRV_TIMER_GLOBAL_RTC 1
#define SNDRV_TIMER_GLOBAL_RTC 1 /* unused */
#define SNDRV_TIMER_GLOBAL_HPET 2
#define SNDRV_TIMER_GLOBAL_HRTIMER 3

Expand Down
29 changes: 0 additions & 29 deletions sound/core/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -141,35 +141,6 @@ config SND_SEQ_HRTIMER_DEFAULT
Say Y here to use the HR-timer backend as the default sequencer
timer.

config SND_RTCTIMER
tristate "RTC Timer support"
depends on RTC
select SND_TIMER
help
Say Y here to enable RTC timer support for ALSA. ALSA uses
the RTC timer as a precise timing source and maps the RTC
timer to ALSA's timer interface. The ALSA sequencer code also
can use this timing source.

To compile this driver as a module, choose M here: the module
will be called snd-rtctimer.

Note that this option is exclusive with the new RTC drivers
(CONFIG_RTC_CLASS) since this requires the old API.

config SND_SEQ_RTCTIMER_DEFAULT
bool "Use RTC as default sequencer timer"
depends on SND_RTCTIMER && SND_SEQUENCER
depends on !SND_SEQ_HRTIMER_DEFAULT
default y
help
Say Y here to use the RTC timer as the default sequencer
timer. This is strongly recommended because it ensures
precise MIDI timing even when the system timer runs at less
than 1000 Hz.

If in doubt, say Y.

config SND_DYNAMIC_MINORS
bool "Dynamic device file minor numbers"
help
Expand Down
1 change: 0 additions & 1 deletion sound/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ obj-$(CONFIG_SND) += snd.o
obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o
obj-$(CONFIG_SND_TIMER) += snd-timer.o
obj-$(CONFIG_SND_HRTIMER) += snd-hrtimer.o
obj-$(CONFIG_SND_RTCTIMER) += snd-rtctimer.o
obj-$(CONFIG_SND_PCM) += snd-pcm.o
obj-$(CONFIG_SND_DMAENGINE_PCM) += snd-pcm-dmaengine.o
obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o
Expand Down
25 changes: 12 additions & 13 deletions sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,12 @@ static ssize_t snd_compr_write(struct file *f, const char __user *buf,
stream = &data->stream;
mutex_lock(&stream->device->lock);
/* write is allowed when stream is running or has been steup */
if (stream->runtime->state != SNDRV_PCM_STATE_SETUP &&
stream->runtime->state != SNDRV_PCM_STATE_PREPARED &&
stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
switch (stream->runtime->state) {
case SNDRV_PCM_STATE_SETUP:
case SNDRV_PCM_STATE_PREPARED:
case SNDRV_PCM_STATE_RUNNING:
break;
default:
mutex_unlock(&stream->device->lock);
return -EBADFD;
}
Expand Down Expand Up @@ -391,14 +394,13 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
int retval = 0;

if (snd_BUG_ON(!data))
return -EFAULT;
return POLLERR;

stream = &data->stream;
if (snd_BUG_ON(!stream))
return -EFAULT;

mutex_lock(&stream->device->lock);
if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
retval = -EBADFD;
retval = snd_compr_get_poll(stream) | POLLERR;
goto out;
}
poll_wait(f, &stream->runtime->sleep, wait);
Expand All @@ -421,10 +423,7 @@ static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
retval = snd_compr_get_poll(stream);
break;
default:
if (stream->direction == SND_COMPRESS_PLAYBACK)
retval = POLLOUT | POLLWRNORM | POLLERR;
else
retval = POLLIN | POLLRDNORM | POLLERR;
retval = snd_compr_get_poll(stream) | POLLERR;
break;
}
out:
Expand Down Expand Up @@ -802,9 +801,9 @@ static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)

if (snd_BUG_ON(!data))
return -EFAULT;

stream = &data->stream;
if (snd_BUG_ON(!stream))
return -EFAULT;

mutex_lock(&stream->device->lock);
switch (_IOC_NR(cmd)) {
case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION):
Expand Down
56 changes: 39 additions & 17 deletions sound/core/hrtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,53 @@ static unsigned int resolution;
struct snd_hrtimer {
struct snd_timer *timer;
struct hrtimer hrt;
atomic_t running;
bool in_callback;
};

static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
{
struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
struct snd_timer *t = stime->timer;
unsigned long oruns;

if (!atomic_read(&stime->running))
return HRTIMER_NORESTART;

oruns = hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
snd_timer_interrupt(stime->timer, t->sticks * oruns);
ktime_t delta;
unsigned long ticks;
enum hrtimer_restart ret = HRTIMER_NORESTART;

spin_lock(&t->lock);
if (!t->running)
goto out; /* fast path */
stime->in_callback = true;
ticks = t->sticks;
spin_unlock(&t->lock);

/* calculate the drift */
delta = ktime_sub(hrt->base->get_time(), hrtimer_get_expires(hrt));
if (delta.tv64 > 0)
ticks += ktime_divns(delta, ticks * resolution);

snd_timer_interrupt(stime->timer, ticks);

spin_lock(&t->lock);
if (t->running) {
hrtimer_add_expires_ns(hrt, t->sticks * resolution);
ret = HRTIMER_RESTART;
}

if (!atomic_read(&stime->running))
return HRTIMER_NORESTART;
return HRTIMER_RESTART;
stime->in_callback = false;
out:
spin_unlock(&t->lock);
return ret;
}

static int snd_hrtimer_open(struct snd_timer *t)
{
struct snd_hrtimer *stime;

stime = kmalloc(sizeof(*stime), GFP_KERNEL);
stime = kzalloc(sizeof(*stime), GFP_KERNEL);
if (!stime)
return -ENOMEM;
hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
stime->timer = t;
stime->hrt.function = snd_hrtimer_callback;
atomic_set(&stime->running, 0);
t->private_data = stime;
return 0;
}
Expand All @@ -78,6 +94,11 @@ static int snd_hrtimer_close(struct snd_timer *t)
struct snd_hrtimer *stime = t->private_data;

if (stime) {
spin_lock_irq(&t->lock);
t->running = 0; /* just to be sure */
stime->in_callback = 1; /* skip start/stop */
spin_unlock_irq(&t->lock);

hrtimer_cancel(&stime->hrt);
kfree(stime);
t->private_data = NULL;
Expand All @@ -89,18 +110,19 @@ static int snd_hrtimer_start(struct snd_timer *t)
{
struct snd_hrtimer *stime = t->private_data;

atomic_set(&stime->running, 0);
hrtimer_try_to_cancel(&stime->hrt);
if (stime->in_callback)
return 0;
hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
HRTIMER_MODE_REL);
atomic_set(&stime->running, 1);
return 0;
}

static int snd_hrtimer_stop(struct snd_timer *t)
{
struct snd_hrtimer *stime = t->private_data;
atomic_set(&stime->running, 0);

if (stime->in_callback)
return 0;
hrtimer_try_to_cancel(&stime->hrt);
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,8 +1886,8 @@ void snd_pcm_period_elapsed(struct snd_pcm_substream *substream)
snd_timer_interrupt(substream->timer, 1);
#endif
_end:
snd_pcm_stream_unlock_irqrestore(substream, flags);
kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
snd_pcm_stream_unlock_irqrestore(substream, flags);
}

EXPORT_SYMBOL(snd_pcm_period_elapsed);
Expand Down Expand Up @@ -2595,6 +2595,8 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
};
int err;

if (WARN_ON(pcm->streams[stream].chmap_kctl))
return -EBUSY;
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
Expand Down
4 changes: 2 additions & 2 deletions sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -3161,7 +3161,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)

substream = pcm_file->substream;
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
return POLLOUT | POLLWRNORM | POLLERR;
runtime = substream->runtime;

poll_wait(file, &runtime->sleep, wait);
Expand Down Expand Up @@ -3200,7 +3200,7 @@ static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait)

substream = pcm_file->substream;
if (PCM_RUNTIME_CHECK(substream))
return -ENXIO;
return POLLIN | POLLRDNORM | POLLERR;
runtime = substream->runtime;

poll_wait(file, &runtime->sleep, wait);
Expand Down
Loading

0 comments on commit 581abba

Please sign in to comment.