Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp53171pxm; Wed, 2 Mar 2022 10:15:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBqJkCtH2Xz6rDFmcEwq8WgxyZ5rrBjDiTAszL5KPDbNgmE2pzJxBJSMblc8pL2G8FVjiB X-Received: by 2002:a17:90a:f185:b0:1bc:806f:5cfc with SMTP id bv5-20020a17090af18500b001bc806f5cfcmr1096059pjb.136.1646244955670; Wed, 02 Mar 2022 10:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646244955; cv=none; d=google.com; s=arc-20160816; b=psOEvN1NU1aJ1VmOGJbyvS2wg7QdtXTSu1FpuOxpLG68N3Z331vwta3nH1Qtuy3Rbb MCQwISM1ak6Bv03CR0Z6/gvx1uak58GG8zLCZrsxlr+9X9YdEDdcysU+oc+ABxjh+bLV U0qOvKduHsLJa13W/Iv6ovIzlmHcJuedaavKi81h5gY0eRH4OqbxdO1mE5n+qeaHwJN3 LC4Jnx4MvgR92KfEGtioWuKy8QQG6LYL4x06JEPOGnXiZLkJ1TFf4iQ0PNpgzg1mxEPY siI1kV6V6FrVpVd3Gd7Ur+w8elgScLnwCMS2AQhOX9seInbE180woJYv11UW/OGXHIVg NVBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oT/3Ongt8Q2ULTSwFiOQKSwI/q+Zf9XwdeUeI1mjB2U=; b=lkj50cdW5+tdOFmsU3vbYInLewklAq6/LWLbQa0LkboDZXRoo5GvrPUFmO2NucOnC+ daUiTXCCNoQg6K08rvP7IXgoXbkDB4qM4m860iIxY6G6wcpSnTjld3pyu2SfrysZSt+y 13kGhtoM2ejwfzUQakCWoz7Um+GxhHl9bM6y3kPdmA5GrN7wCvYq+hjME5G1UgpWjyDZ xFMnLumy/SBjZ0crAbHE/1dXWfwBT+6iA7mO49PWi+wNZSfT5Z5dpSG4M3N3bRcktmIv 6u0j8J1lsojyjt+C7yOEZ/OibFlUqPVAxAdMEJ+MH4BhaHcmjqgTqRFhsGsyeomKxBav i4/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=huswXYlC; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a6566d3000000b0036c15e9be21si15819327pgw.88.2022.03.02.10.15.38; Wed, 02 Mar 2022 10:15:55 -0800 (PST) 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=@intel.com header.s=Intel header.b=huswXYlC; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236163AbiCAQSg (ORCPT + 99 others); Tue, 1 Mar 2022 11:18:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234486AbiCAQSa (ORCPT ); Tue, 1 Mar 2022 11:18:30 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEB725B3FE; Tue, 1 Mar 2022 08:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646151469; x=1677687469; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=oW7rCjucB/FAM9m562SoKysdtSc96jMNqsGkSaAFJyc=; b=huswXYlCt6OzR/mdF2ftO/wK3tzrZC4LEK/1F60nwtX/odL93YIuOjXG UlbazkApYAGFNAMo5ZofHiqcN8EMCVTv4GTiTxwjvgLOl6gaU+hRq8ET3 h2vFMnybKQDHsaG8EmJlAmfMDBCq9a6rMtL6AVLpUx0S1+PKl1EiSDbam id9uwldaBIjzj6rarg/VA4aJXUa3u0g6FUm1ex6FHHBd7+GtGS/E6Fjet mzOhh714wdKEIf+FGsUgKYz9xqh06mixb/OqeVsDT+mlJNtwr6RGeaHCY TmB3VtECprjGy3F4EUtYbSuXmbdM72YpqeCh4Sxfr2yacOZV7DhhTieYA g==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="339600547" X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="339600547" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 08:17:49 -0800 X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="545146496" Received: from rbrosius-mobl.amr.corp.intel.com (HELO [10.209.131.146]) ([10.209.131.146]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 08:17:48 -0800 Message-ID: Date: Tue, 1 Mar 2022 07:52:43 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.5.0 Subject: Re: [PATCH v3 3/3] soundwire: qcom: add in-band wake up interrupt support Content-Language: en-US To: Srinivas Kandagatla , robh+dt@kernel.org, vkoul@kernel.org, yung-chuan.liao@linux.intel.com Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com References: <20220228172528.3489-1-srinivas.kandagatla@linaro.org> <20220228172528.3489-4-srinivas.kandagatla@linaro.org> From: Pierre-Louis Bossart In-Reply-To: <20220228172528.3489-4-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 On 2/28/22 11:25, Srinivas Kandagatla wrote: > Some of the Qualcomm SoundWire Controller instances like the ones that are > connected to RX path along with Headset connections support Waking up > Controller from Low power clock stop state using SoundWire In-band interrupt. > SoundWire Slave on the bus would initiate this by pulling the data line high, > while the clock is stopped. > > Add support to this wake up interrupt. > > Signed-off-by: Srinivas Kandagatla Reviewed-by: Pierre-Louis Bossart > --- > drivers/soundwire/qcom.c | 50 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c > index 810232686196..e893aee1b057 100644 > --- a/drivers/soundwire/qcom.c > +++ b/drivers/soundwire/qcom.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -154,6 +155,7 @@ struct qcom_swrm_ctrl { > u8 rd_cmd_id; > int irq; > unsigned int version; > + int wake_irq; > int num_din_ports; > int num_dout_ports; > int cols_index; > @@ -503,6 +505,31 @@ static int qcom_swrm_enumerate(struct sdw_bus *bus) > return 0; > } > > +static irqreturn_t qcom_swrm_wake_irq_handler(int irq, void *dev_id) > +{ > + struct qcom_swrm_ctrl *swrm = dev_id; > + int ret; > + > + ret = pm_runtime_get_sync(swrm->dev); > + if (ret < 0 && ret != -EACCES) { > + dev_err_ratelimited(swrm->dev, > + "pm_runtime_get_sync failed in %s, ret %d\n", > + __func__, ret); > + pm_runtime_put_noidle(swrm->dev); > + } > + > + if (swrm->wake_irq > 0) { > + if (!irqd_irq_disabled(irq_get_irq_data(swrm->wake_irq))) > + disable_irq_nosync(swrm->wake_irq); > + } > + > + pm_runtime_mark_last_busy(swrm->dev); > + pm_runtime_put_autosuspend(swrm->dev); > + > + return IRQ_HANDLED; > +} > + > + > static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id) > { > struct qcom_swrm_ctrl *swrm = dev_id; > @@ -1340,6 +1367,19 @@ static int qcom_swrm_probe(struct platform_device *pdev) > goto err_clk; > } > > + ctrl->wake_irq = of_irq_get(dev->of_node, 1); > + if (ctrl->wake_irq > 0) { > + ret = devm_request_threaded_irq(dev, ctrl->wake_irq, NULL, > + qcom_swrm_wake_irq_handler, > + IRQF_TRIGGER_HIGH | IRQF_ONESHOT, > + "swr_wake_irq", ctrl); > + if (ret) { > + dev_err(dev, "Failed to request soundwire wake irq\n"); > + goto err_init; > + } > + } > + > + > ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode); > if (ret) { > dev_err(dev, "Failed to register Soundwire controller (%d)\n", > @@ -1424,6 +1464,11 @@ static int swrm_runtime_resume(struct device *dev) > struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(dev); > int ret; > > + if (ctrl->wake_irq > 0) { > + if (!irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq))) > + disable_irq_nosync(ctrl->wake_irq); > + } > + > clk_prepare_enable(ctrl->hclk); > > if (ctrl->clock_stop_not_supported) { > @@ -1491,6 +1536,11 @@ static int __maybe_unused swrm_runtime_suspend(struct device *dev) > > usleep_range(300, 305); > > + if (ctrl->wake_irq > 0) { > + if (irqd_irq_disabled(irq_get_irq_data(ctrl->wake_irq))) > + enable_irq(ctrl->wake_irq); > + } > + > return 0; > } >