From patchwork Thu Dec 2 22:27:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 519808 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52ABBC43217 for ; Thu, 2 Dec 2021 22:29:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377486AbhLBWc3 (ORCPT ); Thu, 2 Dec 2021 17:32:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377495AbhLBWbz (ORCPT ); Thu, 2 Dec 2021 17:31:55 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEF5C0613BF for ; Thu, 2 Dec 2021 14:28:02 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id nh10-20020a17090b364a00b001a69adad5ebso912304pjb.2 for ; Thu, 02 Dec 2021 14:28:02 -0800 (PST) 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=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=XcKcYyUhIYivc39EjxDzgKxoJpVCSIl6YOFb+f4hLmxGUjyRbTHwoCyL2NtdhV/YdU r7DiT3WhsvI602knCn6FAvxGshi/IAwUHHzhfuGXwXnaW72X5cJFnC7R1yQpr0ZkdD2u kbux2NC5nCXoF6JESch1VN1TvCo5854Z4hPGw= 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=N66rEkaY3Hcvo9L0yTqqS+dEsFgKt6MiGsAE0j7XsvA=; b=Spf3IigEfVw1Rrl9o2JADqWxo5dVmR8oNPgahVgtICY6lEomk8jZGggkDH4Lr2ChlW wGyzzF7FAiCgLenjPb/SWWSdVZnzz+0ao5QfWk4DwdPSffPyRtLVe1Il+0QiLQsLRujC 6hw/dOL5Lhz15RMIP/L46JvKcdqGQCAJiW8kUcQqoaznsBl1721NFNf7OHxv3psDAq/u Tq8pN06ejavgPwtAnqoAHjt+RX1hjwTn25QvF+i207oH+k5Kls9LgCd6XpWQ8BGf6go6 Tws5VzZKawd3VXyOItQIG7mYaZMkp4pDgZghtQnMnFb8vvuCnDyAYzrY89hX+JE/iFuN iaEQ== X-Gm-Message-State: AOAM532k16HDt8ki1Mreea0iu483u3ags9RRtR0YS88OomP6AiBDLSv0 d80NTwl8up255CNk9Yp144qfnQ== X-Google-Smtp-Source: ABdhPJyJAIEeNwFvHrDCG6a6EWCpmwbCAkuRuLpBUFvL5M7qySrlj3aUKw6GslG1dEiODlX+Vq+KTQ== X-Received: by 2002:a17:90b:33cf:: with SMTP id lk15mr9121711pjb.85.1638484081818; Thu, 02 Dec 2021 14:28:01 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:f4f2:1b7e:5aea:bf3c]) by smtp.gmail.com with ESMTPSA id q9sm836934pfj.9.2021.12.02.14.28.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Dec 2021 14:28:01 -0800 (PST) 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 v4 31/34] ASoC: codecs: wcd938x: Migrate to aggregate driver Date: Thu, 2 Dec 2021 14:27:29 -0800 Message-Id: <20211202222732.2453851-32-swboyd@chromium.org> X-Mailer: git-send-email 2.34.0.384.gca35af8252-goog In-Reply-To: <20211202222732.2453851-1-swboyd@chromium.org> References: <20211202222732.2453851-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 52de7d14b139..f44f5d41bfdb 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; }