Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Aug 2000 20:55:22 -0400 (EDT)
From:      ira@mit.edu
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/20891: Suspend-Resume support for YMF744. (Non ACPI)
Message-ID:  <200008280055.UAA20763@moose.ne.mediaone.net>

next in thread | raw e-mail | index | archive | help

>Number:         20891
>Category:       misc
>Synopsis:       Suspend/Resume does not work for the YMF744.  This fixes that.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Aug 27 18:00:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ira L. Cooper
>Release:        FreeBSD 4.1-STABLE i386
>Organization:
n/a
>Environment:

	Sony C1XS w/128MB ram. FreeBSD 4.1-STABLE a week or two old.

>Description:

	Sound stops working if you  and resume the laptop.

>How-To-Repeat:

	Hibernate using Fn+F12, or hibernate on another laptop w/this chip
set I'd assume.

>Fix:

	Patch against -STABLE should work against -CURRENT.  I've been
using it 2-3 weeks no problems. (Output from cvs diff -u -rRELENG_4 ds1.c)

	Please contact me about any issues arising from this.

	-Ira / ira@mit.edu

Index: ds1.c
===================================================================
RCS file: /usr/cvs/src/sys/dev/sound/pci/ds1.c,v
retrieving revision 1.8.2.3
diff -u -r1.8.2.3 ds1.c
--- ds1.c       2000/08/20 00:41:00     1.8.2.3
+++ ds1.c       2000/08/21 12:24:30
@@ -114,6 +114,8 @@
        int             regid, irqid;
        void            *ih;
 
+        void *buf;
+
        u_int32_t *pbase, pbankbase, pbanksize;
        volatile struct pbank *pbank[2 * 64];
        volatile struct rbank *rbank;
@@ -809,13 +811,20 @@
        memsz = 64 * 2 * pcs + 2 * 2 * rcs + 5 * 2 * ecs + ws;
        memsz += (64 + 1) * 4;
 
-       if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, &map))
+       /* this is put in so suspend/resume works and init still works. */
+       if(sc->buf == NULL)
+       {
+           if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, &map))
                return -1;
-       if (bus_dmamap_load(sc->parent_dmat, map, buf, memsz, ds_setmap, sc, 0)
-           || !sc->ctrlbase) {
+           if (bus_dmamap_load(sc->parent_dmat, map, buf, memsz, ds_setmap, sc,
 0)
+               || !sc->ctrlbase) {
                device_printf(sc->dev, "pcs=%d, rcs=%d, ecs=%d, ws=%d, memsz=%d\
n",
                              pcs, rcs, ecs, ws, memsz);
                return -1;
+           }
+           sc->buf = buf;
+       } else {
+           buf = sc->buf;
        }
 
        cb = 0;
@@ -971,11 +980,35 @@
        return ENXIO;
 }
 
+/* the idea for this code is stolen from neomagic.c */
+
+static int 
+ds_pci_resume(device_t dev)
+{
+       snddev_info *d; 
+       struct sc_info *sc;
+
+       d = device_get_softc(dev);
+       sc = pcm_getdevinfo(dev);
+
+
+       if(ds_init(sc) == -1)
+       {
+           device_printf(dev, "unable to reinitialize the card\n");
+           return ENXIO;
+       }           
+       if (mixer_reinit(d) == -1) {
+               device_printf(dev, "unable to reinitialize the mixer\n");
+               return ENXIO;
+       }
+       return 0;
+}
+
 static device_method_t ds1_methods[] = {
        /* Device interface */
        DEVMETHOD(device_probe,         ds_pci_probe),
        DEVMETHOD(device_attach,        ds_pci_attach),
-
+       DEVMETHOD(device_resume,        ds_pci_resume),
        { 0, 0 }
 };


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008280055.UAA20763>