Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199306
b: refs/heads/master
c: a39e33e
h: refs/heads/master
v: v3
  • Loading branch information
Jerone Young authored and Takashi Iwai committed May 27, 2010
1 parent b630cfc commit 67f1cfb
Show file tree
Hide file tree
Showing 35 changed files with 237 additions and 368 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a98d3984c85222aa9efc63c4f9dd3d805ce469f2
refs/heads/master: a39e33eb2a9d6afa79021ba1de2aa7d1039f4e53
16 changes: 0 additions & 16 deletions trunk/include/linux/usb/audio-v2.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,6 @@ struct uac_as_header_descriptor_v2 {
__u8 iChannelNames;
} __attribute__((packed));

/* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */

struct uac2_iso_endpoint_descriptor {
__u8 bLength; /* in bytes: 8 */
__u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */
__u8 bDescriptorSubtype; /* EP_GENERAL */
__u8 bmAttributes;
__u8 bmControls;
__u8 bLockDelayUnits;
__le16 wLockDelay;
} __attribute__((packed));

#define UAC2_CONTROL_PITCH (3 << 0)
#define UAC2_CONTROL_DATA_OVERRUN (3 << 2)
#define UAC2_CONTROL_DATA_UNDERRUN (3 << 4)

/* 6.1 Interrupt Data Message */

#define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0)
Expand Down
13 changes: 3 additions & 10 deletions trunk/sound/core/pcm_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
new_hw_ptr = hw_base + pos;
}
__delta:
delta = new_hw_ptr - old_hw_ptr;
if (delta < 0)
delta += runtime->boundary;
delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary;
if (xrun_debug(substream, in_interrupt ?
XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) {
char name[16];
Expand Down Expand Up @@ -441,13 +439,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
snd_pcm_playback_silence(substream, new_hw_ptr);

if (in_interrupt) {
delta = new_hw_ptr - runtime->hw_ptr_interrupt;
if (delta < 0)
delta += runtime->boundary;
delta -= (snd_pcm_uframes_t)delta % runtime->period_size;
runtime->hw_ptr_interrupt += delta;
if (runtime->hw_ptr_interrupt >= runtime->boundary)
runtime->hw_ptr_interrupt -= runtime->boundary;
runtime->hw_ptr_interrupt = new_hw_ptr -
(new_hw_ptr % runtime->period_size);
}
runtime->hw_ptr_base = hw_base;
runtime->status->hw_ptr = new_hw_ptr;
Expand Down
39 changes: 36 additions & 3 deletions trunk/sound/core/pcm_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/pm_qos_params.h>
#include <linux/uio.h>
#include <linux/dma-mapping.h>
#include <linux/math64.h>
#include <sound/core.h>
#include <sound/control.h>
#include <sound/info.h>
Expand Down Expand Up @@ -369,6 +370,38 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime)
return usecs;
}

static int calc_boundary(struct snd_pcm_runtime *runtime)
{
u_int64_t boundary;

boundary = (u_int64_t)runtime->buffer_size *
(u_int64_t)runtime->period_size;
#if BITS_PER_LONG < 64
/* try to find lowest common multiple for buffer and period */
if (boundary > LONG_MAX - runtime->buffer_size) {
u_int32_t remainder = -1;
u_int32_t divident = runtime->buffer_size;
u_int32_t divisor = runtime->period_size;
while (remainder) {
remainder = divident % divisor;
if (remainder) {
divident = divisor;
divisor = remainder;
}
}
boundary = div_u64(boundary, divisor);
if (boundary > LONG_MAX - runtime->buffer_size)
return -ERANGE;
}
#endif
if (boundary == 0)
return -ERANGE;
runtime->boundary = boundary;
while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
runtime->boundary *= 2;
return 0;
}

static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
Expand Down Expand Up @@ -444,9 +477,9 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
runtime->stop_threshold = runtime->buffer_size;
runtime->silence_threshold = 0;
runtime->silence_size = 0;
runtime->boundary = runtime->buffer_size;
while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size)
runtime->boundary *= 2;
err = calc_boundary(runtime);
if (err < 0)
goto _error;

snd_pcm_timer_resolution_change(substream);
runtime->status->state = SNDRV_PCM_STATE_SETUP;
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/mips/au1x00.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ get the interrupt driven case to work efficiently */
break;
if (i == 0x5000) {
printk(KERN_ERR "au1000 AC97: AC97 command read timeout\n");
spin_unlock(&au1000->ac97_lock);
return 0;
}

Expand Down
5 changes: 2 additions & 3 deletions trunk/sound/oss/dmasound/dmasound_atari.c
Original file line number Diff line number Diff line change
Expand Up @@ -1277,15 +1277,15 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
* (almost) like on the TT.
*/
write_sq_ignore_int = 0;
goto out;
return IRQ_HANDLED;
}

