From owner-freebsd-ppc@FreeBSD.ORG Fri Sep 26 18:17:27 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 21F031065747 for ; Fri, 26 Sep 2008 18:17:27 +0000 (UTC) (envelope-from marcotrillo@gmail.com) Received: from mail-gx0-f17.google.com (mail-gx0-f17.google.com [209.85.217.17]) by mx1.freebsd.org (Postfix) with ESMTP id C1D5E8FC1C for ; Fri, 26 Sep 2008 18:17:26 +0000 (UTC) (envelope-from marcotrillo@gmail.com) Received: by gxk10 with SMTP id 10so8570294gxk.19 for ; Fri, 26 Sep 2008 11:17:26 -0700 (PDT) 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:mime-version:content-type:content-transfer-encoding :content-disposition; bh=xrJJx1OcPSprOvYqjppTBJbY97BJWAN43YJ8AtV+SO8=; b=cxlNaFMVaySnkSdI6q8RNPh4N3QqwnV05lQ3MSlSPCRmUI2iAuD8C5DUJW8vvwuUnK TcGwDSLIAUyzYhNSdNXRl97jSF1CPvd7CMxZQLRFde1lS7Lcz26mpGhqK6/5K6kwjrc8 6fXYMZme0NaCZMSfDk05F5q2NfcYsNiDt4BF8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=ta7Cs8W3fgC1u4r8j7quO7TBC0o+UU+ySikPNMR9R0ilJZzOGOOTREHGAfCKbJ3wA1 Vw+vD6ubhaXm62TE0DpgTOyfczKs0Gpps3oKIfTcnHFHHAzAmGe345CatnT6FI8qxje3 1Ks+Ie8bokGgOX3OO44ZOiQGuR/Knp+WDqlw0= Received: by 10.142.105.13 with SMTP id d13mr713046wfc.275.1222453045626; Fri, 26 Sep 2008 11:17:25 -0700 (PDT) Received: by 10.142.101.13 with HTTP; Fri, 26 Sep 2008 11:17:25 -0700 (PDT) Message-ID: Date: Fri, 26 Sep 2008 20:17:25 +0200 From: "Marco Trillo" To: freebsd-ppc@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Onboard audio support and DBDMA API extensions. 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: Fri, 26 Sep 2008 18:17:27 -0000 Hi, I'm working in a pcm(4) driver for the Apple onboard audio. The current status is that audio output works on my machine using a default volume, but volume changing is not supported yet. In more detail, what I have is support for audio output using the I2S-based mac-io audio controller (which is the one used on most new-world Apple machines), using DBDMA to transfer the audio. Support for the older, DAVbus-based controllers should be easy too since the DBDMA stuff is mostly the same. I would like to propose two extensions for the DBDMA API, detailed below. I also have preliminary support for the GPIO controls, which are used mainly to select the output port (built-in speakers or headphones). What I have yet to do is to support the mixer(4) interface (to support changing the output volume), which needs support for the Keywest I2C controller in order to talk to the codec. I have in fact ported a Keywest I2C driver from NetBSD, but I don't use it much yet. Some dmesg output of the driver with debugging enabled: macio0: mem 0x80000000-0x8007ffff at device 23.0 on pci1 pcm0: mem 0x10000-0x10fff,0x8000-0x80ff,0x8100-0x81ff,0x8200-0x82ff,0x8300-0x83ff irq 30,1,2,31,3,4 on macio0 interrupting at irq 1 pcm0: [ITHREAD] GPIO : addr 0x6f GPIO : addr 0x70 GPIO : addr 0x75 GPIO : addr 0x67 enabled outputs: SPEAKER resetting codec pcm_getbuffersize returned 65536 aoa_dma_setprd: addr = 31391744, 32 slots aoa_chan_setformat: format = 268435488 aoa_chan_setspeed: speed = 44100 aoa_chan_setformat: format = 268435488 aoa_chan_setblocksize: blocksz = 2048, dma->blksz = 2048 aoa_chan_setspeed: speed = 44100 aoa_chan_setformat: format = 268435488 aoa_chan_setblocksize: blocksz = 2048, dma->blksz = 2048 aoa_chan_setblocksize: blocksz = 2048, dma->blksz = 2048 aoa_chan_setspeed: speed = 44100 aoa_chan_setformat: format = 268435488 aoa_chan_setblocksize: blocksz = 2048, dma->blksz = 2048 kiic0: mem 0x18000-0x18fff irq 26 on macio0 $ cat /dev/sndstat FreeBSD Audio Driver (newpcm: 32bit 2007061600/powerpc) Installed devices: pcm0: at irq 1 [GIANT] (1p:1v/0r:0v channels default) Playing an audio file (in this case using the "aifftools" utilities): $ cd dl/aiff/aifftools/aifftools $ ./aiffopen 1\ Kyrie.aiff => Reading '1 Kyrie.aiff'... +---------------------------------+ | 1 Kyrie.aiff | +----------------+----------------+ | Author:| | +----------------+----------------+ | Length:| 0:07:08| +----------------+----------------+ | Sampling rate:| 44.100 kHz| +----------------+----------------+ | Channels:| Stereo| +----------------+----------------+ | Resolution:| 16 bps| +----------------+----------------+ | Bitrate:| 1411 kbps| +----------------+----------------+ => oss: Open Sound System (OSS) => Start playing [0:00:38]^C => Aborted by signal 2 The current work-in-progress version of the driver is at: . I would like to propose the following additions to the DBDMA API, which I'm using in the driver: void dbdma_clear_cmd_status(dbdma_channel_t *, int slot); Clears the cmdStatus of DBDMA command at slot 'slot'. Used for keeping track of completed blocks. void dbdma_control(dbdma_channel_t *, uint8_t mask, uint8_t in); General-purpose manipulation of the DBDMA channel control register. Used for setting/clearing general-purpose control bits such as S0. What do you think? Thanks, Marco.