Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4121292rwl; Tue, 28 Mar 2023 02:59:27 -0700 (PDT) X-Google-Smtp-Source: AKy350aGP58erM7coOgGRZjxXVeRh9qgiVuI4vnpqrF+xjPGwcJUWj10Az7gCpV4oGgM4UXZn0hg X-Received: by 2002:a17:906:4795:b0:944:308f:b976 with SMTP id cw21-20020a170906479500b00944308fb976mr9750231ejc.36.1679997567267; Tue, 28 Mar 2023 02:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679997567; cv=none; d=google.com; s=arc-20160816; b=dctXWyYFzT60loFqQQeqZyey6x7sO/yXX+xFIjNKtZWiB5OMBrGiGmRWcEsm6LXgxi oYTP9179RDy81R+v/bW5TnCGgwmEWQ9BSh52ZD6p16km2UUwVt1TLRr/wnjdFqe/WlpF +NDc6scaNBxtEqmVlSJkAQexRhFFKZtUcYiBO64vufSm4qIybPD9fWsooR3anSh9sXhR sgHIgaNCKjIVzycEFHT3mkm9FWTx2DgAgmhi5/HbwUnnLw1Q7cE0pMywL7mIBbuZ7ImJ MnMODDK/jwQ9+qW8btd9Yf0RsphhP3j4QiuP5h6I5V8OyjCVu//8Fley3LQbfhoBKW5R 3yDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vhePFVqXOVqunZri9AjD1dJuToYnCj7tIFWvW7blzMI=; b=pWVZzb/FbSGzyEqlzvJe0RRapkku4i85/TR2RK0KAfnMhwNXBFsxHmKA95twKyQf3O dx8qFfnDGe5DokIiZYsapS2ieG3A2pNxrGHwzsSp5G57XtYcpjPjBliCamVyuSs7+6x7 WhxKAufsdkZtth0Vz827uw0ojC66W2yyMWcQdq5MAVvz1XCz/07r2EpL7Fup4OsS+Y1c +KsV2nli7aGtXiiyl99Sx6Prtq8+UVfJyGj8BfQmzvjbmB54h2GihStJQMAbWDO9Jb4Y 5RVGn/VWQp/+f6mPq5zeLa0Qlmv+vB0/htrVwhUL22dTRxbf3BAL67iGSGi6Uc1RgxEH uKPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VcXeONKx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t9-20020a170906608900b0092604f32e91si27780900ejj.730.2023.03.28.02.59.03; Tue, 28 Mar 2023 02:59:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VcXeONKx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232846AbjC1Jue (ORCPT + 99 others); Tue, 28 Mar 2023 05:50:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232673AbjC1JuE (ORCPT ); Tue, 28 Mar 2023 05:50:04 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A2B6A62 for ; Tue, 28 Mar 2023 02:49:08 -0700 (PDT) Received: from localhost (unknown [188.24.133.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madras.collabora.co.uk (Postfix) with ESMTPSA id 099B9660313B; Tue, 28 Mar 2023 10:49:05 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1679996946; bh=tvwdoB9D+B+grzUkDaRMsZodsfqatGfdvkJIH90Q3x0=; h=From:To:Cc:Subject:Date:From; b=VcXeONKxGtgjVV1ohFWVXUPTtzQgKtyRCQY0iyS/y2g3wxS7Xj08zPk+gUfPV/jPw 2VzpE4j2GzbRQJeC/NjxDebmBf/mEhiazT6g22hKAJbK3kavZ3/uuX3QToEHV0pP5p hfpg+oY0mlsJsSsmulZZM12RPD7KzAp//VkXiV77GJ3Q92131OvaANhPHvdOVJHqdz 4aXWsjKVE3tWI3gOPeRPqZ2H+i1hlh1S0ueHfZoJBp0cFt6ei69MyUgzCON28NhPlI 2LlxjGvZ/wUW6yGkqwpQ602BXSDzIF3YZrDEeTL08RSO/UgSvLriZ3cBf8LtTd9jIU zVovuvuPORC6A== From: Cristian Ciocaltea To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Hans de Goede Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH] ASoC: es8316: Handle optional IRQ assignment Date: Tue, 28 Mar 2023 12:49:01 +0300 Message-Id: <20230328094901.50763-1-cristian.ciocaltea@collabora.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver is able to work fine without relying on a mandatory interrupt being assigned to the I2C device. This is only needed when making use of the jack-detect support. However, the following warning message is always emitted when there is no such interrupt available: es8316 0-0011: Failed to get IRQ 0: -22 Do not attempt to request an IRQ if it is not available/valid. This also ensures the rather misleading message is not displayed anymore. Also note the IRQ validation relies on commit dab472eb931bc291 ("i2c / ACPI: Use 0 to indicate that device does not have interrupt assigned"). Fixes: 822257661031 ("ASoC: es8316: Add jack-detect support") Signed-off-by: Cristian Ciocaltea --- sound/soc/codecs/es8316.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c index 056c3082fe02..f7d7a9c91e04 100644 --- a/sound/soc/codecs/es8316.c +++ b/sound/soc/codecs/es8316.c @@ -842,12 +842,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client) es8316->irq = i2c_client->irq; mutex_init(&es8316->lock); - ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN, - "es8316", es8316); - if (ret) { - dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret); - es8316->irq = -ENXIO; + if (es8316->irq > 0) { + ret = devm_request_threaded_irq(dev, es8316->irq, NULL, es8316_irq, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT | IRQF_NO_AUTOEN, + "es8316", es8316); + if (ret) { + dev_warn(dev, "Failed to get IRQ %d: %d\n", es8316->irq, ret); + es8316->irq = -ENXIO; + } } return devm_snd_soc_register_component(&i2c_client->dev, -- 2.40.0