Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp757928pxb; Fri, 28 Jan 2022 09:19:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJSkyy3STNIexFIkX2//H60Vvu9S+LJCcFNNJ3ddWksokPu8op/hyhU2hdSHB1Bmanoslt X-Received: by 2002:a63:2c16:: with SMTP id s22mr7303059pgs.297.1643390350672; Fri, 28 Jan 2022 09:19:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643390350; cv=none; d=google.com; s=arc-20160816; b=Y8+NhrAAXoeAR1BaOyTo0z6UTbDBlOQqV5lrKNjuVrfLR2WrZc6L45u85AJ3jIFSRC g/pbpfip2oSFrbU32Be15G9CYjEQbQscDB2KU8GuFlIf+1PMviV428QjhUdRnJY80CaF G43yAqRtBi4tRJ7UpXE4SLNRzGbhluWUHYKq/hHeNPJ6srRJntq8pj4uGCDwmcPRFmJ1 jCZVBmpzxE3/E/S5N4xEgWBopihM7vTGQKEN22KBT/jrLjrb8OMdosernXpCKTYtrPLM NegqtlWwYN2IGFIuWa9/dN/0lkH32HsHaMwnqt7eQg+f9KrfQKydBhHbfRj3BohSm7C5 jzKg== 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=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=uoykLCQkRIL/Ppwpg67CxTmiZu2RM/sH8Fjzj9dvQilj8Ek5ESdORuqB/MbyojU+JI uysbyuv3LV0e+V46zohZNzN2aNtEYv7cLvaxglS5AnTKXG1uMoly+j7X781XNtIqS8D3 L5sIbtBX2yyNvGgqG7yur/xwIvByUeAYw35HhdyAelZO59q3GnQSpCvdyYqqRVRBhOch qAWre7k6cHZnIWm+Ntc0omYnAVeE+iduDzOrbFxww2AuI3GhemENMPAOfi9dfSNikFAQ RQ5dhVIJJZUrjnFJKhU4s121EeBLjMp6TGMConqorWryab5yZg2U3yhOrQ0XJxfedGa9 DRKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=MXoXAgK1; 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 e2si6063647pgp.559.2022.01.28.09.18.58; Fri, 28 Jan 2022 09:19:10 -0800 (PST) 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=MXoXAgK1; 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 S230438AbiA0UDE (ORCPT + 99 others); Thu, 27 Jan 2022 15:03:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343856AbiA0UCf (ORCPT ); Thu, 27 Jan 2022 15:02:35 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7B10C06174A for ; Thu, 27 Jan 2022 12:02:33 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id 133so3283484pgb.0 for ; Thu, 27 Jan 2022 12:02:33 -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=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=MXoXAgK1oy6andcq7Ev9jdik2AL8qv5c3I8xi0/e6YDPc830v2J7hy32iT3ICQBJ8J xy09VzT9Yn29S+RdgW2+6hsABDgU6UyFNOGBLRCszHxFQFq6dKmKLilaT6sUw4r9sdt7 c29EGPbcTtzKRF4KZrDHS+Z347DLhk07qht9s= 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=ka5n0VIFlCANZbv+1O6BEaBIrpT2TSivDZEr/FN1kY8=; b=SIS4uSpx0QmIC9JPvV0HpJ0qdEP7f0mcmMW1e6uNvTKQKcx1QgifP+3hKHfXmt9kaX NxDrat7RoJ4KRIB0iGLyQNAS1qjkJWCjSLjxLoIzjyn+iOKfy/jrU0+ZHkqs2Xqa8BSY SuEhBNRNy9TWKhMYQN+3EhDURZWyk/JgwYUSfQvXRalzkWVkR6EKLvYAIjtJOClu4XOe Ey06IbugX2paKQX2dRqR+RSEB0lJEUQXkNZTOtvurI3hK6Op4GL0QJihMfjZBVtAXcmx ekCYNcOcKth9nyQ0buvu2Uw10OJqsv71m3GPonvExFrVdfebvWNWTsFj8RiFNCEBqZND b85Q== X-Gm-Message-State: AOAM533vxivyzFdiScTCOsGCZQNY3fi9j747G80SJWCfOaclEpXCDSAw Xcy+azZRtSE2fUf0gyAHjBNRUQ== X-Received: by 2002:a63:2d86:: with SMTP id t128mr3994596pgt.200.1643313753420; Thu, 27 Jan 2022 12:02:33 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:9246:1838:3243:3071]) by smtp.gmail.com with ESMTPSA id k21sm6561190pff.33.2022.01.27.12.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 12:02:33 -0800 (PST) From: Stephen Boyd To: Greg Kroah-Hartman , Douglas Anderson 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 v6 29/35] sound: hdac: Migrate to aggregate driver Date: Thu, 27 Jan 2022 12:01:35 -0800 Message-Id: <20220127200141.1295328-30-swboyd@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog In-Reply-To: <20220127200141.1295328-1-swboyd@chromium.org> References: <20220127200141.1295328-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..4ec5d9bf8533 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 = aggregate_device_parent(adev); 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 = aggregate_device_parent(adev); 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