Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1447907rdb; Tue, 30 Jan 2024 21:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHO48jNj15viAcEH7B8sXJ+gkI3s+PHI7BPkfGSShKQW1lXEnapnjUlmheJJdOKqlgMsSuO X-Received: by 2002:a2e:a163:0:b0:2cf:2d44:ee1a with SMTP id u3-20020a2ea163000000b002cf2d44ee1amr338335ljl.36.1706677506043; Tue, 30 Jan 2024 21:05:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706677506; cv=pass; d=google.com; s=arc-20160816; b=Lc9thigpogj7+LSA3q9IWzEUnczLSOhNFs6BwLEmAdE6qwrnpua/RV1rHvAIMN7Ahj KOwOc8P9tW+7vhvhFBvIYHJavrQJbQB3xXNRhfjRykDPLXEsOi159F3rkdWRN2YKPnTH uUKCbYpPvOm0vw5msX3bXRTclkjnQwBE7NBGG2J70QHbuhcXOC/onqdV4/BqQzcPYCDY yNU1L161exn+CBlfPhkrHaKOZ1iY2diFd7hDnRSB8OGqJxCSOGtSFSyYHrF5f2qUHxsR 2RvoWeFmn8V6i3FjaaNzBNUzM9cJl3JzbeJmcYLH8wDWECA5w0HHe9qGQAD1g3tfCZMF Cf6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:dlp-filter:cms-type:content-language:thread-index :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject :in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=gsvbIOyOSrjMUXayJMmPPRCKGWsgCiQGBNQtMy3C5Aw=; fh=ksA4XU03x28BDKr4nCd5AdsOxlmtURQH9QN0sF1051g=; b=AktS2XdSOEMFUq096LW7j9/ugU5ryzbR0mMI7yVhgDfN6jV+16HdqE+ZOsmJ6DJCB2 kBouqBxkGS0ns02cItnrzxoR8q4X10qnPP5hrbWz9ta7c14qJTpBdxbfSUBJt078KUsd 0j0m22vcC+Pt47TG8tGgUs0WaCIvD5AAL9Me1zN5VgVVCOqW+4P38c5YiQqo7YfrsJ9P /MWlq0AwN0E/HabWDan6lVsrw7Bqeb2Z4jji9HJJ4OzPei/nXBpm8rV6+mtAWN4e0r5O zit4z3xtqp4L6IQTRsbGKdjBcEIpf7VWHbjJNnycOSu80Fsdu+fTmsEy36ZRAg4WQZj9 c0Cg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="C/6DBw1b"; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-45753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=1; AJvYcCWbmDn5PUkbNHwuR7Fy0HSqhCaACYN9CxZ3NqGpAEXRAzXihB/EVR+XRYeA5UulD2ZDyMc96e7VTFlHAnIVXT9KkFUOxSYE6ggiMaRDew== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l8-20020a056402344800b0055f33433716si1583077edc.36.2024.01.30.21.05.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 21:05:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="C/6DBw1b"; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-45753-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45753-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9B95E1F26434 for ; Wed, 31 Jan 2024 05:05:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BD753D0BD; Wed, 31 Jan 2024 05:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="C/6DBw1b" Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FDAD3D386 for ; Wed, 31 Jan 2024 05:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.254.224.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706677489; cv=none; b=s2cuoZ8IqqH/oIGdeAGwc2W2NjgW/w8wZmUH4wyRMcBZSAmGn6MGD4UYB9LNjtLaC6zewvUM2RYJlw5IqR5uLsmpxCxxc2odK2iiKSx70BSjnuDPL6ly6DkqajJ4NdXMhxRflmBLmbvhEhlfQlVQIaidv3b4SxY57NYcncHH2HQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706677489; c=relaxed/simple; bh=ozsbjuFfrDrel1zvIqWJ+Px1N3BXsFW7a0mQarbNt40=; h=From:To:Cc:In-Reply-To:Subject:Date:Message-ID:MIME-Version: Content-Type:References; b=X/JY0doaIDD5tmsUTrm82aoLBpDzHNhBxLtK8pXpoBkQ5lxs8AQG1S0Q8Ak+B9Cjm7dklFCAAirHd1bk047UOSg+sU6QmQqV0z4wBc+TPhJhm5/ouwe/Ueye4xcGU3UCQtMbycBGJH9QGQJ6EMLbFBa4ZsUijpLfd8d86RiWnRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=C/6DBw1b; arc=none smtp.client-ip=203.254.224.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20240131050444epoutp0497b153b5d494e0683f59db6611e0ef7f~vViEtYu6d2334223342epoutp04L for ; Wed, 31 Jan 2024 05:04:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20240131050444epoutp0497b153b5d494e0683f59db6611e0ef7f~vViEtYu6d2334223342epoutp04L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1706677484; bh=gsvbIOyOSrjMUXayJMmPPRCKGWsgCiQGBNQtMy3C5Aw=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=C/6DBw1bxMVG5f5WoK4u3lOPBD1QhtRpbnNU1FGaYYWrqSgShVQpPiIhwtVdmZUmR DIzoJdJ4A9m8wOjGCYwR1BKnvgnWu5UrIJQO0LTS4RoQd6/5whR8zt8QwxjkG8m4U+ MHLBCYMIHQBxO5CTxkEodGNnRP4jcBSreoVoPNRM= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20240131050443epcas5p46e1e2a1232f33e77123606dc2574df3a~vViEVV9AP0567105671epcas5p4b; Wed, 31 Jan 2024 05:04:43 +0000 (GMT) Received: from epsmgec5p1new.samsung.com (unknown [182.195.38.180]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4TPqhp1cR7z4x9QD; Wed, 31 Jan 2024 05:04:42 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmgec5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 10.39.08567.AE4D9B56; Wed, 31 Jan 2024 14:04:42 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20240131050441epcas5p1854fb3d30778fa7033a920d4a207662c~vViB8sDBR1292912929epcas5p13; Wed, 31 Jan 2024 05:04:41 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240131050441epsmtrp23a454530efc67a243c01ef85ad6bdbf5~vViB7px8B0527905279epsmtrp2I; Wed, 31 Jan 2024 05:04:41 +0000 (GMT) X-AuditID: b6c32a44-c1e3da8000002177-e2-65b9d4eabdbd Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 28.6C.08755.9E4D9B56; Wed, 31 Jan 2024 14:04:41 +0900 (KST) Received: from INBRO000447 (unknown [107.122.12.5]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240131050438epsmtip1bc422215090eb3317c9da112fce8166d~vVh-YEDJ21904719047epsmtip17; Wed, 31 Jan 2024 05:04:38 +0000 (GMT) From: "Alim Akhtar" To: "'Shradha Todi'" , , , , , Cc: , , , , , , , , , , , In-Reply-To: <20240124103838.32478-2-shradha.t@samsung.com> Subject: RE: [PATCH v4 1/2] clk: Provide managed helper to get and enable bulk clocks Date: Wed, 31 Jan 2024 10:34:37 +0530 Message-ID: <009b01da5402$ff3370c0$fd9a5240$@samsung.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQIcpPks/WB953w72Rl3v8cfkz9jJgG3GiapAsOufW6wSuUg0A== Content-Language: en-us X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJsWRmVeSWpSXmKPExsWy7bCmlu6rKztTDTqbWSyWNGVYrPgyk91i 7+ut7BYNPb9ZLTY9vsZq8bHnHqvF5V1z2CzOzjvOZjHj/D4mi0NT9zJatPxpYbFYe+Quu8Xd lk5Wi4unXC0Wbf3CbvF/zw52i3/XNrJY9B6udRDyuHztIrPH+xut7B47Z91l91iwqdRj06pO No871/aweTy5Mp3JY/OSeo++LasYPT5vkgvgisq2yUhNTEktUkjNS85PycxLt1XyDo53jjc1 MzDUNbS0MFdSyEvMTbVVcvEJ0HXLzAH6SEmhLDGnFCgUkFhcrKRvZ1OUX1qSqpCRX1xiq5Ra kJJTYFKgV5yYW1yal66Xl1piZWhgYGQKVJiQnfFm8XXWghvKFUc2r2JuYFwq28XIwSEhYCLx Z4NgFyMXh5DAbkaJbVvOskI4nxglfn49wgjhfGOUuLhoF3MXIydYx7K9k9ghEnsZJfZ8P8wM 4bxglHhzZiMLSBWbgK7EjsVtbCAJEYHrjBJfvq9iAXGYBXYzSbzd9YMRpIpTwFpi5qpusA5h gXCJyd96mUBsFgFViVNvJrGC2LwClhLzmvYyQtiCEidnPgGrZxbQlli28DXUTQoSP58uA6sX EXCSmPnjKlSNuMTLo0fAbpUQ+M8hcf3XYSaIBheJ7TfOs0HYwhKvjm9hh7ClJD6/28sGCRoP iUV/pCDCGRJvl69nhLDtJQ5cmcMCUsIsoCmxfpc+xCo+id7fT5ggOnklOtqEIKpVJZrfQVwj ISAtMbG7mxXC9pBYOqOfeQKj4iwkj81C8tgsJA/MQli2gJFlFaNkakFxbnpqsmmBYV5qOTzC k/NzNzGCE7y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LGFlWMUqmFhTnpucWGxYY5qWW 6xUn5haX5qXrJefnbmIEx7mW5g7G7as+6B1iZOJgPMQowcGsJMK7Um5nqhBvSmJlVWpRfnxR aU5q8SFGaQ4WJXFe8Re9KUIC6YklqdmpqQWpRTBZJg5OqQamdU1qOxMWhv978cC6I0iLufPh pe52sVSZZTyxGpfC9kn92prF7nm6TNmknlVfYv1hnpKPcypeTBLjqK+ZbG2l5X/dqimw4+kn 0wsehWdPB56ayvuUv+OlWXjh2yB3iUP3U/wLbhc7u/6ZN7HjTWaPf09LsEgDI/9mlo07hGu5 ZoXyr0351Ps69Fae56qEdQU/bDWPWvPxSS1LT7H8MrVAI/azhw6n3i8rphlOxxjvbckK73/8 aXZiiP7TTt478ru+C6zTlmF5ZdI+P+Sy5HrZkPjgY7M9DimEvfXtP5i29p7i7V8bxFLWt15a UXb6xc3m7/16M/9rZn13lX09yzP88N1/9ZGON9ZdnHCxaaUSS3FGoqEWc1FxIgDKZv07YgMA AA== X-CMS-MailID: 20240131050441epcas5p1854fb3d30778fa7033a920d4a207662c X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20240124103855epcas5p27400bd95df42f36b9547a4e28aa26f5d References: <20240124103838.32478-1-shradha.t@samsung.com> <20240124103838.32478-2-shradha.t@samsung.com> Hi Shradha > -----Original Message----- > From: Shradha Todi > Sent: Wednesday, January 24, 2024 4:09 PM > To: linux-clk=40vger.kernel.org; linux-kernel=40vger.kernel.org; linux- > pci=40vger.kernel.org; linux-arm-kernel=40lists.infradead.org; linux-sams= ung- > soc=40vger.kernel.org > Cc: mturquette=40baylibre.com; sboyd=40kernel.org; jingoohan1=40gmail.com= ; > lpieralisi=40kernel.org; kw=40linux.com; robh=40kernel.org; > bhelgaas=40google.com; krzysztof.kozlowski=40linaro.org; > alim.akhtar=40samsung.com; linux=40armlinux.org.uk; > m.szyprowski=40samsung.com; manivannan.sadhasivam=40linaro.org; > pankaj.dubey=40samsung.com; Shradha Todi > Subject: =5BPATCH v4 1/2=5D clk: Provide managed helper to get and enable= bulk > clocks >=20 > Provide a managed devm_clk_bulk* wrapper to get and enable all bulk clock= s > in order to simplify drivers that keeps all clocks enabled for the time o= f driver > operation. >=20 > Suggested-by: Marek Szyprowski > Signed-off-by: Shradha Todi > --- Reviewed-by: Alim Akhtar > drivers/clk/clk-devres.c =7C 40 > ++++++++++++++++++++++++++++++++++++++++ > include/linux/clk.h =7C 24 ++++++++++++++++++++++++ > 2 files changed, 64 insertions(+) >=20 > diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c index > 4fb4fd4b06bd..cbbd2cc339c3 100644 > --- a/drivers/clk/clk-devres.c > +++ b/drivers/clk/clk-devres.c > =40=40 -182,6 +182,46 =40=40 int __must_check devm_clk_bulk_get_all(struc= t > device *dev, =7D EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all); >=20 > +static void devm_clk_bulk_release_all_enable(struct device *dev, void > +*res) =7B > + struct clk_bulk_devres *devres =3D res; > + > + clk_bulk_disable_unprepare(devres->num_clks, devres->clks); > + clk_bulk_put_all(devres->num_clks, devres->clks); =7D > + > +int __must_check devm_clk_bulk_get_all_enable(struct device *dev, > + struct clk_bulk_data **clks) =7B > + struct clk_bulk_devres *devres; > + int ret; > + > + devres =3D devres_alloc(devm_clk_bulk_release_all_enable, > + sizeof(*devres), GFP_KERNEL); > + if (=21devres) > + return -ENOMEM; > + > + ret =3D clk_bulk_get_all(dev, &devres->clks); > + if (ret > 0) =7B > + *clks =3D devres->clks; > + devres->num_clks =3D ret; > + =7D else =7B > + devres_free(devres); > + return ret; > + =7D > + > + ret =3D clk_bulk_prepare_enable(devres->num_clks, *clks); > + if (=21ret) =7B > + devres_add(dev, devres); > + =7D else =7B > + clk_bulk_put_all(devres->num_clks, devres->clks); > + devres_free(devres); > + =7D > + > + return ret; > +=7D > +EXPORT_SYMBOL_GPL(devm_clk_bulk_get_all_enable); > + > static int devm_clk_match(struct device *dev, void *res, void *data) = =7B > struct clk **c =3D res; > diff --git a/include/linux/clk.h b/include/linux/clk.h index > 1ef013324237..a005e709b7bd 100644 > --- a/include/linux/clk.h > +++ b/include/linux/clk.h > =40=40 -438,6 +438,23 =40=40 int __must_check > devm_clk_bulk_get_optional(struct device *dev, int num_clks, int > __must_check devm_clk_bulk_get_all(struct device *dev, > struct clk_bulk_data **clks); >=20 > +/** > + * devm_clk_bulk_get_all_enable - managed get multiple clk consumers > and > + * enable all clks > + * =40dev: device for clock =22consumer=22 > + * =40clks: pointer to the clk_bulk_data table of consumer > + * > + * Returns success (0) or negative errno. > + * > + * This helper function allows drivers to get several clk > + * consumers and enable all of them in one operation with management. > + * The clks will automatically be disabled and freed when the device > + * is unbound. > + */ > + > +int __must_check devm_clk_bulk_get_all_enable(struct device *dev, > + struct clk_bulk_data **clks); > + > /** > * devm_clk_get - lookup and obtain a managed reference to a clock > producer. > * =40dev: device for clock =22consumer=22 > =40=40 -960,6 +977,13 =40=40 static inline int __must_check > devm_clk_bulk_get_all(struct device *dev, > return 0; > =7D >=20 > +static inline int __must_check devm_clk_bulk_get_all_enable(struct devic= e > *dev, > + struct clk_bulk_data **clks) > +=7B > + > + return 0; > +=7D > + > static inline struct clk *devm_get_clk_from_child(struct device *dev, > struct device_node *np, const char *con_id) > =7B > -- > 2.17.1