All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/5] Add platform clock for BayTrail platforms
@ 2017-01-23 18:07 Pierre-Louis Bossart
  2017-01-23 18:07 ` [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK Pierre-Louis Bossart
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

These patches specifically enable the audio MCLK required by Baytrail
CR devices. It is the remaining part of a bigger set of patches
(already merged in Mark Brown's tree) that enable sound for Baytrail CR
devices (especially Asus T100TAF) [1]. They include the clock driver
and clock enabling in the pmc_atom code (along with moving of the
non-architectural pmc_atom driver code into drivers/platform/x86 as
suggested by Thomas Gleixner [2]). This move includes a new header in
include/linux/platform_data/x86/. While there is an agreement that the
definitions for PMC clocks are not really platform data this location
is seen as a good-enough compromise with an agreement between Darren
Hart and Andy Shevchenko [3]

[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-August/111704.html
[2] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-October/113936.html
[3] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-December/115892.html

Changes from v7:
 - Replaced clk-readl/writel by regular readl/writel
 - Fixed two nitpick comments (newline and driver name string)
 - Fixed [5:0] to [0..5] in comment (missed in v6)

Changes from v6:
 - Addressed comments from Stephen Boyd, Andy Shevchenko and Vinod Koul
 - Renamed clk-byt-plt to clk-pmc-atom
 - Rebase to 4.10-rc3 (broonie/for-next)
 - Added helper functions to make error handling more compact
 - Removed module-related code since it's not possible/supported
 - Removed useless tests on remove
 - PMC_CLK_OFFSET move to clk-pcm-atom (more logical)
 - Split typo correction and makefile fix in separate patches
 - small fixes (spaces, defaults in switches, alphabetical order, use of
clk_writel/readl and no test on write, simpler error handling, use of
while(i--), unsigned loop variables, kernel doc fields, format-patch -M
 -C -D, use of PLATFORM_DEVID_NONE)

Changes from v5:
 - fix build error reported by kbuild test robot
 - split the clk driver code from x86 platform changes

Changes from v4:
 - move the pmc_atom driver from arch/x86/platform/atom to
drivers/platform/x86

Changes from v3:
 - replace devm_kzalloc with devm_kcalloc
 - add x86 architecture maintainers

Changes from v2:
 - move clk platform data structures to a separate include file
 - store clk_hw pointer for the fixed rate clocks

Changes from v1:
 - register the clk device as child of pmc device
 - pass iomem pointer from pmc driver to clk driver to avoid using
pmc_atom_read()/write() and use readl/writel API instead
 - use devm_clk_hw_register/clkdev_hw_create instead of
clk_register/clkdev_create

Irina Tirdea (3):
  clk: x86: Add Atom PMC platform clocks
  arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
  platform/x86: Enable Atom PMC platform clocks

Pierre-Louis Bossart (2):
  clk: Make x86/ conditional on CONFIG_COMMON_CLK
  platform/x86: fix typo in comment

 arch/x86/Kconfig                                   |   4 -
 arch/x86/platform/atom/Makefile                    |   1 -
 drivers/acpi/acpi_lpss.c                           |   2 +-
 drivers/clk/Makefile                               |   2 +
 drivers/clk/x86/Makefile                           |   1 +
 drivers/clk/x86/clk-pmc-atom.c                     | 371 +++++++++++++++++++++
 drivers/platform/x86/Kconfig                       |   5 +
 drivers/platform/x86/Makefile                      |   1 +
 .../atom => drivers/platform/x86}/pmc_atom.c       |  88 ++++-
 include/linux/platform_data/x86/clk-pmc-atom.h     |  44 +++
 .../linux/platform_data/x86}/pmc_atom.h            |   2 +-
 11 files changed, 506 insertions(+), 15 deletions(-)
 create mode 100644 drivers/clk/x86/clk-pmc-atom.c
 rename {arch/x86/platform/atom => drivers/platform/x86}/pmc_atom.c (87%)
 create mode 100644 include/linux/platform_data/x86/clk-pmc-atom.h
 rename {arch/x86/include/asm => include/linux/platform_data/x86}/pmc_atom.h (98%)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
@ 2017-01-23 18:07 ` Pierre-Louis Bossart
  2017-01-27  0:22   ` Stephen Boyd
  2017-01-23 18:07 ` [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks Pierre-Louis Bossart
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

Fix Makefile for x86 support, dependency on CONFIG_COMMON_CLK
was not explicit

Fixes: 701190fd7419 ('clk: x86: add support for Lynxpoint LPSS clocks')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/clk/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 925081e..42042c0 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -87,6 +87,8 @@ obj-y					+= ti/
 obj-$(CONFIG_CLK_UNIPHIER)		+= uniphier/
 obj-$(CONFIG_ARCH_U8500)		+= ux500/
 obj-$(CONFIG_COMMON_CLK_VERSATILE)	+= versatile/
+ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_X86)			+= x86/
+endif
 obj-$(CONFIG_ARCH_ZX)			+= zte/
 obj-$(CONFIG_ARCH_ZYNQ)			+= zynq/
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
  2017-01-23 18:07 ` [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK Pierre-Louis Bossart
@ 2017-01-23 18:07 ` Pierre-Louis Bossart
  2017-01-27  0:22   ` Stephen Boyd
  2017-01-23 18:07 ` [PATCH v8 3/5] arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86 Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

From: Irina Tirdea <irina.tirdea@intel.com>

The BayTrail and CherryTrail platforms provide platform clocks
through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
are available for general system use, where appropriate, and each
have Control & Frequency register fields associated with them.

Port from legacy by Pierre Bossart, integration in clock framework
by Irina Tirdea

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 drivers/clk/x86/Makefile                       |   1 +
 drivers/clk/x86/clk-pmc-atom.c                 | 371 +++++++++++++++++++++++++
 include/linux/platform_data/x86/clk-pmc-atom.h |  44 +++
 3 files changed, 416 insertions(+)
 create mode 100644 drivers/clk/x86/clk-pmc-atom.c
 create mode 100644 include/linux/platform_data/x86/clk-pmc-atom.h

