From patchwork Fri Nov 3 20:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 10041195 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 94134600C5 for ; Fri, 3 Nov 2017 20:49:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B3452993C for ; Fri, 3 Nov 2017 20:49:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FBD82993F; Fri, 3 Nov 2017 20:49:19 +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=0.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAF6F2993C for ; Fri, 3 Nov 2017 20:49:18 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 9526F2675DB; Fri, 3 Nov 2017 21:36:04 +0100 (CET) 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 A2F112675CA; Fri, 3 Nov 2017 21:36:02 +0100 (CET) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by alsa0.perex.cz (Postfix) with ESMTP id 5671E2675BD for ; Fri, 3 Nov 2017 21:36:00 +0100 (CET) Received: by mail-io0-f196.google.com with SMTP id b186so8902557iof.8 for ; Fri, 03 Nov 2017 13:36:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZgSIYx4uU9JHF0Rpb8HvGaZgqqrktfOd8w1e5LveyjU=; b=uPcttPwcUnQm3Y4qnPOPo/HhLD86b1w9WwCe8CaNJll5Agesgcrtssk4m2NIYG0kUG 5pQMrGc8gVTLBEU3Z8njhoH6h3pDMAe149QV6WSBhsu0saI6SW29gjEQaYr6/3yi7qju k1nGiZw6BJLa7LM31NXIVsugr8BoqrUtUvXmUisHDZx8q2cJYv2Sy5HzJRBW4Cj4xa7x +j0fmIay16YVzE4jxYGc1w0VoylcozhxsWKzsWPxsxnHfS6ZwGiq5Qx1EWv23C2tkp5c EtNrktNlluc90ksjHYLYC88OUsRGp1eG+HlL65CbeTrpVQQoV/LG04DdOhjZV2Bu8G/G aNcg== 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=ZgSIYx4uU9JHF0Rpb8HvGaZgqqrktfOd8w1e5LveyjU=; b=EpqaO79afFQXbUzl7VgPHkscuEzt5v5dOU7iY9zrxZdj9pq573DVltfVttO8jJoHzX c5rOiUqS7tP95dVpVoTSp6r5BgKHdLMklmcS/cnSnmqhScHa32RZTebBP70rp6gEccXt Z06guWRQr/GJU0V825Qi+pXoysNW1pPTw8c9vytcedL6wiVHRRFvPwtUxQefsc4Iiuf7 zUPhy43yioS9FkeFZubH4r//6fG0u+2qkhYAxn4dpjvFMjWcIjXeWwiMxZstV1DSA1so Ipkw149U4uF7qklivYZ7pFWMKxZpZa6F8eYn1M1hxluIJ4GF13T0QvNrM563eU0JxE6V jwcQ== X-Gm-Message-State: AMCzsaW0TJzKPqRkab4o/qqPQU5vJzEUWU2wvsLYMw5Cg8KeHXWGC5Nb TPk5pL8wIwcxYyVoc3dXLok= X-Google-Smtp-Source: ABhQp+TFO7H6YesCiiFS+wa1ji18z/LZozzg1PZK8JDmAYZdFHNUnRAcX8mskhq/Se/SYo8omT8NVw== X-Received: by 10.107.25.18 with SMTP id 18mr10625273ioz.11.1509741359408; Fri, 03 Nov 2017 13:35:59 -0700 (PDT) Received: from cm.amd.com ([165.204.55.251]) by smtp.gmail.com with ESMTPSA id y16sm1571946ita.11.2017.11.03.13.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Nov 2017 13:35:59 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, airlied@gmail.com, alsa-devel@alsa-project.org, broonie@kernel.org, Vijendar.Mukunda@amd.com Date: Fri, 3 Nov 2017 16:35:45 -0400 Message-Id: <1509741345-1589-4-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1509741345-1589-1-git-send-email-alexander.deucher@amd.com> References: <1509741345-1589-1-git-send-email-alexander.deucher@amd.com> Cc: tiwai@suse.de, Bard Liao , Alex Deucher , lgirdwood@gmail.com, Akshu Agrawal Subject: [alsa-devel] [PATCH 3/3] ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2 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 From: Akshu Agrawal Minimum time required between power On of codec and read of RT5645_VENDOR_ID2 is 400msec. We should wait and attempt before erroring out. BUG=b:66978383 TEST=Cold boot the device and check for sound device. Signed-off-by: Akshu Agrawal Signed-off-by: Bard Liao Signed-off-by: Alex Deucher --- sound/soc/codecs/rt5645.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 23cc2cb..2da0b33 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -55,6 +55,8 @@ MODULE_PARM_DESC(quirk, "RT5645 pdata quirk override"); #define RT5645_HWEQ_NUM 57 +#define TIME_TO_POWER_MS 400 + static const struct regmap_range_cfg rt5645_ranges[] = { { .name = "PR", @@ -3712,6 +3714,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, int ret, i; unsigned int val; struct regmap *regmap; + int timeout = TIME_TO_POWER_MS; rt5645 = devm_kzalloc(&i2c->dev, sizeof(struct rt5645_priv), GFP_KERNEL); @@ -3786,6 +3789,15 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, } regmap_read(regmap, RT5645_VENDOR_ID2, &val); + /* + * Read for 400msec, as it is the interval required between + * read and power On. + */ + while (val != RT5645_DEVICE_ID && val != RT5650_DEVICE_ID && --timeout) { + msleep(1); + regmap_read(regmap, RT5645_VENDOR_ID2, &val); + } + switch (val) { case RT5645_DEVICE_ID: rt5645->regmap = devm_regmap_init_i2c(i2c, &rt5645_regmap);