From rombios@avalon.org  Tue Jul  2 19:18:06 2002
Return-Path: <rombios@avalon.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0128237B400
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  2 Jul 2002 19:18:06 -0700 (PDT)
Received: from avalon.org (p77-68.acedsl.com [66.114.77.68])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1941443E0A
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  2 Jul 2002 19:18:05 -0700 (PDT)
	(envelope-from rombios@avalon.org)
Received: (from rombios@localhost)
	by avalon.org (8.11.6/8.11.6) id g630O9p00932;
	Tue, 2 Jul 2002 20:24:09 -0400 (EDT)
	(envelope-from rombios)
Message-Id: <200207030024.g630O9p00932@avalon.org>
Date: Tue, 2 Jul 2002 20:24:09 -0400 (EDT)
From: rombios <rombios@acedsl.com>
Reply-To: rombios <rombios@acedsl.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject:
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         40132
>Category:       kern
>Synopsis:       [sound] [patch] enabling the joystick interface on es137x pci sound cards
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 02 19:20:01 PDT 2002
>Closed-Date:    Wed Dec 28 18:51:15 GMT 2005
>Last-Modified:  Wed Dec 28 18:51:15 GMT 2005
>Originator:     
>Release:        FreeBSD 4.4-RELEASE i386
>Organization:
>Environment:
	FreeBSD avalon.org 4.4-RELEASE FreeBSD 4.4-RELEASE #1:
	Wed Apr 24 20:44:40 EDT 2002 root@avalon.org:/usr/src/sys/compile/avalon_on_bsd i386

>Description:
 	Currently the Ensonique (now SoundBlaster) PCI sound card driver, 
 	disables access to the joystick interface on the card. This is
 	easily corrected by enabling this mode and port in the control
 	register. 
 	
 How-To-Repeat:
 	Any driver written to communicate with a Joystick or Gamepad 
 	connected to the 15 pin connector on the Sound card will fail,
 	because joystick interface is disabled by default.
 
 Fix:
 
 	modifications should be made to /sys/dev/sound/pci/es137x.c to
 	enable the joystick interface. see diff output below:
 
 *** es137x.c	Tue Jul  2 20:01:25 2002
 --- newes137x.c	Tue Jul  2 20:06:25 2002
 ***************
 *** 85,91 ****
   #define CT5880REV_CT5880_D  0x03
   
   #define ES_BUFFSIZE 4096
 - 
   /* device private data */
   struct es_info;
   
 --- 85,90 ----
 ***************
 *** 467,474 ****
   static int
   es1370_init(struct es_info *es)
   {
 ! 	es->ctrl = CTRL_CDC_EN | CTRL_SERR_DIS |
 ! 		(DAC2_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_PCLKDIV);
   	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
   
   	es->sctrl = 0;
 --- 466,473 ----
   static int
   es1370_init(struct es_info *es)
   {
 ! 	es->ctrl = CTRL_CDC_EN | CTRL_JYSTK_EN | CTRL_SERR_DIS |
 ! 		(DAC2_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_PCLKDIV); 
   	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
   
   	es->sctrl = 0;
 ***************
 *** 495,501 ****
   	if (debug > 0) printf("es_init\n");
   
   	es->num = 0;
 ! 	es->ctrl = 0;
   	es->sctrl = 0;
   	/* initialize the chips */
   	if ((devid == ES1371_PCI_ID && revid == ES1371REV_ES1373_8) ||
 --- 494,500 ----
   	if (debug > 0) printf("es_init\n");
   
   	es->num = 0;
 ! 	es->ctrl = CTRL_JYSTK_EN;	
   	es->sctrl = 0;
   	/* initialize the chips */
   	if ((devid == ES1371_PCI_ID && revid == ES1371REV_ES1373_8) ||
 ***************
 *** 512,520 ****
   	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, 0);
   	/* AC'97 warm reset to start the bitclk */
 ! 	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, es->ctrl | ES1371_SYNC_RES);
   	DELAY(2000);
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->ctrl);
   	/* Init the sample rate converter */
   	bus_space_write_4(es->st, es->sh, ES1371_REG_SMPRATE, ES1371_DIS_SRC);
   	for (idx = 0; idx < 0x80; idx++)
 --- 511,520 ----
   	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, 0);
   	/* AC'97 warm reset to start the bitclk */
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);					/*added CTRL_JYSTK_EN*/
 ! 	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY,ES1371_SYNC_RES);
   	DELAY(2000);
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	/* Init the sample rate converter */
   	bus_space_write_4(es->st, es->sh, ES1371_REG_SMPRATE, ES1371_DIS_SRC);
   	for (idx = 0; idx < 0x80; idx++)
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: keramida 
State-Changed-When: Wed Jul 3 02:09:36 PDT 2002 
State-Changed-Why:  