diff --git a/drivers/clk/x86/Makefile b/drivers/clk/x86/Makefile
index 0478138..1367afb 100644
--- a/drivers/clk/x86/Makefile
+++ b/drivers/clk/x86/Makefile
@@ -1,2 +1,3 @@
 clk-x86-lpss-objs		:= clk-lpt.o
 obj-$(CONFIG_X86_INTEL_LPSS)	+= clk-x86-lpss.o
+obj-$(CONFIG_PMC_ATOM)		+= clk-pmc-atom.o
diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
new file mode 100644
index 0000000..2b60577
--- /dev/null
+++ b/drivers/clk/x86/clk-pmc-atom.c
@@ -0,0 +1,371 @@
+/*
+ * Intel Atom platform clocks driver for BayTrail and CherryTrail SoCs
+ *
+ * Copyright (C) 2016, Intel Corporation
+ * Author: Irina Tirdea <irina.tirdea@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/err.h>
+#include <linux/platform_data/x86/clk-pmc-atom.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+
+#define PLT_CLK_NAME_BASE	"pmc_plt_clk"
+
+#define PMC_CLK_CTL_OFFSET		0x60
+#define PMC_CLK_CTL_SIZE		4
+#define PMC_CLK_NUM			6
+#define PMC_CLK_CTL_GATED_ON_D3		0x0
+#define PMC_CLK_CTL_FORCE_ON		0x1
+#define PMC_CLK_CTL_FORCE_OFF		0x2
+#define PMC_CLK_CTL_RESERVED		0x3
+#define PMC_MASK_CLK_CTL		GENMASK(1, 0)
+#define PMC_MASK_CLK_FREQ		BIT(2)
+#define PMC_CLK_FREQ_XTAL		(0 << 2)	/* 25 MHz */
+#define PMC_CLK_FREQ_PLL		(1 << 2)	/* 19.2 MHz */
+
+struct clk_plt_fixed {
+	struct clk_hw *clk;
+	struct clk_lookup *lookup;
+};
+
+struct clk_plt {
+	struct clk_hw hw;
+	void __iomem *reg;
+	struct clk_lookup *lookup;
+	/* protect access to PMC registers */
+	spinlock_t lock;
+};
+
+#define to_clk_plt(_hw) container_of(_hw, struct clk_plt, hw)
+
+struct clk_plt_data {
+	struct clk_plt_fixed **parents;
+	u8 nparents;
+	struct clk_plt *clks[PMC_CLK_NUM];
+};
+
+/* Return an index in parent table */
+static inline int plt_reg_to_parent(int reg)
+{
+	switch (reg & PMC_MASK_CLK_FREQ) {
+	default:
+	case PMC_CLK_FREQ_XTAL:
+		return 0;
+	case PMC_CLK_FREQ_PLL:
+		return 1;
+	}
+}
+
+/* Return clk index of parent */
+static inline int plt_parent_to_reg(int index)
+{
+	switch (index) {
+	default:
+	case 0:
+		return PMC_CLK_FREQ_XTAL;
+	case 1:
+		return PMC_CLK_FREQ_PLL;
+	}
+}
+
+/* Abstract status in simpler enabled/disabled value */
+static inline int plt_reg_to_enabled(int reg)
+{
+	switch (reg & PMC_MASK_CLK_CTL) {
+	case PMC_CLK_CTL_GATED_ON_D3:
+	case PMC_CLK_CTL_FORCE_ON:
+		return 1;	/* enabled */
+	case PMC_CLK_CTL_FORCE_OFF:
+	case PMC_CLK_CTL_RESERVED:
+	default:
+		return 0;	/* disabled */
+	}
+}
+
+static void plt_clk_reg_update(struct clk_plt *clk, u32 mask, u32 val)
+{
+	u32 tmp;
+	unsigned long flags;
+
+	spin_lock_irqsave(&clk->lock, flags);
+
+	tmp = readl(clk->reg);
+	tmp = (tmp & ~mask) | (val & mask);
+	writel(tmp, clk->reg);
+
+	spin_unlock_irqrestore(&clk->lock, flags);
+}
+
+static int plt_clk_set_parent(struct clk_hw *hw, u8 index)
+{
+	struct clk_plt *clk = to_clk_plt(hw);
+
+	plt_clk_reg_update(clk, PMC_MASK_CLK_FREQ, plt_parent_to_reg(index));
+
+	return 0;
+}
+
+static u8 plt_clk_get_parent(struct clk_hw *hw)
+{
+	struct clk_plt *clk = to_clk_plt(hw);
+	u32 value;
+
+	value = readl(clk->reg);
+
+	return plt_reg_to_parent(value);
+}
+
+static int plt_clk_enable(struct clk_hw *hw)
+{
+	struct clk_plt *clk = to_clk_plt(hw);
+
+	plt_clk_reg_update(clk, PMC_MASK_CLK_CTL, PMC_CLK_CTL_FORCE_ON);
+
+	return 0;
+}
+
+static void plt_clk_disable(struct clk_hw *hw)
+{
+	struct clk_plt *clk = to_clk_plt(hw);
+
+	plt_clk_reg_update(clk, PMC_MASK_CLK_CTL, PMC_CLK_CTL_FORCE_OFF);
+}
+
+static int plt_clk_is_enabled(struct clk_hw *hw)
+{
+	struct clk_plt *clk = to_clk_plt(hw);
+	u32 value;
+
+	value = readl(clk->reg);
+
+	return plt_reg_to_enabled(value);
+}
+
+static const struct clk_ops plt_clk_ops = {
+	.enable = plt_clk_enable,
+	.disable = plt_clk_disable,
+	.is_enabled = plt_clk_is_enabled,
+	.get_parent = plt_clk_get_parent,
+	.set_parent = plt_clk_set_parent,
+	.determine_rate = __clk_mux_determine_rate,
+};
+
+static struct clk_plt *plt_clk_register(struct platform_device *pdev, int id,
+					void __iomem *base,
+					const char **parent_names,
+					int num_parents)
+{
+	struct clk_plt *pclk;
+	struct clk_init_data init;
+	int ret;
+
+	pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL);
+	if (!pclk)
+		return ERR_PTR(-ENOMEM);
+
+	init.name =  kasprintf(GFP_KERNEL, "%s_%d", PLT_CLK_NAME_BASE, id);
+	init.ops = &plt_clk_ops;
+	init.flags = 0;
+	init.parent_names = parent_names;
+	init.num_parents = num_parents;
+
+	pclk->hw.init = &init;
+	pclk->reg = base + PMC_CLK_CTL_OFFSET + id * PMC_CLK_CTL_SIZE;
+	spin_lock_init(&pclk->lock);
+
+	ret = devm_clk_hw_register(&pdev->dev, &pclk->hw);
+	if (ret) {
+		pclk = ERR_PTR(ret);
+		goto err_free_init;
+	}
+
+	pclk->lookup = clkdev_hw_create(&pclk->hw, init.name, NULL);
+	if (!pclk->lookup) {
+		pclk = ERR_PTR(-ENOMEM);
+		goto err_free_init;
+	}
+
+err_free_init:
+	kfree(init.name);
+	return pclk;
+}
+
+static void plt_clk_unregister(struct clk_plt *pclk)
+{
+	clkdev_drop(pclk->lookup);
+}
+
+static struct clk_plt_fixed *plt_clk_register_fixed_rate(struct platform_device *pdev,
+						 const char *name,
+						 const char *parent_name,
+						 unsigned long fixed_rate)
+{
+	struct clk_plt_fixed *pclk;
+
+	pclk = devm_kzalloc(&pdev->dev, sizeof(*pclk), GFP_KERNEL);
+	if (!pclk)
+		return ERR_PTR(-ENOMEM);
+
+	pclk->clk = clk_hw_register_fixed_rate(&pdev->dev, name, parent_name,
+					       0, fixed_rate);
+	if (IS_ERR(pclk->clk))
+		return ERR_CAST(pclk->clk);
+
+	pclk->lookup = clkdev_hw_create(pclk->clk, name, NULL);
+	if (!pclk->lookup) {
+		clk_hw_unregister_fixed_rate(pclk->clk);
+		return ERR_PTR(-ENOMEM);
+	}
+
+	return pclk;
+}
+
+static void plt_clk_unregister_fixed_rate(struct clk_plt_fixed *pclk)
+{
+	clkdev_drop(pclk->lookup);
+	clk_hw_unregister_fixed_rate(pclk->clk);
+}
+
+static void plt_clk_unregister_fixed_rate_loop(struct clk_plt_data *data,
+					       unsigned int i)
+{
+	while (i--)
+		plt_clk_unregister_fixed_rate(data->parents[i]);
+}
+
+static void plt_clk_free_parent_names_loop(const char **parent_names,
+					   unsigned int i)
+{
+	while (i--)
+		kfree_const(parent_names[i]);
+	kfree(parent_names);
+}
+
+static void plt_clk_unregister_loop(struct clk_plt_data *data,
+				    unsigned int i)
+{
+	while (i--)
+		plt_clk_unregister(data->clks[i]);
+}
+
+static const char **plt_clk_register_parents(struct platform_device *pdev,
+					     struct clk_plt_data *data,
+					     const struct pmc_clk *clks)
+{
+	const char **parent_names;
+	unsigned int i;
+	int err;
+	int nparents = 0;
+
+	data->nparents = 0;
+	while (clks[nparents].name)
+		nparents++;
+
+	data->parents = devm_kcalloc(&pdev->dev, nparents,
+				     sizeof(*data->parents), GFP_KERNEL);
+	if (!data->parents)
+		return ERR_PTR(-ENOMEM);
+
+	parent_names = kcalloc(nparents, sizeof(*parent_names),
+			       GFP_KERNEL);
+	if (!parent_names)
+		return ERR_PTR(-ENOMEM);
+
+	for (i = 0; i < nparents; i++) {
+		data->parents[i] =
+			plt_clk_register_fixed_rate(pdev, clks[i].name,
+						    clks[i].parent_name,
+						    clks[i].freq);
+		if (IS_ERR(data->parents[i])) {
+			err = PTR_ERR(data->parents[i]);
+			goto err_unreg;
+		}
+		parent_names[i] = kstrdup_const(clks[i].name, GFP_KERNEL);
+	}
+
+	data->nparents = nparents;
+	return parent_names;
+
+err_unreg:
+	plt_clk_unregister_fixed_rate_loop(data, i);
+	plt_clk_free_parent_names_loop(parent_names, i);
+	return ERR_PTR(err);
+}
+
+static void plt_clk_unregister_parents(struct clk_plt_data *data)
+{
+	plt_clk_unregister_fixed_rate_loop(data, data->nparents);
+}
+
+static int plt_clk_probe(struct platform_device *pdev)
+{
+	const struct pmc_clk_data *pmc_data;
+	const char **parent_names;
+	struct clk_plt_data *data;
+	unsigned int i;
+	int err;
+
+	pmc_data = dev_get_platdata(&pdev->dev);
+	if (!pmc_data || !pmc_data->clks)
+		return -EINVAL;
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	parent_names = plt_clk_register_parents(pdev, data, pmc_data->clks);
+	if (IS_ERR(parent_names))
+		return PTR_ERR(parent_names);
+
+	for (i = 0; i < PMC_CLK_NUM; i++) {
+		data->clks[i] = plt_clk_register(pdev, i, pmc_data->base,
+						 parent_names, data->nparents);
+		if (IS_ERR(data->clks[i])) {
+			err = PTR_ERR(data->clks[i]);
+			goto err_unreg_clk_plt;
+		}
+	}
+
+	plt_clk_free_parent_names_loop(parent_names, data->nparents);
+
+	platform_set_drvdata(pdev, data);
+	return 0;
+
+err_unreg_clk_plt:
+	plt_clk_unregister_loop(data, i);
+	plt_clk_unregister_parents(data);
+	plt_clk_free_parent_names_loop(parent_names, data->nparents);
+	return err;
+}
+
+static int plt_clk_remove(struct platform_device *pdev)
+{
+	struct clk_plt_data *data;
+
+	data = platform_get_drvdata(pdev);
+
+	plt_clk_unregister_loop(data, PMC_CLK_NUM);
+	plt_clk_unregister_parents(data);
+	return 0;
+}
+
+static struct platform_driver plt_clk_driver = {
+	.driver = {
+		.name = "clk-pmc-atom",
+	},
+	.probe = plt_clk_probe,
+	.remove = plt_clk_remove,
+};
+builtin_platform_driver(plt_clk_driver);
diff --git a/include/linux/platform_data/x86/clk-pmc-atom.h b/include/linux/platform_data/x86/clk-pmc-atom.h
new file mode 100644
index 0000000..3ab8922
--- /dev/null
+++ b/include/linux/platform_data/x86/clk-pmc-atom.h
@@ -0,0 +1,44 @@
+/*
+ * Intel Atom platform clocks for BayTrail and CherryTrail SoC.
+ *
+ * Copyright (C) 2016, Intel Corporation
+ * Author: Irina Tirdea <irina.tirdea@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __PLATFORM_DATA_X86_CLK_PMC_ATOM_H
+#define __PLATFORM_DATA_X86_CLK_PMC_ATOM_H
+
+/**
+ * struct pmc_clk - PMC platform clock configuration
+ *
+ * @name:	identified, typically pmc_plt_clk_<x>, x=[0..5]
+ * @freq:	in Hz, 19.2MHz  and 25MHz (Baytrail only) supported
+ * @parent_name: one of 'xtal' or 'osc'
+ */
+struct pmc_clk {
+	const char *name;
+	unsigned long freq;
+	const char *parent_name;
+};
+
+/**
+ * struct pmc_clk_data - common PMC clock configuration
+ *
+ * @base:	PMC clock register base offset
+ * @clks:	pointer to set of registered clocks, typically 0..5
+ */
+struct pmc_clk_data {
+	void __iomem *base;
+	const struct pmc_clk *clks;
+};
+
+#endif /* __PLATFORM_DATA_X86_CLK_PMC_ATOM_H */
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v8 3/5] arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
  2017-01-23 18:07 ` [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK Pierre-Louis Bossart
  2017-01-23 18:07 ` [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks Pierre-Louis Bossart
@ 2017-01-23 18:07 ` Pierre-Louis Bossart
  2017-01-23 18:07 ` [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

From: Irina Tirdea <irina.tirdea@intel.com>

The pmc_atom driver does not contain any architecture specific
code. It only enables the SoC Power Management Controller driver
for BayTrail and CherryTrail platforms.

Move the pmc_atom driver from arch/x86/platform/atom to
drivers/platform/x86. Also clean-up and reorder include files by
alphabetical order in pmc_atom.h

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 arch/x86/Kconfig                                                 | 4 ----
 arch/x86/platform/atom/Makefile                                  | 1 -
 drivers/acpi/acpi_lpss.c                                         | 2 +-
 drivers/platform/x86/Kconfig                                     | 4 ++++
 drivers/platform/x86/Makefile                                    | 1 +
 {arch/x86/platform/atom => drivers/platform/x86}/pmc_atom.c      | 9 ++++-----
 .../include/asm => include/linux/platform_data/x86}/pmc_atom.h   | 0
 7 files changed, 10 insertions(+), 11 deletions(-)
 rename {arch/x86/platform/atom => drivers/platform/x86}/pmc_atom.c (99%)
 rename {arch/x86/include/asm => include/linux/platform_data/x86}/pmc_atom.h (100%)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e487493..7b4f178 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2789,10 +2789,6 @@ config X86_DMA_REMAP
 	bool
 	depends on STA2X11
 
-config PMC_ATOM
-	def_bool y
-        depends on PCI
-
 source "net/Kconfig"
 
 source "drivers/Kconfig"
diff --git a/arch/x86/platform/atom/Makefile b/arch/x86/platform/atom/Makefile
index 40983f5..57be88f 100644
--- a/arch/x86/platform/atom/Makefile
+++ b/arch/x86/platform/atom/Makefile
@@ -1,2 +1 @@
-obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
 obj-$(CONFIG_PUNIT_ATOM_DEBUG)	+= punit_atom_debug.o
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 8ea836c..90d112a 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -18,6 +18,7 @@
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
 #include <linux/platform_data/clk-lpss.h>
+#include <linux/platform_data/x86/pmc_atom.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
 #include <linux/delay.h>
@@ -31,7 +32,6 @@ ACPI_MODULE_NAME("acpi_lpss");
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
 #include <asm/iosf_mbi.h>
-#include <asm/pmc_atom.h>
 
 #define LPSS_ADDR(desc) ((unsigned long)&desc)
 
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 59aa8e3..8b1988a 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1077,3 +1077,7 @@ config MLX_CPLD_PLATFORM
 	  cables and fans on the wide range Mellanox IB and Ethernet systems.
 
 endif # X86_PLATFORM_DEVICES
+
+config PMC_ATOM
+       def_bool y
+       depends on PCI
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index d4111f0..49ee7ef 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -74,5 +74,6 @@ obj-$(CONFIG_INTEL_TELEMETRY)	+= intel_telemetry_core.o \
 				   intel_telemetry_pltdrv.o \
 				   intel_telemetry_debugfs.o
 obj-$(CONFIG_INTEL_PMC_CORE)    += intel_pmc_core.o
+obj-$(CONFIG_PMC_ATOM)		+= pmc_atom.o
 obj-$(CONFIG_MLX_PLATFORM)	+= mlx-platform.o
 obj-$(CONFIG_MLX_CPLD_PLATFORM)	+= mlxcpld-hotplug.o
diff --git a/arch/x86/platform/atom/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
similarity index 99%
rename from arch/x86/platform/atom/pmc_atom.c
rename to drivers/platform/x86/pmc_atom.c
index 964ff4f..e1dfb1b 100644
--- a/arch/x86/platform/atom/pmc_atom.c
+++ b/drivers/platform/x86/pmc_atom.c
@@ -15,14 +15,13 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/debugfs.h>
+#include <linux/device.h>
 #include <linux/init.h>
+#include <linux/io.h>
+#include <linux/platform_data/x86/pmc_atom.h>
 #include <linux/pci.h>
-#include <linux/device.h>
-#include <linux/debugfs.h>
 #include <linux/seq_file.h>
-#include <linux/io.h>
-
-#include <asm/pmc_atom.h>
 
 struct pmc_bit_map {
 	const char *name;
diff --git a/arch/x86/include/asm/pmc_atom.h b/include/linux/platform_data/x86/pmc_atom.h
similarity index 100%
rename from arch/x86/include/asm/pmc_atom.h
rename to include/linux/platform_data/x86/pmc_atom.h
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2017-01-23 18:07 ` [PATCH v8 3/5] arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86 Pierre-Louis Bossart
@ 2017-01-23 18:07 ` Pierre-Louis Bossart
  2017-01-27  0:23   ` Stephen Boyd
  2017-01-23 18:07 ` [PATCH v8 5/5] platform/x86: fix typo in comment Pierre-Louis Bossart
  2017-01-23 21:47   ` Andy Shevchenko
  5 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

From: Irina Tirdea <irina.tirdea@intel.com>

The BayTrail and CherryTrail platforms provide platform clocks
through their Power Management Controller (PMC).

The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
are available for general system use, where appropriate. For example,
the usage for platform clocks suggested in the datasheet is the
following:
  PLT_CLK[0..2] - Camera
  PLT_CLK[3] - Audio Codec
  PLT_CLK[4] -
  PLT_CLK[5] - COMMs

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
---
 drivers/platform/x86/Kconfig    |  1 +
 drivers/platform/x86/pmc_atom.c | 79 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 8b1988a..2c95f77 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -1081,3 +1081,4 @@ endif # X86_PLATFORM_DEVICES
 config PMC_ATOM
        def_bool y
        depends on PCI
+       select COMMON_CLK
diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c
index e1dfb1b..77bac85 100644
--- a/drivers/platform/x86/pmc_atom.c
+++ b/drivers/platform/x86/pmc_atom.c
@@ -19,7 +19,9 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/platform_data/x86/clk-pmc-atom.h>
 #include <linux/platform_data/x86/pmc_atom.h>
+#include <linux/platform_device.h>
 #include <linux/pci.h>
 #include <linux/seq_file.h>
 
@@ -36,6 +38,11 @@ struct pmc_reg_map {
 	const struct pmc_bit_map *pss;
 };
 
+struct pmc_data {
+	const struct pmc_reg_map *map;
+	const struct pmc_clk *clks;
+};
+
 struct pmc_dev {
 	u32 base_addr;
 	void __iomem *regmap;
@@ -49,6 +56,29 @@ struct pmc_dev {
 static struct pmc_dev pmc_device;
 static u32 acpi_base_addr;
 
+static const struct pmc_clk byt_clks[] = {
+	{
+		.name = "xtal",
+		.freq = 25000000,
+		.parent_name = NULL,
+	},
+	{
+		.name = "pll",
+		.freq = 19200000,
+		.parent_name = "xtal",
+	},
+	{},
+};
+
+static const struct pmc_clk cht_clks[] = {
+	{
+		.name = "xtal",
+		.freq = 19200000,
+		.parent_name = NULL,
+	},
+	{},
+};
+
 static const struct pmc_bit_map d3_sts_0_map[] = {
 	{"LPSS1_F0_DMA",	BIT_LPSS1_F0_DMA},
 	{"LPSS1_F1_PWM1",	BIT_LPSS1_F1_PWM1},
@@ -168,6 +198,16 @@ static const struct pmc_reg_map cht_reg_map = {
 	.pss		= cht_pss_map,
 };
 
+static const struct pmc_data byt_data = {
+	.map = &byt_reg_map,
+	.clks = byt_clks,
+};
+
+static const struct pmc_data cht_data = {
+	.map = &cht_reg_map,
+	.clks = cht_clks,
+};
+
 static inline u32 pmc_reg_read(struct pmc_dev *pmc, int reg_offset)
 {
 	return readl(pmc->regmap + reg_offset);
@@ -381,10 +421,37 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc)
 }
 #endif /* CONFIG_DEBUG_FS */
 
+static int pmc_setup_clks(struct pci_dev *pdev, void __iomem *pmc_regmap,
+			  const struct pmc_data *pmc_data)
+{
+	struct platform_device *clkdev;
+	struct pmc_clk_data *clk_data;
+
+	clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
+	if (!clk_data)
+		return -ENOMEM;
+
+	clk_data->base = pmc_regmap; /* offset is added by client */
+	clk_data->clks = pmc_data->clks;
+
+	clkdev = platform_device_register_data(&pdev->dev, "clk-pmc-atom",
+					       PLATFORM_DEVID_NONE,
+					       clk_data, sizeof(*clk_data));
+	if (IS_ERR(clkdev)) {
+		kfree(clk_data);
+		return PTR_ERR(clkdev);
+	}
+
+	kfree(clk_data);
+
+	return 0;
+}
+
 static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct pmc_dev *pmc = &pmc_device;
-	const struct pmc_reg_map *map = (struct pmc_reg_map *)ent->driver_data;
+	const struct pmc_data *data = (struct pmc_data *)ent->driver_data;
+	const struct pmc_reg_map *map = data->map;
 	int ret;
 
 	/* Obtain ACPI base address */
@@ -413,6 +480,12 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		dev_warn(&pdev->dev, "debugfs register failed\n");
 
+	/* Register platform clocks - PMC_PLT_CLK [0..5] */
+	ret = pmc_setup_clks(pdev, pmc->regmap, data);
+	if (ret)
+		dev_warn(&pdev->dev, "platform clocks register failed: %d\n",
+			 ret);
+
 	pmc->init = true;
 	return ret;
 }
@@ -423,8 +496,8 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)
  * used by pci_match_id() call below.
  */
 static const struct pci_device_id pmc_pci_ids[] = {
-	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), (kernel_ulong_t)&byt_reg_map },
-	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CHT_PMC), (kernel_ulong_t)&cht_reg_map },
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_VLV_PMC), (kernel_ulong_t)&byt_data },
+	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_CHT_PMC), (kernel_ulong_t)&cht_data },
 	{ 0, },
 };
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v8 5/5] platform/x86: fix typo in comment
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2017-01-23 18:07 ` [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks Pierre-Louis Bossart
@ 2017-01-23 18:07 ` Pierre-Louis Bossart
  2017-01-27  0:23   ` Stephen Boyd
  2017-01-23 21:47   ` Andy Shevchenko
  5 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-23 18:07 UTC (permalink / raw)
  To: linux-clk, x86, platform-driver-x86, Stephen Boyd, Darren Hart,
	Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul,
	Pierre-Louis Bossart

s/Acumulate/Accumulate/

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/linux/platform_data/x86/pmc_atom.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/platform_data/x86/pmc_atom.h b/include/linux/platform_data/x86/pmc_atom.h
index aa8744c..e4905fe 100644
--- a/include/linux/platform_data/x86/pmc_atom.h
+++ b/include/linux/platform_data/x86/pmc_atom.h
@@ -50,7 +50,7 @@
 				BIT_ORED_DEDICATED_IRQ_GPSC | \
 				BIT_SHARED_IRQ_GPSS)
 
-/* The timers acumulate time spent in sleep state */
+/* The timers accumulate time spent in sleep state */
 #define	PMC_S0IR_TMR		0x80
 #define	PMC_S0I1_TMR		0x84
 #define	PMC_S0I2_TMR		0x88
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 0/5] Add platform clock for BayTrail platforms
  2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
@ 2017-01-23 21:47   ` Andy Shevchenko
  2017-01-23 18:07 ` [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks Pierre-Louis Bossart
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2017-01-23 21:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart, linux-clk, x86, platform-driver-x86,
	Stephen Boyd, Darren Hart, Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Vinod Koul

On Mon, 2017-01-23 at 12:07 -0600, Pierre-Louis Bossart wrote:
> These patches specifically enable the audio MCLK required by Baytrail
> CR devices. It is the remaining part of a bigger set of patches
> (already merged in Mark Brown's tree) that enable sound for Baytrail
> CR
> devices (especially Asus T100TAF) [1]. They include the clock driver
> and clock enabling in the pmc_atom code (along with moving of the
> non-architectural pmc_atom driver code into drivers/platform/x86 as
> suggested by Thomas Gleixner [2]). This move includes a new header in
> include/linux/platform_data/x86/. While there is an agreement that the
> definitions for PMC clocks are not really platform data this location
> is seen as a good-enough compromise with an agreement between Darren
> Hart and Andy Shevchenko [3]
> 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-
> August/111704.html
> [2] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-October/
> 113936.html
> [3] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-December
> /115892.html
> 
> Changes from v7:
>  - Replaced clk-readl/writel by regular readl/writel
>  - Fixed two nitpick comments (newline and driver name string)
>  - Fixed [5:0] to [0..5] in comment (missed in v6)
> 
> Changes from v6:
>  - Addressed comments from Stephen Boyd, Andy Shevchenko and Vinod
> Koul
>  - Renamed clk-byt-plt to clk-pmc-atom
>  - Rebase to 4.10-rc3 (broonie/for-next)
>  - Added helper functions to make error handling more compact
>  - Removed module-related code since it's not possible/supported
>  - Removed useless tests on remove
>  - PMC_CLK_OFFSET move to clk-pcm-atom (more logical)
>  - Split typo correction and makefile fix in separate patches
>  - small fixes (spaces, defaults in switches, alphabetical order, use
> of
> clk_writel/readl and no test on write, simpler error handling, use of
> while(i--), unsigned loop variables, kernel doc fields, format-patch
> -M
>  -C -D, use of PLATFORM_DEVID_NONE)
> 


> Changes from v5:
>  - fix build error reported by kbuild test robot
>  - split the clk driver code from x86 platform changes
> 
> Changes from v4:
>  - move the pmc_atom driver from arch/x86/platform/atom to
> drivers/platform/x86
> 
> Changes from v3:
>  - replace devm_kzalloc with devm_kcalloc
>  - add x86 architecture maintainers
> 
> Changes from v2:
>  - move clk platform data structures to a separate include file
>  - store clk_hw pointer for the fixed rate clocks
> 
> Changes from v1:
>  - register the clk device as child of pmc device
>  - pass iomem pointer from pmc driver to clk driver to avoid using
> pmc_atom_read()/write() and use readl/writel API instead
>  - use devm_clk_hw_register/clkdev_hw_create instead of
> clk_register/clkdev_create
> 
> Irina Tirdea (3):
>   clk: x86: Add Atom PMC platform clocks
>   arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
>   platform/x86: Enable Atom PMC platform clocks
> 
> Pierre-Louis Bossart (2):
>   clk: Make x86/ conditional on CONFIG_COMMON_CLK
>   platform/x86: fix typo in comment
> 
>  arch/x86/Kconfig                                   |   4 -
>  arch/x86/platform/atom/Makefile                    |   1 -
>  drivers/acpi/acpi_lpss.c                           |   2 +-
>  drivers/clk/Makefile                               |   2 +
>  drivers/clk/x86/Makefile                           |   1 +
>  drivers/clk/x86/clk-pmc-atom.c                     | 371
> +++++++++++++++++++++
>  drivers/platform/x86/Kconfig                       |   5 +
>  drivers/platform/x86/Makefile                      |   1 +
>  .../atom => drivers/platform/x86}/pmc_atom.c       |  88 ++++-
>  include/linux/platform_data/x86/clk-pmc-atom.h     |  44 +++
>  .../linux/platform_data/x86}/pmc_atom.h            |   2 +-
>  11 files changed, 506 insertions(+), 15 deletions(-)
>  create mode 100644 drivers/clk/x86/clk-pmc-atom.c
>  rename {arch/x86/platform/atom => drivers/platform/x86}/pmc_atom.c
> (87%)
>  create mode 100644 include/linux/platform_data/x86/clk-pmc-atom.h
>  rename {arch/x86/include/asm =>
> include/linux/platform_data/x86}/pmc_atom.h (98%)
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 0/5] Add platform clock for BayTrail platforms
@ 2017-01-23 21:47   ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2017-01-23 21:47 UTC (permalink / raw)
  To: Pierre-Louis Bossart, linux-clk, x86, platform-driver-x86,
	Stephen Boyd, Darren Hart, Thomas Gleixner
  Cc: alsa-devel, Irina Tirdea, Michael Turquette, Rafael J . Wysocki,
	Takashi Iwai, linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Vinod Koul

On Mon, 2017-01-23 at 12:07 -0600, Pierre-Louis Bossart wrote:
> These patches specifically enable the audio MCLK required by Baytrail
> CR devices. It is the remaining part of a bigger set of patches
> (already merged in Mark Brown's tree) that enable sound for Baytrail
> CR
> devices (especially Asus T100TAF) [1]. They include the clock driver
> and clock enabling in the pmc_atom code (along with moving of the
> non-architectural pmc_atom driver code into drivers/platform/x86 as
> suggested by Thomas Gleixner [2]). This move includes a new header in
> include/linux/platform_data/x86/. While there is an agreement that the
> definitions for PMC clocks are not really platform data this location
> is seen as a good-enough compromise with an agreement between Darren
> Hart and Andy Shevchenko [3]
> 

Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> [1] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-
> August/111704.html
> [2] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-October/
> 113936.html
> [3] http://mailman.alsa-project.org/pipermail/alsa-devel/2016-December
> /115892.html
> 
> Changes from v7:
>  - Replaced clk-readl/writel by regular readl/writel
>  - Fixed two nitpick comments (newline and driver name string)
>  - Fixed [5:0] to [0..5] in comment (missed in v6)
> 
> Changes from v6:
>  - Addressed comments from Stephen Boyd, Andy Shevchenko and Vinod
> Koul
>  - Renamed clk-byt-plt to clk-pmc-atom
>  - Rebase to 4.10-rc3 (broonie/for-next)
>  - Added helper functions to make error handling more compact
>  - Removed module-related code since it's not possible/supported
>  - Removed useless tests on remove
>  - PMC_CLK_OFFSET move to clk-pcm-atom (more logical)
>  - Split typo correction and makefile fix in separate patches
>  - small fixes (spaces, defaults in switches, alphabetical order, use
> of
> clk_writel/readl and no test on write, simpler error handling, use of
> while(i--), unsigned loop variables, kernel doc fields, format-patch
> -M
>  -C -D, use of PLATFORM_DEVID_NONE)
> 


> Changes from v5:
>  - fix build error reported by kbuild test robot
>  - split the clk driver code from x86 platform changes
> 
> Changes from v4:
>  - move the pmc_atom driver from arch/x86/platform/atom to
> drivers/platform/x86
> 
> Changes from v3:
>  - replace devm_kzalloc with devm_kcalloc
>  - add x86 architecture maintainers
> 
> Changes from v2:
>  - move clk platform data structures to a separate include file
>  - store clk_hw pointer for the fixed rate clocks
> 
> Changes from v1:
>  - register the clk device as child of pmc device
>  - pass iomem pointer from pmc driver to clk driver to avoid using
> pmc_atom_read()/write() and use readl/writel API instead
>  - use devm_clk_hw_register/clkdev_hw_create instead of
> clk_register/clkdev_create
> 
> Irina Tirdea (3):
>   clk: x86: Add Atom PMC platform clocks
>   arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86
>   platform/x86: Enable Atom PMC platform clocks
> 
> Pierre-Louis Bossart (2):
>   clk: Make x86/ conditional on CONFIG_COMMON_CLK
>   platform/x86: fix typo in comment
> 
>  arch/x86/Kconfig                                   |   4 -
>  arch/x86/platform/atom/Makefile                    |   1 -
>  drivers/acpi/acpi_lpss.c                           |   2 +-
>  drivers/clk/Makefile                               |   2 +
>  drivers/clk/x86/Makefile                           |   1 +
>  drivers/clk/x86/clk-pmc-atom.c                     | 371
> +++++++++++++++++++++
>  drivers/platform/x86/Kconfig                       |   5 +
>  drivers/platform/x86/Makefile                      |   1 +
>  .../atom => drivers/platform/x86}/pmc_atom.c       |  88 ++++-
>  include/linux/platform_data/x86/clk-pmc-atom.h     |  44 +++
>  .../linux/platform_data/x86}/pmc_atom.h            |   2 +-
>  11 files changed, 506 insertions(+), 15 deletions(-)
>  create mode 100644 drivers/clk/x86/clk-pmc-atom.c
>  rename {arch/x86/platform/atom => drivers/platform/x86}/pmc_atom.c
> (87%)
>  create mode 100644 include/linux/platform_data/x86/clk-pmc-atom.h
>  rename {arch/x86/include/asm =>
> include/linux/platform_data/x86}/pmc_atom.h (98%)
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK
  2017-01-23 18:07 ` [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK Pierre-Louis Bossart
@ 2017-01-27  0:22   ` Stephen Boyd
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:22 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-clk, x86, platform-driver-x86, Darren Hart,
	Thomas Gleixner, alsa-devel, Irina Tirdea, Michael Turquette,
	Rafael J . Wysocki, Takashi Iwai, linux-kernel, linux-acpi,
	Ingo Molnar, Mark Brown, H . Peter Anvin, Len Brown,
	Andy Shevchenko, Vinod Koul

On 01/23, Pierre-Louis Bossart wrote:
> Fix Makefile for x86 support, dependency on CONFIG_COMMON_CLK
> was not explicit
> 
> Fixes: 701190fd7419 ('clk: x86: add support for Lynxpoint LPSS clocks')
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks
  2017-01-23 18:07 ` [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks Pierre-Louis Bossart
@ 2017-01-27  0:22   ` Stephen Boyd
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:22 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-clk, x86, platform-driver-x86, Darren Hart,
	Thomas Gleixner, alsa-devel, Irina Tirdea, Michael Turquette,
	Rafael J . Wysocki, Takashi Iwai, linux-kernel, linux-acpi,
	Ingo Molnar, Mark Brown, H . Peter Anvin, Len Brown,
	Andy Shevchenko, Vinod Koul

On 01/23, Pierre-Louis Bossart wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
> 
> The BayTrail and CherryTrail platforms provide platform clocks
> through their Power Management Controller (PMC).
> 
> The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
> frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
> and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
> are available for general system use, where appropriate, and each
> have Control & Frequency register fields associated with them.
> 
> Port from legacy by Pierre Bossart, integration in clock framework
> by Irina Tirdea
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks
  2017-01-23 18:07 ` [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks Pierre-Louis Bossart
@ 2017-01-27  0:23   ` Stephen Boyd
  2017-07-10 10:19     ` Enric Balletbo Serra
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-clk, x86, platform-driver-x86, Darren Hart,
	Thomas Gleixner, alsa-devel, Irina Tirdea, Michael Turquette,
	Rafael J . Wysocki, Takashi Iwai, linux-kernel, linux-acpi,
	Ingo Molnar, Mark Brown, H . Peter Anvin, Len Brown,
	Andy Shevchenko, Vinod Koul

On 01/23, Pierre-Louis Bossart wrote:
> From: Irina Tirdea <irina.tirdea@intel.com>
> 
> The BayTrail and CherryTrail platforms provide platform clocks
> through their Power Management Controller (PMC).
> 
> The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
> frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
> and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
> are available for general system use, where appropriate. For example,
> the usage for platform clocks suggested in the datasheet is the
> following:
>   PLT_CLK[0..2] - Camera
>   PLT_CLK[3] - Audio Codec
>   PLT_CLK[4] -
>   PLT_CLK[5] - COMMs
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 5/5] platform/x86: fix typo in comment
  2017-01-23 18:07 ` [PATCH v8 5/5] platform/x86: fix typo in comment Pierre-Louis Bossart
@ 2017-01-27  0:23   ` Stephen Boyd
  0 siblings, 0 replies; 13+ messages in thread
From: Stephen Boyd @ 2017-01-27  0:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: linux-clk, x86, platform-driver-x86, Darren Hart,
	Thomas Gleixner, alsa-devel, Irina Tirdea, Michael Turquette,
	Rafael J . Wysocki, Takashi Iwai, linux-kernel, linux-acpi,
	Ingo Molnar, Mark Brown, H . Peter Anvin, Len Brown,
	Andy Shevchenko, Vinod Koul

On 01/23, Pierre-Louis Bossart wrote:
> s/Acumulate/Accumulate/
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks
  2017-01-27  0:23   ` Stephen Boyd
@ 2017-07-10 10:19     ` Enric Balletbo Serra
  0 siblings, 0 replies; 13+ messages in thread
From: Enric Balletbo Serra @ 2017-07-10 10:19 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Pierre-Louis Bossart, linux-clk, x86, platform-driver-x86,
	Darren Hart, Thomas Gleixner, alsa-devel, Irina Tirdea,
	Michael Turquette, Rafael J . Wysocki, Takashi Iwai,
	linux-kernel, linux-acpi, Ingo Molnar, Mark Brown,
	H . Peter Anvin, Len Brown, Andy Shevchenko, Vinod Koul

Hi all,

2017-01-27 1:23 GMT+01:00 Stephen Boyd <sboyd@codeaurora.org>:
> On 01/23, Pierre-Louis Bossart wrote:
>> From: Irina Tirdea <irina.tirdea@intel.com>
>>
>> The BayTrail and CherryTrail platforms provide platform clocks
>> through their Power Management Controller (PMC).
>>
>> The SoC supports up to 6 clocks (PMC_PLT_CLK[0..5]) with a
>> frequency of either 19.2 MHz (PLL) or 25 MHz (XTAL) for BayTrail
>> and a frequency of 19.2 MHz (XTAL) for CherryTrail. These clocks
>> are available for general system use, where appropriate. For example,
>> the usage for platform clocks suggested in the datasheet is the
>> following:
>>   PLT_CLK[0..2] - Camera
>>   PLT_CLK[3] - Audio Codec
>>   PLT_CLK[4] -
>>   PLT_CLK[5] - COMMs
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
>> ---
>
> Applied to clk-next
>

I just noticed that I need to revert this patch on kernel 4.12 to get
audio working again on my Acer C200 (Baytrail). Any clue on what could
be wrong?

Thanks in advance,
 Enric


> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
> a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-07-10 10:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 18:07 [PATCH v8 0/5] Add platform clock for BayTrail platforms Pierre-Louis Bossart
2017-01-23 18:07 ` [PATCH v8 1/5] clk: Make x86/ conditional on CONFIG_COMMON_CLK Pierre-Louis Bossart
2017-01-27  0:22   ` Stephen Boyd
2017-01-23 18:07 ` [PATCH v8 2/5] clk: x86: Add Atom PMC platform clocks Pierre-Louis Bossart
2017-01-27  0:22   ` Stephen Boyd
2017-01-23 18:07 ` [PATCH v8 3/5] arch/x86/platform/atom: Move pmc_atom to drivers/platform/x86 Pierre-Louis Bossart
2017-01-23 18:07 ` [PATCH v8 4/5] platform/x86: Enable Atom PMC platform clocks Pierre-Louis Bossart
2017-01-27  0:23   ` Stephen Boyd
2017-07-10 10:19     ` Enric Balletbo Serra
2017-01-23 18:07 ` [PATCH v8 5/5] platform/x86: fix typo in comment Pierre-Louis Bossart
2017-01-27  0:23   ` Stephen Boyd
2017-01-23 21:47 ` [PATCH v8 0/5] Add platform clock for BayTrail platforms Andy Shevchenko
2017-01-23 21:47   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.