From patchwork Sat May 23 16:15:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 6470551 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6631AC0020 for ; Sat, 23 May 2015 16:15:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A9F82058E for ; Sat, 23 May 2015 16:15:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5D50220585 for ; Sat, 23 May 2015 16:15:50 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 7AB57260535; Sat, 23 May 2015 18:15:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 2A99C2604C3; Sat, 23 May 2015 18:15:40 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id ADAAD2604FF; Sat, 23 May 2015 18:15:38 +0200 (CEST) Received: from pokefinder.org (sauhun.de [89.238.76.85]) by alsa0.perex.cz (Postfix) with ESMTP id 73A9F2604BA for ; Sat, 23 May 2015 18:15:30 +0200 (CEST) Received: from p4fe25ce7.dip0.t-ipconnect.de ([79.226.92.231]:50497 helo=localhost) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YwC56-0000F1-Q0; Sat, 23 May 2015 18:15:25 +0200 From: Wolfram Sang To: linuxppc-dev@lists.ozlabs.org Date: Sat, 23 May 2015 18:15:11 +0200 Message-Id: <1432397711-3186-1-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 2.1.4 Cc: alsa-devel@alsa-project.org, Wolfram Sang , Benjamin Herrenschmidt , Dan DeVoto , Mark Elliott , linux-i2c@vger.kernel.org Subject: [alsa-devel] [RFC] sound: ppc: keywest: check if DEQ was already instantiated X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Due to changes in i2c-powermac, for some Macs the DEQ is instantiated now in i2c-powermac while some need the instantiation here in the keywest sound driver. The proper fix is to convert this driver to AOA. Until then support both ways of instantiation. Before this patch, some Macs lost sound because the sound driver failed when instantiating the DEQ for the second time. Signed-off-by: Wolfram Sang --- Dan, Mark: I hope I found a generic but not too intrusive solution to the doubled instantiation problem. Can you please test this patch on top of this one "sound: ppc: keywest: drop using attach adapter" from last time? Check if you have sound and send the dmesg output, please. I hope it compiles even, couldn't test that this time. sound/ppc/keywest.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index d7627bae08362e..6120a067494a44 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -31,10 +31,15 @@ */ static struct pmac_keywest *keywest_ctx; +static bool keywest_probed; static int keywest_probe(struct i2c_client *client, const struct i2c_device_id *id) { + keywest_probed = true; + /* If instantiated via i2c-powermac, we still need to set the client */ + if (!keywest_ctx->client) + keywest_ctx->client = client; i2c_set_clientdata(client, keywest_ctx); return 0; } @@ -92,7 +97,8 @@ static int keywest_remove(struct i2c_client *client) static const struct i2c_device_id keywest_i2c_id[] = { - { "keywest", 0 }, + { "MAC,tas3004", 0 }, /* instantiated by i2c-powermac */ + { "keywest", 0 }, /* instantiated by us if needed */ { } }; @@ -149,8 +155,13 @@ int snd_pmac_keywest_init(struct pmac_keywest *i2c) return err; } + /* There was already a device from i2c-powermac. Great, let's return */ + if (keywest_probed) + return 0; + /* We assume Macs have consecutive I2C bus numbers starting at 0 */ while (adap) { + /* Scan for devices to be bound to */ err = keywest_attach_adapter(adap); if (!err) return 0;