Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7154957yba; Thu, 2 May 2019 05:20:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvcU8UQpHP6UhcNGqr3vxT9xABKpHoiN3pGlqL9PBHvdS2MtVpvVSeBh7Ctg/YpzL61+8+ X-Received: by 2002:a62:ee17:: with SMTP id e23mr3880642pfi.80.1556799603335; Thu, 02 May 2019 05:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556799603; cv=none; d=google.com; s=arc-20160816; b=o7z0U4/x+jkBWadWlDSB1Jw/AvPtjyMybKClrywzuiBJBho6e9TRtefVl4ZQ1cBA9/ q6CC8ZTccg4RFx9CIKbEXkAErieB+ggv9v2gp0XZA9/4vD0HhxvIqz1vFVOsufTp1fyc lu/2b2F/pVt3cGS8Sk1NkcfkoCjhxdEpD8CqVyLMhU538k80NcF/jD59PEBTPOGz5Ipg Cef+5K351qtzJrusDBzUTqyYBPO4jJZRew4kV8Y8ooaMBkmUOgQkfW0VyglYg80zjCwN sD7+/ZQ4rgtJQRxfi++WM5VKxly1Pij9ylmodt1A+3fhcVx1Ocbm+a1wJTWViktfEtoz iabA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GgusURE/W8WQalA33cEWfpRjVdXD5wgJb44vpMIQJIA=; b=TaD4Rzc8nHZcaxVbXbIVronhOGNDIUiA1zvCoIhfGgMi112S/iRug2K2myO87H6vuP 5+Gwqrnz3jDHxeFj4Fa6xPI2DrYHPsTBLjPtreMSOFbP1QIJbI/XsjpugqMZ3DfiMmWU jdt7MqfhPCjk/lPQToGgdCwnjBKQEJHORnvlvp8pm1MnVo8G39Lil86xJTXY+rPWEJbb MMhBKv4eF9NobzFwhdgEyhrEqa2j/NRsVJum8uZsl6xHlvCwtfjRwIRaCMriWqniWlw5 sZW4TcZ7C/fJKysg25/Oe7DwzLeOGZviEjJ5fdpMcYxE8utdrqRzOcFaV+xIFcVutZpj CRUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WjOwbub2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si43152714plz.403.2019.05.02.05.19.48; Thu, 02 May 2019 05:20:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=WjOwbub2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726403AbfEBMSx (ORCPT + 99 others); Thu, 2 May 2019 08:18:53 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46361 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726321AbfEBMSu (ORCPT ); Thu, 2 May 2019 08:18:50 -0400 Received: by mail-wr1-f67.google.com with SMTP id r7so2997761wrr.13 for ; Thu, 02 May 2019 05:18:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GgusURE/W8WQalA33cEWfpRjVdXD5wgJb44vpMIQJIA=; b=WjOwbub2CHS1lEAR4PJpFWurl6WPeh5AUPx3XVhxTlB6Hx86nhqpr263GBgcxcM371 oyHujRiVkACMN1FmTMuu7oidpncrUfL4EK/riYLsKOaYPbYTy7/nFKhRrjFoP/zJraWF bz57mAh+V/aGF9idDq1WN/BXsmcjYfS0wLI7EZsoUxJxQ7u7dK9fBCELS9QnTvftpObc eLlBZDIVmoH4/Fvi11y80wkptE+q88nT8V6Se+GdtbVr9lw063HhUsOSSShj+cts5QCA CtveCcOCx65P9jYCKjp0ajcbpQSbVCyJyRTj04XI4KH8fGKae6luNAC+Wye4E/SmHYsi ZLaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GgusURE/W8WQalA33cEWfpRjVdXD5wgJb44vpMIQJIA=; b=ReXzGadI8xRgbHS3rdYY8cOzOIrhpyju0sLthiZFqQelck87kdonO7Wq11u0BLmgjT d9JNFLZzqjBqz4eJFflQNewnq2yzLy0tU/fPQCLheDj2SWlgDFY9zuvXQFQKvDIiM439 qb4DHVx2fKGfHNh0gWX7ySxtY6zEn/p8mkp/us2Hodv9an+HF/rzAjZG9GHgrV9FyIsd 9Mbzg0RyS73P6pZ6kWdGe0rLAhACD8ZwTebAqtXdKg68wwAXm8rmfVOn2YDUj4cVTayx 96h3DqWWMPLQwpyJRP/HbcQdXrC+G1VVXqjBa+pQD3tXd3JDvY8+r4kztqbxCFdGCR5G /0DQ== X-Gm-Message-State: APjAAAVL7s8ALamY3FZxSvAeeZyZBy5TY/kb48LWzOmmzMF6DN1Dx7G1 H/Gn7CUMm+6PAhAytlATvGJO2Q== X-Received: by 2002:a5d:55cc:: with SMTP id i12mr2560960wrw.179.1556799527780; Thu, 02 May 2019 05:18:47 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-8-187.w90-86.abo.wanadoo.fr. [90.86.125.187]) by smtp.gmail.com with ESMTPSA id f6sm4392842wmh.13.2019.05.02.05.18.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 05:18:47 -0700 (PDT) From: Fabien Parent To: robh+dt@kernel.org, mark.rutland@arm.com, mturquette@baylibre.com, sboyd@kernel.org, matthias.bgg@gmail.com, wenzhen.yu@mediatek.com, sean.wang@mediatek.com, ryder.lee@mediatek.com Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Fabien Parent Subject: [PATCH 2/2] clk: mediatek: add audsys clock driver for MT8516 Date: Thu, 2 May 2019 14:18:43 +0200 Message-Id: <20190502121843.14493-2-fparent@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190502121843.14493-1-fparent@baylibre.com> References: <20190502121843.14493-1-fparent@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add audsys clock driver for MediaTek MT8516 SoC. Signed-off-by: Fabien Parent --- drivers/clk/mediatek/Kconfig | 6 +++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8516-aud.c | 65 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8516-aud.c diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig index 1e951ae49982..f9cd45e7760a 100644 --- a/drivers/clk/mediatek/Kconfig +++ b/drivers/clk/mediatek/Kconfig @@ -225,4 +225,10 @@ config COMMON_CLK_MT8516 help This driver supports MediaTek MT8516 clocks. +config COMMON_CLK_MT8516_AUDSYS + bool "Clock driver for MediaTek MT8516 audsys" + depends on COMMON_CLK_MT8516 + help + This driver supports MediaTek MT8516 audsys clocks. + endmenu diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile index c4f413ef5aad..a2557b0c9273 100644 --- a/drivers/clk/mediatek/Makefile +++ b/drivers/clk/mediatek/Makefile @@ -32,3 +32,4 @@ obj-$(CONFIG_COMMON_CLK_MT7629_HIFSYS) += clk-mt7629-hif.o obj-$(CONFIG_COMMON_CLK_MT8135) += clk-mt8135.o obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o obj-$(CONFIG_COMMON_CLK_MT8516) += clk-mt8516.o +obj-$(CONFIG_COMMON_CLK_MT8516_AUDSYS) += clk-mt8516-aud.o diff --git a/drivers/clk/mediatek/clk-mt8516-aud.c b/drivers/clk/mediatek/clk-mt8516-aud.c new file mode 100644 index 000000000000..6ab3a06dc9d5 --- /dev/null +++ b/drivers/clk/mediatek/clk-mt8516-aud.c @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 MediaTek Inc. + * Author: James Liao + * Fabien Parent + */ + +#include +#include +#include +#include +#include + +#include "clk-mtk.h" +#include "clk-gate.h" + +#include + +static const struct mtk_gate_regs aud_cg_regs = { + .set_ofs = 0x0, + .clr_ofs = 0x0, + .sta_ofs = 0x0, +}; + +#define GATE_AUD(_id, _name, _parent, _shift) { \ + .id = _id, \ + .name = _name, \ + .parent_name = _parent, \ + .regs = &aud_cg_regs, \ + .shift = _shift, \ + .ops = &mtk_clk_gate_ops_no_setclr, \ + } + +static const struct mtk_gate aud_clks[] __initconst = { + GATE_AUD(CLK_AUD_AFE, "aud_afe", "clk26m_ck", 2), + GATE_AUD(CLK_AUD_I2S, "aud_i2s", "i2s_infra_bck", 6), + GATE_AUD(CLK_AUD_22M, "aud_22m", "rg_aud_engen1", 8), + GATE_AUD(CLK_AUD_24M, "aud_24m", "rg_aud_engen2", 9), + GATE_AUD(CLK_AUD_INTDIR, "aud_intdir", "rg_aud_spdif_in", 15), + GATE_AUD(CLK_AUD_APLL2_TUNER, "aud_apll2_tuner", "rg_aud_engen2", 18), + GATE_AUD(CLK_AUD_APLL_TUNER, "aud_apll_tuner", "rg_aud_engen1", 19), + GATE_AUD(CLK_AUD_HDMI, "aud_hdmi", "apll12_div4", 20), + GATE_AUD(CLK_AUD_SPDF, "aud_spdf", "apll12_div6", 21), + GATE_AUD(CLK_AUD_ADC, "aud_adc", "aud_afe", 24), + GATE_AUD(CLK_AUD_DAC, "aud_dac", "aud_afe", 25), + GATE_AUD(CLK_AUD_DAC_PREDIS, "aud_dac_predis", "aud_afe", 26), + GATE_AUD(CLK_AUD_TML, "aud_tml", "aud_afe", 27), +}; + +static void __init mtk_audsys_init(struct device_node *node) +{ + struct clk_onecell_data *clk_data; + int r; + + clk_data = mtk_alloc_clk_data(CLK_AUD_NR_CLK); + + mtk_clk_register_gates(node, aud_clks, ARRAY_SIZE(aud_clks), clk_data); + + r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data); + if (r) + pr_err("%s(): could not register clock provider: %d\n", + __func__, r); + +} +CLK_OF_DECLARE(mtk_audsys, "mediatek,mt8516-audsys", mtk_audsys_init); -- 2.20.1