From patchwork Tue Mar 28 09:49:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Ciocaltea X-Patchwork-Id: 75951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2097230vqo; Tue, 28 Mar 2023 03:06:12 -0700 (PDT) X-Google-Smtp-Source: AKy350Yz+10MWJQtDGNFBJUpU+4UAhRM3HrFPUYZL6n6BiSuOOvVplYdy4KKO1duaCj3p2/L0Vij X-Received: by 2002:a17:906:144a:b0:944:394:93f7 with SMTP id q10-20020a170906144a00b00944039493f7mr8688708ejc.61.1679997972518; Tue, 28 Mar 2023 03:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679997972; cv=none; d=google.com; s=arc-20160816; b=VAGeW0peUjAIV8gicwG01W8wdv3PuxbNRj3ZiAUIHvLNfC0p7eCsceTLNgJ3vvGTw3 2xNBrQ2+bS2Skf1UR1j8iSr61/rQDecnU13KlTphE9Gc3qwvstCe05Nen7clYPcDjl58 MSs09x79HHvSj4tHTWXzKk7uRiBHMYOuVXJRvyFVfwYJsm+9+5bRyGP+kvJV5dtMZ3Vt tCdMYz9Vz3CKEZ5pyWl3wC0d5LZO0qy3c6WYHs8rRC9MFqSJKaoe2WBPdHU3NtSiDUA+ pYCxoWSKHZAvreZVsFD1AU7H4C4j389PxisokF4SSRNghxaISM725XSku7Fz3Zf7NG2P /9lw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o6-20020a17090611c600b008c7986cbd76si27781336eja.745.2023.03.28.03.05.49; Tue, 28 Mar 2023 03:06:12 -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 S233009AbjC1Jue (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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761605554289122552?= X-GMAIL-MSGID: =?utf-8?q?1761605554289122552?= 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 Reviewed-by: Hans de Goede --- 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,