From patchwork Fri Jul 13 15:36:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141907 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp950976ljj; Fri, 13 Jul 2018 08:39:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/Rz37DIAZZdrc+KCbhl1RsairnyA1NED1PFfEucbkRdmdXrUHFJolas063wpBFmX6sikd X-Received: by 2002:a62:2646:: with SMTP id m67-v6mr4120796pfm.254.1531496368838; Fri, 13 Jul 2018 08:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531496368; cv=none; d=google.com; s=arc-20160816; b=ipRXWhOIr1cXM21svr01eKmnmtb5VUYWxBu2MrBpylXflhzKI/fn1RvxN0WuBvu4SK QpyNmzwNP4nlAsUagekQlBmtgebiaPV3zt/7oXKPdyk1h/1uwqElmGpQO5wogGhgXQSt s4+OYusDaGCVIWQ5l/S6HtiM5PQW0q1s01IWWWW1Scfn9hwHUcHVqFcZL5F5qdtfC2h/ 28OH+z8NGunMkB64y8GLfHE8M3AsMDqDtpvrR3wBEP6wLsKtUXf2KRTqhIgNnFV3FrZ5 gnmxCgw9hrKFZNOKxVZ8g+gepLMKVNUbg8JoGZSRQiR5wa2RO/356LOy72gqK+ZBOgS4 5QCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=MzGp1j0ioWGKIzF4+VhKRBq/gMz1o36NO5cj7JYy6/I=; b=yG/z8WmabpOz29Q4fAWyPop8pQG9dtrbxwJybAW5XJfu7cdCDffaWf1x7nFHPcoAg3 2AduUbFUGHdEaxFbUhCHmYXM30SEoO3Xb8ebnCma8Lnkmhnk8Ytkn0B2UEAVs+rwDEJP fV78QkHQGdsx0vlOq8C539SYXe570SsqCZsJGEKS+P0kk07mzCbJMvdX6SpRnE7W55yV HLM4as2E4jmQbdZZLn36bND/pSkdViZncML26O2GuXUIs8XxSs1MDXNWThtChgPW0LaA cZjYqB0oWvBCXxkzSPhtba2B3nRuUBJPdjxjIN9f7/wQFro4S+XhI8qM3kPHi5ZlnsQW Ym9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fEBEpc51; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si22204921pgp.681.2018.07.13.08.39.28; Fri, 13 Jul 2018 08:39:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fEBEpc51; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1731620AbeGMPye (ORCPT + 31 others); Fri, 13 Jul 2018 11:54:34 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34377 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729765AbeGMPyc (ORCPT ); Fri, 13 Jul 2018 11:54:32 -0400 Received: by mail-wr1-f65.google.com with SMTP id c13-v6so25512592wrt.1 for ; Fri, 13 Jul 2018 08:39:22 -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; bh=MzGp1j0ioWGKIzF4+VhKRBq/gMz1o36NO5cj7JYy6/I=; b=fEBEpc519bIcEIfUAJ8WbWRjMN81gnjLQ7wWbdcC4CPV7K84EyA1AYJY9T0+RsY9Nd wttg4qIEZl3ewEoDViECfR6x373I1sMfENgO+0Cy62SM5dlmfPOd3OOE36KkQOIFJVj/ oX7vczhg74ZG/DEa8TSwsbC1rLJjBbzxaz98k= 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; bh=MzGp1j0ioWGKIzF4+VhKRBq/gMz1o36NO5cj7JYy6/I=; b=UPWohkCdl1xBbMdlw2e55uHPCMorM6snjQqU0ApkzBeP88ItildQ+8JvDqGQvmpg02 24Fin9mL2q2ofZguJb0zWEBvONVnzMTTS6OkEAxK9XNNo3nZDmwO14aOXmi8lykIcYZc VfmCHbsEwVsH7ybBAvISFA+I9U/GLpryikRCg2scdY2uR9zIwRNAc3XaR6xaiNVq7aks yy7UacPObTz3isjQdoEXzWPlZ0SQmrIXcc1E0OvQT79aV9IkEBn5iyZARcF2+kwlU4fy GYtfiUnm6GGrfkBcbPJ5wOPtYc/pZdieP/T4aw0qJHd3cpT57EZKtNLQXe4v4naVM/t6 8q2w== X-Gm-Message-State: AOUpUlFVRbAWYsD+TaLGB63wYt0SqqmEPi8BflHyIuF5EOoy/tNaotV0 4Rf9J50qNzKVntT9JNx+BKN4jQ== X-Received: by 2002:adf:9c91:: with SMTP id d17-v6mr5144212wre.11.1531496362148; Fri, 13 Jul 2018 08:39:22 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 63-v6sm4840902wmo.22.2018.07.13.08.39.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jul 2018 08:39:21 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.com, vkoul@kernel.org, linux-kernel@vger.kernel.org, rohitkr@codeaurora.org, bgoswami@codeaurora.org, Srinivas Kandagatla Subject: [PATCH v2 1/5] ASoC: core: add support to card re-bind using component framework Date: Fri, 13 Jul 2018 16:36:28 +0100 Message-Id: <20180713153632.32511-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> References: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch aims at achieving dynamic behaviour of audio card when the dependent components disappear and reappear. With this patch the card is removed if any of the dependent component is removed and card is added back if the dependent component comes back. All this is done using component framework and matching based on component name. Signed-off-by: Srinivas Kandagatla --- include/sound/soc.h | 7 ++++++ sound/soc/soc-core.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) -- 2.16.2 diff --git a/include/sound/soc.h b/include/sound/soc.h index a4915148f739..a23ecdf3eff1 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1090,6 +1091,12 @@ struct snd_soc_card { struct work_struct deferred_resume_work; + /* component framework related */ + bool components_added; + /* set in machine driver to enable/disable auto re-binding */ + bool auto_bind; + struct component_match *match; + /* lists of probed devices belonging to this card */ struct list_head component_dev_list; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6d33634b934b..65d11c13117f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -279,11 +279,28 @@ static inline void snd_soc_debugfs_exit(void) #endif +static int snd_soc_card_comp_compare(struct device *dev, void *data) +{ + struct snd_soc_component *component; + + lockdep_assert_held(&client_mutex); + list_for_each_entry(component, &component_list, list) { + if (dev == component->dev) { + if (!strcmp(component->name, data)) + return 1; + break; + } + } + + return 0; +} + static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, struct snd_soc_component *component) { struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *new_rtdcom; + char *cname; for_each_rtdcom(rtd, rtdcom) { /* already connected */ @@ -300,6 +317,13 @@ static int snd_soc_rtdcom_add(struct snd_soc_pcm_runtime *rtd, list_add_tail(&new_rtdcom->list, &rtd->component_list); + if (rtd->card->auto_bind && !rtd->card->components_added) { + cname = devm_kasprintf(rtd->card->dev, GFP_KERNEL, + "%s", component->name); + component_match_add(rtd->card->dev, &rtd->card->match, + snd_soc_card_comp_compare, cname); + } + return 0; } @@ -835,6 +859,25 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; } +static int snd_soc_card_comp_bind(struct device *dev) +{ + struct snd_soc_card *card = dev_get_drvdata(dev); + + if (card->instantiated) + return 0; + + return snd_soc_register_card(card); +} + +static void snd_soc_card_comp_unbind(struct device *dev) +{ +} + +static const struct component_master_ops snd_soc_card_comp_ops = { + .bind = snd_soc_card_comp_bind, + .unbind = snd_soc_card_comp_unbind, +}; + static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) { @@ -2108,6 +2151,12 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) card->instantiated = 1; snd_soc_dapm_sync(&card->dapm); + if (card->auto_bind && !card->components_added) { + component_master_add_with_match(card->dev, + &snd_soc_card_comp_ops, + card->match); + card->components_added = true; + } mutex_unlock(&card->mutex); mutex_unlock(&client_mutex); @@ -2757,6 +2806,9 @@ int snd_soc_unregister_card(struct snd_soc_card *card) dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name); } + if (!card->auto_bind && card->components_added) + component_master_del(card->dev, &snd_soc_card_comp_ops); + return 0; } EXPORT_SYMBOL_GPL(snd_soc_unregister_card); @@ -3169,8 +3221,17 @@ int snd_soc_add_component(struct device *dev, snd_soc_component_add(component); + ret = component_add(dev, NULL); + if (ret < 0) { + dev_err(dev, "ASoC: Failed to add Component: %d\n", ret); + goto err_comp; + } + return 0; +err_comp: + soc_remove_component(component); + snd_soc_unregister_dais(component); err_cleanup: snd_soc_component_cleanup(component); err_free: @@ -3218,6 +3279,7 @@ static int __snd_soc_unregister_component(struct device *dev) mutex_unlock(&client_mutex); if (found) { + component_del(dev, NULL); snd_soc_component_cleanup(component); } From patchwork Fri Jul 13 15:36:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141908 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp950998ljj; Fri, 13 Jul 2018 08:39:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd2bO/3I39+zoQfpvqFQqKvS7lFOy2wR6CbEsRmaC8ITBhybstP4xRP+suaEsWdOYxJ0+rk X-Received: by 2002:a62:df82:: with SMTP id d2-v6mr7658619pfl.189.1531496369731; Fri, 13 Jul 2018 08:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531496369; cv=none; d=google.com; s=arc-20160816; b=XCcypoqFAHJfmo11Ol6UvarimFIV/nZk6YoHhbhg07DMCnT8ysEUfHVeBYpc93HT5c 4Cufteg7wcog2QdnQSlBoM/MutAdobNB/rzkeg6VRPqjxvC3ASEVBGRLxxfrgUoOfntn MTnh1wO2zacZ/CxRZYM59zdeGSpr6mYfUQMirR2GjEOzdjB/YCzeO82m+RO8Q/hF0TlW 8a0G1Q4pG/PAHzsfQbK50+5ErvwCpUuC1hcHEzq2uaNPcnaU3ygHXVz1mh9PP3Mad1gt FuhUMKBitBBo9xSS2onwmyW+oyzUpYYEL+Xy52xf36IF6HRsfgiNyN+pF/DSP4C99/hg lKrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=TqQmdbUc76Zh3AKXyulvqz/9XxR8S85UTq3b7WXey3s=; b=nMhz9RhtCDR/6wxIrYHVxAm1jmrXyy5LvMdN4UmX4BjrxUVgkm54+RW3IXDWXYb3XN Z5TLoEQgGdHm5Sc1QPPepXqEylYXjwgReuavEEuxoaiCiAiWsTPuKGDbLUeSYHlrCOXk H9H+E64PMTxTcux9QndQLtSwhQ2kA5eGPUclIvawabBdqpmetWQSaxuyCtJPufEaBYRf 5z1m1Mzb829lbv96yE22PEkMoMigKLISuhXlyBPKb2LQC9MvFyZpn5J6h6oo6esD+G90 aM46t1Hxz43EmiZWxp0z6pVRJOOjoMPbcIV+1cBBexLv9j8jW8jIU+ThyKHLiMpcrd2m f+5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fJuoBeqK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id o3-v6si22399969pga.609.2018.07.13.08.39.29; Fri, 13 Jul 2018 08:39:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fJuoBeqK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1731886AbeGMPye (ORCPT + 31 others); Fri, 13 Jul 2018 11:54:34 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:54160 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731210AbeGMPye (ORCPT ); Fri, 13 Jul 2018 11:54:34 -0400 Received: by mail-wm0-f66.google.com with SMTP id s9-v6so1904749wmh.3 for ; Fri, 13 Jul 2018 08:39:24 -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; bh=TqQmdbUc76Zh3AKXyulvqz/9XxR8S85UTq3b7WXey3s=; b=fJuoBeqKTg7nosmoZ7eFaF9rkHo+pyOcwXuqN9bBmcpUAAPRJwli9LxUi2SHxw9cdy RdzhQvdgyJ+dXhCRn43X2XO3PwUmpkxz1y45PWifn+pg4NlW08SzXWWWF0K28kabLTXf yeiL25dBR/R1anE1WZBBOd0C5vm4KtIHYhvyo= 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; bh=TqQmdbUc76Zh3AKXyulvqz/9XxR8S85UTq3b7WXey3s=; b=Lag0VadZ73jmbNpV7MGhq6DV5t1lqQSpyXEXWAjBD450eBelYmDDaYdS3VYXlGMPHC S1EbOLIKq3HhHgPd3yRuCjFkyau9hjlMFQsEEx9cZRhVNwn96Wia5Xk8MDh2CJXTiAh6 ioA1b9EcW6be+adChmQgbcFBTydUAUdkHBdWeKC0ULgjjdgFx0FqGplMhitPX7H5AD0k T3/OSYfWrzi1ecMWiEioag4zZPPWbx4jJivySOU7Fxwz1RuwAtnc5xir8hKzPp6N8xpN gITSwoa6hnJj94lv6MqaLhTdprouS9ek9CrKxWeSyMadHvGacKfK2rYvRyJxiUH4Nmag ii8g== X-Gm-Message-State: AOUpUlFcbiYh32xaS50wvtNszHAhTe31YFi4xyLuxKaulKwITVL/TduC ur9F+J/Pz/m5O+SSG50LCpQAOA== X-Received: by 2002:a1c:9c0b:: with SMTP id f11-v6mr4200050wme.148.1531496364158; Fri, 13 Jul 2018 08:39:24 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 63-v6sm4840902wmo.22.2018.07.13.08.39.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jul 2018 08:39:23 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.com, vkoul@kernel.org, linux-kernel@vger.kernel.org, rohitkr@codeaurora.org, bgoswami@codeaurora.org, Srinivas Kandagatla Subject: [PATCH v2 3/5] ASoC: qdsp6: q6asm-dai: remove component framework related code Date: Fri, 13 Jul 2018 16:36:30 +0100 Message-Id: <20180713153632.32511-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> References: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the component framework is integrated into the ASoC core, remove any redundant code in this driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6asm-dai.c | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) -- 2.16.2 diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 199d0fb6f90a..9db9a2944ef2 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -563,14 +562,15 @@ static struct snd_soc_dai_driver q6asm_fe_dais[] = { Q6ASM_FEDAI_DRIVER(8), }; -static int q6asm_dai_bind(struct device *dev, struct device *master, void *data) +static int q6asm_dai_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; struct of_phandle_args args; struct q6asm_dai_data *pdata; int rc; - pdata = kzalloc(sizeof(struct q6asm_dai_data), GFP_KERNEL); + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM; @@ -582,36 +582,10 @@ static int q6asm_dai_bind(struct device *dev, struct device *master, void *data) dev_set_drvdata(dev, pdata); - return snd_soc_register_component(dev, &q6asm_fe_dai_component, + return devm_snd_soc_register_component(dev, &q6asm_fe_dai_component, q6asm_fe_dais, ARRAY_SIZE(q6asm_fe_dais)); } -static void q6asm_dai_unbind(struct device *dev, struct device *master, - void *data) -{ - struct q6asm_dai_data *pdata = dev_get_drvdata(dev); - - snd_soc_unregister_component(dev); - - kfree(pdata); - -} - -static const struct component_ops q6asm_dai_comp_ops = { - .bind = q6asm_dai_bind, - .unbind = q6asm_dai_unbind, -}; - -static int q6asm_dai_probe(struct platform_device *pdev) -{ - return component_add(&pdev->dev, &q6asm_dai_comp_ops); -} - -static int q6asm_dai_dev_remove(struct platform_device *pdev) -{ - component_del(&pdev->dev, &q6asm_dai_comp_ops); - return 0; -} static const struct of_device_id q6asm_dai_device_id[] = { { .compatible = "qcom,q6asm-dais" }, @@ -625,7 +599,6 @@ static struct platform_driver q6asm_dai_platform_driver = { .of_match_table = of_match_ptr(q6asm_dai_device_id), }, .probe = q6asm_dai_probe, - .remove = q6asm_dai_dev_remove, }; module_platform_driver(q6asm_dai_platform_driver); From patchwork Fri Jul 13 15:36:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141909 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp951030ljj; Fri, 13 Jul 2018 08:39:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd9C+gBMY2L9ax8lzEJC5TofJYNpX+RzCKgGhES5GLmOM2uHD1caqYrwNpdDI6uFIAwZgiA X-Received: by 2002:a63:8648:: with SMTP id x69-v6mr6580837pgd.172.1531496371161; Fri, 13 Jul 2018 08:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531496371; cv=none; d=google.com; s=arc-20160816; b=CBnXVMUgQlo742nXh8gv0A368Ocf69QceV5M8mAAKDGuPrUIOYfKsplpvp9QrYllnd ot3hvn6qVU0LI2c01z6GI/1l6MTCsGjbjASb71oSHPjaoH3HOnp8lutU8YYVZ7cmuwM0 nQXBzDNIoWpxkKsma3zUxXXnaMtde/zRHFO9MPUBodN9DGddfpLosyZlZD18IDssSGZD CgE/NKsgClCkRdMxbkKXB7g1TeLYZCFFFADpRqODUwUouW+pTM2F0Ogh61jWld+/3uvx EPGlOu+jx8dK7UNyPW6p0Q7bZrqAlopdKncPG0/fzG85dmXd3DGpdQ8K5mi7X7UfdGif Dx9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7DT8uzieULApLhHCk+Za0usRqnEVnd2LGlbLtpiw7yc=; b=Mmm3pE8T90DDY1pLZIX+ixG4txwsrSsLlm6rCRIaOTDymmiUKLeUTj5xaH9ZoZiUV+ FN5dswm95tFwjJF+GUc9ltciE3qGIhUC8ktBfskCYp4aRHX99DLY5LfcEIBJe8yr+Sd2 aOxAM4w52PxhezB/Dqu2oMmqgyw7CxNWck2+WbGwUk2PA8YpY7NGd97GgdLtCrs4FskJ 0NuY+mXrSi0BFO2LwCjrY3qI5Lr6JnyAr9sC8E+QLt+6hFykNPubJovPykitE6azATTu JdwLH6KtT6mwOe4iPmiiI7J5oKo96Q8A2XfxYI3HQ2yBg7jjCXJzLDa75QmYIf44ODj9 0EmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iVpbE/Tg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si26152294plk.111.2018.07.13.08.39.30; Fri, 13 Jul 2018 08:39:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iVpbE/Tg"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1731935AbeGMPyg (ORCPT + 31 others); Fri, 13 Jul 2018 11:54:36 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38096 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731552AbeGMPyf (ORCPT ); Fri, 13 Jul 2018 11:54:35 -0400 Received: by mail-wr1-f65.google.com with SMTP id m1-v6so12824168wrg.5 for ; Fri, 13 Jul 2018 08:39:26 -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; bh=7DT8uzieULApLhHCk+Za0usRqnEVnd2LGlbLtpiw7yc=; b=iVpbE/TgrkJoRyeje16gkO+sU9aqmenWuGH0919eKPGHaoEscwsU3SFcuMyQ/PJC5T Y6nZNTirGAj9nN9BoGSpVEaCPHHHHXkyYfdS1UuqIvck1NZn2ovGYGVRxOVFg6gVjJVS euxd++oPh2aAjkh0z50H55mwCI89bKvtMhTcc= 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; bh=7DT8uzieULApLhHCk+Za0usRqnEVnd2LGlbLtpiw7yc=; b=PHNpib2EhUlRtzwu2dJgjR3DuP+P3RWQjWKEmow8i22hx7853je3IAggOGAwnXb5uS pIMdIhQTrhgBFpA8jHZJJTcQZcNm0TgkisbZpajkf/a4CnqMLKB1gmORJ3LwdPOsdqfY 5n2mBH1sPXziYuIfmNcuuE8etsz11wKQEwvvJbLQaSuAQXj6A+hkCcAr6dGg7S2hc3qD iIlKf5BVEVrPh5UtkRghKnoBFRlEPupSRY4/Tuav8FDryc8RJEUR9gP3RSVBf7/Pihrk wOh9RY91g1HXA6eIHeCuDh3+ltaJ0ZK9K5m1b5xIQoXj0qgsZWxjIjICW0Gix2iNy8X9 Ci1g== X-Gm-Message-State: AOUpUlFSXuDue07ttmliLRJ9QPAKn5NXnc+v6T7Y6q1mr2xGArNYjXZb WoKJ1uYEUwTv4zPs9ZEI0Pwlhg== X-Received: by 2002:adf:959a:: with SMTP id p26-v6mr5142953wrp.202.1531496365156; Fri, 13 Jul 2018 08:39:25 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 63-v6sm4840902wmo.22.2018.07.13.08.39.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jul 2018 08:39:24 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.com, vkoul@kernel.org, linux-kernel@vger.kernel.org, rohitkr@codeaurora.org, bgoswami@codeaurora.org, Srinivas Kandagatla Subject: [PATCH v2 4/5] ASoC: qdsp6: q6routing: remove component framework related code Date: Fri, 13 Jul 2018 16:36:31 +0100 Message-Id: <20180713153632.32511-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> References: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the component framework is integrated into the ASoC core, remove any redundant code in this driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/qdsp6/q6routing.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) -- 2.16.2 diff --git a/sound/soc/qcom/qdsp6/q6routing.c b/sound/soc/qcom/qdsp6/q6routing.c index 35269b492761..1d33b00e5b44 100644 --- a/sound/soc/qcom/qdsp6/q6routing.c +++ b/sound/soc/qcom/qdsp6/q6routing.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -977,9 +976,10 @@ static const struct snd_soc_component_driver msm_soc_routing_component = { .num_dapm_routes = ARRAY_SIZE(intercon), }; -static int q6routing_dai_bind(struct device *dev, struct device *master, - void *data) +static int q6pcm_routing_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; + routing_data = kzalloc(sizeof(*routing_data), GFP_KERNEL); if (!routing_data) return -ENOMEM; @@ -989,35 +989,15 @@ static int q6routing_dai_bind(struct device *dev, struct device *master, mutex_init(&routing_data->lock); dev_set_drvdata(dev, routing_data); - return snd_soc_register_component(dev, &msm_soc_routing_component, + return devm_snd_soc_register_component(dev, &msm_soc_routing_component, NULL, 0); } -static void q6routing_dai_unbind(struct device *dev, struct device *master, - void *d) +static int q6pcm_routing_remove(struct platform_device *pdev) { - struct msm_routing_data *data = dev_get_drvdata(dev); - - snd_soc_unregister_component(dev); - - kfree(data); - + kfree(routing_data); routing_data = NULL; -} -static const struct component_ops q6routing_dai_comp_ops = { - .bind = q6routing_dai_bind, - .unbind = q6routing_dai_unbind, -}; - -static int q6pcm_routing_probe(struct platform_device *pdev) -{ - return component_add(&pdev->dev, &q6routing_dai_comp_ops); -} - -static int q6pcm_routing_remove(struct platform_device *pdev) -{ - component_del(&pdev->dev, &q6routing_dai_comp_ops); return 0; } From patchwork Fri Jul 13 15:36:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141910 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp951079ljj; Fri, 13 Jul 2018 08:39:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcqmAsdNYt13JGLGhj9C0NENeDhCPPheak+5h6ZGTpuxtrAjYd6TbcDVcMrxmbdClFSG/vG X-Received: by 2002:a65:41c6:: with SMTP id b6-v6mr6496961pgq.174.1531496373603; Fri, 13 Jul 2018 08:39:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531496373; cv=none; d=google.com; s=arc-20160816; b=zVrex6pulc2qo9+uhQZwe0KzucjgvifGwbWMmMpnVzqaQCiQ6w5On1m6vByWTApfeb qR4zlYwQfdAWvVqINIBNuPTFUGxOfH/UP5StplHKodm07P4DywkcICMy5fLCVsJt0PqE S/xpaP5dUW4McrttpqzSmu/gH/nv3QbDXZBOQVTXKaM8QCnKkPt4XPHtE4lCMaIODXW3 klugf22y7Klnv2ji2odzLEw/yEjfMYHbzV+LTNUf4U2zF2taQ+APdZP9yx3R5PwuStoq KaY4LWi72hJUkeKMBi8PsB5CUVqCThrWUzM940SWUtS330zvJ1U32Kkk8aib0WbaEwZs wq5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=gfafMkLu59T46j/xhUfD5cqyO4e9j7V6stGEV8DhnRc=; b=vPQeAj+SIObRf0j3MD2XkgNz5TYWHkeKc2f6++DfLLJvQ+oAtXS1DazEFN11Y+cThT 1e5xV7h2NueBS+4t3YFP5s4Uoxly4hEzqbDws3WfrQtpXTkpOmOQpnRZmkZhv1trf1D9 T/eezFXcFEDa0sboiTWh652ciYm3t6vfN/mWJhuX2CQ+JsyUsEfTswVmZ2s9O8k0K6BB Tfv2eflxD51Tq9zgcbp0UuMAFGKGclxZhYG5lRkmBgY0TCD25TxaizTTD3A9ybgh4n/r ujp5Sdj608PeTiPTRxmqVNv8emWIkLglRajpADkJN5pq3AoJ8qzZ51qNZ3ctHbZOfVXa WlbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SiO1Emh8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si24243018ply.300.2018.07.13.08.39.33; Fri, 13 Jul 2018 08:39:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SiO1Emh8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1731957AbeGMPyi (ORCPT + 31 others); Fri, 13 Jul 2018 11:54:38 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34621 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731895AbeGMPyg (ORCPT ); Fri, 13 Jul 2018 11:54:36 -0400 Received: by mail-wm0-f65.google.com with SMTP id s13-v6so4816175wmc.1 for ; Fri, 13 Jul 2018 08:39:26 -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; bh=gfafMkLu59T46j/xhUfD5cqyO4e9j7V6stGEV8DhnRc=; b=SiO1Emh86qjtfSNJR7vucbFQ6L8onXUyDYX/fF/5fLwHHDMXgBTZPTMLvWWPejyFcN Vxdx0yna9wR/XE3oHaCAOZTYwzYrRStplMLXIaDmr3wNA/4SuPTE22K1myLyLI3VCRFA ZShF9nplPT7ITYTLG2A30rgjj2Tvxir2zoMzQ= 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; bh=gfafMkLu59T46j/xhUfD5cqyO4e9j7V6stGEV8DhnRc=; b=RAt6mLI337cgkZfHgCUXPfh+edUkv44xz29POWiDrSejaW/insfB2pvtG8NGgob+EV JeS6L5NYJpzE/sFYs2Nufo6qPlZtk8l+A9PfVuv2Pjm5hZT0Wbpu9cxPlc6VVRlz2Xzs IYUrlE691hpC1LSuMQbD3ipSnVGs14U1v+B35m4OvWiz5yrefGzpWt2Ta+SyENyEG9yG y+VI5M98lT+Se1assV/wG3XWvsR7PdfIjVcEynTVB11JfdxEXPmhf5PgaICzMfNR8mZT fGq2hcbvIxRTE8n+LHFus4ipsacJCu9/vgqb0gfXpf435YXF1/dBi3qqUnNYmnfY1wC0 webA== X-Gm-Message-State: AOUpUlFw3PBMwJMW8RRCAWXD16VxfC2OF/K0Fz2yqBGZkvOOgusC8jt2 syLfvMLDairtWGkTz/q9MGu/2A== X-Received: by 2002:a1c:8e8c:: with SMTP id q134-v6mr1700220wmd.3.1531496366286; Fri, 13 Jul 2018 08:39:26 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id 63-v6sm4840902wmo.22.2018.07.13.08.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Jul 2018 08:39:25 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.com, vkoul@kernel.org, linux-kernel@vger.kernel.org, rohitkr@codeaurora.org, bgoswami@codeaurora.org, Srinivas Kandagatla Subject: [PATCH v2 5/5] ASoC: qcom: apq8096: remove component framework related code Date: Fri, 13 Jul 2018 16:36:32 +0100 Message-Id: <20180713153632.32511-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> References: <20180713153632.32511-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the component framework is integrated into the ASoC core, remove any redundant code in this driver. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/apq8096.c | 75 ++++-------------------------------------------- 1 file changed, 6 insertions(+), 69 deletions(-) -- 2.16.2 diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c index cab8c4ff7c00..a56156281c8d 100644 --- a/sound/soc/qcom/apq8096.c +++ b/sound/soc/qcom/apq8096.c @@ -129,17 +129,18 @@ static int apq8096_sbc_parse_of(struct snd_soc_card *card) return ret; } -static int apq8096_bind(struct device *dev) +static int apq8096_platform_probe(struct platform_device *pdev) { struct snd_soc_card *card; + struct device *dev = &pdev->dev; int ret; card = kzalloc(sizeof(*card), GFP_KERNEL); if (!card) return -ENOMEM; - component_bind_all(dev, card); card->dev = dev; + card->auto_bind = true; dev_set_drvdata(dev, card); ret = apq8096_sbc_parse_of(card); if (ret) { @@ -154,82 +155,18 @@ static int apq8096_bind(struct device *dev) return 0; err: - component_unbind_all(dev, card); kfree(card); return ret; } -static void apq8096_unbind(struct device *dev) +static int apq8096_platform_remove(struct platform_device *pdev) { - struct snd_soc_card *card = dev_get_drvdata(dev); + struct snd_soc_card *card = dev_get_drvdata(&pdev->dev); + card->auto_bind = false; snd_soc_unregister_card(card); - component_unbind_all(dev, card); kfree(card->dai_link); kfree(card); -} - -static const struct component_master_ops apq8096_ops = { - .bind = apq8096_bind, - .unbind = apq8096_unbind, -}; - -static int apq8016_compare_of(struct device *dev, void *data) -{ - return dev->of_node == data; -} - -static void apq8016_release_of(struct device *dev, void *data) -{ - of_node_put(data); -} - -static int add_audio_components(struct device *dev, - struct component_match **matchptr) -{ - struct device_node *np, *platform, *cpu, *node, *dai_node; - - node = dev->of_node; - - for_each_child_of_node(node, np) { - cpu = of_get_child_by_name(np, "cpu"); - if (cpu) { - dai_node = of_parse_phandle(cpu, "sound-dai", 0); - of_node_get(dai_node); - component_match_add_release(dev, matchptr, - apq8016_release_of, - apq8016_compare_of, - dai_node); - } - - platform = of_get_child_by_name(np, "platform"); - if (platform) { - dai_node = of_parse_phandle(platform, "sound-dai", 0); - component_match_add_release(dev, matchptr, - apq8016_release_of, - apq8016_compare_of, - dai_node); - } - } - - return 0; -} - -static int apq8096_platform_probe(struct platform_device *pdev) -{ - struct component_match *match = NULL; - int ret; - - ret = add_audio_components(&pdev->dev, &match); - if (ret) - return ret; - - return component_master_add_with_match(&pdev->dev, &apq8096_ops, match); -} - -static int apq8096_platform_remove(struct platform_device *pdev) -{ - component_master_del(&pdev->dev, &apq8096_ops); return 0; }