[parisc-linux-cvs] linux deller
Helge Deller
deller@gmx.de
Mon, 7 Jan 2002 01:23:17 +0100
--------------Boundary-00=_T2LJ9OOW9U8NSL9MK5FB
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
On Monday 07 January 2002 01:23, Helge Deller wrote:
> CVSROOT: /var/cvs
> Module name: linux
> Changes by: deller 02/01/06 17:23:03
>
> Modified files:
> . : Makefile
> drivers/sound : harmony.c
>
> Log message:
> - 2.4.17-pa5
> - patch vs harmony sound driver, fixes mpg123 on HPPA
>
> This patch was contributed by
> Matthieu Delahaye <delahaym@esiee.fr>
> Thanks !
--------------Boundary-00=_T2LJ9OOW9U8NSL9MK5FB
Content-Type: text/plain;
charset="iso-8859-1";
name="diff"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="diff"
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.242
diff -u -p -r1.242 Makefile
--- Makefile 2002/01/06 17:35:10 1.242
+++ Makefile 2002/01/07 00:21:06
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 17
-EXTRAVERSION = -pa4
+EXTRAVERSION = -pa5
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: drivers/sound/harmony.c
===================================================================
RCS file: /var/cvs/linux/drivers/sound/harmony.c,v
retrieving revision 1.19
diff -u -p -r1.19 harmony.c
--- drivers/sound/harmony.c 2002/01/05 01:37:03 1.19
+++ drivers/sound/harmony.c 2002/01/07 00:21:07
@@ -196,6 +196,7 @@ struct harmony_dev {
wait_queue_head_t wq_play, wq_record;
int first_filled_play; /* first buffer containing data (next to play) */
int nb_filled_play;
+ int play_offset;
int first_filled_record;
int nb_filled_record;
@@ -389,18 +390,18 @@ static int harmony_audio_open(struct ino
return -EBUSY;
harmony.audio_open++;
- harmony.format_initialized = 0;
harmony.suspended_playing = harmony.suspended_recording = 1;
harmony.blocked_playing = harmony.blocked_recording = 0;
harmony.first_filled_play = harmony.first_filled_record = 0;
harmony.nb_filled_play = harmony.nb_filled_record = 0;
-
+ harmony.play_offset = 0;
init_waitqueue_head(&harmony.wq_play);
init_waitqueue_head(&harmony.wq_record);
/* Start off in a balanced mode. */
- harmony_set_control(HARMONY_DF_16BIT_LINEAR, HARMONY_SR_44KHZ, HARMONY_SS_STEREO);
+ harmony_set_control(HARMONY_DF_8BIT_ULAW, HARMONY_SR_8KHZ, HARMONY_SS_MONO);
harmony_update_control();
+ harmony.format_initialized = 0;
/* Clear out all the buffers and flush to cache */
harmony_silence(&played_buf, 0, HARMONY_BUF_SIZE*MAX_BUFS);
@@ -540,7 +541,7 @@ static void harmony_format_auto_detect(c
return;
}
}
- harmony_set_control(HARMONY_DF_16BIT_LINEAR, HARMONY_SR_22KHZ, HARMONY_SS_MONO);
+ harmony_set_control(HARMONY_DF_8BIT_ULAW, HARMONY_SR_8KHZ, HARMONY_SS_MONO);
return;
}
#undef four_bytes_to_u32
@@ -564,39 +565,44 @@ static ssize_t harmony_audio_write(struc
harmony_wait_CNTL();
/* Figure out which buffer to fill in */
- if (harmony.nb_filled_play+2 >= MAX_BUFS) {
+ if (harmony.nb_filled_play+2 >= MAX_BUFS && !harmony.play_offset) {
harmony.blocked_playing = 1;
interruptible_sleep_on(&harmony.wq_play);
harmony.blocked_playing = 0;
}
- if (harmony.nb_filled_play+2 >= MAX_BUFS)
+ if (harmony.nb_filled_play+2 >= MAX_BUFS && !harmony.play_offset)
return -EBUSY;
- buf_to_fill = (harmony.first_filled_play+harmony.nb_filled_play) % MAX_BUFS;
+ buf_to_fill = (harmony.first_filled_play+harmony.nb_filled_play);
+ if (harmony.play_offset)
+ buf_to_fill--;
+ buf_to_fill %= MAX_BUFS;
/* Figure out the size of the frame */
- if ((total_count-count) > HARMONY_BUF_SIZE) {
- frame_size = HARMONY_BUF_SIZE;
+ if ((total_count-count) > HARMONY_BUF_SIZE - harmony.play_offset) {
+ frame_size = HARMONY_BUF_SIZE - harmony.play_offset;
} else {
frame_size = total_count - count;
/* Clear out the buffer, since there we'll only be
overlaying part of the old buffer with the new one */
harmony_silence(&played_buf,
- HARMONY_BUF_SIZE*buf_to_fill+frame_size,
- HARMONY_BUF_SIZE-frame_size);
+ HARMONY_BUF_SIZE*buf_to_fill+frame_size+harmony.play_offset,
+ HARMONY_BUF_SIZE-frame_size-harmony.play_offset);
}
/* Copy the page to an aligned buffer */
- copy_from_user(played_buf.addr + (HARMONY_BUF_SIZE*buf_to_fill),
+ copy_from_user(played_buf.addr + (HARMONY_BUF_SIZE*buf_to_fill) + harmony.play_offset,
buffer+count, frame_size);
- CHECK_WBACK_INV_OFFSET(played_buf, (HARMONY_BUF_SIZE*buf_to_fill),
+ CHECK_WBACK_INV_OFFSET(played_buf, (HARMONY_BUF_SIZE*buf_to_fill + harmony.play_offset),
frame_size);
- harmony.nb_filled_play++;
+ if (!harmony.play_offset)
+ harmony.nb_filled_play++;
count += frame_size;
-
+ harmony.play_offset += frame_size;
+ harmony.play_offset %= HARMONY_BUF_SIZE;
if (harmony.suspended_playing && (harmony.nb_filled_play>=4))
harmony_enable_interrupts();
}
--------------Boundary-00=_T2LJ9OOW9U8NSL9MK5FB--