From nobody Sat Nov 30 02:41:04 2024 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) (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 6FC261DA0F5; Fri, 13 Sep 2024 12:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.89.224.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229649; cv=none; b=iztcROJyi3+Bx6bcbFzj6NRloXhArFcuqDqyWQBE1j+UsRhmstN8wwh5iH0ccY8HxnJuWeA3j3yhBnzTXzJUCuMebD+34AH5B1g2EGCxcYwd4lK+G2KFZhNsMRSeXti0cvGWIrDwsitWGRNtoWfRk+ZWS1pAJhCZ6r2s6lYMQc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726229649; c=relaxed/simple; bh=i2Du9mw9yK4xJHzCM3GmoAp0Fx/Tme8q7/RpqMbHqDM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=byJ20B60NX3HwevIUt4h9hGROojf7UEstXNpbHxYZDbxDYOwFKrlj3xAg77uaBw7SiloGbBiECnFdCo6jjIrALJawUBinkE7JMkYmhzEjWqVMjolikUxDCF8SNdLLOoCjMVXZPgm4Fy3iUhXvGgrDvrLc35pSzGPPPr2VfHwyTY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com; spf=pass smtp.mailfrom=sberdevices.ru; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b=N+Avhbhp; arc=none smtp.client-ip=45.89.224.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=salutedevices.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sberdevices.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=salutedevices.com header.i=@salutedevices.com header.b="N+Avhbhp" Received: from p-infra-ksmg-sc-msk02.sberdevices.ru (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 420FE12000B; Fri, 13 Sep 2024 15:14:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 420FE12000B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=salutedevices.com; s=mail; t=1726229643; bh=cY3K3FQ81SKp3EdwKgsF2p7UTyEFyh0HPwCNPtrZSZI=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=N+AvhbhprNJCsvYayYKolVYcK4EE93Mlff1jejsx50VtnsXFiWqqRLtWnTe3x1Exj saeRC2XchKvxTOTjux/KhT+gruSv0eFcofJQO+RsVYDRbEfikBBamcgmMLAjaH+c/k xNH2WlpDH0jhfBU+qdw0xyMwCCiF2E171rzcUGUOUQ7tSnpyVsGGYVAFj6JDfWryxF 0YyJrQ6T8X+VufuaGVpy17oTIv8z+/tAeElRPbfbfJo0wJ2Np42QHdviG0Ihw06EaF K9i43telf6W9RECZplPAOXBgNj796dHIGyof4R1vX4vbtn5RWfJ71U1pe1ipwrog55 JhjsNX77CTadQ== Received: from smtp.sberdevices.ru (p-i-exch-sc-m02.sberdevices.ru [172.16.192.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Fri, 13 Sep 2024 15:13:53 +0300 (MSK) From: Jan Dakinevich To: Jan Dakinevich , Conor Dooley , , Jerome Brunet , Kevin Hilman , "Krzysztof Kozlowski" , , , , , Martin Blumenstingl , Michael Turquette , Neil Armstrong , Philipp Zabel , Rob Herring , Stephen Boyd Subject: [RFC PATCH v4 2/5] clk: meson: axg: share the set of audio helper macro Date: Fri, 13 Sep 2024 15:11:49 +0300 Message-ID: <20240913121152.817575-3-jan.dakinevich@salutedevices.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913121152.817575-1-jan.dakinevich@salutedevices.com> References: <20240913121152.817575-1-jan.dakinevich@salutedevices.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-ClientProxiedBy: p-i-exch-a-m1.sberdevices.ru (172.24.196.116) To p-i-exch-a-m1.sberdevices.ru (172.24.196.116) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 187732 [Sep 13 2024] X-KSMG-AntiSpam-Version: 6.1.1.5 X-KSMG-AntiSpam-Envelope-From: YVDakinevich@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 34 0.3.34 8a1fac695d5606478feba790382a59668a4f0039, {Tracking_smtp_not_equal_from}, sberdevices.ru:5.0.1,7.1.1;smtp.sberdevices.ru:5.0.1,7.1.1;salutedevices.com:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1, {Tracking_smtp_domain_mismatch}, {Tracking_smtp_domain_2level_mismatch}, {Tracking_sender_alignment_int}, {Tracking_white_helo}, FromAlignment: n X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2024/09/13 10:05:00 #26575345 X-KSMG-AntiVirus-Status: Clean, skipped Content-Type: text/plain; charset="utf-8" These macro will be used in upcoming audio clock controller for Meson A1 SoC. Signed-off-by: Jan Dakinevich --- drivers/clk/meson/axg-audio.c | 138 +----------------------------- drivers/clk/meson/meson-audio.h | 143 ++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 137 deletions(-) create mode 100644 drivers/clk/meson/meson-audio.h diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c index beda86349389..0d911e06a29f 100644 --- a/drivers/clk/meson/axg-audio.c +++ b/drivers/clk/meson/axg-audio.c @@ -16,6 +16,7 @@ #include =20 #include "meson-clkc-utils.h" +#include "meson-audio.h" #include "axg-audio.h" #include "clk-regmap.h" #include "clk-phase.h" @@ -23,52 +24,6 @@ =20 #include =20 -#define AUD_GATE(_name, _reg, _bit, _pname, _iflags) { \ - .data =3D &(struct clk_regmap_gate_data){ \ - .offset =3D (_reg), \ - .bit_idx =3D (_bit), \ - }, \ - .hw.init =3D &(struct clk_init_data) { \ - .name =3D "aud_"#_name, \ - .ops =3D &clk_regmap_gate_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ -} - -#define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pdata, _iflags) { \ - .data =3D &(struct clk_regmap_mux_data){ \ - .offset =3D (_reg), \ - .mask =3D (_mask), \ - .shift =3D (_shift), \ - .flags =3D (_dflags), \ - }, \ - .hw.init =3D &(struct clk_init_data){ \ - .name =3D "aud_"#_name, \ - .ops =3D &clk_regmap_mux_ops, \ - .parent_data =3D _pdata, \ - .num_parents =3D ARRAY_SIZE(_pdata), \ - .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ -} - -#define AUD_DIV(_name, _reg, _shift, _width, _dflags, _pname, _iflags) { \ - .data =3D &(struct clk_regmap_div_data){ \ - .offset =3D (_reg), \ - .shift =3D (_shift), \ - .width =3D (_width), \ - .flags =3D (_dflags), \ - }, \ - .hw.init =3D &(struct clk_init_data){ \ - .name =3D "aud_"#_name, \ - .ops =3D &clk_regmap_divider_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D (_iflags), \ - }, \ -} - #define AUD_PCLK_GATE(_name, _reg, _bit) { \ .data =3D &(struct clk_regmap_gate_data){ \ .offset =3D (_reg), \ @@ -82,97 +37,6 @@ }, \ } =20 -#define AUD_SCLK_DIV(_name, _reg, _div_shift, _div_width, \ - _hi_shift, _hi_width, _pname, _iflags) { \ - .data =3D &(struct meson_sclk_div_data) { \ - .div =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_div_shift), \ - .width =3D (_div_width), \ - }, \ - .hi =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_hi_shift), \ - .width =3D (_hi_width), \ - }, \ - }, \ - .hw.init =3D &(struct clk_init_data) { \ - .name =3D "aud_"#_name, \ - .ops =3D &meson_sclk_div_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D (_iflags), \ - }, \ -} - -#define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2, \ - _pname, _iflags) { \ - .data =3D &(struct meson_clk_triphase_data) { \ - .ph0 =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift0), \ - .width =3D (_width), \ - }, \ - .ph1 =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift1), \ - .width =3D (_width), \ - }, \ - .ph2 =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift2), \ - .width =3D (_width), \ - }, \ - }, \ - .hw.init =3D &(struct clk_init_data) { \ - .name =3D "aud_"#_name, \ - .ops =3D &meson_clk_triphase_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ - }, \ -} - -#define AUD_PHASE(_name, _reg, _width, _shift, _pname, _iflags) { \ - .data =3D &(struct meson_clk_phase_data) { \ - .ph =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift), \ - .width =3D (_width), \ - }, \ - }, \ - .hw.init =3D &(struct clk_init_data) { \ - .name =3D "aud_"#_name, \ - .ops =3D &meson_clk_phase_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D (_iflags), \ - }, \ -} - -#define AUD_SCLK_WS(_name, _reg, _width, _shift_ph, _shift_ws, _pname, \ - _iflags) { \ - .data =3D &(struct meson_sclk_ws_inv_data) { \ - .ph =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift_ph), \ - .width =3D (_width), \ - }, \ - .ws =3D { \ - .reg_off =3D (_reg), \ - .shift =3D (_shift_ws), \ - .width =3D (_width), \ - }, \ - }, \ - .hw.init =3D &(struct clk_init_data) { \ - .name =3D "aud_"#_name, \ - .ops =3D &meson_clk_phase_ops, \ - .parent_names =3D (const char *[]){ #_pname }, \ - .num_parents =3D 1, \ - .flags =3D (_iflags), \ - }, \ -} - /* Audio Master Clocks */ static const struct clk_parent_data mst_mux_parent_data[] =3D { { .fw_name =3D "mst_in0", }, diff --git a/drivers/clk/meson/meson-audio.h b/drivers/clk/meson/meson-audi= o.h new file mode 100644 index 000000000000..cbcdbd487d4a --- /dev/null +++ b/drivers/clk/meson/meson-audio.h @@ -0,0 +1,143 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ + +#ifndef __MESON_AUDIO_H__ +#define __MESON_AUDIO_H__ + +#define AUD_GATE(_name, _reg, _bit, _pname, _iflags) { \ + .data =3D &(struct clk_regmap_gate_data){ \ + .offset =3D (_reg), \ + .bit_idx =3D (_bit), \ + }, \ + .hw.init =3D &(struct clk_init_data) { \ + .name =3D "aud_"#_name, \ + .ops =3D &clk_regmap_gate_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ + }, \ +} + +#define AUD_MUX(_name, _reg, _mask, _shift, _dflags, _pdata, _iflags) { \ + .data =3D &(struct clk_regmap_mux_data){ \ + .offset =3D (_reg), \ + .mask =3D (_mask), \ + .shift =3D (_shift), \ + .flags =3D (_dflags), \ + }, \ + .hw.init =3D &(struct clk_init_data){ \ + .name =3D "aud_"#_name, \ + .ops =3D &clk_regmap_mux_ops, \ + .parent_data =3D _pdata, \ + .num_parents =3D ARRAY_SIZE(_pdata), \ + .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ + }, \ +} + +#define AUD_DIV(_name, _reg, _shift, _width, _dflags, _pname, _iflags) { \ + .data =3D &(struct clk_regmap_div_data){ \ + .offset =3D (_reg), \ + .shift =3D (_shift), \ + .width =3D (_width), \ + .flags =3D (_dflags), \ + }, \ + .hw.init =3D &(struct clk_init_data){ \ + .name =3D "aud_"#_name, \ + .ops =3D &clk_regmap_divider_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D (_iflags), \ + }, \ +} + +#define AUD_SCLK_DIV(_name, _reg, _div_shift, _div_width, \ + _hi_shift, _hi_width, _pname, _iflags) { \ + .data =3D &(struct meson_sclk_div_data) { \ + .div =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_div_shift), \ + .width =3D (_div_width), \ + }, \ + .hi =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_hi_shift), \ + .width =3D (_hi_width), \ + }, \ + }, \ + .hw.init =3D &(struct clk_init_data) { \ + .name =3D "aud_"#_name, \ + .ops =3D &meson_sclk_div_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D (_iflags), \ + }, \ +} + +#define AUD_TRIPHASE(_name, _reg, _width, _shift0, _shift1, _shift2, \ + _pname, _iflags) { \ + .data =3D &(struct meson_clk_triphase_data) { \ + .ph0 =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift0), \ + .width =3D (_width), \ + }, \ + .ph1 =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift1), \ + .width =3D (_width), \ + }, \ + .ph2 =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift2), \ + .width =3D (_width), \ + }, \ + }, \ + .hw.init =3D &(struct clk_init_data) { \ + .name =3D "aud_"#_name, \ + .ops =3D &meson_clk_triphase_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D CLK_DUTY_CYCLE_PARENT | (_iflags), \ + }, \ +} + +#define AUD_PHASE(_name, _reg, _width, _shift, _pname, _iflags) { \ + .data =3D &(struct meson_clk_phase_data) { \ + .ph =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift), \ + .width =3D (_width), \ + }, \ + }, \ + .hw.init =3D &(struct clk_init_data) { \ + .name =3D "aud_"#_name, \ + .ops =3D &meson_clk_phase_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D (_iflags), \ + }, \ +} + +#define AUD_SCLK_WS(_name, _reg, _width, _shift_ph, _shift_ws, _pname, \ + _iflags) { \ + .data =3D &(struct meson_sclk_ws_inv_data) { \ + .ph =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift_ph), \ + .width =3D (_width), \ + }, \ + .ws =3D { \ + .reg_off =3D (_reg), \ + .shift =3D (_shift_ws), \ + .width =3D (_width), \ + }, \ + }, \ + .hw.init =3D &(struct clk_init_data) { \ + .name =3D "aud_"#_name, \ + .ops =3D &meson_clk_phase_ops, \ + .parent_names =3D (const char *[]){ #_pname }, \ + .num_parents =3D 1, \ + .flags =3D (_iflags), \ + }, \ +} + +#endif /* __MESON_AUDIO_H__ */ --=20 2.34.1