From patchwork Mon Jul 17 19:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmytro Maluka X-Patchwork-Id: 12168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1322783vqt; Mon, 17 Jul 2023 13:14:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlGSZ4kxCYnIRC657eQLPIYambNixg0Q5hMmIdDTqS8R68cPpT7Gc643Y2I+Pt1lHjZgcB81 X-Received: by 2002:a17:906:224b:b0:994:54af:e27d with SMTP id 11-20020a170906224b00b0099454afe27dmr8463303ejr.29.1689624858760; Mon, 17 Jul 2023 13:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689624858; cv=none; d=google.com; s=arc-20160816; b=T7Cni5Y6y7LvRyMlHLNJoNdz0ShVU8D+DPv9mOEBNgONB+P6CA84tY5DG8wAo+cmIa eTxBkyfkjFN+kRZKmf//AReWAzYfVPGyq0QGulA+5By+w/mGDS4SzN8WSAE0isO1PEk9 KWEa3Pl+PmxboWq9Fb+cFvznBlf+57/WzrjN1PDA15ZzKczFTzUun+lnzfcDo65k0Eqd Qi65tuPiBlAjMTWvzwwpqI6AFvlI4Y5iU+e/qmemnIdCAVwatfXvH7WQ55jAvMYLCS7E QcOW63KeDmBObC46CSWDJqnAHWBKKN1wa+yjyoj+0T/iUVzG3b43sa09rb2o8ZV3ZQ0e ZUjA== 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=JPjGa2gVly2nkBzUKiQge11g2a89IAwqmPmDHU14Mk0=; fh=1yAXhE4HpPWDUWqZ2ipyZ6AU48nt43DA/f7u2z0wBa8=; b=ekYqHvWFXyag/akvjb46C5NfeHxrCFu9CiFZMYwrufjoUeBAhsHKnDL42eVqeeUu5n ShKzoTG9fb9lJs46gxVALNrySvex4+DZREYL39IvQaf5MntKBaAjw478JOvPjboHKuDs rUBpDZFYj8mCfYqx0XWN+6t7FAGba6oJ+zsPJwhXLYQRYwSxjpmdLIm3C5DW6ez5P3tZ aEJsmI/R8iqNUy7WJBITMdgI2mhvc4k/nZ938r/0sqV/SbsH1n6twqfHbKDly0AkHU4v m6NYkGHRKc9fslww8t8aRU6ZifoBCoW549XIkVHav/b6uVwmw6pKcQhq7v5QOJtCMUhs 5E/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@semihalf.com header.s=google header.b=Wg3Y4Ifd; 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=semihalf.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a170906145500b00993860a6d36si106584ejc.374.2023.07.17.13.13.54; Mon, 17 Jul 2023 13:14:18 -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=@semihalf.com header.s=google header.b=Wg3Y4Ifd; 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=semihalf.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231296AbjGQTiV (ORCPT + 99 others); Mon, 17 Jul 2023 15:38:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230502AbjGQTiT (ORCPT ); Mon, 17 Jul 2023 15:38:19 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FF1B132 for ; Mon, 17 Jul 2023 12:38:18 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f95bf5c493so7763799e87.3 for ; Mon, 17 Jul 2023 12:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1689622696; x=1692214696; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JPjGa2gVly2nkBzUKiQge11g2a89IAwqmPmDHU14Mk0=; b=Wg3Y4IfdQPSIExSHgXxXdxlyE672ZA8B/KPe7TShBB7Ws8yniOaByJb9Fjbrth7Orv tBW3DPWjFS5zGWvza1YCnjaHbpHQ3F9PcOGM5PdDZ2bbIUqpPQqF73a4N5B0st8dUV9P AGldt+FdqHC5/bgc2IH1WUsnGjAHwO4P3d+adq4F95nQuDVdl1gvcz3iaWTnZUJ/nBtJ tnTWd7VXcwrwKYKGv63ovyfxfojMlO9Xa2m8IcFo0wTQvLYlBj0jaHAu/dl9yJ0ONpgA NAgpkh6w0k11/sxIVsdSVAMkUlYXz92yDVtyjUnEbAlIE0lC/Y/XyrQPQ7b4SL33pGyO bBkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689622696; x=1692214696; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JPjGa2gVly2nkBzUKiQge11g2a89IAwqmPmDHU14Mk0=; b=Am9o3jnb8LTrzfUvPSGtkzlmBwH4clMbBl0Wnmb6Rzt3Fwg9PzlxpsgV8gim1JkVfY 5dG8BJFnQ3nv0tf08CqK3cCIwjLIKkZiaaORc7OD06hY3/czTp0ztC5AfRGZJkAS7mEK nRzuaUKmnsu5iDYUQXdbw0aGfk/J/Ex/keAFoqqS0dZ2Yp1ZQoFNY1pECK6hNzWlwp+v Qz2e13jk2HEsqoSfdBhIZoBoSGBDZTsT/y5f6cj4Dz6tT8N1fsFOFdL1TdtXBDPTr2bb ORa9f2HCWN0NrboWm1eQm22HgOq964zjpojArA/j98Op1z1MCxiSWUvZuLQEV9kYODza DbTA== X-Gm-Message-State: ABy/qLZWFOrcGHWEkmM4QQe/rng8ne5IUtgu+vxwopKgkxddiloPXMOm BfyDgGEIHT0uAGdGWVLZXPNEui6qXYnEkpnm2VE= X-Received: by 2002:a05:6512:28c:b0:4f8:714e:27a8 with SMTP id j12-20020a056512028c00b004f8714e27a8mr8300437lfp.0.1689622696220; Mon, 17 Jul 2023 12:38:16 -0700 (PDT) Received: from dmaluka.office.semihalf.net ([83.142.187.84]) by smtp.gmail.com with ESMTPSA id e5-20020ac25465000000b004fb75943ab3sm53124lfn.258.2023.07.17.12.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 12:38:15 -0700 (PDT) From: Dmytro Maluka To: Support Opensource , DLG Support Opensource , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Dmytro Maluka Subject: [PATCH 0/2] ASoC: da7219: Patches related to a spurious AAD IRQ issue Date: Mon, 17 Jul 2023 21:37:35 +0200 Message-ID: <20230717193737.161784-1-dmy@semihalf.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: INBOX X-GMAIL-THRID: 1771700076022992600 X-GMAIL-MSGID: 1771700076022992600 This series includes 2 patches related to (but not fixing) the following I2C failure which occurs sometimes during system suspend or resume and indicates a problem with a spurious DA7219 interrupt: [ 355.876211] i2c_designware i2c_designware.3: Transfer while suspended [ 355.876245] WARNING: CPU: 2 PID: 3576 at drivers/i2c/busses/i2c-designware-master.c:570 i2c_dw_xfer+0x411/0x440 ... [ 355.876462] Call Trace: [ 355.876468] [ 355.876475] ? update_load_avg+0x1b3/0x615 [ 355.876484] __i2c_transfer+0x101/0x1d8 [ 355.876494] i2c_transfer+0x74/0x10d [ 355.876504] regmap_i2c_read+0x6a/0x9c [ 355.876513] _regmap_raw_read+0x179/0x223 [ 355.876521] regmap_raw_read+0x1e1/0x28e [ 355.876527] regmap_bulk_read+0x17d/0x1ba [ 355.876532] ? __wake_up+0xed/0x1bb [ 355.876542] da7219_aad_irq_thread+0x54/0x2c9 [snd_soc_da7219 5fb8ebb2179cf2fea29af090f3145d68ed8e2184] [ 355.876556] irq_thread+0x13c/0x231 [ 355.876563] ? irq_forced_thread_fn+0x5f/0x5f [ 355.876570] ? irq_thread_fn+0x4d/0x4d [ 355.876576] kthread+0x13a/0x152 [ 355.876581] ? synchronize_irq+0xc3/0xc3 [ 355.876587] ? kthread_blkcg+0x31/0x31 [ 355.876592] ret_from_fork+0x1f/0x30 [ 355.876601] This log shows that DA7219 AAD interrupt handler da7219_aad_irq_thread() is unexpectedly running when DA7219 is suspended and should not generate interrupts. As a result, the IRQ handler is trying to read AAD IRQ event status over I2C and is hitting the I2C driver "Transfer while suspended" failure. Patch #1 adds synchronize_irq() when suspending DA7219, to prevent the IRQ handler from running after suspending if there is a pending IRQ generated before suspending. With this patch the above failure is still reproducible, so this patch does not fix any real observed issue so far, but at least is useful for confirming that the above issue is not caused by a pending IRQ but rather looks like a DA7219 hardware issue with an unexpectedly generated IRQ. Patch #2 does not fix the above issue either, but it prevents its potentially harmful side effects. With the existing code, if the issue occurs and the IRQ handler fails to read the AAD IRQ events status over I2C, it does not check that and tries to use the garbage uninitialized value of the events status, potentially reporting bogus events. This patch fixes that by adding missing error checking. In fact I'm sending these patches not only to submit them for review but also to ask Renesas folks for any hints on a possible cause of the described DA7219 issue (AAD interrupts spuriously firing after jack detection is already disabled) or how to debug it further. Dmytro Maluka (2): ASoC: da7219: Flush pending AAD IRQ when suspending ASoC: da7219: Check for failure reading AAD IRQ events sound/soc/codecs/da7219-aad.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c