From patchwork Thu Apr 9 19:58:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 207082 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D618C2BB86 for ; Thu, 9 Apr 2020 19:59:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B8662084D for ; Thu, 9 Apr 2020 19:59:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727014AbgDIT73 (ORCPT ); Thu, 9 Apr 2020 15:59:29 -0400 Received: from mga14.intel.com ([192.55.52.115]:22248 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbgDIT73 (ORCPT ); Thu, 9 Apr 2020 15:59:29 -0400 IronPort-SDR: BuoOC34MnW28Z+vbd0OYBLhoB7OxSk4ZZbjzH//Hjv2FpLVOkFC133wpnvZjZi5MYeN6xnsEw4 U0Y4U80UgQ1g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2020 12:59:29 -0700 IronPort-SDR: kl8qEAxVlGenLQdfxE4JQ+rivjtPX5k5bWjuJ7HOQFjf5cPo1BMBH4uZFpiwGAqHxdeW8QKpoi jnASgac0PMng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,363,1580803200"; d="scan'208";a="242745417" Received: from davidadu-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.amr.corp.intel.com) ([10.212.151.218]) by fmsmga007.fm.intel.com with ESMTP; 09 Apr 2020 12:59:27 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Andy Shevchenko , Daniel Matuschek , Matthias Reichl , Hui Wang , linux-gpio@vger.kernel.org, Linus Walleij , Bartosz Golaszewski , linux-clk@vger.kernel.org, Michael Turquette , Stephen Boyd , Rob Herring , Pierre-Louis Bossart Subject: [RFC PATCH 15/16] clk: hifiberry-dacpro: add delay on clock prepare/deprepare Date: Thu, 9 Apr 2020 14:58:40 -0500 Message-Id: <20200409195841.18901-16-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200409195841.18901-1-pierre-louis.bossart@linux.intel.com> References: <20200409195841.18901-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add a delay to make sure the PCM512x codec can detect SCLK presence. The initial code from the Raspberry tree used msleep(2), which can be up to 20ms. A delay of 5-10ms seems fine in practice. Signed-off-by: Pierre-Louis Bossart --- drivers/clk/clk-hifiberry-dacpro.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/clk/clk-hifiberry-dacpro.c b/drivers/clk/clk-hifiberry-dacpro.c index f1f5af260083..2907b203fcf2 100644 --- a/drivers/clk/clk-hifiberry-dacpro.c +++ b/drivers/clk/clk-hifiberry-dacpro.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -145,6 +146,8 @@ static int clk_hifiberry_dacpro_prepare(struct clk_hw *hw) default: return -EINVAL; } + /* wait for SCLK update to be detected by PCM512x codec */ + usleep_range(5000, 10000); clk->prepared = 1; @@ -168,6 +171,8 @@ static void clk_hifiberry_dacpro_unprepare(struct clk_hw *hw) default: return; } + /* wait for SCLK update to be detected by PCM512x codec */ + usleep_range(5000, 10000); clk->prepared = false; }