All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Brady <sdbrady@ntlworld.com>
To: Thibaut VARENE <varenet@esiee.fr>
Cc: parisc-linux@lists.parisc-linux.org
Subject: [parisc-linux] [PATCH] Harmony fixes
Date: Sat, 5 Jun 2004 19:45:26 +0100	[thread overview]
Message-ID: <20040605184526.GA1317@calypso> (raw)
In-Reply-To: <20040527151731.633A93658BE@mail.esiee.fr>

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

Hi,

Here's the next set of fixes.  I should point out an annoyance with the
harmony-s16le patch though: apps that use AFMT_S16_NE are broken by this
patch, because the kernel headers incorrectly define AFMT_S16_NE as
AFMT_S16_LE, when it should be AFMT_S16_BE.

harmony-levellimit.patch:
Volume levels passed to the MIXER_WRITE ioctls are now limited to 100,
which prevents bogus levels from interferring with other mixer channels.

harmony-stereolevels.patch:
The MIXER_READ ioctls now return a right_level for the monophonic mixer
channels that is the same as the left_level.

harmony-s16le.patch:
The AFMT_S16_LE format is now rejected, just as all other unsupported
formats are rejected.  As a result, applications which write big-endian
samples with AFMT_S16_LE format set will no longer work.

Thanks,
-- 
Stuart Brady

[-- Attachment #2: harmony-levellimit.patch --]
[-- Type: text/plain, Size: 372 bytes --]

--- drivers/sound/harmony.c.orig	2004-06-04 15:02:51.000000000 +0100
+++ drivers/sound/harmony.c	2004-06-05 15:27:03.000000000 +0100
@@ -940,6 +940,8 @@
 
 	right_level = (value & 0x0000ff00) >> 8;
 	left_level = value & 0x000000ff;
+	if (right_level > 100) right_level = 100;
+	if (left_level > 100) left_level = 100;
   
 	switch (channel) {
 		case SOUND_MIXER_VOLUME:

[-- Attachment #3: harmony-stereolevels.patch --]
[-- Type: text/plain, Size: 759 bytes --]

--- drivers/sound/harmony.c.orig	2004-06-04 15:02:51.000000000 +0100
+++ drivers/sound/harmony.c	2004-06-05 15:28:17.000000000 +0100
@@ -918,7 +918,7 @@
 		case SOUND_MIXER_MONITOR:
 			left_level = (harmony.current_gain & GAIN_MA_MASK) >> GAIN_MA_SHIFT;
 			left_level = to_oss_level(MAX_MONITOR_LEVEL-left_level, MAX_MONITOR_LEVEL);
-			return left_level;
+			return (left_level << 8)+left_level;
 	}
 	return -EINVAL;
 }
@@ -967,7 +967,7 @@
 			new_left_level = to_oss_level(MAX_MONITOR_LEVEL-left_level, MAX_MONITOR_LEVEL);
 			harmony.current_gain = (harmony.current_gain & ~GAIN_MA_MASK) | (left_level << GAIN_MA_SHIFT);
 			harmony_mixer_set_gain();
-			return new_left_level;
+			return (new_left_level << 8) + new_left_level;
 	}
 
 	return -EINVAL;

[-- Attachment #4: harmony-s16le.patch --]
[-- Type: text/plain, Size: 1157 bytes --]

--- drivers/sound/harmony.c.orig	2004-06-04 15:02:51.000000000 +0100
+++ drivers/sound/harmony.c	2004-06-05 15:24:31.000000000 +0100
@@ -655,18 +655,17 @@
 			switch (ival) {
 			case AFMT_MU_LAW:	new_format = HARMONY_DF_8BIT_ULAW; break;
 			case AFMT_A_LAW:	new_format = HARMONY_DF_8BIT_ALAW; break;
-			case AFMT_S16_LE:	/* fall through, but not really supported */
-			case AFMT_S16_BE:	new_format = HARMONY_DF_16BIT_LINEAR;
-						ival = AFMT_S16_BE;
-						break; 
+			case AFMT_S16_BE:	new_format = HARMONY_DF_16BIT_LINEAR; break;
 			default: {
 				DPRINTK(KERN_WARNING PFX 
 					"unsupported sound format 0x%04x requested.\n",
 					ival);
-				return -EINVAL;
+				ival = AFMT_S16_BE;
+				return put_user(ival, (int *) arg);
 			}
 			}
 			harmony_set_format(new_format);
+			return 0;
 		} else {
 			switch (harmony.data_format) {
 			case HARMONY_DF_8BIT_ULAW:	ival = AFMT_MU_LAW; break;
@@ -674,8 +673,8 @@
 			case HARMONY_DF_16BIT_LINEAR:	ival = AFMT_U16_BE; break;
 			default: ival = 0;
 			}
+			return put_user(ival, (int *) arg);
 		}
-		return put_user(ival, (int *) arg);
 
 	case SOUND_PCM_READ_RATE:
 		ival = harmony.dac_rate;

[-- Attachment #5: Type: text/plain, Size: 169 bytes --]

_______________________________________________
parisc-linux mailing list
parisc-linux@lists.parisc-linux.org
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

  parent reply	other threads:[~2004-06-05 18:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040527150933.GB612@calypso>
     [not found] ` <20040527151731.633A93658BE@mail.esiee.fr>
2004-05-27 20:02   ` [parisc-linux] [PATCH] Harmony - better mixer channel names Stuart Brady
2004-05-27 22:02   ` [parisc-linux] [PATCH] Harmony - improved recording source toggling Stuart Brady
2004-06-05 18:45   ` Stuart Brady [this message]
2004-06-08 18:21     ` [parisc-linux] Re: [PATCH] Harmony fixes Thibaut VARENE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040605184526.GA1317@calypso \
    --to=sdbrady@ntlworld.com \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=varenet@esiee.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.