From owner-freebsd-ppc@FreeBSD.ORG Tue Nov 4 09:59:10 2008 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20DDD1065672 for ; Tue, 4 Nov 2008 09:59:10 +0000 (UTC) (envelope-from marcotrillo@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.173]) by mx1.freebsd.org (Postfix) with ESMTP id E7FA68FC08 for ; Tue, 4 Nov 2008 09:59:09 +0000 (UTC) (envelope-from marcotrillo@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so3064126wfg.7 for ; Tue, 04 Nov 2008 01:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=EaUherB0gRwTkAdRAjYvgEnCJHUFPb29j/N9CMLmywU=; b=VkgZkd12bDOIAt7FoRJ9sucXOMRLpOhOccl5EujgKF/CQ5dNp98sgcL/A31NO9PDJq vKYpIPMAam73/wKI/OVeKprJaLBvVyJpdi6x6LOGeYGqOLhCf0Nety6OvBBgvPVOKYnB nZx7ZNJC0LAZpF9y6GjOaN358SHqQJbQmni54= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=vvHBW/kImpjF+rQTKwrW/fqHTIxYvPwuFe2oUd5lknse1Ku++nGboJDNXln6yIQ3PF 1RhHmyc9BYQ3bG+AQDOFd6CaRSvM+8MIb2vyXDdEV8wRC3EdioPQXPOP30GC7MymSGxH 9XFSmia20YkEqc1RZClZsZ4t1MTWnkTP/pywI= Received: by 10.142.14.20 with SMTP id 20mr673690wfn.149.1225792749712; Tue, 04 Nov 2008 01:59:09 -0800 (PST) Received: by 10.142.101.13 with HTTP; Tue, 4 Nov 2008 01:59:09 -0800 (PST) Message-ID: Date: Tue, 4 Nov 2008 10:59:09 +0100 From: "Marco Trillo" To: "Andreas Tobler" In-Reply-To: <490F5E89.4040608@fgznet.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <490F5E89.4040608@fgznet.ch> Cc: FreeBSD PowerPC ML Subject: Re: feedback: Apple Tumbler and Snapper audio: looking for testers X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 09:59:10 -0000 Hi, On Mon, Nov 3, 2008 at 9:26 PM, Andreas Tobler wrote: > took a while, but finally I managed to test your patch on my AluBook. > > It seems to work. I can hear a very quite output either on built-in speaker > or on headphones. > > I've done this on yesterdays src tree. Including my speed hacks. > > The messages from the kernel: > [...] > kiic0: mem 0x18000-0x18fff irq 26 on macio0 > [...] > Unfortunately I do not seem to be able to use the mixer correctly. mixer > doesn't report a default device. So I can't set the volume. Thanks a lot for testing the driver! Hmm... it seems that it is not able to detect the codec, so the volume cannot be changed. I think the following patch should solve this problem -- it makes the driver also look for a "layout-id" property and use that, if the other match attempts have failed. The patch is for the /usr/src/sys/dev/sound/macio/i2s.c file: --- i2s.c.orig 2008-10-09 11:05:57.000000000 +0200 +++ i2s.c 2008-11-04 10:50:39.000000000 +0100 @@ -526,6 +526,11 @@ void (*init)(struct i2s_softc *); int (*set_volume)(void *, int, int); }; +enum { + I2S_CODEC_TUMBLER, + I2S_CODEC_SNAPPER, + I2S_CODEC_UNKNOWN +}; static struct i2s_codec i2s_codecs[] = { {"tumbler", NULL, 0x68, tumbler_init, tumbler_set_volume}, {"snapper", "tas", 0x6a, snapper_init, tumbler_set_volume}, @@ -569,6 +574,24 @@ return 0; } } + + /* If still no match, try with `layout-id' property. */ + if (OF_getprop(soundbus, "layout-id", &ref, sizeof(ref)) == + sizeof(ref)) { + + c = NULL; + switch (ref) { + case 41: + case 51: + c = &i2s_codecs[I2S_CODEC_SNAPPER]; + break; + } + + if (c != NULL) { + sc->codec = c; + return 0; + } + } return -1; } Thanks! Marco