From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (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 5E6AF2101AD for ; Wed, 22 Jan 2025 11:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737545202; cv=none; b=jYmh1DSpU41ARvabOcWUDwVkSY/m2n1fDl678nj3qDX+rYb1hZsOf6+R9rGRywLXkR1ccQ5sA97aFrgKOJ4IlT69ie2y2Y1ZQ2by9NwIxYmflFWacqKIkhvTHReprSSEfwvpzx03SjE7J3AcLqPaTky6Ll3HJrgAnVsS97LhM0M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737545202; c=relaxed/simple; bh=R6yxEUhyubvOsFVz8IsmZuJrGI9PILOm3emog28fWcc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:From:In-Reply-To: Content-Type:References; b=OI2ArKLS+gk8eTt2X0hbdQP/N/x1GYeulwBGvLh26/xaK+P3mpam7APDw6DMmey06Bx3axT2fAU4/AMhb/8At0sCGziqnulPe/FtGKMrjA+H4O0fGLDQc5iAkpXW1T/geRCDLwUjdsG5Reswex46XrLAfNCRkShTnNWKV+unl0M= 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=DepA5Nlq; arc=none smtp.client-ip=210.118.77.12 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="DepA5Nlq" Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20250122112638euoutp02e3673c0dcbc56e938024065b26ed69d8~dACbzHGj70745007450euoutp02b for ; Wed, 22 Jan 2025 11:26:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20250122112638euoutp02e3673c0dcbc56e938024065b26ed69d8~dACbzHGj70745007450euoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1737545198; bh=OzxWzg2x4Cwra8cOzJYDj90iXRfkcTkglD4PrGOpiHg=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=DepA5NlqeUt02ysoT0EcLIYirtddGNlMSRjc67BsvcDGplQDsI1M7dCKFmH+oSFYF /jg6JFeP/oC2+lrwY7gWCmvWX3HXs48G7Z9huQwo+SxFtjBeonTmvo/ljhuBa93r00 SmP5aTDLGAB9Y5Eat1EqBkaHkC4URyZ/p225y7ZA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20250122112638eucas1p2f059d8a9c27573ee8c32779c005dfda6~dACbU8nb_2646526465eucas1p2Z; Wed, 22 Jan 2025 11:26:38 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 00.E9.20409.DE5D0976; Wed, 22 Jan 2025 11:26:37 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20250122112637eucas1p162414679b12de45b2ee26ba1e486012a~dACa1rwpX0353603536eucas1p1L; Wed, 22 Jan 2025 11:26:37 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20250122112637eusmtrp1661b45e773e44a602e6c9802c17c36fb~dACa0lb0T1389913899eusmtrp1Z; Wed, 22 Jan 2025 11:26:37 +0000 (GMT) X-AuditID: cbfec7f4-c39fa70000004fb9-22-6790d5edcf8d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7C.11.19920.DE5D0976; Wed, 22 Jan 2025 11:26:37 +0000 (GMT) Received: from [192.168.1.44] (unknown [106.210.136.40]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20250122112636eusmtip23592639f5b607ab9234dcf41545997a5~dACZigDrR0994809948eusmtip2S; Wed, 22 Jan 2025 11:26:36 +0000 (GMT) Message-ID: <9039d98b-ea3b-401a-804c-8c60ec714b99@samsung.com> Date: Wed, 22 Jan 2025 12:26:35 +0100 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC v3 05/18] pmdomain: thead: Add power-domain driver for TH1520 To: Krzysztof Kozlowski Cc: mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, drew@pdp7.com, guoren@kernel.org, wefu@redhat.com, jassisinghbrar@gmail.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, frank.binns@imgtec.com, matt.coster@imgtec.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, ulf.hansson@linaro.org, jszhang@kernel.org, p.zabel@pengutronix.de, m.szyprowski@samsung.com, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-pm@vger.kernel.org Content-Language: en-US From: Michal Wilczynski In-Reply-To: <508d6120-53df-4db1-ab62-5f4c49358cbf@kernel.org> Content-Transfer-Encoding: 7bit X-Brightmail-Tracker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KLSnNTiQ4ymwJCYyCwlmpwPTJx5JfGGZgamhiZmlgamlmbG SuK8bpfPpwkJpCeWpGanphakFsH0MXFwSjUwaVebRzd5u/z82cZ9v73A72d9WdicU3unRiff qvIQqb+pcu9qVu/TsuTXK/3SmVteTItzqc29/K1c68fRwoTMyzmm5wxeb7G9/M7Gc1+DYPb2 /fNFwvr3NP1awST2ZUqu65UdfueffT7kYvh1zoapnxj4nas/C1oELznjPGHt5tNKOtmLP6q/ m2U6/9v7NM9jC63rUxeeD/OQsmzNT/No673U5DrRcJXZk+DoTQX3bl1jv5nb/HiyE/dNrbsx B70zDTKXdt2+alaV9vW1H8st5kd5j3tYA36ovv+xo/hfk1bS5GtXui8ev+bhe5jL7Z7Wpa+P ngUyMP/h3LDx7auP8hduKq6ufjj12OaAN0+mnlBiKc5INNRiLipOBAA7w6co5AMAAA== X-CMS-MailID: 20250122112637eucas1p162414679b12de45b2ee26ba1e486012a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20250120172125eucas1p141540607f423eea4c55b2bd22ff5adf0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20250120172125eucas1p141540607f423eea4c55b2bd22ff5adf0 References: <20250120172111.3492708-1-m.wilczynski@samsung.com> <20250120172111.3492708-6-m.wilczynski@samsung.com> <20250121-mature-marigold-ammonite-b379d2@krzk-bin> <508d6120-53df-4db1-ab62-5f4c49358cbf@kernel.org> On 1/22/25 08:46, Krzysztof Kozlowski wrote: > On 21/01/2025 22:42, Michal Wilczynski wrote: >> >> >> On 1/21/25 11:02, Krzysztof Kozlowski wrote: >>> On Mon, Jan 20, 2025 at 06:20:58PM +0100, Michal Wilczynski wrote: >>>> The T-Head TH1520 SoC contains multiple power islands that can be >>>> programmatically turned on and off using the AON (Always-On) protocol >>>> and a hardware mailbox [1]. The relevant mailbox driver has already been >>>> merged into the mainline kernel in commit 5d4d263e1c6b ("mailbox: >>>> Introduce support for T-head TH1520 Mailbox driver"); >>>> >>>> This commit introduces a power-domain driver for the TH1520 SoC, which >>> >>> Please do not use "This commit/patch/change", but imperative mood. See >>> longer explanation here: >>> https://protect2.fireeye.com/v1/url?k=2123f702-40a8e22d-21227c4d-74fe485cbfe7-afb876722bdc8fc5&q=1&e=e5dabc89-5f0c-4819-9008-76faafc3c1bc&u=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.17.1%2Fsource%2FDocumentation%2Fprocess%2Fsubmitting-patches.rst%23L95 >>> >>>> is using AON firmware protocol to communicate with E902 core through the >>>> hardware mailbox. This way it can send power on/off commands to the E902 >>>> core. >>> >>> ... >>> >>>> diff --git a/drivers/pmdomain/thead/Makefile b/drivers/pmdomain/thead/Makefile >>>> new file mode 100644 >>>> index 000000000000..adfdf5479c68 >>>> --- /dev/null >>>> +++ b/drivers/pmdomain/thead/Makefile >>>> @@ -0,0 +1,2 @@ >>>> +# SPDX-License-Identifier: GPL-2.0-only >>>> +obj-$(CONFIG_TH1520_PM_DOMAINS) += th1520-pm-domains.o >>>> diff --git a/drivers/pmdomain/thead/th1520-pm-domains.c b/drivers/pmdomain/thead/th1520-pm-domains.c >>>> new file mode 100644 >>>> index 000000000000..d913ad40fb76 >>>> --- /dev/null >>>> +++ b/drivers/pmdomain/thead/th1520-pm-domains.c >>>> @@ -0,0 +1,174 @@ >>>> +// SPDX-License-Identifier: GPL-2.0 >>>> +/* >>>> + * Copyright (C) 2021 Alibaba Group Holding Limited. >>>> + * Copyright (c) 2024 Samsung Electronics Co., Ltd. >>>> + * Author: Michal Wilczynski >>>> + */ >>>> + >>>> +#include >>>> +#include >>>> +#include >>>> +#include >>>> + >>>> +#include >>> >>> So here it is used... I don't understand why power domain is under >>> firmware. Please move it to proper directory and name the file exactly >>> the same as bindings doc which this belongs to. >> >> The power-domain driver has no bindings doc. It's a child driver of the AON >> node. > > OK, not changing my comment, though. > >> >>> >>> >>>> + >>>> +struct th1520_power_domain { >>>> + struct th1520_aon_chan *aon_chan; >>>> + struct generic_pm_domain genpd; >>>> + u32 rsrc; >>>> +}; >>>> + >>>> +struct th1520_power_info { >>>> + const char *name; >>>> + u32 rsrc; >>>> +}; >>>> + >>>> +static const struct th1520_power_info th1520_pd_ranges[] = { >>>> + { "vdec", TH1520_AON_VDEC_PD }, >>> >>> Why TH1520_AON_XXX aren't the indices? >> >> These power-domain constants are defined by the AON firmware protocol, >> which dictates the exact IDs (e.g., 1 for NPU). They are not just array >> indices; we must use these specific values to communicate with the >> firmware correctly. Using array indices starting with 1 would be >> unusual. > > Then that's a no. Binding constants do not represent values used by your > hardware. The binding constant should start from 0. Would it be a problem if those overlapped ? There is one more value that I skipped for now TH_1520_AON_AUDIO, that is indeed a 0. I skipped it cause trying to turn it on/off, caused a crash in the firmware, which stopped responding for a while. With this extra constant I would be able to use those values as an indices, but would need to add extra code in the driver to work around the issue. > > Best regards, > Krzysztof >