if (!write_sq.active) {
/* playing was interrupted and sq_reset() has already cleared
* the sq variables, so better don't do anything here.
*/
WAKE_UP(write_sq.sync_queue);
goto out;
return IRQ_HANDLED;
}

/* Probably ;) one frame is finished. Well, in fact it may be that a
Expand Down Expand Up @@ -1322,7 +1322,6 @@ static irqreturn_t AtaInterrupt(int irq, void *dummy)
/* We are not playing after AtaPlay(), so there
is nothing to play any more. Wake up a process
waiting for audio output to drain. */
out:
spin_unlock(&dmasound.lock);
return IRQ_HANDLED;
}
Expand Down
8 changes: 1 addition & 7 deletions trunk/sound/pci/asihpi/hpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ i.e 3.05.02 is a development version
#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))

/* Use single digits for versions less that 10 to avoid octal. */
#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25)
#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 18)

/* Library version as documented in hpi-api-versions.txt */
#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0)
Expand Down Expand Up @@ -1632,12 +1632,6 @@ u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys,
u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pquality);

u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pblend);

u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
u32 h_control, const u32 blend);

/****************************/
/* PADs control */
/****************************/
Expand Down
6 changes: 4 additions & 2 deletions trunk/sound/pci/asihpi/hpi6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@ static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
case 0x6200:
boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200);
break;
case 0x8800:
boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x8800);
break;
default:
return HPI6000_ERROR_UNHANDLED_SUBSYS_ID;
}
Expand Down Expand Up @@ -1772,6 +1775,7 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
u16 error = 0;
u16 dsp_index = 0;
u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp;
hpios_dsplock_lock(pao);

if (num_dsp < 2)
dsp_index = 0;
Expand All @@ -1792,8 +1796,6 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
}
}
}

hpios_dsplock_lock(pao);
error = hpi6000_message_response_sequence(pao, dsp_index, phm, phr);

/* maybe an error response */
Expand Down
21 changes: 13 additions & 8 deletions trunk/sound/pci/asihpi/hpi6205.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,17 +965,24 @@ static void outstream_write(struct hpi_adapter_obj *pao,
hpi_init_response(phr, phm->object, phm->function, 0);
status = &interface->outstream_host_buffer_status[phm->obj_index];

if (phw->flag_outstream_just_reset[phm->obj_index]) {
/* Format can only change after reset. Must tell DSP. */
u16 function = phm->function;
phw->flag_outstream_just_reset[phm->obj_index] = 0;
phm->function = HPI_OSTREAM_SET_FORMAT;
hw_message(pao, phm, phr); /* send the format to the DSP */
phm->function = function;
if (phr->error)
return;
}
#if 1
if (phw->flag_outstream_just_reset[phm->obj_index]) {
/* First OutStremWrite() call following reset will write data to the
adapter's buffers, reducing delay before stream can start. The DSP
takes care of setting the stream data format using format information
embedded in phm.
adapter's buffers, reducing delay before stream can start
*/
int partial_write = 0;
unsigned int original_size = 0;

phw->flag_outstream_just_reset[phm->obj_index] = 0;

/* Send the first buffer to the DSP the old way. */
/* Limit size of first transfer - */
/* expect that this will not usually be triggered. */
Expand Down Expand Up @@ -1005,6 +1012,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
original_size - HPI6205_SIZEOF_DATA;
phm->u.d.u.data.pb_data += HPI6205_SIZEOF_DATA;
}
#endif

space_available = outstream_get_space_available(status);
if (space_available < (long)phm->u.d.u.data.data_size) {
Expand Down Expand Up @@ -1361,9 +1369,6 @@ static u16 adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
case HPI_ADAPTER_FAMILY_ASI(0x6500):
firmware_id = HPI_ADAPTER_FAMILY_ASI(0x6600);
break;
case HPI_ADAPTER_FAMILY_ASI(0x8800):
firmware_id = HPI_ADAPTER_FAMILY_ASI(0x8900);
break;
}
boot_code_id[1] = firmware_id;

Expand Down
5 changes: 0 additions & 5 deletions trunk/sound/pci/asihpi/hpi_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ enum HPI_BUSES {
#define HPI_TUNER_HDRADIO_SDK_VERSION HPI_CTL_ATTR(TUNER, 13)
/** HD Radio DSP firmware version. */
#define HPI_TUNER_HDRADIO_DSP_VERSION HPI_CTL_ATTR(TUNER, 14)
/** HD Radio signal blend (force analog, or automatic). */
#define HPI_TUNER_HDRADIO_BLEND HPI_CTL_ATTR(TUNER, 15)

/** \} */

Expand Down Expand Up @@ -480,10 +478,8 @@ Threshold is a -ve number in units of dB/100,

/** First 2 hex digits define the adapter family */
#define HPI_ADAPTER_FAMILY_MASK 0xff00
#define HPI_MODULE_FAMILY_MASK 0xfff0

#define HPI_ADAPTER_FAMILY_ASI(f) (f & HPI_ADAPTER_FAMILY_MASK)
#define HPI_MODULE_FAMILY_ASI(f) (f & HPI_MODULE_FAMILY_MASK)
#define HPI_ADAPTER_ASI(f) (f)

/******************************************* message types */
Expand Down Expand Up @@ -974,7 +970,6 @@ struct hpi_control_union_msg {
u32 mode;
u32 value;
} mode;
u32 blend;
} tuner;
} u;
};
Expand Down
38 changes: 25 additions & 13 deletions trunk/sound/pci/asihpi/hpicmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,20 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
found = 0;
break;
case HPI_CONTROL_TUNER:
if (phm->u.c.attribute == HPI_TUNER_FREQ)
phr->u.c.param1 = pC->u.t.freq_ink_hz;
else if (phm->u.c.attribute == HPI_TUNER_BAND)
phr->u.c.param1 = pC->u.t.band;
else if ((phm->u.c.attribute == HPI_TUNER_LEVEL)
&& (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE))
phr->u.c.param1 = pC->u.t.level;
else
found = 0;
{
struct hpi_control_cache_single *pCT =
(struct hpi_control_cache_single *)pI;
if (phm->u.c.attribute == HPI_TUNER_FREQ)
phr->u.c.param1 = pCT->u.t.freq_ink_hz;
else if (phm->u.c.attribute == HPI_TUNER_BAND)
phr->u.c.param1 = pCT->u.t.band;
else if ((phm->u.c.attribute == HPI_TUNER_LEVEL)
&& (phm->u.c.param1 ==
HPI_TUNER_LEVEL_AVERAGE))
phr->u.c.param1 = pCT->u.t.level;
else
found = 0;
}
break;
case HPI_CONTROL_AESEBU_RECEIVER:
if (phm->u.c.attribute == HPI_AESEBURX_ERRORSTATUS)
Expand Down Expand Up @@ -498,9 +503,6 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
struct hpi_control_cache_single *pC;
struct hpi_control_cache_info *pI;

