From patchwork Thu Jul 16 03:30:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Boichat X-Patchwork-Id: 6803861 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2FE169F380 for ; Thu, 16 Jul 2015 03:31:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D90320573 for ; Thu, 16 Jul 2015 03:31:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id BD21E2056D for ; Thu, 16 Jul 2015 03:31:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F292B26606C; Thu, 16 Jul 2015 05:31:32 +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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 8C75926601B; Thu, 16 Jul 2015 05:31:24 +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 22629265E05; Thu, 16 Jul 2015 05:31:23 +0200 (CEST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by alsa0.perex.cz (Postfix) with ESMTP id A3FF5265E05 for ; Thu, 16 Jul 2015 05:31:17 +0200 (CEST) Received: by pdbqm3 with SMTP id qm3so36215380pdb.0 for ; Wed, 15 Jul 2015 20:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=/hxJIv9+QlKTl7JB63G+eRRJC/kjKUmzg0HCaV6Hvds=; b=hc2KRUxaU4GwpCVEmhHtO7z7sEWrki5ritF+bIhj8O024rRK+8cCjfkdxvthLEVX70 eoz6srbikRIjkrqyGjPjINV/fWh4kmp07XF7E8paOONBl6An326KYvn1cUp3nDc9ZRnp aeiBgxRcELfXCAxZL896rzL/7MN9mISIhbcns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/hxJIv9+QlKTl7JB63G+eRRJC/kjKUmzg0HCaV6Hvds=; b=QARTDXW06oq/T6fPSssszyYu8Tzo/6yO3eoASBQuUN9VqSciGhyWm8XbGMGDgnVetO 3WSGgyAvPYUq45LhcKJNAuDYtkJuKpeQppQKLghtTjrGX48gTtgyyQrK9FDYiw3096Io xmC3c3zr4NkjnLpZNRjUHrDCH9Q1zn+yQ2yiI4rfkUF9OvdA49EnGN8be6OosSrBqxaP vNwCXXBQHpCHQCGBoUnRMXNmYIJegZVcWU8omSCIFcWsRMg6c1+Hp+6kNWksoaGqUdw2 ZPYnvkLmUfwl9KM+GaPBEMX037CInlcUhS2QlCezx1wCeE8Vr1plG0o/bJ9G0DO7h0oe N0qQ== X-Gm-Message-State: ALoCoQltsHWQe25V6DWeyb+zdXJ26qYxSYJlcjhXnn66M5qsumIq3rcUd9/Q7iKxLFzGl/5EKRwQ X-Received: by 10.70.135.67 with SMTP id pq3mr14430491pdb.8.1437017476391; Wed, 15 Jul 2015 20:31:16 -0700 (PDT) Received: from drinkcat.tpe.corp.google.com ([172.30.210.53]) by smtp.gmail.com with ESMTPSA id sc1sm6153317pac.36.2015.07.15.20.31.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 15 Jul 2015 20:31:15 -0700 (PDT) From: Nicolas Boichat To: Mark Brown Date: Thu, 16 Jul 2015 11:30:58 +0800 Message-Id: <1437017458-19476-1-git-send-email-drinkcat@chromium.org> X-Mailer: git-send-email 2.4.3.573.g4eafbef Cc: Oder Chiou , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , Koro Chen , Bard Liao Subject: [alsa-devel] [PATCH v3] ASoC: rt5645: Check if codec is initialized in workqueue handler 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 rt5645_jack_detect_work needs rt5645->codec to be initialized to setup dapm pins. Also, reporting jack events is useless, as the jacks cannot be set before the codec is ready. Since we manually call the interrupt handler in rt5645_set_jack_detect, the initial jack state will be reported correctly, and dapm pins will be setup at that time. Signed-off-by: Nicolas Boichat --- sound/soc/codecs/rt5645.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 093a41d..ff75d04 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c @@ -2918,6 +2918,9 @@ static void rt5645_jack_detect_work(struct work_struct *work) container_of(work, struct rt5645_priv, jack_detect_work.work); int val, btn_type, gpio_state = 0, report = 0; + if (!rt5645->codec) + return; + switch (rt5645->pdata.jd_mode) { case 0: /* Not using rt5645 JD */ if (rt5645->gpiod_hp_det) {