Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp662876pxb; Wed, 6 Oct 2021 12:41:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHRaaVdcsiWf2PeGnRpJzmOSa4Vh5ixfcOzdIQVP2sWI56/qkh7o03lokJ5BShQjT5wKgu X-Received: by 2002:a62:4d42:0:b0:44b:3078:7387 with SMTP id a63-20020a624d42000000b0044b30787387mr186883pfb.27.1633549298043; Wed, 06 Oct 2021 12:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633549298; cv=none; d=google.com; s=arc-20160816; b=ClMzvE+hOBMiEkXndIWzn2SpkefeAoN4p5yPzXCZ0mp6H1gg5jGtAjMsb5zzPO6DXZ YpJ6So83wTIy5soEMpJ91gzVq0e4VutKUtrX0uwKiTNcDUHqLPT179Hv/sCrDb3mUMDe XyEROaAp7mvwzY87cVoNw1bpQGjCkz9OxmLO2sWJpRjSSlyt/mLvPC3cRNVhZZU+//vc wISLmbuIVA0PpD/4P4oGYgalOz8lvjItC764+XMIPlSLFICzUqxeIZ1yCX/xRGPzdsgk pqHFl1YiKPvW+CCuqF9Q11ZL8eCtRiDIhNDxrvsqPXTTaOTLZEFvN/ZZauaCeiqiXyOG an6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=1Fd82cNedrk29I+a1Kr8YzefUQPHzYfxGgdVrU2QAsKHYX6QAKuXK9JjEFb9lHgbdA amHb+stCgN16vQAYw19XhI5SzTx/5GcreA+8jV1Q1mpfhNDHxzPSBurE83cdfxhFvQA2 ywC/2HV66FlzKLz+AjpQIFLHw0Xb518Mo63/abM8CxhMfbDAqFlh23L0DiFpwXLTCzdP fB9wiwga5EDGdCdlTVoYeIRZGFlybeu+ynj820mMJmtvOisy4/mVtXx+bDgf5EOR9ldx FXY6aYY/7XlyYYIxQJHs6xB1ElCZfKW4X4nIZN8D5DY7We5Pxx6crIXNF6+Hdr0YbMnf 2VnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DW8Rq7I4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si36828984plh.151.2021.10.06.12.41.25; Wed, 06 Oct 2021 12:41:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@chromium.org header.s=google header.b=DW8Rq7I4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239678AbhJFTmU (ORCPT + 99 others); Wed, 6 Oct 2021 15:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239814AbhJFTlv (ORCPT ); Wed, 6 Oct 2021 15:41:51 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4ADDC06139D for ; Wed, 6 Oct 2021 12:38:58 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 133so3430519pgb.1 for ; Wed, 06 Oct 2021 12:38:58 -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=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=DW8Rq7I48xcvXfJwO7zkXFQduC0Ire4Rm/IUtLp2n5907rSjR5g3Ms15Gszi401quM XqjUBmfR0/WPu9fvux4hZDn8BRL79KCrhOTEhLR93sv6dm5LaN8m6Ey4spGKOAmhEd1H XQcWnWYhbhQPQ898DqOITmZobQar+DzEmVh7Q= 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=8jRHJbzxJCo8C1IXTJW3KiTq5EwC3cp5SncHLYDZJzc=; b=Y8O6RNlIX90S7hS6+7+l1rHrvO280FnGL9moXG9Cih1TM2dXJmQhm73+hzZVE+s6IE PwU6JnUqlQ2lmjdTgaayOcijdtTDVLXopDUnF5chHlpwF9fdvoOIQBP9XQk5Y/EhsLQ6 +FBFmXzGzqWdaSTdhJP3rPsNR45NVLmT6D2f8P0gBIwSa6cwXvm6unVaSmDFiLMuonlo 8aZ9z+BJjzWeoWjCEuTK+dF9bjlxTnQtLp+K+109Mu2hsZc+KIJdOBGQMnutlp7r9yiR pWhF2fPWGdhXwIz1jpGrXx/X0bXcppN5yWaRhdYIhXHBU83Aw5IEhTimLc9EB9JHcmqr VTlA== X-Gm-Message-State: AOAM531B4Hm2BA23+RCb4PNNWl2VH9pMyO+lGfbx2m/RCgkTt66OgLPZ /VjHGrRlN9BDmwzRqb9Z3hv8rhPGQ7YlwQ== X-Received: by 2002:a63:5717:: with SMTP id l23mr445293pgb.87.1633549138330; Wed, 06 Oct 2021 12:38:58 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:d412:c5eb:4aca:4738]) by smtp.gmail.com with ESMTPSA id o14sm22011296pfh.84.2021.10.06.12.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 12:38:58 -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, Jaroslav Kysela , Takashi Iwai , Kai Vehmanen , Daniel Vetter , "Rafael J. Wysocki" , Rob Clark , Russell King , Saravana Kannan Subject: [PATCH v2 30/34] sound: hdac: Migrate to aggregate driver Date: Wed, 6 Oct 2021 12:38:15 -0700 Message-Id: <20211006193819.2654854-31-swboyd@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006193819.2654854-1-swboyd@chromium.org> References: <20211006193819.2654854-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Kai Vehmanen Cc: Daniel Vetter Cc: "Rafael J. Wysocki" Cc: Rob Clark Cc: Russell King Cc: Saravana Kannan Signed-off-by: Stephen Boyd --- sound/hda/hdac_component.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index bb37e7e0bd79..9e4dab97f485 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c @@ -181,8 +181,9 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, } EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); -static int hdac_component_master_bind(struct device *dev) +static int hdac_component_master_bind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_audio_component *acomp = hdac_get_acomp(dev); int ret; @@ -222,8 +223,9 @@ static int hdac_component_master_bind(struct device *dev) return ret; } -static void hdac_component_master_unbind(struct device *dev) +static void hdac_component_master_unbind(struct aggregate_device *adev) { + struct device *dev = adev->parent; struct drm_audio_component *acomp = hdac_get_acomp(dev); if (acomp->audio_ops && acomp->audio_ops->master_unbind) @@ -233,9 +235,13 @@ static void hdac_component_master_unbind(struct device *dev) WARN_ON(acomp->ops || acomp->dev); } -static const struct component_master_ops hdac_component_master_ops = { - .bind = hdac_component_master_bind, - .unbind = hdac_component_master_unbind, +static struct aggregate_driver hdac_aggregate_driver = { + .probe = hdac_component_master_bind, + .remove = hdac_component_master_unbind, + .driver = { + .name = "hdac_agg", + .owner = THIS_MODULE, + }, }; /** @@ -303,8 +309,7 @@ int snd_hdac_acomp_init(struct hdac_bus *bus, devres_add(dev, acomp); component_match_add_typed(dev, &match, match_master, bus); - ret = component_master_add_with_match(dev, &hdac_component_master_ops, - match); + ret = component_aggregate_register(dev, &hdac_aggregate_driver, match); if (ret < 0) goto out_err; @@ -344,7 +349,7 @@ int snd_hdac_acomp_exit(struct hdac_bus *bus) bus->display_power_active = 0; bus->display_power_status = 0; - component_master_del(dev, &hdac_component_master_ops); + component_aggregate_unregister(dev, &hdac_aggregate_driver); bus->audio_component = NULL; devres_destroy(dev, hdac_acomp_release, NULL, NULL); -- https://chromeos.dev