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: 10041181 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 B2D776032D for ; Fri, 3 Nov 2017 20:36:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A558728632 for ; Fri, 3 Nov 2017 20:36:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A37229920; Fri, 3 Nov 2017 20:36:06 +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=-2.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0315D28632 for ; Fri, 3 Nov 2017 20:36:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D64D36EB2A; Fri, 3 Nov 2017 20:36:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-x243.google.com (mail-io0-x243.google.com [IPv6:2607:f8b0:4001:c06::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AC326EB26; Fri, 3 Nov 2017 20:36:00 +0000 (UTC) Received: by mail-io0-x243.google.com with SMTP id 134so8966766ioo.0; 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=aGQ967aHDbMiBw37RIWeXygsobmrVeGgT+5/fef5W4tbjpfbfSHQ5y2NKKUwwqWebd B3hWYyUhL+NdtSAKjmFgfslAxG2kjF297OcGny1/bTE0tuRmzs6nSXRjUqEF/S5GRbIC 8o2PcS9OsjWyv38cu08IG43Mre3tdc4QBUW1hTHa7CXR//wJJqZBV30XvUblL9R1Dkf9 A3Jthlf9czL3+KNrwwQZFCnTwWt+Hb2U80il/1gQQ1WlM1FQLXvAUi93/AkdV/47+z3R sb/YSYPxsp/r44i/ITsMHUFqcStpxJT1JUbiqzjyW8+CHZwoOxqIErhooJOLltKwdzk6 wx7w== X-Gm-Message-State: AMCzsaVVjc+SQQbtCDL/5hrLcywDsIGBNfXn/fyh+rgxoUd32dBh4x00 Pl3Tu6gE1S0kiEol4m/v2TUFjg== 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 Subject: [PATCH 3/3] ASoC: rt5645: Wait for 400msec before concluding on value of RT5645_VENDOR_ID2 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: Bard Liao , Alex Deucher , lgirdwood@gmail.com, Akshu Agrawal X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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);