http://www.freebsd.org/cgi/query-pr.cgi?pr=40132 
State-Changed-From-To: closed->open 
State-Changed-By: keramida 
State-Changed-When: Wed Jul 3 02:11:19 PDT 2002 
State-Changed-Why:  
Refile this under i386/. 
Sorry for closing this accidentally. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40132 
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: keramida 
Responsible-Changed-When: Wed Jul 10 17:27:01 PDT 2002 
Responsible-Changed-Why:  
Refile this under freebsd-bugs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40132 

From: Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
To: freebsd-gnats-submit@FreeBSD.org, rombios@acedsl.com
Cc:  
Subject: Re: i386/40132: Enabling the joystick interface on es137x pci sound cards
Date: Sun, 17 Nov 2002 13:55:50 +0100

 Could somebody please commit the patch from this PR?
 
 I can confirm that it works (i.e. makes the joystick usable), at least
 on es1371-compatible sound cards.
 
 Also, I think kern/20297 could then be closed, too. (That patch is only
 for es1370 and is slightly different in that it sets the flag CTRL_UART_EN,
 too. I don't see why that should be necessary and Linux's driver for
 the es1370 doesn't seem to do it either.)
 
 The original patch from this PR, which is for -stable, doesn't apply
 cleanly to -current and there's also a trailing blank. Below is a
 cleaned up version of "rombios"'s patch for -current.
 
 Thanks,
 Philipp
 
 
 Index: es137x.c
 ===================================================================
 RCS file: /ncvs/src/sys/dev/sound/pci/es137x.c,v
 retrieving revision 1.42
 diff -c -r1.42 es137x.c
 *** es137x.c	28 Apr 2002 22:38:23 -0000	1.42
 --- es137x.c	17 Nov 2002 12:09:07 -0000
 ***************
 *** 470,476 ****
   static int
   es1370_init(struct es_info *es)
   {
 ! 	es->ctrl = CTRL_CDC_EN | CTRL_SERR_DIS |
   		(DAC2_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_PCLKDIV);
   	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
   
 --- 470,476 ----
   static int
   es1370_init(struct es_info *es)
   {
 ! 	es->ctrl = CTRL_CDC_EN | CTRL_JYSTK_EN | CTRL_SERR_DIS |
   		(DAC2_SRTODIV(DSP_DEFAULT_SPEED) << CTRL_SH_PCLKDIV);
   	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);
   
 ***************
 *** 498,504 ****
   	if (debug > 0) printf("es_init\n");
   
   	es->num = 0;
 ! 	es->ctrl = 0;
   	es->sctrl = 0;
   	/* initialize the chips */
   	if ((devid == ES1371_PCI_ID && revid == ES1371REV_ES1373_8) ||
 --- 498,504 ----
   	if (debug > 0) printf("es_init\n");
   
   	es->num = 0;
 ! 	es->ctrl = CTRL_JYSTK_EN;	
   	es->sctrl = 0;
   	/* initialize the chips */
   	if ((devid == ES1371_PCI_ID && revid == ES1371REV_ES1373_8) ||
 ***************
 *** 516,524 ****
   	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, 0);
   	/* AC'97 warm reset to start the bitclk */
 ! 	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, es->ctrl | ES1371_SYNC_RES);
   	DELAY(2000);
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->ctrl);
   	/* Init the sample rate converter */
   	bus_space_write_4(es->st, es->sh, ES1371_REG_SMPRATE, ES1371_DIS_SRC);
   	for (idx = 0; idx < 0x80; idx++)
 --- 516,525 ----
   	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY, 0);
   	/* AC'97 warm reset to start the bitclk */
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_CONTROL, es->ctrl);					/*added CTRL_JYSTK_EN*/
 ! 	bus_space_write_4(es->st, es->sh, ES1371_REG_LEGACY,ES1371_SYNC_RES);
   	DELAY(2000);
 ! 	bus_space_write_4(es->st, es->sh, ES1370_REG_SERIAL_CONTROL, es->sctrl);
   	/* Init the sample rate converter */
   	bus_space_write_4(es->st, es->sh, ES1371_REG_SMPRATE, ES1371_DIS_SRC);
   	for (idx = 0; idx < 0x80; idx++)
 
 
Responsible-Changed-From-To: freebsd-bugs->sound 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 9 21:40:27 GMT 2004 
Responsible-Changed-Why:  
Over to mailing list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40132 
State-Changed-From-To: open->closed 
State-Changed-By: netchild 
State-Changed-When: Wed Dec 28 18:51:06 UTC 2005 
State-Changed-Why:  
This is fixed in -current. 

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