From patchwork Thu Sep 10 10:17:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 249603 Delivered-To: patch@linaro.org Received: by 2002:a17:906:6011:0:0:0:0 with SMTP id o17csp1246379ejj; Thu, 10 Sep 2020 03:20:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjDj4Py8ulHP6HXk+bVzz07OcXaPpcF1hCbnHG8yRShOvP1Dok4P1duaRD+1Yz4ZH1KgJ2 X-Received: by 2002:a17:906:8690:: with SMTP id g16mr7833358ejx.187.1599733232554; Thu, 10 Sep 2020 03:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599733232; cv=none; d=google.com; s=arc-20160816; b=MceAFcT1cbH1IumZRkp0To5HIQY4fSQ8ikxF270pnmjBaLvKVYIf/JHodW9nqcgNEs ZDFsCzj4vyqKiwzm7b7DmP09uvrbc3lCp9sjd+ke8knJE8N0UMpRrZsJO5fNIQpGLLqI 9EzIF8SfHNaTCmRbXavSawPI0r9E1HRDluxwDVH8h05zuwYLREW5LDvoGxwUU+dBVqgi +vL1hj80NeXrQaaeQ1/7Pn7WMB2CPhHo0GgsP7J5J8TWItfC+tZUgmQyzSR4BxgeemGz TzqTDpOo/4qzp6B2oE47bxUMEH7NHzFNLYkkxTg1TUKi8b+K/iZR2Z8gik6XtJhUttAP fUaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5EKdqRsK8wVtz9cHR3wKpVYkVxvCf4OgD26PR6bDVFQ=; b=GoOTQnm047TnhZvouIYwTl/gEB61wTaeFsF00scwcqffFOkuWDM+XF0TTmmYFh8L2A +nnLo3aMPUDMakJQNlYF4tYFMWL5QAhExHnQZD0oZ17qj8nLn9v1CsqdHrVi6LmBI9JO yeYjbJEI0d+ZXCDLtj4421ML0gKuME4p6sraLOk0sD5fKsXcKFc1SUPqERhld+yOGNxB 73y3aehNX7B2G0kznAVGYe06+49E89tM2oK9aszzqeRrbocGjUloWdfiAeMY8U2AFsSF Gv6XkipYxfW0SRu3zI2IRCzZHqwV9zyQbDzdWDe1QtyBaOoBE/iRVKEv4Ae+CDslv/Pl V8Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e1mK1tGz; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si3177689edr.13.2020.09.10.03.20.32; Thu, 10 Sep 2020 03:20:32 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e1mK1tGz; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730662AbgIJKUG (ORCPT + 6 others); Thu, 10 Sep 2020 06:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730588AbgIJKSA (ORCPT ); Thu, 10 Sep 2020 06:18:00 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A86C061799 for ; Thu, 10 Sep 2020 03:17:53 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id a17so6070533wrn.6 for ; Thu, 10 Sep 2020 03:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5EKdqRsK8wVtz9cHR3wKpVYkVxvCf4OgD26PR6bDVFQ=; b=e1mK1tGz6rZaNFFeQOtX2dk9yd8gvcj3TmaGXRNp1rqBIffPapTSViWj1tmPT/i0Sj bX6Jdr3LpJclFl1JAq2XVIrK5Fj5nxWBUryo1a71BZFL9dDYC8G3E6JOLlfUj2oj9x1g masAqBHlE0yWtextn4dI95Lwgv0cAvBdVvap5r9e3ezZEd1URr5OsAetuaNMmIKA5T1m n+A0dkvgFOX9FJQTn+CZ2b64lGGja+5QvtGMspVRwzDBfYq4n1nrTjFTXschjs/lO141 Kzxqz9wSjXJmESJR+8zWXkjkN0VTyTAyWQiow+omrnDjuzbQoicZHVUpsGL59+FvvW3d w/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5EKdqRsK8wVtz9cHR3wKpVYkVxvCf4OgD26PR6bDVFQ=; b=FJOA0yQr8k9L1scEpIHU8+tu1R27vkL/hJtVvK0ENSeaKvwJ5guk+tl3VOscU2qqLb DT9Vw+EZQa7rGgfIxbYN+hpbmJvgkSBNRA72dxpbvvVbVBCLjgPDWHJBrSzDfjMB9nbF wIfSYynrMDO9aIrxFusLAfZGSACB7xVqi9v/mlZOWAREtnZUl6E8NeGPumwChaGrKTTz T0RlPdIdlVo/7Be5ZKEgLjYaFFPLyq0NKbRmRX8OFLsfg/2RPXa1+T4biqvFYRvxcP20 KVF3TdnMpp1sdUShYRfRQLwgwKraq7kL9SRCqAW3cVQuD1Px44lSj74mcBLaQ58u6k7H /9oA== X-Gm-Message-State: AOAM5321ECmnHVR7ZHMyV35DQdrOpbkon08LA/g7fkdEzLO5g2doNPtk 9OKNiTX8K+NXHTX5hUqQJJsSYw== X-Received: by 2002:adf:94c1:: with SMTP id 59mr8856155wrr.29.1599733072447; Thu, 10 Sep 2020 03:17:52 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id m4sm8851731wro.18.2020.09.10.03.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 03:17:51 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, robh+dt@kernel.org, plai@codeaurora.org, bgoswami@codeaurora.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 4/8] ASoC: q6dsp: q6afe: add global q6afe waitqueue Date: Thu, 10 Sep 2020 11:17:28 +0100 Message-Id: <20200910101732.23484-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200910101732.23484-1-srinivas.kandagatla@linaro.org> References: <20200910101732.23484-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In some cases like clocks q6afe would have to process commands without an associated q6afe port, in such cases waitqueue is required at global level to wait for the command to finish. This patch also adds the command result to go with this waitqueue. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6afe.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c index f934c69f0a14..2a8e3c3acb10 100644 --- a/sound/soc/qcom/qdsp6/q6afe.c +++ b/sound/soc/qcom/qdsp6/q6afe.c @@ -362,6 +362,8 @@ struct q6afe { struct device *dev; struct q6core_svc_api_info ainfo; struct mutex lock; + struct aprv2_ibasic_rsp_result_t result; + wait_queue_head_t wait; struct list_head port_list; spinlock_t port_list_lock; }; @@ -905,11 +907,20 @@ static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt, struct q6afe_port *port, uint32_t rsp_opcode) { wait_queue_head_t *wait = &port->wait; + struct aprv2_ibasic_rsp_result_t *result; int ret; mutex_lock(&afe->lock); - port->result.opcode = 0; - port->result.status = 0; + if (port) { + wait = &port->wait; + result = &port->result; + } else { + result = &afe->result; + wait = &afe->wait; + } + + result->opcode = 0; + result->status = 0; ret = apr_send_pkt(afe->apr, pkt); if (ret < 0) { @@ -918,13 +929,13 @@ static int afe_apr_send_pkt(struct q6afe *afe, struct apr_pkt *pkt, goto err; } - ret = wait_event_timeout(*wait, (port->result.opcode == rsp_opcode), + ret = wait_event_timeout(*wait, (result->opcode == rsp_opcode), msecs_to_jiffies(TIMEOUT_MS)); if (!ret) { ret = -ETIMEDOUT; - } else if (port->result.status > 0) { + } else if (result->status > 0) { dev_err(afe->dev, "DSP returned error[%x]\n", - port->result.status); + result->status); ret = -EINVAL; } else { ret = 0; @@ -1594,6 +1605,7 @@ static int q6afe_probe(struct apr_device *adev) q6core_get_svc_api_info(adev->svc_id, &afe->ainfo); afe->apr = adev; mutex_init(&afe->lock); + init_waitqueue_head(&afe->wait); afe->dev = dev; INIT_LIST_HEAD(&afe->port_list); spin_lock_init(&afe->port_list_lock);