From patchwork Tue Jun 25 14:00:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 2778111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C22F3C0AB1 for ; Tue, 25 Jun 2013 16:24:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AE092036C for ; Tue, 25 Jun 2013 16:24:03 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B45220367 for ; Tue, 25 Jun 2013 16:24:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrTod-00022W-Kt; Tue, 25 Jun 2013 14:01:52 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrTnw-0000nr-Mb; Tue, 25 Jun 2013 14:01:08 +0000 Received: from co9ehsobe002.messaging.microsoft.com ([207.46.163.25] helo=co9outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrTnu-0000mW-7L for linux-arm-kernel@lists.infradead.org; Tue, 25 Jun 2013 14:01:06 +0000 Received: from mail71-co9-R.bigfish.com (10.236.132.251) by CO9EHSOBE024.bigfish.com (10.236.130.87) with Microsoft SMTP Server id 14.1.225.23; Tue, 25 Jun 2013 14:00:43 +0000 Received: from mail71-co9 (localhost [127.0.0.1]) by mail71-co9-R.bigfish.com (Postfix) with ESMTP id C9D1FA00CC; Tue, 25 Jun 2013 14:00:43 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e23h1155h) Received: from mail71-co9 (localhost.localdomain [127.0.0.1]) by mail71-co9 (MessageSwitch) id 137216881677850_26641; Tue, 25 Jun 2013 14:00:16 +0000 (UTC) Received: from CO9EHSMHS010.bigfish.com (unknown [10.236.132.241]) by mail71-co9.bigfish.com (Postfix) with ESMTP id E39272E0087; Tue, 25 Jun 2013 14:00:15 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS010.bigfish.com (10.236.130.20) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 25 Jun 2013 14:00:14 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.328.11; Tue, 25 Jun 2013 14:00:14 +0000 Received: from fabio-Latitude-E6410.am.freescale.net ([10.29.244.66]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r5PE07Jq024178; Tue, 25 Jun 2013 07:00:12 -0700 From: Fabio Estevam To: Subject: [PATCH 3/3] ASoC: sgtl5000: Defer probe in case of I2C error Date: Tue, 25 Jun 2013 11:00:01 -0300 Message-ID: <1372168801-4221-3-git-send-email-fabio.estevam@freescale.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1372168801-4221-1-git-send-email-fabio.estevam@freescale.com> References: <1372168801-4221-1-git-send-email-fabio.estevam@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130625_100106_375542_17EDE8AC X-CRM114-Status: GOOD ( 12.46 ) X-Spam-Score: -4.2 (----) Cc: marex@denx.de, Fabio Estevam , alsa-devel@alsa-project.org, shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of I2C error, let's defer the probe. On mx28, for example, the first read of the codec revision register fails because there is no codec clock provided at this point. The codec clock will be enabled later in the mxs-saif driver, so return -EPROBE_DEFER in case of I2C read error, so that the codec driver can do another attempt at a later stage when the codec clock is available. Signed-off-by: Fabio Estevam --- sound/soc/codecs/sgtl5000.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d441559..a2dce4a 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c @@ -1536,9 +1536,12 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, /* read chip information */ ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®); - if (ret) + if (ret) { + ret = -EPROBE_DEFER; /* If I2C read failed, try again later */ goto disable_clk; + } + if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) != SGTL5000_PARTID_PART_ID) { dev_err(&client->dev,