if (phr->error)
return;

if (!find_control(phm, p_cache, &pI, &control_index))
return;

Expand All @@ -518,13 +520,17 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
break;
case HPI_CONTROL_MULTIPLEXER:
/* mux does not return its setting on Set command. */
if (phr->error)
return;
if (phm->u.c.attribute == HPI_MULTIPLEXER_SOURCE) {
pC->u.x.source_node_type = (u16)phm->u.c.param1;
pC->u.x.source_node_index = (u16)phm->u.c.param2;
}
break;
case HPI_CONTROL_CHANNEL_MODE:
/* mode does not return its setting on Set command. */
if (phr->error)
return;
if (phm->u.c.attribute == HPI_CHANNEL_MODE_MODE)
pC->u.m.mode = (u16)phm->u.c.param1;
break;
Expand All @@ -539,14 +545,20 @@ void hpi_sync_control_cache(struct hpi_control_cache *p_cache,
pC->u.phantom_power.state = (u16)phm->u.c.param1;
break;
case HPI_CONTROL_AESEBU_TRANSMITTER:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_AESEBUTX_FORMAT)
pC->u.aes3tx.format = phm->u.c.param1;
break;
case HPI_CONTROL_AESEBU_RECEIVER:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_AESEBURX_FORMAT)
pC->u.aes3rx.source = phm->u.c.param1;
break;
case HPI_CONTROL_SAMPLECLOCK:
if (phr->error)
return;
if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE)
pC->u.clk.source = (u16)phm->u.c.param1;
else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SOURCE_INDEX)
Expand Down Expand Up @@ -578,7 +590,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32

void hpi_free_control_cache(struct hpi_control_cache *p_cache)
{
if (p_cache->init) {
if ((p_cache->init) && (p_cache->p_info)) {
kfree(p_cache->p_info);
p_cache->p_info = NULL;
p_cache->init = 0;
Expand Down
17 changes: 2 additions & 15 deletions trunk/sound/pci/asihpi/hpifunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2946,20 +2946,6 @@ u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys,
HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL);
}

u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
u32 h_control, u32 *pblend)
{
return hpi_control_param_get(ph_subsys, h_control,
HPI_TUNER_HDRADIO_BLEND, 0, 0, pblend, NULL);
}

u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys,
u32 h_control, const u32 blend)
{
return hpi_control_param_set(ph_subsys, h_control,
HPI_TUNER_HDRADIO_BLEND, blend, 0);
}

u16 hpi_tuner_getRDS(const struct hpi_hsubsys *ph_subsys, u32 h_control,
char *p_data)
{
Expand Down Expand Up @@ -3280,7 +3266,8 @@ u16 hpi_entity_find_next(struct hpi_entity *container_entity,

void hpi_entity_free(struct hpi_entity *entity)
{
kfree(entity);
if (entity != NULL)
kfree(entity);
}

static u16 hpi_entity_alloc_and_copy(struct hpi_entity *src,
Expand Down
Loading

0 comments on commit 67f1cfb

Please sign in to comment.