From nobody@FreeBSD.org  Sun Dec 28 21:11:43 2003
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0B7B316A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 28 Dec 2003 21:11:43 -0800 (PST)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7F6AD43D3F
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 28 Dec 2003 21:11:35 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.10/8.12.10) with ESMTP id hBT5BZdL058466
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 28 Dec 2003 21:11:35 -0800 (PST)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.10/8.12.10/Submit) id hBT5BZsB058465;
	Sun, 28 Dec 2003 21:11:35 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200312290511.hBT5BZsB058465@www.freebsd.org>
Date: Sun, 28 Dec 2003 21:11:35 -0800 (PST)
From: SHINOHARA Takahiro <shinoharatk@yahoo.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: No reaction of volume controy key on IBM Thinkpad i1124
X-Send-Pr-Version: www-2.0

>Number:         60677
>Category:       kern
>Synopsis:       [sound] [patch] No reaction of volume controy key on IBM Thinkpad i1124
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 28 21:20:15 PST 2003
>Closed-Date:    
>Last-Modified:  Sun Oct 23 23:18:08 GMT 2005
>Originator:     SHINOHARA Takahiro
>Release:        5.2-CURRENT
>Organization:
private
>Environment:
FreeBSD kunkun.de.la.grant 5.2-CURRENT FreeBSD 5.2-CURRENT #1: Sun Dec 28 21:33:42 JST 2003     shino@kunkun.de.la.grant:/usr/src/sys/i386/compile/KUNKUN  i386
>Description:
ThinkPad i1124 has volume control keys. I push them, but volume is not changed. Because chip(CS4281) register is not set as do so.
>How-To-Repeat:
boot, play some mp3 or any audio file, and push volume control key.
>Fix:
diff -ur sys.orig/conf/options.i386 sys/conf/options.i386
--- sys.orig/conf/options.i386	Sat Apr 12 18:40:37 2003
+++ sys/conf/options.i386	Wed Jul 16 20:46:37 2003
@@ -141,6 +141,9 @@
 PCVT_VT220KEYB		opt_pcvt.h
 PCVT_GREENSAVER		opt_pcvt.h
 
+# Enable hardware volume control for PCM Audio on note PC
+PCM_NOTE_HWVOL		opt_sound.h
+
 # Video spigot
 SPIGOT_UNSECURE		opt_spigot.h
 
diff -ur sys.orig/dev/sound/pci/cs4281.c sys/dev/sound/pci/cs4281.c
--- sys.orig/dev/sound/pci/cs4281.c	Fri Feb 21 02:31:11 2003
+++ sys/dev/sound/pci/cs4281.c	Wed Jul 16 20:46:50 2003
@@ -29,6 +29,8 @@
  * contributed towards power management.
  */
 
+#include "opt_sound.h"
+
 #include <dev/sound/pcm/sound.h>
 #include <dev/sound/pcm/ac97.h>
 
@@ -639,6 +641,13 @@
     cs4281_wr(sc,
 	      CS4281PCI_ACOSV,
 	      CS4281PCI_ACOSV_SLV(3) | CS4281PCI_ACOSV_SLV(4));
+
+#ifdef PCM_NOTE_HWVOL
+    /* Set hardware volume control */
+    cs4281_wr(sc,
+	      CS4281PCI_SSCR,
+	      CS4281PCI_SSCR_HVC);
+#endif /* PCM_NOTE_HWVOL */
 
     /* Set Master and headphone to max */
     cs4281_wrcd(0, sc, AC97_MIX_AUXOUT, 0);
diff -ur sys.orig/dev/sound/pci/cs4281.h sys/dev/sound/pci/cs4281.h
--- sys.orig/dev/sound/pci/cs4281.h	Thu Apr 19 22:23:50 2001
+++ sys/dev/sound/pci/cs4281.h	Wed Jul 16 20:46:51 2003
@@ -146,6 +146,8 @@
 #	define CS4281PCI_SERMC_PTC_MASK		0x0000000e
 #	define CS4281PCI_SERMC_ODSEN1		0x01000000
 #	define CS4281PCI_SERMC_ODSEN2		0x02000000
+#	define CS4281PCI_SERMC_PLB		0x00000010
+#	define CS4281PCI_SERMC_PXLB		0x00000020
 #define CS4281PCI_SERC1		0x428
 #define CS4281PCI_SERC2		0x42c
 
@@ -183,6 +185,15 @@
 #define CS4281PCI_DACSR		0x744
 #define CS4281PCI_ADCSR		0x748
 #define CS4281PCI_SSCR		0x74c
+#	define CS4281PCI_SSCR_HVS1		0x00800000
+#	define CS4281PCI_SSCR_MVCS		0x00080000
+#	define CS4281PCI_SSCR_MVLD		0x00040000
+#	define CS4281PCI_SSCR_MVAD		0x00020000
+#	define CS4281PCI_SSCR_MVMD		0x00010000
+#	define CS4281PCI_SSCR_XLPSRC		0x00000100
+#	define CS4281PCI_SSCR_LPSRC		0x00000080
+#	define CS4281PCI_SSCR_CDTX		0x00000020
+#	define CS4281PCI_SSCR_HVC		0x00000008
 
 #define CS4281PCI_SRCSA		0x75c
 #	define CS4281PCI_SRCSA_PLSS(x)		(x)
diff -ur sys.orig/modules/sound/driver/cs4281/Makefile sys/modules/sound/driver/cs4281/Makefile
--- sys.orig/modules/sound/driver/cs4281/Makefile	Wed Jul 16 21:00:11 2003
+++ sys/modules/sound/driver/cs4281/Makefile	Wed Jul 16 21:08:16 2003
@@ -3,7 +3,7 @@
 .PATH: ${.CURDIR}/../../../../dev/sound/pci
 
 KMOD=	snd_cs4281
-SRCS=	device_if.h bus_if.h pci_if.h
+SRCS=	device_if.h bus_if.h pci_if.h opt_sound.h
 SRCS+=	cs4281.c
 
 .include <bsd.kmod.mk>

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-multimedia 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Oct 23 23:17:17 GMT 2005 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60677 
>Unformatted:
