From patchwork Thu Jun 9 13:35:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B6C1C43334 for ; Thu, 9 Jun 2022 13:37:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7A394189E; Thu, 9 Jun 2022 15:36:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7A394189E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781832; bh=8HJcIravgrWc+gp3rtvSdU0B38FZF2WwoFaIgFk2ZtI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=h5mVq8mIWPXVFtAWLRmcu/jonSmm3YZ0s3eMwxOvm59iZDh2n0+ykv4/7gcnpLvjy DOyBEefxVlH3fMXqHMWKDjS+YjlXqvDoM4hZdySYSSRpib8OZQuyJeTGPFQu344uvx +4zLRZWeup740BIxcAP5Az6tI2zMiKmh+wCrkAas= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CCBCCF804BD; Thu, 9 Jun 2022 15:35:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 81EA6F804BD; Thu, 9 Jun 2022 15:35:51 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id DD30AF800E9 for ; Thu, 9 Jun 2022 15:35:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DD30AF800E9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q0CUht9t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781746; x=1686317746; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8HJcIravgrWc+gp3rtvSdU0B38FZF2WwoFaIgFk2ZtI=; b=Q0CUht9t5htFHo60YaCE5Imo0XZSYrwgpSKTXsZm3h3HpBYmn/ZQxAC3 e4j7yjTohflodFNtjQz/t8ZK8p/UIfsk9GD4qTCfISdpF7zuuf5W/Tsni NFlVKE2kZJ7dyOr2fgmA9Q9laGiKoB7+7G+8nQWVf7dTfO7fPxUN3ILts KISV121YsAwharvWr9M+gGv4MXHwxhBbUlNYrVYRFAA7gMq2G/T6DFtHz VQD9VTME2csYvOEJpW33MevJ83mJHpOaq4xcBWSFtBZkA3R1z2JGdh+X3 Tv/7nfdWQ/iFLMi5m8KSEwg49JiFOECPX6dsoW0cdo8E63d06a/AoL9VT w==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061384" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061384" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966134" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:40 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 01/11] ASoC: codecs: rt274: Always init jack_detect_work Date: Thu, 9 Jun 2022 15:35:31 +0200 Message-Id: <20220609133541.3984886-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Cezary Rojewski Improves readability by making sure the work is always initialized. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/codecs/rt274.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index ab093bdb5552..a5615e94ec7d 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -980,14 +980,11 @@ static int rt274_probe(struct snd_soc_component *component) struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); rt274->component = component; + INIT_DELAYED_WORK(&rt274->jack_detect_work, rt274_jack_detect_work); - if (rt274->i2c->irq) { - INIT_DELAYED_WORK(&rt274->jack_detect_work, - rt274_jack_detect_work); + if (rt274->i2c->irq) schedule_delayed_work(&rt274->jack_detect_work, - msecs_to_jiffies(1250)); - } - + msecs_to_jiffies(1250)); return 0; } From patchwork Thu Jun 9 13:35:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A9C4C433EF for ; Thu, 9 Jun 2022 13:37:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 564401AA0; Thu, 9 Jun 2022 15:36:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 564401AA0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781851; bh=6IST5ir4l2I4tycvBS6qrHv0bIV/cPWBWi5cIKlB+Pw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CojjNm+nujPoNDhOx6cyDyJtzIZHiQn6+VdFSTsxYEChELIhf3cOSSOTefWTuGt15 3mCgryPza3HqHjVmBujMYp6xYhY6IEndOnKk2f6oYR/7i4WiXj7jVPwxDeUNFFX8wK KaRNqp99ItHcmTyrkTmeFLYkdKEdcfA2AHrll1rU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BAF12F80527; Thu, 9 Jun 2022 15:35:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1A5ABF80528; Thu, 9 Jun 2022 15:35:53 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D0BD3F8019D for ; Thu, 9 Jun 2022 15:35:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D0BD3F8019D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Jwc07nsU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781747; x=1686317747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6IST5ir4l2I4tycvBS6qrHv0bIV/cPWBWi5cIKlB+Pw=; b=Jwc07nsUuRYLvvaG5d1YXdI5+GgPUTpV5agXHqvX1C1nJEQY78b7aedg xKjiBwrDsp/aMinn08k+yG8I8M/W6islqPZLAM3uiWlpUY/o2t4kmi9VZ nybPJx/ARuEOrXsaD4uGLy6xzXqmoS5/i87HLaTQAeSqZORIOdIbkwfpx zGRfW+2lpV+yl36oxaVOHnh3z5Xzn/X7EP5L+BXVNrmjqKXYinxUmvrQ0 Hg2zkbiK54pmOIMSTdsFK1IXHqq5aio76TBpYkyIx3AsYSt7Thh3esdgW Kq8Hn5q5mEUEszpJhmn11HSGdYUbpspjkUOILER8iHcyPTWSI00zxR1OE Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061388" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061388" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966148" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:42 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 02/11] ASoC: codecs: rt286: Reorganize jack detect handling Date: Thu, 9 Jun 2022 15:35:32 +0200 Message-Id: <20220609133541.3984886-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Cezary Rojewski Clean up in order to use and expose .set_jack callback. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/codecs/rt286.c | 17 ++++++----------- sound/soc/codecs/rt286.h | 2 -- sound/soc/intel/boards/broadwell.c | 6 +++--- sound/soc/intel/boards/skl_rt286.c | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index ad8ea1fa7c23..0534a073ee69 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -311,7 +311,8 @@ static void rt286_jack_detect_work(struct work_struct *work) SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); } -int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack) +static int rt286_mic_detect(struct snd_soc_component *component, + struct snd_soc_jack *jack, void *data) { struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); @@ -335,7 +336,6 @@ int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j return 0; } -EXPORT_SYMBOL_GPL(rt286_mic_detect); static int is_mclk_mode(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink) @@ -947,17 +947,11 @@ static int rt286_probe(struct snd_soc_component *component) struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); rt286->component = component; + INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work); - if (rt286->i2c->irq) { - regmap_update_bits(rt286->regmap, - RT286_IRQ_CTRL, 0x2, 0x2); - - INIT_DELAYED_WORK(&rt286->jack_detect_work, - rt286_jack_detect_work); + if (rt286->i2c->irq) schedule_delayed_work(&rt286->jack_detect_work, - msecs_to_jiffies(1250)); - } - + msecs_to_jiffies(50)); return 0; } @@ -1055,6 +1049,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt286 = { .suspend = rt286_suspend, .resume = rt286_resume, .set_bias_level = rt286_set_bias_level, + .set_jack = rt286_mic_detect, .controls = rt286_snd_controls, .num_controls = ARRAY_SIZE(rt286_snd_controls), .dapm_widgets = rt286_dapm_widgets, diff --git a/sound/soc/codecs/rt286.h b/sound/soc/codecs/rt286.h index f27a4e71d5b6..4b7a3bd6043d 100644 --- a/sound/soc/codecs/rt286.h +++ b/sound/soc/codecs/rt286.h @@ -196,7 +196,5 @@ enum { RT286_AIFS, }; -int rt286_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack); - #endif /* __RT286_H__ */ diff --git a/sound/soc/intel/boards/broadwell.c b/sound/soc/intel/boards/broadwell.c index b29d77dfb281..48bf3241b3e6 100644 --- a/sound/soc/intel/boards/broadwell.c +++ b/sound/soc/intel/boards/broadwell.c @@ -75,7 +75,7 @@ static int broadwell_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - rt286_mic_detect(component, &broadwell_headset); + snd_soc_component_set_jack(component, &broadwell_headset, NULL); return 0; } @@ -235,7 +235,7 @@ static void broadwell_disable_jack(struct snd_soc_card *card) if (!strcmp(component->name, "i2c-INT343A:00")) { dev_dbg(component->dev, "disabling jack detect before going to suspend.\n"); - rt286_mic_detect(component, NULL); + snd_soc_component_set_jack(component, NULL, NULL); break; } } @@ -255,7 +255,7 @@ static int broadwell_resume(struct snd_soc_card *card){ if (!strcmp(component->name, "i2c-INT343A:00")) { dev_dbg(component->dev, "enabling jack detect for resume.\n"); - rt286_mic_detect(component, &broadwell_headset); + snd_soc_component_set_jack(component, &broadwell_headset, NULL); break; } } diff --git a/sound/soc/intel/boards/skl_rt286.c b/sound/soc/intel/boards/skl_rt286.c index e9f9520dcea4..4f3d655e2bfa 100644 --- a/sound/soc/intel/boards/skl_rt286.c +++ b/sound/soc/intel/boards/skl_rt286.c @@ -133,7 +133,7 @@ static int skylake_rt286_codec_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - rt286_mic_detect(component, &skylake_headset); + snd_soc_component_set_jack(component, &skylake_headset, NULL); snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); From patchwork Thu Jun 9 13:35:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC2A8C43334 for ; Thu, 9 Jun 2022 13:37:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 150531AC9; Thu, 9 Jun 2022 15:36:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 150531AC9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781862; bh=bDAlvYHEeUUAeWe8+rnRMO2QQto1n8rp+2xEHobkNOQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T7RrMt/GnVYKXaj6zSlz+NggcURZVuRAn3Zqd7LiFFDuOmtseoaZcPcTqqQPX8a8g svJvugm+W1OTZsl6UJhI2RWYGomYk1Fr1yaxF2bneb7qNOuCPatR1L5EBAsIvLxycu 74Jn3rpgM5/6TxKBPk0YFXxDks9GRJNm7QSm20kQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31E98F80537; Thu, 9 Jun 2022 15:35:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B0722F8052D; Thu, 9 Jun 2022 15:35:54 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0BEC6F800C7 for ; Thu, 9 Jun 2022 15:35:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0BEC6F800C7 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mTnhd/RD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781748; x=1686317748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bDAlvYHEeUUAeWe8+rnRMO2QQto1n8rp+2xEHobkNOQ=; b=mTnhd/RDWufWyWsgGAWEaMJBqDZuUE0SmpXwnXqRNg5OaLE7MS5oO++O eQYxbyd1sNar9s3A+GWjO0hIvMiZCmsYNeHUkUeEFQrgX/Ew/47Y6T9ZB Yzr3dhlvgD/SmdFoCAHUCdHT6R0txGYOCn5R6yF0lCHa+4pM5UJ+/VuAr 40wv2Li2SLbQMkEHXtXgrMt8XbB4qAQs81HDbxHJamyhfoaSw1Y6LBN6n O89Dw0oJ9Idw2wr47QMqxOCKlUEvrASdiTX9O5Rmg0B3bKSiKlwS7CaQY ZSAItARIIPgtxuusnTt/aRl7GNAiAaEs4fgHSS6dJp9fBAyl9VEHULOVc Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061392" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061392" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966151" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:44 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 03/11] ASoC: codecs: rt298: Reorganize jack detect handling Date: Thu, 9 Jun 2022 15:35:33 +0200 Message-Id: <20220609133541.3984886-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Cezary Rojewski Clean up in order to use and expose .set_jack callback. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/codecs/rt298.c | 17 ++++++----------- sound/soc/codecs/rt298.h | 2 -- sound/soc/intel/boards/bxt_rt298.c | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index c291786dc82d..1a27e5e63289 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -326,7 +326,8 @@ static void rt298_jack_detect_work(struct work_struct *work) SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); } -int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack) +static int rt298_mic_detect(struct snd_soc_component *component, + struct snd_soc_jack *jack, void *data) { struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); struct snd_soc_dapm_context *dapm; @@ -358,7 +359,6 @@ int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *j return 0; } -EXPORT_SYMBOL_GPL(rt298_mic_detect); static int is_mclk_mode(struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink) @@ -1011,17 +1011,11 @@ static int rt298_probe(struct snd_soc_component *component) struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); rt298->component = component; + INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work); - if (rt298->i2c->irq) { - regmap_update_bits(rt298->regmap, - RT298_IRQ_CTRL, 0x2, 0x2); - - INIT_DELAYED_WORK(&rt298->jack_detect_work, - rt298_jack_detect_work); + if (rt298->i2c->irq) schedule_delayed_work(&rt298->jack_detect_work, - msecs_to_jiffies(1250)); - } - + msecs_to_jiffies(1250)); return 0; } @@ -1120,6 +1114,7 @@ static const struct snd_soc_component_driver soc_component_dev_rt298 = { .suspend = rt298_suspend, .resume = rt298_resume, .set_bias_level = rt298_set_bias_level, + .set_jack = rt298_mic_detect, .controls = rt298_snd_controls, .num_controls = ARRAY_SIZE(rt298_snd_controls), .dapm_widgets = rt298_dapm_widgets, diff --git a/sound/soc/codecs/rt298.h b/sound/soc/codecs/rt298.h index ed2b8fd87f4c..f1be9c135401 100644 --- a/sound/soc/codecs/rt298.h +++ b/sound/soc/codecs/rt298.h @@ -207,7 +207,5 @@ enum { RT298_AIFS, }; -int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack); - #endif /* __RT298_H__ */ diff --git a/sound/soc/intel/boards/bxt_rt298.c b/sound/soc/intel/boards/bxt_rt298.c index 75995d17597d..4bd93c3ba377 100644 --- a/sound/soc/intel/boards/bxt_rt298.c +++ b/sound/soc/intel/boards/bxt_rt298.c @@ -176,7 +176,7 @@ static int broxton_rt298_codec_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - rt298_mic_detect(component, &broxton_headset); + snd_soc_component_set_jack(component, &broxton_headset, NULL); snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); From patchwork Thu Jun 9 13:35:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580348 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44D23C433EF for ; Thu, 9 Jun 2022 13:37:59 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 75CF41A99; Thu, 9 Jun 2022 15:37:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 75CF41A99 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781877; bh=LdtGmqYHx6gWjJZNFLVe4g7UugnDo1JHioUOoTNWkAI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=F7rvcNAVWIxlAZeVbUDY5MuvGTYnRV3798IwbgCBDJH7a5zXAMbw/tuKh0oEd1XQ/ pRTm1eSI5xJsoeB6UxAnowfCUsV2aUHZJ5NIrkq7Fb9RzZ+M1kimuBNkPAujF+Yy8Z PvyWizLiQeYZxpMrKTnYeD9jEnFoAodLfGRdheD8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DBFD1F80538; Thu, 9 Jun 2022 15:35:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8510AF80538; Thu, 9 Jun 2022 15:35:56 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2D8B5F8051E for ; Thu, 9 Jun 2022 15:35:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2D8B5F8051E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kG9CEOlX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781751; x=1686317751; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LdtGmqYHx6gWjJZNFLVe4g7UugnDo1JHioUOoTNWkAI=; b=kG9CEOlXCopFOJvHUNpzaISJTQBox0jd3PHhQM48cFE4Iargw4zeezQV 05VTIKlx+2GAUZ7ah3YHevu7Xxbu5WKYgdNpLMa4PArXo3LdVXdrhJsMz CpIiaSe11mTEDqjsCPUzexldGmvrQEz+tSc84zHCInYzi3j+RU/bFb57T rbmZg0qMxG61BSSSefRQ8sJdZ5EaG4q6aD0PZ9H4iqZS3tJyuFluMgGpC AbL8POGo/8euuOkpCuE6canF5b6YfqK/Q3Z6ls7v9aTOgOFCsnUdSgolS L6mYhmM+XiJrWUP5/snxjdekGKUL+vQF8TL6ppT2F5YcJyR20b9+oCkVT g==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061396" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061396" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966156" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:46 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 04/11] ASoC: codecs: rt274: Move irq registration and cleanup Date: Thu, 9 Jun 2022 15:35:34 +0200 Message-Id: <20220609133541.3984886-5-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Currently irq is registered when i2c driver is loaded, it is unnecessary when component is unused. Initialize irq only when we probe ASoC component. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt274.c | 44 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index a5615e94ec7d..144a6f775c21 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -978,13 +978,22 @@ static irqreturn_t rt274_irq(int irq, void *data) static int rt274_probe(struct snd_soc_component *component) { struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); + int ret; rt274->component = component; INIT_DELAYED_WORK(&rt274->jack_detect_work, rt274_jack_detect_work); - if (rt274->i2c->irq) - schedule_delayed_work(&rt274->jack_detect_work, - msecs_to_jiffies(1250)); + if (rt274->i2c->irq) { + ret = request_threaded_irq(rt274->i2c->irq, NULL, rt274_irq, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt274", rt274); + if (ret) { + dev_err(&rt274->i2c->dev, "Failed to reguest IRQ: %d\n", ret); + return ret; + } + + schedule_delayed_work(&rt274->jack_detect_work, msecs_to_jiffies(1250)); + } + return 0; } @@ -992,7 +1001,12 @@ static void rt274_remove(struct snd_soc_component *component) { struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); - cancel_delayed_work_sync(&rt274->jack_detect_work); + if (rt274->i2c->irq) { + cancel_delayed_work_sync(&rt274->jack_detect_work); + + disable_irq(rt274->i2c->irq); + free_irq(rt274->i2c->irq, rt274); + } } #ifdef CONFIG_PM @@ -1187,16 +1201,6 @@ static int rt274_i2c_probe(struct i2c_client *i2c) regmap_write(rt274->regmap, RT274_UNSOLICITED_HP_OUT, 0x81); regmap_write(rt274->regmap, RT274_UNSOLICITED_MIC, 0x82); - if (rt274->i2c->irq) { - ret = request_threaded_irq(rt274->i2c->irq, NULL, rt274_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt274", rt274); - if (ret != 0) { - dev_err(&i2c->dev, - "Failed to reguest IRQ: %d\n", ret); - return ret; - } - } - ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_rt274, rt274_dai, ARRAY_SIZE(rt274_dai)); @@ -1204,17 +1208,6 @@ static int rt274_i2c_probe(struct i2c_client *i2c) return ret; } -static int rt274_i2c_remove(struct i2c_client *i2c) -{ - struct rt274_priv *rt274 = i2c_get_clientdata(i2c); - - if (i2c->irq) - free_irq(i2c->irq, rt274); - - return 0; -} - - static struct i2c_driver rt274_i2c_driver = { .driver = { .name = "rt274", @@ -1224,7 +1217,6 @@ static struct i2c_driver rt274_i2c_driver = { #endif }, .probe_new = rt274_i2c_probe, - .remove = rt274_i2c_remove, .id_table = rt274_i2c_id, }; From patchwork Thu Jun 9 13:35:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A32C5C43334 for ; Thu, 9 Jun 2022 13:38:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id DC1D91ABE; Thu, 9 Jun 2022 15:37:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DC1D91ABE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781901; bh=eArE8WoqidIymkaFaEff+cQsFtCZvNeJ0MK1qIZTf4U=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KIYpluYyh3dk2HPXZ56ZS8nX+ZU79BLxK8lzwbvBdr4HI0AVyVpa7Rz28+CIWQMRl XLTPeHsvgtv3FOkL72NrpY30T4qg3tOkbI0eE9AYcSmoINkdJG3Azyk/r6020NIs/3 yrJWRaKXAsNkCdzEr9nwj9Zy4l5s81SCs1N/AtRk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C5272F8053A; Thu, 9 Jun 2022 15:36:00 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3FA05F80538; Thu, 9 Jun 2022 15:35:58 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EC212F800E9 for ; Thu, 9 Jun 2022 15:35:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EC212F800E9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HXCMMEXJ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781752; x=1686317752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eArE8WoqidIymkaFaEff+cQsFtCZvNeJ0MK1qIZTf4U=; b=HXCMMEXJ4lt9XHNzmm4DJf9s/jDrdVJZsNDDcCQZLJBVJLgxIVef/wME ghFe2TOpbGAp0sFw5k+e1ZqvBgOvRa0nX5JzXYnE01W8p1iB4XESWpycg 6Zw97VSltdwLyO75k7316BiL0ma6kS3WdDIEK4pcVg4rJJcUCxJaCHNcv rcUelHCmGb6EeB02CmdYCIzR0ZbxlJ0wMgbalfIArgD6JQFKn9Wr+kf// v8iDchf//Kn5xAH/q/a3wTCqvVfP4gR6RSv9/AnOKgmSX4vIrHurfbNL2 E+uFH7MoxMhgMdjbkfw/ZyBqiGFEsIrB1enk/YhH34BNmLinv6MpS5TTw g==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061400" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061400" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966159" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:48 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 05/11] ASoC: codecs: rt286: Move irq registration and cleanup Date: Thu, 9 Jun 2022 15:35:35 +0200 Message-Id: <20220609133541.3984886-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Currently irq is registered when i2c driver is loaded, it is unnecessary when component is unused. Initialize irq only when we probe ASoC component. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt286.c | 44 ++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 0534a073ee69..02a41c915776 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -945,13 +945,22 @@ static irqreturn_t rt286_irq(int irq, void *data) static int rt286_probe(struct snd_soc_component *component) { struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); + int ret; rt286->component = component; INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work); - if (rt286->i2c->irq) - schedule_delayed_work(&rt286->jack_detect_work, - msecs_to_jiffies(50)); + if (rt286->i2c->irq) { + ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); + if (ret) { + dev_err(&rt286->i2c->dev, "Failed to reguest IRQ: %d\n", ret); + return ret; + } + + schedule_delayed_work(&rt286->jack_detect_work, msecs_to_jiffies(50)); + } + return 0; } @@ -959,7 +968,12 @@ static void rt286_remove(struct snd_soc_component *component) { struct rt286_priv *rt286 = snd_soc_component_get_drvdata(component); - cancel_delayed_work_sync(&rt286->jack_detect_work); + if (rt286->i2c->irq) { + cancel_delayed_work_sync(&rt286->jack_detect_work); + + disable_irq(rt286->i2c->irq); + free_irq(rt286->i2c->irq, rt286); + } } #ifdef CONFIG_PM @@ -1232,16 +1246,6 @@ static int rt286_i2c_probe(struct i2c_client *i2c) RT286_GPIO_CTRL, 0xc, 0x8); } - if (rt286->i2c->irq) { - ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); - if (ret != 0) { - dev_err(&i2c->dev, - "Failed to reguest IRQ: %d\n", ret); - return ret; - } - } - ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_rt286, rt286_dai, ARRAY_SIZE(rt286_dai)); @@ -1249,24 +1253,12 @@ static int rt286_i2c_probe(struct i2c_client *i2c) return ret; } -static int rt286_i2c_remove(struct i2c_client *i2c) -{ - struct rt286_priv *rt286 = i2c_get_clientdata(i2c); - - if (i2c->irq) - free_irq(i2c->irq, rt286); - - return 0; -} - - static struct i2c_driver rt286_i2c_driver = { .driver = { .name = "rt286", .acpi_match_table = ACPI_PTR(rt286_acpi_match), }, .probe_new = rt286_i2c_probe, - .remove = rt286_i2c_remove, .id_table = rt286_i2c_id, }; From patchwork Thu Jun 9 13:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88000C433EF for ; Thu, 9 Jun 2022 13:38:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CA3871AF2; Thu, 9 Jun 2022 15:37:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CA3871AF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781923; bh=ifemrvuZbS2YcJbpDgxIZ0DM/6fgabIxhHx+XsW3DzI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=G2wFfqDvjhmwbJQnT+zdplpItQBokChliYwn6TTpprQTgLbSbWnjDbZPGhMtRK9Gu 7DWAPd+d1mZbaU+sJUc9pnDdaLygD3qH4uGZuXf8+XF79uSoP5XO9sRABhisc0T6MI vc5QZVkVb+gkfC4qchIkkI3cj/7H+yzagwrsIMC4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3659FF80551; Thu, 9 Jun 2022 15:36:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1264FF8053D; Thu, 9 Jun 2022 15:36:00 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 03D2DF8019D for ; Thu, 9 Jun 2022 15:35:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 03D2DF8019D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JpTCk0qO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781754; x=1686317754; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ifemrvuZbS2YcJbpDgxIZ0DM/6fgabIxhHx+XsW3DzI=; b=JpTCk0qO916h8+T070XkkAIABTokmOh1UAeFrXNBgMWAqba/v4ktA6Th Cvb/T+0OAdXpWtmN3LxwoVoe5QFGEJlcoHl8rVJBhzp3VeotfamVzjsxD oRvVTgfoWDtkGn4YsjFVl2T98ovye4KkAHbe/mOP5ClmO8AVpzkt2y8pQ K9cSixzfSL6Zv+ol1xLH4WyjBrcZ7v24q6btHqEzRMT6rJTKa7Q0YmVtb MYOxlU3HHrkGxP4t37y0vwdJGacGgWkrfcA1tO9GqJdoMphrQIM8WUB70 HFYNf5r2gOIAxdcDKzvVAU53iGDbluiE7pHdsfeST4zvj1QFeEeaL12xi A==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061405" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061405" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966163" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:50 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 06/11] ASoC: codecs: rt298: Move irq registration and cleanup Date: Thu, 9 Jun 2022 15:35:36 +0200 Message-Id: <20220609133541.3984886-7-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Currently irq is registered when i2c driver is loaded, it is unnecessary when component is unused. Initialize irq only when we probe ASoC component. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 43 +++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 1a27e5e63289..078810f2ec7b 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -1009,13 +1009,22 @@ static irqreturn_t rt298_irq(int irq, void *data) static int rt298_probe(struct snd_soc_component *component) { struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); + int ret; rt298->component = component; INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work); - if (rt298->i2c->irq) - schedule_delayed_work(&rt298->jack_detect_work, - msecs_to_jiffies(1250)); + if (rt298->i2c->irq) { + ret = request_threaded_irq(rt298->i2c->irq, NULL, rt298_irq, + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt298", rt298); + if (ret) { + dev_err(&rt298->i2c->dev, "Failed to reguest IRQ: %d\n", ret); + return ret; + } + + schedule_delayed_work(&rt298->jack_detect_work, msecs_to_jiffies(1250)); + } + return 0; } @@ -1023,7 +1032,12 @@ static void rt298_remove(struct snd_soc_component *component) { struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); - cancel_delayed_work_sync(&rt298->jack_detect_work); + if (rt298->i2c->irq) { + cancel_delayed_work_sync(&rt298->jack_detect_work); + + disable_irq(rt298->i2c->irq); + free_irq(rt298->i2c->irq, rt298); + } } #ifdef CONFIG_PM @@ -1275,16 +1289,6 @@ static int rt298_i2c_probe(struct i2c_client *i2c) rt298->is_hp_in = -1; - if (rt298->i2c->irq) { - ret = request_threaded_irq(rt298->i2c->irq, NULL, rt298_irq, - IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt298", rt298); - if (ret != 0) { - dev_err(&i2c->dev, - "Failed to reguest IRQ: %d\n", ret); - return ret; - } - } - ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_rt298, rt298_dai, ARRAY_SIZE(rt298_dai)); @@ -1292,17 +1296,6 @@ static int rt298_i2c_probe(struct i2c_client *i2c) return ret; } -static int rt298_i2c_remove(struct i2c_client *i2c) -{ - struct rt298_priv *rt298 = i2c_get_clientdata(i2c); - - if (i2c->irq) - free_irq(i2c->irq, rt298); - - return 0; -} - - static struct i2c_driver rt298_i2c_driver = { .driver = { .name = "rt298", From patchwork Thu Jun 9 13:35:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6A923C43334 for ; Thu, 9 Jun 2022 13:38:33 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BAF691ABD; Thu, 9 Jun 2022 15:37:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BAF691ABD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781911; bh=Hc9vYKiIGg8Ubnaqos4pEjT2Ox9V/D6S5DeOypIXjEk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KPy+gpoO+bHF14Fiv+ErOOiOkMnwHsm8SDl038TfprbiztQ9+bcpItw8v4HYL5la4 69kUnmyBgNfj+SGhtyHbX9eItqI9QSqSjypp/G/2Xj7/ApPPlLQCIbLNYLM1LoR3ek W7z1yMen0K4MPMMbdGxzQ9WT+jEuML84ogaIInSU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 95994F80544; Thu, 9 Jun 2022 15:36:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8B04BF8053B; Thu, 9 Jun 2022 15:35:58 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 01A4CF80535 for ; Thu, 9 Jun 2022 15:35:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 01A4CF80535 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fd9jJ87M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781756; x=1686317756; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Hc9vYKiIGg8Ubnaqos4pEjT2Ox9V/D6S5DeOypIXjEk=; b=fd9jJ87MvHNR2pg12HHOalbIZJd29IU3G9YPDWNcbxFCG0+AjhTYwOJ/ mp0IVBertuvkqhI90f3QNfOTIzWAGAb/vthX6v3ZH/cfu6FMgN4sOTQck mMQwGxB+WOGXKpFCOuASLRkaY/ubw+dhanzNi04n238e3HHrew4FnlW1u zPDMKi+MN/myuiECbbmHVDlfWi1WjShjOFauKqORtCYU5zODlO/QivODz N3thddmvNUGbC15ej0i1vdErU6bMqQ/zqfxHNvWDjcaQAlenCHgQez/MP +7/wLwg9J3KSa5FzDWT1owXdsVmyiyj4+3xsp0jQZLtrmXZ1WaACfZUIp A==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061409" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061409" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966167" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:52 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 07/11] ASoC: codecs: rt274: Enable irq only when needed Date: Thu, 9 Jun 2022 15:35:37 +0200 Message-Id: <20220609133541.3984886-8-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Interrupt is only needed when jack detection is enabled, so enable it then, similarly disable it when jack detection is being disabled. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt274.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c index 144a6f775c21..730de9452333 100644 --- a/sound/soc/codecs/rt274.c +++ b/sound/soc/codecs/rt274.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -395,28 +396,42 @@ static void rt274_jack_detect_work(struct work_struct *work) SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); } -static irqreturn_t rt274_irq(int irq, void *data); - static int rt274_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data) { struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component); + bool mic = false; + bool hp = false; + int status = 0; + int ret; rt274->jack = jack; if (jack == NULL) { /* Disable jack detection */ + disable_irq(rt274->i2c->irq); regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, RT274_IRQ_EN, RT274_IRQ_DIS); return 0; } + /* Enable jack detection */ regmap_update_bits(rt274->regmap, RT274_EAPD_GPIO_IRQ_CTRL, RT274_IRQ_EN, RT274_IRQ_EN); + enable_irq(rt274->i2c->irq); /* Send an initial report */ - rt274_irq(0, rt274); + ret = rt274_jack_detect(rt274, &hp, &mic); + if (!ret) { + if (hp) + status |= SND_JACK_HEADPHONE; + + if (mic) + status |= SND_JACK_MICROPHONE; + + snd_soc_jack_report(rt274->jack, status, SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + } return 0; } @@ -984,6 +999,9 @@ static int rt274_probe(struct snd_soc_component *component) INIT_DELAYED_WORK(&rt274->jack_detect_work, rt274_jack_detect_work); if (rt274->i2c->irq) { + /* irq will be enabled in rt274_mic_detect */ + irq_set_status_flags(rt274->i2c->irq, IRQ_NOAUTOEN); + ret = request_threaded_irq(rt274->i2c->irq, NULL, rt274_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt274", rt274); if (ret) { From patchwork Thu Jun 9 13:35:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580346 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0B864C43334 for ; Thu, 9 Jun 2022 13:39:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 4CE1D1ADD; Thu, 9 Jun 2022 15:38:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4CE1D1ADD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781943; bh=poLrk9IFRHmbL3RulVGopYSkf6CWGhy+nxAHKExBmyo=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UUIORRS63ShzxQip1DhJwr3QBWh8MWFlG9u8RCqC5YbFJT/q0jxszZBIINiWQbo2v AxwzMv9T1Bm/+nd5S9jiNL5M7D+KDwtrgvWPO0+YudhZKgz80pmsItIxwxprXNwWee EeYsB4wXVjkHbJW3LdixoK9RwvgkJewXZDn4SaI4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 62D5EF80535; Thu, 9 Jun 2022 15:36:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9561F80542; Thu, 9 Jun 2022 15:36:00 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F408DF8053A for ; Thu, 9 Jun 2022 15:35:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F408DF8053A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SaOzQo5s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781758; x=1686317758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=poLrk9IFRHmbL3RulVGopYSkf6CWGhy+nxAHKExBmyo=; b=SaOzQo5s+iHOgNBewAe6XSmorhozSc91Xk9DTXiwgcJhp5tnPswINFZm YDpwgXik/IlkubknwKCjOmz9rAjYC/dxoWfKDfzSf13Q9QgBWWYZq1Zz4 fTL5Qv0ElV8FGAhYzOoMvNgLAf0YanChdRqQE6CB0mhUNQ3rqrNf43hb8 CK7+6qT8qK2wls3qGO1WSKH3JAd94O11NOylkdUodnrc4j6Xdm1j1TUSR X/US4V8UbwfVslmdpUck2wbI61ybypy0FbX5niFjgaTh3Sb2/GBRquh25 3U+jG9uAD4DGWAar94YDcA85T+vm80BPZWolV3p49fpMRt8jwNfhfIXgY Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061415" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061415" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966176" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:54 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 08/11] ASoC: codecs: rt286: Enable irq only when needed Date: Thu, 9 Jun 2022 15:35:38 +0200 Message-Id: <20220609133541.3984886-9-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Interrupt is only needed when jack detection is enabled, so enable it then, similarly disable it when jack detection is being disabled. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt286.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 02a41c915776..6384b4cb9eaf 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -324,11 +325,14 @@ static int rt286_mic_detect(struct snd_soc_component *component, if (rt286->jack->status & SND_JACK_HEADPHONE) snd_soc_dapm_force_enable_pin(dapm, "LDO1"); regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x2); + enable_irq(rt286->i2c->irq); + /* Send an initial empty report */ snd_soc_jack_report(rt286->jack, rt286->jack->status, SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); } else { /* disable IRQ */ + disable_irq(rt286->i2c->irq); regmap_update_bits(rt286->regmap, RT286_IRQ_CTRL, 0x2, 0x0); snd_soc_dapm_disable_pin(dapm, "LDO1"); } @@ -951,6 +955,9 @@ static int rt286_probe(struct snd_soc_component *component) INIT_DELAYED_WORK(&rt286->jack_detect_work, rt286_jack_detect_work); if (rt286->i2c->irq) { + /* irq will be enabled in rt286_mic_detect */ + irq_set_status_flags(rt286->i2c->irq, IRQ_NOAUTOEN); + ret = request_threaded_irq(rt286->i2c->irq, NULL, rt286_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt286", rt286); if (ret) { From patchwork Thu Jun 9 13:35:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 13EFCC433EF for ; Thu, 9 Jun 2022 13:39:27 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3DBC11B08; Thu, 9 Jun 2022 15:38:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3DBC11B08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781965; bh=OyfIkd1NAxDWdbHeK+79uCuF8wIkWKh2q8RH4+BP8Io=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kEK2jXPOl/6zSZUptpb3UdniXOYZi9DG61aUcNwfWr7I6/AInUCg1ZBc1GX5jXGBn lDU5esfPYQuM3JD+YIFgFQVm9fqhTsJz0ydpcNkggjpdXlhkZWtKYxw2mwuBqVU/1V fu6PMvDOFTQPT6413ZbUJEUa7QxvYBtriB8wxGVc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 90AD9F8056F; Thu, 9 Jun 2022 15:36:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 85B19F80557; Thu, 9 Jun 2022 15:36:02 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id EB6E7F80535 for ; Thu, 9 Jun 2022 15:35:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EB6E7F80535 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="cV6QsbmL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781760; x=1686317760; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OyfIkd1NAxDWdbHeK+79uCuF8wIkWKh2q8RH4+BP8Io=; b=cV6QsbmLglIiFNFDjcXqpgqfgE+ZYcAl5e8SN5PftS+izAdCsx0PMPXY uUHec4EgnuucJnoAt/CnIkQhmnk1iHMXBtGsvZzLFP/90uGw8ABtGD4iL 2yxqADlGjfocgM19dtOePdu8zKLZcvzoDa1/dPu29y9Q5R6lF5W3ERBlb TC31POdLVCtQf487TnoWO2t0Q3InLUJtctLwf2K4vYBeJ5ZafXskvXa3L Y/s4azRa1X3kyFrlrF1TJN/kZZTDt5NxfZf9pdITXCo7ZddpyQlhnil0l ongDMRTqg4oRzNg7CP5BRhqvlooWuBgjquu1EsYBuAnFOYpzPFKoonzWI g==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061418" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061418" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:35:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966187" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:56 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 09/11] ASoC: codecs: rt298: Enable irq only when needed Date: Thu, 9 Jun 2022 15:35:39 +0200 Message-Id: <20220609133541.3984886-10-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Interrupt is only needed when jack detection is enabled, so enable it then, similarly disable it when jack detection is being disabled. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 078810f2ec7b..3c13b6dc3be9 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -337,6 +338,7 @@ static int rt298_mic_detect(struct snd_soc_component *component, /* If jack in NULL, disable HS jack */ if (!jack) { + disable_irq(rt298->i2c->irq); regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); dapm = snd_soc_component_get_dapm(component); snd_soc_dapm_disable_pin(dapm, "LDO1"); @@ -346,6 +348,7 @@ static int rt298_mic_detect(struct snd_soc_component *component, rt298->jack = jack; regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); + enable_irq(rt298->i2c->irq); rt298_jack_detect(rt298, &hp, &mic); if (hp) @@ -1015,6 +1018,9 @@ static int rt298_probe(struct snd_soc_component *component) INIT_DELAYED_WORK(&rt298->jack_detect_work, rt298_jack_detect_work); if (rt298->i2c->irq) { + /* irq will be enabled in rt298_mic_detect */ + irq_set_status_flags(rt298->i2c->irq, IRQ_NOAUTOEN); + ret = request_threaded_irq(rt298->i2c->irq, NULL, rt298_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "rt298", rt298); if (ret) { From patchwork Thu Jun 9 13:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82943C43334 for ; Thu, 9 Jun 2022 13:39:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AF6351B0D; Thu, 9 Jun 2022 15:38:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AF6351B0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781975; bh=6aOI0YRpqazTRVptkQQ78+ACWgBkgm9pnoxIuuWsUDw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=vGyXz8/5Dfspth1tpMEhOMTELFIbH8Gd6C5L8rX7h6jAtlVetccCcn4G5Zj+e0Ppb ep+4wfp9XVi2We1EVMP6Oqh3uJIfWXJkafrKcbwp0L/nngHnkviaQbc0GdNRRxp2sA vIt+0dC+WZRqdrVBh5wPtTeeDzU0THD9q1GZWqkQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5B0A5F80570; Thu, 9 Jun 2022 15:36:09 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16082F80579; Thu, 9 Jun 2022 15:36:08 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B0B6BF80548 for ; Thu, 9 Jun 2022 15:36:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B0B6BF80548 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="BgQNDKap" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781761; x=1686317761; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6aOI0YRpqazTRVptkQQ78+ACWgBkgm9pnoxIuuWsUDw=; b=BgQNDKapLId2mSN2Fhh9CyeGBtbLg48yMGa/lrGIh+wXzHytIj3r8ANV WbtlNR4o6FqoU7Qicr3NtHuyAEw4dbJUr6vO9yZktsd5YpxoYuD11/sw8 cCqgb0UGHnIS6mhDD07rF1+aj77qoRUj3BMVbJrBYLgX3i2STYipsWRrC rd2xzEeEmeWOf151hl2CMBaEpvTQ3c6OlQiqC/7Qeaw9t0JSaLhnQojyp oJdf9YMmX66ThQhCfgOpt+IYKGL3+mqKXE8V3P8ASxrttCLt08KpgE+ig VqjakvU1AWsfDu2O0itdaZ6pMGXU47s9Ya5ouPXp2yaPkdUBYruURC2Xw Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061422" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061422" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:36:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966197" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:35:58 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 10/11] ASoC: codecs: rt298: Fix NULL jack in interrupt Date: Thu, 9 Jun 2022 15:35:40 +0200 Message-Id: <20220609133541.3984886-11-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Set rt298->jack to passed value in mic_detect, otherwise when jack is set to NULL on next interrupt call, we may use freed pointer. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 3c13b6dc3be9..2af037536bc9 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -336,6 +336,8 @@ static int rt298_mic_detect(struct snd_soc_component *component, bool mic = false; int status = 0; + rt298->jack = jack; + /* If jack in NULL, disable HS jack */ if (!jack) { disable_irq(rt298->i2c->irq); @@ -346,7 +348,6 @@ static int rt298_mic_detect(struct snd_soc_component *component, return 0; } - rt298->jack = jack; regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); enable_irq(rt298->i2c->irq); From patchwork Thu Jun 9 13:35:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 580676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E332CC43334 for ; Thu, 9 Jun 2022 13:39:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2958C1ACE; Thu, 9 Jun 2022 15:39:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2958C1ACE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654781995; bh=AmseWLKD4anTx0R1RGuTLqlgM0ICZkHNCXs4PhG8m7o=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EiC977p/neqmSDKDlbtoN2Nt97tPmGa3ZTbNwtiw9HR8gjWCi3Zi0kKzAPJs6RL9k Aeik0462Dfns4ccytNreC/JDlgBG2LFtHlG03bS/eVkTSRwZcaIXEIX8Pe/FVEhrJv Rmml12iMNaPsb+kgtK9yGrbNOi4Dr4kW48cS1Mi8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D63E7F8057B; Thu, 9 Jun 2022 15:36:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B7D38F8055B; Thu, 9 Jun 2022 15:36:09 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C40C7F8055B for ; Thu, 9 Jun 2022 15:36:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C40C7F8055B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="liQCXWjp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654781764; x=1686317764; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AmseWLKD4anTx0R1RGuTLqlgM0ICZkHNCXs4PhG8m7o=; b=liQCXWjpw9VdWQULDPEA8tyyR+WkzVlnxDgDmbz8ZCdq0Xrl7n6cgG4Z vSfuAtAa3WyBhJjS0dDi6L+h6ONARWSxLcFcaWKHXEMn2oCRsTSJABs+m IFH5MHdL6n5/tZPono/KPjwmPAo1PitKmXuyhSk5VzZmJgOKQI0EFEUAN 3Z2KomjYRg0vSRwKVS7jgaLN4g9pjjP1pOoitMf3ccyF9PCCv672DJVHO zmR0BRC7Ghx0ubwfEvPgNpwpkRgTPReS+AeObzpNfyszL8RdfCa/zH4dF lz13zTa+78PSL4h+dcA3mv58z+f/AZsxblXL2B3XLp1NeEG1eaBE27pjI w==; X-IronPort-AV: E=McAfee;i="6400,9594,10373"; a="266061428" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="266061428" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 06:36:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="683966203" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 09 Jun 2022 06:36:00 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Oder Chiou , Mark Brown Subject: [PATCH 11/11] ASoC: codecs: rt298: Fix jack detection Date: Thu, 9 Jun 2022 15:35:41 +0200 Message-Id: <20220609133541.3984886-12-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> References: <20220609133541.3984886-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , Cezary Rojewski , alsa-devel@alsa-project.org, Takashi Iwai , Liam Girdwood , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On our RVP platforms using rt298 with combojack we've seen issues with controls being in incorrect state after suspend/resume cycle. This is caused by codec driver not setting pins to correct state and causing codec suspend method to not be called. Which on resume caused codec registers to be in undefined state. Fix this by setting pins correctly in jack detect function. Signed-off-by: Amadeusz Sławiński Reviewed-by: Cezary Rojewski --- sound/soc/codecs/rt298.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 2af037536bc9..f1c3dfdea5e7 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -330,36 +330,31 @@ static void rt298_jack_detect_work(struct work_struct *work) static int rt298_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *jack, void *data) { + struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component); - struct snd_soc_dapm_context *dapm; - bool hp = false; - bool mic = false; - int status = 0; rt298->jack = jack; - /* If jack in NULL, disable HS jack */ - if (!jack) { + if (jack) { + /* enable IRQ */ + if (rt298->jack->status & SND_JACK_HEADPHONE) + snd_soc_dapm_force_enable_pin(dapm, "LDO1"); + if (rt298->jack->status & SND_JACK_MICROPHONE) { + snd_soc_dapm_force_enable_pin(dapm, "HV"); + snd_soc_dapm_force_enable_pin(dapm, "VREF"); + } + regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); + enable_irq(rt298->i2c->irq); + snd_soc_jack_report(rt298->jack, rt298->jack->status, + SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + } else { disable_irq(rt298->i2c->irq); regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0); - dapm = snd_soc_component_get_dapm(component); + snd_soc_dapm_disable_pin(dapm, "HV"); + snd_soc_dapm_disable_pin(dapm, "VREF"); snd_soc_dapm_disable_pin(dapm, "LDO1"); - snd_soc_dapm_sync(dapm); - return 0; } - - regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2); - enable_irq(rt298->i2c->irq); - - rt298_jack_detect(rt298, &hp, &mic); - if (hp) - status |= SND_JACK_HEADPHONE; - - if (mic) - status |= SND_JACK_MICROPHONE; - - snd_soc_jack_report(rt298->jack, status, - SND_JACK_MICROPHONE | SND_JACK_HEADPHONE); + snd_soc_dapm_sync(dapm); return 0; }