From patchwork Tue Oct 26 00:00:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 12583629 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 515D4C433F5 for ; Tue, 26 Oct 2021 00:01:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40308610A0 for ; Tue, 26 Oct 2021 00:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235820AbhJZAEH (ORCPT ); Mon, 25 Oct 2021 20:04:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235663AbhJZADj (ORCPT ); Mon, 25 Oct 2021 20:03:39 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA391C061243 for ; Mon, 25 Oct 2021 17:01:14 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id m26so12491516pff.3 for ; Mon, 25 Oct 2021 17:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qtSBdARAbq/LhSD/0GoJpBn1wQtyRrb0Wrn7wC9yscA=; b=nyUU2nElQbtMsEiN3eH8baHbyx4vIDgLtpGND0ueLc+d38AP9nLIWNViYZ8LcY10FK bNARmqtynLnphzcrh/QBobUupmoZ2DpVmRvWGCKdtMWdgKjKCufbemezK22pZqRO/UuK 3pT7BSLUIWNchpJcrZK5ij+jhcAxdFD21pU6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qtSBdARAbq/LhSD/0GoJpBn1wQtyRrb0Wrn7wC9yscA=; b=dLa7+filkVTq00XDuDrIsPnp9PqcjQwCe4XHWN3vaTnJjbO+1DQ9WIyMLscoKxrozG UVdeOUZFl9NBrt2YHMnxqNoYRirD8F8CJvpuWNmOCsAV9ACbDeZYzmtDEP/KYLL5iwad BacZ9MIh4v606qbHfrjJ1QW8WLjG0Lo2KD4LmE4+bN4xRhKWpxFckluIQLfebhJcRGQi 7i6E/LuRSsjknhhgWOszz5/trLve7STGQND4XkC/x/bkQQ9l8WBEpN2+X4pIA1ZTfsv2 wzwRbQnkKmvM6ba4f6qHxEOuxFStjm+2/o7kdK12mUkcjth7zIsegHBMXmi1yxXMDaOr Rnuw== X-Gm-Message-State: AOAM532shKGK14n6CVgHxg8kDdOr5CtyioDrtMALA3kSt9MzuMkKB2jp +aBBHFcK2HS/pf8UZmehQHrUPg== X-Google-Smtp-Source: ABdhPJy92EvSc9JRTYf97TKzM3B5wkFmo/9+oU5TnXCdy23tj95UiskiicR50JAW9CZixesQs10ztg== X-Received: by 2002:a05:6a00:198b:b0:47b:ac2d:68f4 with SMTP id d11-20020a056a00198b00b0047bac2d68f4mr21340303pfl.1.1635206474295; Mon, 25 Oct 2021 17:01:14 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:f5e3:5eb1:d5ee:6893]) by smtp.gmail.com with ESMTPSA id b7sm9900747pfm.28.2021.10.25.17.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 17:01:14 -0700 (PDT) From: Stephen Boyd To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Mark Brown , Jaroslav Kysela , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v3 32/34] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Mon, 25 Oct 2021 17:00:42 -0700 Message-Id: <20211026000044.885195-33-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211026000044.885195-1-swboyd@chromium.org> References: <20211026000044.885195-1-swboyd@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use an aggregate driver instead of component ops so that we can get proper driver probe ordering of the aggregate device with respect to all the component devices that make up the aggregate device. Acked-by: Mark Brown Cc: Jaroslav Kysela Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- sound/soc/codecs/wcd938x.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index f0daf8defcf1..6033de7f57ef 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -4316,8 +4316,9 @@ static struct snd_soc_dai_driver wcd938x_dais[] = { }, }; -static int wcd938x_bind(struct device *dev) +static int wcd938x_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); int ret; @@ -4400,8 +4401,9 @@ static int wcd938x_bind(struct device *dev) } -static void wcd938x_unbind(struct device *dev) +static void wcd938x_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct wcd938x_priv *wcd938x = dev_get_drvdata(dev); device_link_remove(dev, wcd938x->txdev); @@ -4411,9 +4413,13 @@ static void wcd938x_unbind(struct device *dev) component_unbind_all(dev, wcd938x); } -static const struct component_master_ops wcd938x_comp_ops = { - .bind = wcd938x_bind, - .unbind = wcd938x_unbind, +static struct aggregate_driver wcd938x_aggregate_driver = { + .probe = wcd938x_bind, + .remove = wcd938x_unbind, + .driver = { + .name = "wcd938x_snd", + .owner = THIS_MODULE, + }, }; static int wcd938x_compare_of(struct device *dev, void *data) @@ -4482,7 +4488,7 @@ static int wcd938x_probe(struct platform_device *pdev) wcd938x_reset(wcd938x); - ret = component_master_add_with_match(dev, &wcd938x_comp_ops, match); + ret = component_aggregate_register(dev, &wcd938x_aggregate_driver, match); if (ret) return ret; @@ -4498,7 +4504,7 @@ static int wcd938x_probe(struct platform_device *pdev) static int wcd938x_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &wcd938x_comp_ops); + component_aggregate_unregister(&pdev->dev, &wcd938x_aggregate_driver); return 0; }