From patchwork Wed Apr 19 23:13:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 9689181 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DA2260326 for ; Wed, 19 Apr 2017 23:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D9902582C for ; Wed, 19 Apr 2017 23:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20EC928437; Wed, 19 Apr 2017 23:14:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABDA62582C for ; Wed, 19 Apr 2017 23:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940328AbdDSXO2 (ORCPT ); Wed, 19 Apr 2017 19:14:28 -0400 Received: from mail-qt0-f179.google.com ([209.85.216.179]:33920 "EHLO mail-qt0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S940326AbdDSXO1 (ORCPT ); Wed, 19 Apr 2017 19:14:27 -0400 Received: by mail-qt0-f179.google.com with SMTP id c45so32511624qtb.1 for ; Wed, 19 Apr 2017 16:14:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernellabs-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c2wcheOTfB5sbxEB5VhG6xerOpM1hDA0xU6zs4DFflo=; b=ewHm0ECEnPwOB9TKsAPDA53ymSL542rl+2bQw6ej7UK//ZM77k2bbc5bGjtyEUC/2c 26qM2dNzgFbEip+abmPtTeFzgk4gNbxLJGjqd55y6Tu7HXXljlAJN/fd8k5at6vQ4HzM gcRkGYc1vS4H0dUFrslvQmrOaChRAXge/vipFhoThz9uFvCZr72cm13m4Cxpm77fHUi3 5RqX1MTzFLL+BHcixdHjKDBAKvqN6giJdPpcvpML4i1Ds/TFK0Ikm61mM/hIw2T5irXg 9RZFvqMgrLfqjp/8mGX7Jclvu07h+PuiHcm2vHHe2Cc1+z8ZO8y6qN3bWUu/4ybRVjuF g0kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c2wcheOTfB5sbxEB5VhG6xerOpM1hDA0xU6zs4DFflo=; b=AD4N0o4CgDIByUd0qsFQPSv/jsN4FLdyf59nbCPScImTjEV+VMKiNwNzmueHsoVQTo SHnfZj+DiGGxUaBB8OOZo1BmV9kiQnT43VfrDfOQa5b4NDe76x0JWwki4e3k3FLaHMDo X1MBOo52cBVrG+13s+o3Xiyq+5uREMwaMIravbVZs/BGkqoCQC10/hPOaVcs2ku0TMSg nzE+LfDGtDkXc70iywMzzTCAgbXz0U4sGgQWdv7NJHcVHq7aNrqecqsSAIpW3y871lj0 g13YIY5magp3qEwfdkGIS5R9ARYl6PKovGJgjp0DCe7I39XyBYEX91hJFRwblHgOvqp/ mvRA== X-Gm-Message-State: AN3rC/6kgOlovpSMVB9GqOwFtvwazGKehKpglsRTRNSGRblD4BALy2tS PSTmsgxjp846pFoQ X-Received: by 10.237.60.210 with SMTP id e18mr4900335qtf.141.1492643666331; Wed, 19 Apr 2017 16:14:26 -0700 (PDT) Received: from localhost.localdomain (cpe-74-71-114-159.nyc.res.rr.com. [74.71.114.159]) by smtp.gmail.com with ESMTPSA id 123sm2951916qkm.22.2017.04.19.16.14.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 16:14:25 -0700 (PDT) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller Subject: [PATCH 03/12] au8522: rework setup of audio routing Date: Wed, 19 Apr 2017 19:13:46 -0400 Message-Id: <1492643635-30823-4-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> References: <1492643635-30823-1-git-send-email-dheitmueller@kernellabs.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The original code was based on my reverse engineering of an I2C trace of the Windows driver. Now that I know what the registers actually do, restructure the code a bit, removing some unneeded register programming and fixing the sequencing of operations. This reduces the time it takes to change inputs from 1300ms down to 600ms (as measured by "time v4l2-ctl -i 0") Note this does not address outstanding issues related to the management of the module clocks and power control for the various blocks, which will be done in a separate patch. Signed-off-by: Devin Heitmueller --- drivers/media/dvb-frontends/au8522_decoder.c | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c index 7811717..281b5ac 100644 --- a/drivers/media/dvb-frontends/au8522_decoder.c +++ b/drivers/media/dvb-frontends/au8522_decoder.c @@ -418,28 +418,29 @@ static void set_audio_input(struct au8522_state *state) lpfilter_coef[i].reg_val[0]); } - /* Setup audio */ - au8522_writereg(state, AU8522_AUDIO_VOLUME_L_REG0F2H, 0x00); - au8522_writereg(state, AU8522_AUDIO_VOLUME_R_REG0F3H, 0x00); - au8522_writereg(state, AU8522_AUDIO_VOLUME_REG0F4H, 0x00); - msleep(150); - au8522_writereg(state, AU8522_SYSTEM_MODULE_CONTROL_0_REG0A4H, 0x00); - msleep(10); - au8522_writereg(state, AU8522_SYSTEM_MODULE_CONTROL_0_REG0A4H, - AU8522_SYSTEM_MODULE_CONTROL_0_REG0A4H_CVBS); - msleep(50); + /* Set the volume */ au8522_writereg(state, AU8522_AUDIO_VOLUME_L_REG0F2H, 0x7F); au8522_writereg(state, AU8522_AUDIO_VOLUME_R_REG0F3H, 0x7F); au8522_writereg(state, AU8522_AUDIO_VOLUME_REG0F4H, 0xff); - msleep(80); - au8522_writereg(state, AU8522_AUDIO_VOLUME_L_REG0F2H, 0x7F); - au8522_writereg(state, AU8522_AUDIO_VOLUME_R_REG0F3H, 0x7F); + + /* Not sure what this does */ au8522_writereg(state, AU8522_REG0F9H, AU8522_REG0F9H_AUDIO); + + /* Setup the audio mode to stereo DBX */ au8522_writereg(state, AU8522_AUDIO_MODE_REG0F1H, 0x82); msleep(70); - au8522_writereg(state, AU8522_SYSTEM_MODULE_CONTROL_1_REG0A5H, 0x09); + + /* Start the audio processing module */ + au8522_writereg(state, AU8522_SYSTEM_MODULE_CONTROL_0_REG0A4H, 0x9d); + + /* Set the audio frequency to 48 KHz */ au8522_writereg(state, AU8522_AUDIOFREQ_REG606H, 0x03); + + /* Set the I2S parameters (WS, LSB, mode, sample rate */ au8522_writereg(state, AU8522_I2S_CTRL_2_REG112H, 0xc2); + + /* Enable the I2S output */ + au8522_writereg(state, AU8522_SYSTEM_MODULE_CONTROL_1_REG0A5H, 0x09); } /* ----------------------------------------------------------------------- */