Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp83213lqp; Mon, 10 Jun 2024 19:35:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfecBlVUoqGWN2/kADNcDzknVQXxA4Tz26Qe5B/LuRsXomebXVWUjNOoRFMzef2GUfqr1bb2h11dlZAwSk8pMP5IpJ8jIGTAem1zNsTw== X-Google-Smtp-Source: AGHT+IHV9qOvGPjl+pPMkDOD0Cq3TjtXArtP4AafinkGj1V6MG9ViTo1G3/63FcmALJ+i/YL/csl X-Received: by 2002:a05:6870:51ce:b0:24f:dc76:f6d2 with SMTP id 586e51a60fabf-2546488b586mr11322045fac.45.1718073320431; Mon, 10 Jun 2024 19:35:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718073320; cv=pass; d=google.com; s=arc-20160816; b=SA0crjIknwM47/MIWL3BwpKWjdwOrOp64qHIfmhuLM0d0zlR/PhJ1x5CHJhyJVrgWx +fvf25w/YKIxEcYIRCTBPLymTP19U7qYT/IQwjLaM6sLqHrFMdzYSv1Zee8mHTGhpe/g 0vwImEBfEZRIATgdmkmePFr97ClNoB6L7z5cGfJL+quUykIJhGByRWa6zyCk9yjFQ139 294JwZObO5OjpjWDOciuXIBRtkAdkle1tniyxhveSKDikATQEgdKL4onncxhZGKpYtjB Is//eW8W/xADmajIFPf8VcPwRgPt2Oa86CR5ZTD1OGAAm9m+w+xBJso3LEKueXKThMF0 ICkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=5Gfi1U2YocN7eKZd+4TAjGD3Blv7pzKIBpTmBX7SoCw=; fh=agjdqWsyT+Jk4OuYBOwLJOXZLXxbq8e8i+5G+s0i1yk=; b=PdmVfACzVTfcO2nTwQ3mCqJTJQ2Xfitf6PgJCDGtIileD6K3qhJaG9auxWQj2QUYQ6 tIk0jebhc+L12W9e1tvaae6tGqdHpRE7ZNBywi8trx7YEJFTwDgxqlJzWETQgOY98Wmq Qn4oXJ6ip725DBWU/j/BkoSmuLNQuDdjUvRPHMxXHUerkWCxX8CFEDNKP3MVa9Vb47jm vwdjW4HkPcpbdI/me/aL5a392YjFPT5jsQX26CdhNzcTnCvcc/KsiaiAHrNs9dcqTbte cJwhAc70S4J6NY9f8GMlsqyIdtQ98gCnueVEsziHnd0muhxRyaGvFup/afk86le+WPm8 OWZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cv0kkC45; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209187-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-70420192aafsi5023082b3a.126.2024.06.10.19.35.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 19:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209187-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cv0kkC45; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209187-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2C39EB22C4D for ; Tue, 11 Jun 2024 02:35:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 226D216F85A; Tue, 11 Jun 2024 02:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Cv0kkC45" Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC0DA16F847; Tue, 11 Jun 2024 02:35:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718073305; cv=none; b=MLhBAN2a5Y/4bPKdBeRWfOt+rovKBTtPNA42vIsPeV8cDFHfjEMaDAWmUMkQoUqeZrqOSE+8Tts02U2CU7Q+6fPWiIq5lorw9D8SY0z8xXK5/YCFcY3nUpsFyiphJEd0XXqCaCCwGDjVim8otY9HVDR5QoqA5hLosMqYDGVEhS8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718073305; c=relaxed/simple; bh=uX23ExG6CnBtKrCFcOoTf4iiV2uXPJwIj4H+fGp/ph8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=L87jCjGmJOe10UKSzQGQ3SW0aZ3WeQg3fZYaBLtI2H0iFaukcAds1ZwF0wINFkF/aRyOpOlYOkxmRU/mvX8a5kFm5b2TIb/zhtGkdpc+dKZe1DruhWeKFsjnylPIIQbPLcOvnu+O3GWJpA2C2YuMujhTNkJmZMNbJBr8qjVisKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Cv0kkC45; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3737dc4a669so3109545ab.0; Mon, 10 Jun 2024 19:35:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718073302; x=1718678102; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5Gfi1U2YocN7eKZd+4TAjGD3Blv7pzKIBpTmBX7SoCw=; b=Cv0kkC45AbIB8qZfkBxjGB/uY47FiMFZ4m/BFpOa806f7BkXLME3lDBp9vER5wzQXb LwBIxi6sBmgjOhG93kzB1dtXb+sxe56ZtwbpcZVquNBHPSfaTG5g0S79Wd0VUkrV81Xw zSNHTZgMEhwG28xwYaQswNaW8rk5yYtHViFe/+pSw63kBP02ytPNXaKhmpSMBa3Hu4BT c1F2d0+KVrSGcTVt5+rR6g6++MWZCftdQ8CAo0/sggVsjUKDx6StSQAkZdsHk0FNaA2u vZWA7ynpyIoKwQEPStrIPAZBUWqnIIw3v8NJdgwAm3e4+fea3a4RLHF4nSPAAmPdNdbQ AMJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718073302; x=1718678102; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Gfi1U2YocN7eKZd+4TAjGD3Blv7pzKIBpTmBX7SoCw=; b=Awg0PF22R6SYi/wbjiIrnzPFZv6ri2KLR2qqO2IN+eh7zFS04qc7wDWhwisNLdgnhV fXhhGisdyNZ2ipC5iARq2HLmLdAlsgvRIGPDK7AJlmzRq7mxYb4Xz7yNXyD6pgpxByoK 2XAk1oymQMqxOlPYDMMUeeJ67Z86dxkivFWroVqbKgQLMk2KwBwJO2D1x1nTDstR2dtK sbyTjbtuXvFDp3kTO1KS52YyjV+48IUDadYZovm7fZL7PrCT1QcxlsB3m0UwK41ugSUG MusXw9s9uRELXyvdkBzjiAb442hpn0HGwOu6Rhqqm6qa+8Q9SkmEmN0BL0xoJykpmApK Gd6w== X-Forwarded-Encrypted: i=1; AJvYcCUrqxG3yyYtwx1Ba+D6wpWhdcIFrPc/5jPLu/6dmKQJiHDWIW9qmt3ml0bii+VgTH3pXakUYZRhRHR+tXdtkDW2HtxR6pUPimP1nJTGho2T+AqlEnmPxSDzR7Tv4JxFDWL2VUnXw5zopWmbwGoBpL7AIR/3vYCwlSk6QSf30HBOEHhOig== X-Gm-Message-State: AOJu0YxGZUVVuVHKtExYT5pXXqhs6HKS0r4mx0CQHM67GKtgKrD/44gW 8IBhTHSNlVDT4f/T94jc8YeqZSzfWa+UFT9gcwa0U2IKFcjRVvD7OAxBWxb7w9DnhRUu3LEWtMQ bV5wl9Kx1ffzR/ns7oKsPNqraX8U= X-Received: by 2002:a92:dac1:0:b0:375:88ec:811b with SMTP id e9e14a558f8ab-37588ec880emr95209215ab.10.1718073301702; Mon, 10 Jun 2024 19:35:01 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1717036278-3515-1-git-send-email-shengjiu.wang@nxp.com> <1717036278-3515-3-git-send-email-shengjiu.wang@nxp.com> <20240530085115.ttmzx4dve4x6nep2@pengutronix.de> In-Reply-To: <20240530085115.ttmzx4dve4x6nep2@pengutronix.de> From: Shengjiu Wang Date: Tue, 11 Jun 2024 10:34:50 +0800 Message-ID: Subject: Re: [PATCH v6 2/5] clk: imx: clk-audiomix: Add reset controller To: Marco Felsch Cc: Shengjiu Wang , p.zabel@pengutronix.de, abelvesa@kernel.org, peng.fan@nxp.com, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, marex@denx.de, linux-clk@vger.kernel.org, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, May 30, 2024 at 4:51=E2=80=AFPM Marco Felsch wrote: > > On 24-05-30, Shengjiu Wang wrote: > > Audiomix block control can be a reset controller for > > Enhanced Audio Return Channel (EARC), which is one of > > modules in this audiomix subsystem. > > > > The reset controller is supported by the auxiliary device > > framework. > > > > Signed-off-by: Shengjiu Wang > > Reviewed-by: Frank Li > > --- > > drivers/clk/imx/Kconfig | 1 + > > drivers/clk/imx/clk-imx8mp-audiomix.c | 60 +++++++++++++++++++++++++++ > > 2 files changed, 61 insertions(+) > > > > diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig > > index 6da0fba68225..9edfb030bea9 100644 > > --- a/drivers/clk/imx/Kconfig > > +++ b/drivers/clk/imx/Kconfig > > @@ -81,6 +81,7 @@ config CLK_IMX8MP > > tristate "IMX8MP CCM Clock Driver" > > depends on ARCH_MXC || COMPILE_TEST > > select MXC_CLK > > + select AUXILIARY_BUS > > help > > Build the driver for i.MX8MP CCM Clock Driver > > > > diff --git a/drivers/clk/imx/clk-imx8mp-audiomix.c b/drivers/clk/imx/cl= k-imx8mp-audiomix.c > > index b381d6f784c8..a3dc2f3606ee 100644 > > --- a/drivers/clk/imx/clk-imx8mp-audiomix.c > > +++ b/drivers/clk/imx/clk-imx8mp-audiomix.c > > @@ -5,6 +5,7 @@ > > * Copyright (C) 2022 Marek Vasut > > */ > > > > +#include > > #include > > #include > > #include > > @@ -13,6 +14,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -217,6 +219,60 @@ struct clk_imx8mp_audiomix_priv { > > struct clk_hw_onecell_data clk_data; > > }; > > > > +#if IS_ENABLED(CONFIG_RESET_CONTROLLER) > > + > > +static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev) > > +{ > > + struct auxiliary_device *adev =3D _adev; > > + > > + auxiliary_device_delete(adev); > > + auxiliary_device_uninit(adev); > > +} > > + > > +static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev) > > +{ > > + struct auxiliary_device *adev =3D to_auxiliary_dev(dev); > > + > > + kfree(adev); > > +} > > + > > +static int clk_imx8mp_audiomix_reset_controller_register(struct device= *dev, > > + struct clk_imx8m= p_audiomix_priv *priv) > > +{ > > + struct auxiliary_device *adev __free(kfree) =3D NULL; > > + int ret; > > Since the reset-controller is optional you need to check the existence > of the '#reset-cells' property before you register it. > ok, will add it. best regards Shengjiu Wang > Regards, > Marco > > > + > > + adev =3D kzalloc(sizeof(*adev), GFP_KERNEL); > > + if (!adev) > > + return -ENOMEM; > > + > > + adev->name =3D "reset"; > > + adev->dev.parent =3D dev; > > + adev->dev.release =3D clk_imx8mp_audiomix_reset_adev_release; > > + > > + ret =3D auxiliary_device_init(adev); > > + if (ret) > > + return ret; > > + > > + ret =3D auxiliary_device_add(adev); > > + if (ret) { > > + auxiliary_device_uninit(adev); > > + return ret; > > + } > > + > > + return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_un= register_adev, > > + no_free_ptr(adev)); > > +} > > + > > +#else /* !CONFIG_RESET_CONTROLLER */ > > + > > +static int clk_imx8mp_audiomix_reset_controller_register(struct clk_im= x8mp_audiomix_priv *priv) > > +{ > > + return 0; > > +} > > + > > +#endif /* !CONFIG_RESET_CONTROLLER */ > > + > > static void clk_imx8mp_audiomix_save_restore(struct device *dev, bool = save) > > { > > struct clk_imx8mp_audiomix_priv *priv =3D dev_get_drvdata(dev); > > @@ -337,6 +393,10 @@ static int clk_imx8mp_audiomix_probe(struct platfo= rm_device *pdev) > > if (ret) > > goto err_clk_register; > > > > + ret =3D clk_imx8mp_audiomix_reset_controller_register(dev, priv); > > + if (ret) > > + goto err_clk_register; > > + > > pm_runtime_put_sync(dev); > > return 0; > > > > -- > > 2.34.1 > > > > > >