* [PATCH 2/3] libnvdimm: Add a device-tree interface
From: Oliver O'Halloran @ 2017-11-15 17:51 UTC (permalink / raw)
To: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw
In-Reply-To: <20171115175131.23631-1-oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
A fairly bare-bones set of device-tree bindings so libnvdimm can be used
on powerpc and other device-tree based platforms.
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Oliver O'Halloran <oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
.../devicetree/bindings/nvdimm/nvdimm-bus.txt | 69 +++++++
MAINTAINERS | 8 +
drivers/nvdimm/Kconfig | 10 +
drivers/nvdimm/Makefile | 1 +
drivers/nvdimm/of_nvdimm.c | 202 +++++++++++++++++++++
5 files changed, 290 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt
create mode 100644 drivers/nvdimm/of_nvdimm.c
diff --git a/Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt b/Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt
new file mode 100644
index 000000000000..491e7c4900ed
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt
@@ -0,0 +1,69 @@
+Device-tree bindings for nonvolatile-memory / NVDIMMs
+-----------------------------------------------------
+
+Non-volatile DIMMs are memory modules used to provide (cacheable) main memory that
+retains its contents across power cycles. In more practical terms, they are kind
+of storage device where the contents can be accessed by the CPU directly,
+rather than indirectly via a storage controller or similar. This can provide
+substantial performance improvements for applications designed to take
+advantage of in-memory storage.
+
+This binding provides a way to describe memory regions that should be managed
+by an NVDIMM storage driver (libNVDIMM in Linux) and some of the associated
+metadata. The binding itself is split into two main parts: A container bus and
+its sub-nodes which describe which memory address ranges corresponding to
+NVDIMM backed memory.
+
+Bindings for the container bus:
+------------------------------
+
+Required properties:
+ - compatible = "nvdimm-bus";
+ - ranges;
+ A blank ranges property is required because the sub-nodes have
+ addresses in the system's physical address space.
+
+The use of a container bus is mainly to handle future expansion of the binding. For
+comparison the ACPI equivalent of this binding (NFIT) describes: Memory regions, DIMM
+control structures, Block mode DIMM control structures, interleave sets, and more. Some
+of these structures cross reference each other so everyone should be happier if we keep
+it relatively self contained.
+
+Bindings for the region nodes:
+-----------------------------
+
+Required properties:
+ - compatible = "nvdimm-persistent" or "nvdimm-volatile"
+
+ The "nvdimm-persistent" region type indicates that this memory region
+ is actually a persistent region. The volatile type is mainly useful
+ for testing and RAM disks that can persist across kexec.
+
+ - reg = <base, size>;
+ The reg property should only contain one address range.
+
+Optional properties:
+ - Any relevant NUMA assocativity properties for the target platform.
+
+A complete example:
+--------------------
+
+/ {
+ #size-cells = <1>;
+ #address-cells = <1>;
+
+ nonvolatile-memory {
+ compatible = "nonvolatile-memory";
+ ranges;
+
+ region@5000 {
+ compatible = "nvdimm-persistent";
+ reg = <0x5000 0x1000>;
+ };
+
+ region@6000 {
+ compatible = "nvdimm-volatile";
+ reg = <0x6000 0x1000>;
+ };
+ };
+};
diff --git a/MAINTAINERS b/MAINTAINERS
index 65eff7857ec3..0350bf5a94d2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7875,6 +7875,14 @@ Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
S: Supported
F: drivers/nvdimm/pmem*
+LIBNVDIMM: DEVICETREE BINDINGS
+M: Oliver O'Halloran <oohall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
+L: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
+Q: https://patchwork.kernel.org/project/linux-nvdimm/list/
+S: Supported
+F: drivers/nvdimm/of_nvdimm.c
+F: Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt
+
LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
M: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
L: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig
index 5bdd499b5f4f..72d147b55596 100644
--- a/drivers/nvdimm/Kconfig
+++ b/drivers/nvdimm/Kconfig
@@ -102,4 +102,14 @@ config NVDIMM_DAX
Select Y if unsure
+config OF_NVDIMM
+ tristate "Device-tree support for NVDIMMs"
+ depends on OF
+ default LIBNVDIMM
+ help
+ Allows byte addressable persistent memory regions to be described in the
+ device-tree.
+
+ Select Y if unsure.
+
endif
diff --git a/drivers/nvdimm/Makefile b/drivers/nvdimm/Makefile
index ca6d325438a3..9029511a8486 100644
--- a/drivers/nvdimm/Makefile
+++ b/drivers/nvdimm/Makefile
@@ -3,6 +3,7 @@ obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o
obj-$(CONFIG_ND_BTT) += nd_btt.o
obj-$(CONFIG_ND_BLK) += nd_blk.o
obj-$(CONFIG_X86_PMEM_LEGACY) += nd_e820.o
+obj-$(CONFIG_OF_NVDIMM) += of_nvdimm.o
nd_pmem-y := pmem.o
diff --git a/drivers/nvdimm/of_nvdimm.c b/drivers/nvdimm/of_nvdimm.c
new file mode 100644
index 000000000000..765cbbae8bcb
--- /dev/null
+++ b/drivers/nvdimm/of_nvdimm.c
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2017, IBM Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ */
+
+#define pr_fmt(fmt) "of_nvdimm: " fmt
+
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/libnvdimm.h>
+#include <linux/module.h>
+#include <linux/ioport.h>
+#include <linux/slab.h>
+
+static const struct attribute_group *region_attr_groups[] = {
+ &nd_region_attribute_group,
+ &nd_device_attribute_group,
+ NULL,
+};
+
+static int of_nvdimm_add_byte(struct nvdimm_bus *bus, struct device_node *np)
+{
+ struct nd_region_desc ndr_desc;
+ struct resource temp_res;
+ struct nd_region *region;
+
+ /*
+ * byte regions should only have one address range
+ */
+ if (of_address_to_resource(np, 0, &temp_res)) {
+ pr_warn("Unable to parse reg[0] for %pOF\n", np);
+ return -ENXIO;
+ }
+
+ pr_debug("Found %pR for %pOF\n", &temp_res, np);
+
+ memset(&ndr_desc, 0, sizeof(ndr_desc));
+ ndr_desc.res = &temp_res;
+ ndr_desc.of_node = np;
+ ndr_desc.attr_groups = region_attr_groups;
+#ifdef CONFIG_NUMA
+ ndr_desc.numa_node = of_node_to_nid(np);
+#endif
+ set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
+
+ if (of_device_is_compatible(np, "nvdimm-volatile"))
+ region = nvdimm_volatile_region_create(bus, &ndr_desc);
+ else
+ region = nvdimm_pmem_region_create(bus, &ndr_desc);
+
+ if (!region)
+ return -ENXIO;
+
+ return 0;
+}
+
+static const struct of_device_id of_nvdimm_dev_types[] = {
+ { .compatible = "nvdimm-persistent", .data = of_nvdimm_add_byte },
+ { .compatible = "nvdimm-volatile", .data = of_nvdimm_add_byte },
+ { },
+};
+
+static void of_nvdimm_parse_one(struct nvdimm_bus *bus,
+ struct device_node *node)
+{
+ int (*parse_node)(struct nvdimm_bus *, struct device_node *);
+ const struct of_device_id *match;
+ int rc;
+
+ if (of_node_test_and_set_flag(node, OF_POPULATED)) {
+ pr_debug("%pOF already parsed, skipping\n", node);
+ return;
+ }
+
+ match = of_match_node(of_nvdimm_dev_types, node);
+ if (!match) {
+ pr_info("No compatible match for '%pOF'\n", node);
+ of_node_clear_flag(node, OF_POPULATED);
+ return;
+ }
+
+ of_node_get(node);
+ parse_node = match->data;
+ rc = parse_node(bus, node);
+
+ if (rc) {
+ of_node_clear_flag(node, OF_POPULATED);
+ of_node_put(node);
+ }
+
+ pr_debug("Parsed %pOF, rc = %d\n", node, rc);
+
+ return;
+}
+
+/*
+ * The nvdimm core refers to the bus descriptor structure at runtime
+ * so we need to keep it around. Note that that this is different to
+ * the other nd_*_desc types which are essentially containers for extra
+ * function parameters.
+ */
+struct of_nd_private {
+ struct nvdimm_bus_descriptor desc;
+ struct nvdimm_bus *bus;
+};
+
+static const struct attribute_group *bus_attr_groups[] = {
+ &nvdimm_bus_attribute_group,
+ NULL,
+};
+
+static int of_nvdimm_probe(struct platform_device *pdev)
+{
+ struct device_node *node, *child;
+ struct of_nd_private *priv;
+
+ node = dev_of_node(&pdev->dev);
+ if (!node)
+ return -ENXIO;
+
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ priv->desc.attr_groups = bus_attr_groups;
+ priv->desc.provider_name = "of_nvdimm";
+ priv->desc.module = THIS_MODULE;
+ priv->desc.of_node = node;
+
+ priv->bus = nvdimm_bus_register(&pdev->dev, &priv->desc);
+ if (!priv->bus)
+ goto err;
+
+ platform_set_drvdata(pdev, priv);
+
+ /* now walk the node bus and setup regions, etc */
+ for_each_available_child_of_node(node, child)
+ of_nvdimm_parse_one(priv->bus, child);
+
+ return 0;
+
+err:
+ nvdimm_bus_unregister(priv->bus);
+ kfree(priv);
+ return -ENXIO;
+}
+
+static int of_nvdimm_remove(struct platform_device *pdev)
+{
+ struct of_nd_private *priv = platform_get_drvdata(pdev);
+ struct device_node *node;
+
+ if (!priv)
+ return 0; /* possible? */
+
+ for_each_available_child_of_node(pdev->dev.of_node, node) {
+ if (!of_node_check_flag(node, OF_POPULATED))
+ continue;
+
+ of_node_clear_flag(node, OF_POPULATED);
+ of_node_put(node);
+ pr_debug("de-populating %s\n", node->full_name);
+ }
+
+ nvdimm_bus_unregister(priv->bus);
+ kfree(priv);
+
+ return 0;
+}
+
+static const struct of_device_id of_nvdimm_bus_match[] = {
+ { .compatible = "nvdimm-bus" },
+ { },
+};
+
+static const struct platform_driver of_nvdimm_driver = {
+ .probe = of_nvdimm_probe,
+ .remove = of_nvdimm_remove,
+ .driver = {
+ .name = "of_nvdimm",
+ .owner = THIS_MODULE,
+ .of_match_table = of_nvdimm_bus_match,
+ },
+};
+
+module_platform_driver(of_nvdimm_driver);
+MODULE_DEVICE_TABLE(of, of_nvdimm_bus_match);
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("IBM Corporation");
--
2.9.5
^ permalink raw reply related
* Re: [PATCH v3 5/5] misc serdev: w2sg0004: add debugging code and Kconfig
From: H. Nikolaus Schaller @ 2017-11-15 17:13 UTC (permalink / raw)
To: Ladislav Michl
Cc: Mark Rutland, devicetree, linux-omap, Arnd Bergmann,
Tony Lindgren, Greg Kroah-Hartman, kernel, Russell King,
linux-kernel, Rob Herring, linux-arm-kernel, Benoît Cousson,
Kevin Hilman, letux-kernel, Thierry Reding, Andreas Färber,
Jonathan Cameron
In-Reply-To: <20171115164257.2mbbk7yqhq3puc5a@lenoch>
Hi Ladislav,
> Am 15.11.2017 um 17:42 schrieb Ladislav Michl <ladis@linux-mips.org>:
>
> On Wed, Nov 15, 2017 at 05:29:25PM +0100, H. Nikolaus Schaller wrote:
>> Hi Andreas,
>>
>>> Am 15.11.2017 um 16:53 schrieb Andreas Färber <afaerber@suse.de>:
>>>
>>> Hi,
>>>
>>> Am 15.11.2017 um 16:19 schrieb H. Nikolaus Schaller:
>>>> This allows to set CONFIG_W2SG0004_DEBUG which will
>>>> make the driver report more activities and it will turn on the
>>>> GPS module during boot while the driver assumes that it
>>>> is off. This can be used to debug the correct functioning of
>>>> the hardware. Therefore we add it as an option to the driver
>>>> because we think it is of general use (and a little tricky to
>>>> add by system testers).
>>>>
>>>> Normally it should be off.
>>>> ---
>>>
>>> If you want to merge this, it is lacking a Sob.
>>
>> Whats is a "Sob" in this context (https://acronyms.thefreedictionary.com/SOB)?
>
> https://acronyms.thefreedictionary.com/Signed-Off-By
Ah, ok. Too obvious to associate :) Tnx.
I did never think about that this could be missing. And I don't know why :(
> Also please read Documentation/process/submitting-patches.rst
We have automated things by calling checkpatch but it somwhow failed here.
BR and thanks,
Nikolaus
^ permalink raw reply
* Re: [PATCH V5] clk: qcom: Add spmi_pmic clock divider support
From: Stephen Boyd @ 2017-11-15 17:06 UTC (permalink / raw)
To: Tirupathi Reddy
Cc: mturquette, robh+dt, mark.rutland, andy.gross, david.brown,
linux-clk, devicetree, linux-kernel, linux-arm-msm, linux-soc
In-Reply-To: <1505817286-12445-1-git-send-email-tirupath@codeaurora.org>
On 09/19, Tirupathi Reddy wrote:
> diff --git a/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt b/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
> new file mode 100644
> index 0000000..e37a136
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
> @@ -0,0 +1,56 @@
> +Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
> +
> +clkdiv configures the clock frequency of a set of outputs on the PMIC.
> +These clocks are typically wired through alternate functions on
> +gpio pins.
> +
> +=======================
> +Properties
> +=======================
> +
> +- compatible
> + Usage: required
> + Value type: <string>
> + Definition: must be one of:
> + "qcom,spmi-clkdiv"
> + "qcom,pm8998-clkdiv"
> +
> +- reg
> + Usage: required
> + Value type: <prop-encoded-array>
> + Definition: Addresses and sizes for the memory of this CLKDIV
There's no size though.
> + peripheral.
> +
> +- clocks:
> + Usage: required
> + Value type: <prop-encoded-array>
> + Definition: reference to the xo clock.
> +
> +- clock-names:
> + Usage: required
> + Value type: <stringlist>
> + Definition: must be "xo".
> +
> +- clock-cells:
> + Usage: required
> + Value type: <u32>
> + Definition: shall contain 1.
Can we get a property to indicate the number of clks? Something
like "qcom,num-clkdivs" or something like that. That would make
things easier to handle in the driver because we could match the
generic compatible and look for the property and then populate
that many clks. Otherwise, we're going to need a "small" driver
update for each PMIC just because the number of clks changes.
Of course we're going to need to update the binding to add the
new PMIC compatibles as new things are created, but I'd like to
avoid driver updates for the compatible. If someone messes up the
number we can always fallback to matching the more specific
compatible and fix it up in the driver, but let's hope that
doesn't happen.
> +
> +=======
> +Example
> +=======
> +
> +pm8998_clk_divs: qcom,clock@5b00 {
clock-controller@5b00?
> + compatible = "qcom,pm8998-clkdiv";
> + reg = <0x5b00>;
> + #clock-cells = <1>;
> + clocks = <&xo_board>;
> + clock-names = "xo";
> +
> + assigned-clocks = <&pm8998_clk_divs 1>,
> + <&pm8998_clk_divs 2>,
> + <&pm8998_clk_divs 3>;
> + assigned-clock-rates = <9600000>,
> + <9600000>,
> + <9600000>;
> +};
> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
> index 9f6c278..dd5b18e 100644
> --- a/drivers/clk/qcom/Kconfig
> +++ b/drivers/clk/qcom/Kconfig
> @@ -196,3 +196,12 @@ config MSM_MMCC_8996
> Support for the multimedia clock controller on msm8996 devices.
> Say Y if you want to support multimedia devices such as display,
> graphics, video encode/decode, camera, etc.
> +
> +config SPMI_PMIC_CLKDIV
> + tristate "spmi pmic clkdiv driver"
Capitalize SPMI and PMIC and replace driver with something else.
> + depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST
> + help
> + This driver supports the clkdiv functionality on the Qualcomm
> + Technologies, Inc. SPMI PMIC. It configures the frequency of
> + clkdiv outputs on the PMIC. These clocks are typically wired
> + through alternate functions on gpio pins.
I rewrote a bunch of stuff in the driver. Let me know if anything
doesn't work.
----8<----
diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
index dd5b18ecd9d1..20b5d6fd501d 100644
--- a/drivers/clk/qcom/Kconfig
+++ b/drivers/clk/qcom/Kconfig
@@ -198,10 +198,10 @@ config MSM_MMCC_8996
graphics, video encode/decode, camera, etc.
config SPMI_PMIC_CLKDIV
- tristate "spmi pmic clkdiv driver"
+ tristate "SPMI PMIC clkdiv Support"
depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST
help
This driver supports the clkdiv functionality on the Qualcomm
Technologies, Inc. SPMI PMIC. It configures the frequency of
- clkdiv outputs on the PMIC. These clocks are typically wired
- through alternate functions on gpio pins.
+ clkdiv outputs of the PMIC. These clocks are typically wired
+ through alternate functions on GPIO pins.
diff --git a/drivers/clk/qcom/clk-spmi-pmic-div.c b/drivers/clk/qcom/clk-spmi-pmic-div.c
index af343ad2ee0b..a7217ee9f741 100644
--- a/drivers/clk/qcom/clk-spmi-pmic-div.c
+++ b/drivers/clk/qcom/clk-spmi-pmic-div.c
@@ -18,6 +18,7 @@
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
@@ -29,29 +30,12 @@
#define REG_EN_CTL 0x46
#define REG_EN_MASK BIT(7)
-#define ENABLE_DELAY_NS(cxo_ns, div) ((2 + 3 * div) * cxo_ns)
-#define DISABLE_DELAY_NS(cxo_ns, div) ((3 * div) * cxo_ns)
-
-#define CLK_SPMI_PMIC_DIV_OFFSET 1
-
-#define CLKDIV_XO_DIV_1_0 0
-#define CLKDIV_XO_DIV_1 1
-#define CLKDIV_XO_DIV_2 2
-#define CLKDIV_XO_DIV_4 3
-#define CLKDIV_XO_DIV_8 4
-#define CLKDIV_XO_DIV_16 5
-#define CLKDIV_XO_DIV_32 6
-#define CLKDIV_XO_DIV_64 7
-#define CLKDIV_MAX_ALLOWED 8
-
struct clkdiv {
struct regmap *regmap;
u16 base;
spinlock_t lock;
- /* clock properties */
struct clk_hw hw;
- unsigned int div_factor;
unsigned int cxo_period_ns;
};
@@ -62,94 +46,68 @@ static inline struct clkdiv *to_clkdiv(struct clk_hw *hw)
static inline unsigned int div_factor_to_div(unsigned int div_factor)
{
- if (div_factor == CLKDIV_XO_DIV_1_0)
- return 1;
+ if (!div_factor)
+ div_factor = 1;
- return 1 << (div_factor - CLK_SPMI_PMIC_DIV_OFFSET);
+ return 1 << (div_factor - 1);
}
static inline unsigned int div_to_div_factor(unsigned int div)
{
- return min(ilog2(div) + CLK_SPMI_PMIC_DIV_OFFSET,
- CLKDIV_MAX_ALLOWED - 1);
+ return min(ilog2(div) + 1, 7);
}
static bool is_spmi_pmic_clkdiv_enabled(struct clkdiv *clkdiv)
{
unsigned int val = 0;
- regmap_read(clkdiv->regmap, clkdiv->base + REG_EN_CTL,
- &val);
- return (val & REG_EN_MASK) ? true : false;
+ regmap_read(clkdiv->regmap, clkdiv->base + REG_EN_CTL, &val);
+
+ return val & REG_EN_MASK;
}
-static int spmi_pmic_clkdiv_set_enable_state(struct clkdiv *clkdiv,
- bool enable_state)
+static int
+__spmi_pmic_clkdiv_set_enable_state(struct clkdiv *clkdiv, bool enable,
+ unsigned int div_factor)
{
- int rc;
+ int ret;
+ unsigned int ns = clkdiv->cxo_period_ns;
+ unsigned int div = div_factor_to_div(div_factor);
- rc = regmap_update_bits(clkdiv->regmap, clkdiv->base + REG_EN_CTL,
- REG_EN_MASK,
- (enable_state == true) ? REG_EN_MASK : 0);
- if (rc)
- return rc;
+ ret = regmap_update_bits(clkdiv->regmap, clkdiv->base + REG_EN_CTL,
+ REG_EN_MASK, enable ? REG_EN_MASK : 0);
+ if (ret)
+ return ret;
- if (enable_state == true)
- ndelay(ENABLE_DELAY_NS(clkdiv->cxo_period_ns,
- div_factor_to_div(clkdiv->div_factor)));
+ if (enable)
+ ndelay((2 + 3 * div) * ns);
else
- ndelay(DISABLE_DELAY_NS(clkdiv->cxo_period_ns,
- div_factor_to_div(clkdiv->div_factor)));
+ ndelay(3 * div * ns);
- return rc;
+ return 0;
}
-static int spmi_pmic_clkdiv_config_freq_div(struct clkdiv *clkdiv,
- unsigned int div)
+static int spmi_pmic_clkdiv_set_enable_state(struct clkdiv *clkdiv, bool enable)
{
unsigned int div_factor;
- unsigned long flags;
- bool enabled;
- int rc;
-
- div_factor = div_to_div_factor(div);
-
- spin_lock_irqsave(&clkdiv->lock, flags);
-
- enabled = is_spmi_pmic_clkdiv_enabled(clkdiv);
- if (enabled) {
- rc = spmi_pmic_clkdiv_set_enable_state(clkdiv, false);
- if (rc)
- goto fail;
- }
- rc = regmap_update_bits(clkdiv->regmap,
- clkdiv->base + REG_DIV_CTL1,
- DIV_CTL1_DIV_FACTOR_MASK, div_factor);
- if (rc)
- goto fail;
+ regmap_read(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1, &div_factor);
+ div_factor &= DIV_CTL1_DIV_FACTOR_MASK;
- clkdiv->div_factor = div_factor;
-
- if (enabled)
- rc = spmi_pmic_clkdiv_set_enable_state(clkdiv, true);
-
-fail:
- spin_unlock_irqrestore(&clkdiv->lock, flags);
- return rc;
+ return __spmi_pmic_clkdiv_set_enable_state(clkdiv, enable, div_factor);
}
static int clk_spmi_pmic_div_enable(struct clk_hw *hw)
{
struct clkdiv *clkdiv = to_clkdiv(hw);
unsigned long flags;
- int rc;
+ int ret;
spin_lock_irqsave(&clkdiv->lock, flags);
- rc = spmi_pmic_clkdiv_set_enable_state(clkdiv, true);
+ ret = spmi_pmic_clkdiv_set_enable_state(clkdiv, true);
spin_unlock_irqrestore(&clkdiv->lock, flags);
- return rc;
+ return ret;
}
static void clk_spmi_pmic_div_disable(struct clk_hw *hw)
@@ -163,35 +121,59 @@ static void clk_spmi_pmic_div_disable(struct clk_hw *hw)
}
static long clk_spmi_pmic_div_round_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long *parent_rate)
+ unsigned long *parent_rate)
{
- unsigned long new_rate;
unsigned int div, div_factor;
div = DIV_ROUND_UP(*parent_rate, rate);
div_factor = div_to_div_factor(div);
- new_rate = *parent_rate / div_factor_to_div(div_factor);
+ div = div_factor_to_div(div_factor);
- return new_rate;
+ return *parent_rate / div;
}
-static unsigned long clk_spmi_pmic_div_recalc_rate(struct clk_hw *hw,
- unsigned long parent_rate)
+static unsigned long
+clk_spmi_pmic_div_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{
struct clkdiv *clkdiv = to_clkdiv(hw);
- unsigned long rate;
+ unsigned int div_factor;
- rate = parent_rate / div_factor_to_div(clkdiv->div_factor);
+ regmap_read(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1, &div_factor);
+ div_factor &= DIV_CTL1_DIV_FACTOR_MASK;
- return rate;
+ return parent_rate / div_factor_to_div(div_factor);
}
static int clk_spmi_pmic_div_set_rate(struct clk_hw *hw, unsigned long rate,
- unsigned long parent_rate)
+ unsigned long parent_rate)
{
struct clkdiv *clkdiv = to_clkdiv(hw);
+ unsigned int div_factor = div_to_div_factor(parent_rate / rate);
+ unsigned long flags;
+ bool enabled;
+ int ret;
+
+ spin_lock_irqsave(&clkdiv->lock, flags);
+ enabled = is_spmi_pmic_clkdiv_enabled(clkdiv);
+ if (enabled) {
+ ret = spmi_pmic_clkdiv_set_enable_state(clkdiv, false);
+ if (ret)
+ goto unlock;
+ }
+
+ ret = regmap_update_bits(clkdiv->regmap, clkdiv->base + REG_DIV_CTL1,
+ DIV_CTL1_DIV_FACTOR_MASK, div_factor);
+ if (ret)
+ goto unlock;
+
+ if (enabled)
+ ret = __spmi_pmic_clkdiv_set_enable_state(clkdiv, true,
+ div_factor);
- return spmi_pmic_clkdiv_config_freq_div(clkdiv, parent_rate / rate);
+unlock:
+ spin_unlock_irqrestore(&clkdiv->lock, flags);
+
+ return ret;
}
static const struct clk_ops clk_spmi_pmic_div_ops = {
@@ -203,30 +185,25 @@ static const struct clk_ops clk_spmi_pmic_div_ops = {
};
struct spmi_pmic_div_clk_cc {
- struct clk_hw **div_clks;
int nclks;
+ struct clkdiv clks[];
};
-#define SPMI_PMIC_CLKDIV_MIN_INDEX 1
-
-static struct clk_hw *spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec,
- void *data)
+static struct clk_hw *
+spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec, void *data)
{
- struct spmi_pmic_div_clk_cc *clk_cc = data;
- unsigned int idx = (clkspec->args[0] - SPMI_PMIC_CLKDIV_MIN_INDEX);
+ struct spmi_pmic_div_clk_cc *cc = data;
+ int idx = clkspec->args[0] - 1; /* Start at 1 instead of 0 */
- if (idx < 0 || idx >= clk_cc->nclks) {
- pr_err("%s: index value %u is invalid; allowed range: [%d, %d]\n",
- __func__, clkspec->args[0], SPMI_PMIC_CLKDIV_MIN_INDEX,
- clk_cc->nclks);
+ if (idx < 0 || idx >= cc->nclks) {
+ pr_err("%s: index value %u is invalid; allowed range [1, %d]\n",
+ __func__, clkspec->args[0], cc->nclks);
return ERR_PTR(-EINVAL);
}
- return clk_cc->div_clks[idx];
+ return &cc->clks[idx].hw;
}
-#define SPMI_PMIC_DIV_CLK_SIZE 0x100
-
static const struct of_device_id spmi_pmic_clkdiv_match_table[] = {
{
.compatible = "qcom,spmi-clkdiv",
@@ -242,20 +219,21 @@ MODULE_DEVICE_TABLE(of, spmi_pmic_clkdiv_match_table);
static int spmi_pmic_clkdiv_probe(struct platform_device *pdev)
{
- struct spmi_pmic_div_clk_cc *clk_cc;
+ struct spmi_pmic_div_clk_cc *cc;
struct clk_init_data init = {};
struct clkdiv *clkdiv;
struct clk *cxo;
struct regmap *regmap;
struct device *dev = &pdev->dev;
+ struct device_node *of_node = dev->of_node;
const char *parent_name;
- int nclks, i, rc, cxo_hz;
+ int nclks, i, ret, cxo_hz;
u32 start;
- rc = of_property_read_u32(dev->of_node, "reg", &start);
- if (rc < 0) {
+ ret = of_property_read_u32(of_node, "reg", &start);
+ if (ret < 0) {
dev_err(dev, "reg property reading failed\n");
- return rc;
+ return ret;
}
regmap = dev_get_regmap(dev->parent, NULL);
@@ -264,62 +242,51 @@ static int spmi_pmic_clkdiv_probe(struct platform_device *pdev)
return -EINVAL;
}
- nclks = (uintptr_t)of_match_node(spmi_pmic_clkdiv_match_table,
- dev->of_node)->data;
-
- clkdiv = devm_kcalloc(dev, nclks, sizeof(*clkdiv), GFP_KERNEL);
- if (!clkdiv)
- return -ENOMEM;
-
- clk_cc = devm_kzalloc(&pdev->dev, sizeof(*clk_cc), GFP_KERNEL);
- if (!clk_cc)
- return -ENOMEM;
+ nclks = (uintptr_t)of_device_get_match_data(dev);
+ if (!nclks)
+ return -EINVAL;
- clk_cc->div_clks = devm_kcalloc(&pdev->dev, nclks,
- sizeof(*clk_cc->div_clks), GFP_KERNEL);
- if (!clk_cc->div_clks)
+ cc = devm_kzalloc(dev, sizeof(*cc) + sizeof(*cc->clks) * nclks,
+ GFP_KERNEL);
+ if (!cc)
return -ENOMEM;
+ cc->nclks = nclks;
cxo = clk_get(dev, "xo");
if (IS_ERR(cxo)) {
- rc = PTR_ERR(cxo);
- if (rc != -EPROBE_DEFER)
- dev_err(dev, "failed to get xo clock");
- return rc;
+ ret = PTR_ERR(cxo);
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev, "failed to get xo clock\n");
+ return ret;
}
cxo_hz = clk_get_rate(cxo);
clk_put(cxo);
- parent_name = of_clk_get_parent_name(dev->of_node, 0);
+ parent_name = of_clk_get_parent_name(of_node, 0);
if (!parent_name) {
dev_err(dev, "missing parent clock\n");
return -ENODEV;
}
init.parent_names = &parent_name;
- init.num_parents = parent_name ? 1 : 0;
+ init.num_parents = 1;
init.ops = &clk_spmi_pmic_div_ops;
- init.flags = 0;
- for (i = 0; i < nclks; i++) {
+ for (i = 0, clkdiv = cc->clks; i < nclks; i++) {
spin_lock_init(&clkdiv[i].lock);
- clkdiv[i].base = start + i * SPMI_PMIC_DIV_CLK_SIZE;
+ clkdiv[i].base = start + i * 0x100;
clkdiv[i].regmap = regmap;
clkdiv[i].cxo_period_ns = NSEC_PER_SEC / cxo_hz;
init.name = kasprintf(GFP_KERNEL, "div_clk%d", i + 1);
clkdiv[i].hw.init = &init;
- rc = devm_clk_hw_register(dev, &clkdiv[i].hw);
- kfree(init.name); /* clock framework made a copy of the name */
- if (rc)
- return rc;
- clk_cc->div_clks[i] = &clkdiv[i].hw;
+ ret = devm_clk_hw_register(dev, &clkdiv[i].hw);
+ kfree(init.name); /* clk framework made a copy */
+ if (ret)
+ return ret;
}
- clk_cc->nclks = nclks;
- rc = of_clk_add_hw_provider(pdev->dev.of_node, spmi_pmic_div_clk_hw_get,
- clk_cc);
- return rc;
+ return of_clk_add_hw_provider(of_node, spmi_pmic_div_clk_hw_get, cc);
}
static int spmi_pmic_clkdiv_remove(struct platform_device *pdev)
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related
* Re: [PATCH v3 3/5] misc serdev: Add w2sg0004 (gps receiver) power control driver
From: Arnd Bergmann @ 2017-11-15 17:03 UTC (permalink / raw)
To: H. Nikolaus Schaller
Cc: Mark Rutland, DTML, linux-omap, Tony Lindgren, Greg Kroah-Hartman,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf, Russell King,
Linux Kernel Mailing List, Rob Herring, Linux ARM,
Benoît Cousson, Kevin Hilman,
letux-kernel-S0jZdbWzriLCfDggNXIi3w, Thierry Reding,
Andreas Färber, Jonathan Cameron
In-Reply-To: <AFD95D2E-2EBB-4EBF-9B3B-E68ED98E5437-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
On Wed, Nov 15, 2017 at 5:27 PM, H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> wrote:
>> Am 15.11.2017 um 16:54 schrieb Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>:
>> On Wed, Nov 15, 2017 at 4:19 PM, H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> wrote:
>>> Add driver for Wi2Wi W2SG0004/84 GPS module connected through uart.
>
> There is one more goal. Some people are dreaming about a generic GPS interface.
> Then, the driver wouldn't have to register a /dev/GPS tty any more but a
> gps_interface and mangle serial data as requested by that API. This will become
> a simple upgrade.
>
> So you can consider creating a new tty as sort of temporary solution. Like we
> had for years for UART HCI based bluetooth devices using a user-space daemon.
It shouldn't be hard to split out the tty_driver portion of your file from the
part that registers the port, basically getting two files that each handle
half of the work, and the second one would be generic from the start.
>>> + /* initialize the tty driver */
>>> + data->tty_drv->owner = THIS_MODULE;
>>> + data->tty_drv->driver_name = "w2sg0004";
>>> + data->tty_drv->name = "ttyGPS";
>>> + data->tty_drv->major = 0;
>>> + data->tty_drv->minor_start = 0;
>>> + data->tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
>>> + data->tty_drv->subtype = SERIAL_TYPE_NORMAL;
>>> + data->tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
>>> + data->tty_drv->init_termios = tty_std_termios;
>>> + data->tty_drv->init_termios.c_cflag = B9600 | CS8 | CREAD |
>>> + HUPCL | CLOCAL;
>>> + /*
>>> + * optional:
>>> + * tty_termios_encode_baud_rate(&data->tty_drv->init_termios,
>>> + 115200, 115200);
>>> + * w2sg_tty_termios(&data->tty_drv->init_termios);
>>> + */
>>> + tty_set_operations(data->tty_drv, &w2sg_serial_ops);
>>
>> While I'm still not sure about why we want nested tty port, it
>> seems that we should have only one tty_driver that gets initialized
>> at module load time, rather than one driver structure per port.
>
> If we have several such chips connected to different serdev UARTs
> we need different /dev/GPS to separate them in user-space.
I understand that you need multiple devices, but I don't see
what having multiple drivers that all share the same name
"w2sg0004" helps. I would have expected that to fail in
tty_register_driver() when you get to the second driver,
but looking at the code, it doesn't actually try to make the name
unique proc_tty_register_driver() will fail to create the second
procfs file, but we ignore that failure.
Why not call tty_register_driver() in the init function rather than probe()?
>>> + /* register the tty driver */
>>> + err = tty_register_driver(data->tty_drv);
>>> + if (err) {
>>> + pr_err("%s - tty_register_driver failed(%d)\n",
>>> + __func__, err);
>>> + put_tty_driver(data->tty_drv);
>>> + goto err_rfkill;
>>> + }
>>> +
>>> + tty_port_init(&data->port);
>>> + data->port.ops = &w2sg_port_ops;
>>> +
>>> +/*
>>> + * FIXME: this appears to reenter this probe() function a second time
>>> + * which only fails because the gpio is already assigned
>>> + */
>>> +
>>> + data->dev = tty_port_register_device(&data->port,
>>> + data->tty_drv, minor, &serdev->dev);
>>
>> This seems to be a result of having nested tty ports, and both
>> ports point to the same device.
>
> The UART tty would be e.g. /dev/ttyO2 (on OMAP3) if no driver is
> installed. And the new one that is registered is /dev/GPS0. So the
> tty subsystem doesn't (or shouldn't) know they are related. They
> are only related/connected inside this driver. So I assume that
> some locking or reentrancy happens in tty_port_register_device().
I meant the serdev->dev pointer that you pass into
tty_port_register_device() seems to be the same one that
got passed into the first tty_port_register_device() in the
parent uart_port.
I just checked the current mainline code, and it doesn't seem
to actually call serdev_tty_port_register() from
tty_port_register_device(), so maybe the comment was
based on an older version of the serdev framework?
It seems like something that should be fixed, so maybe
put a WARN_ON() at the beginning of the probe
function to see where we come from.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH] arm64: dts: ulcb-kf: add dr_mode property for USB2.0 channel 0
From: Geert Uytterhoeven @ 2017-11-15 16:52 UTC (permalink / raw)
To: Vladimir Barinov
Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland,
Catalin Marinas, Will Deacon, devicetree@vger.kernel.org,
Linux-Renesas
In-Reply-To: <1510146540-31881-1-git-send-email-vladimir.barinov@cogentembedded.com>
On Wed, Nov 8, 2017 at 2:09 PM, Vladimir Barinov
<vladimir.barinov@cogentembedded.com> wrote:
> ULCB-KF has a USB2.0 dual-role channel (CN13).
> This adds dr_mode property for USB2.0 channel 0 (EHCI/OHCI and HS-USB)
> as "otg".
>
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH] arm64: dts: renesas: ulcb-kf: add pfc node for USB3.0 channel 0
From: Geert Uytterhoeven @ 2017-11-15 16:49 UTC (permalink / raw)
To: Vladimir Barinov
Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland,
Catalin Marinas, Will Deacon,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux-Renesas
In-Reply-To: <1510146398-31805-1-git-send-email-vladimir.barinov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Hi Vladimir,
On Wed, Nov 8, 2017 at 2:06 PM, Vladimir Barinov
<vladimir.barinov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org> wrote:
> Adds the pfc node for USB3.0 channel 0.
>
> Signed-off-by: Vladimir Barinov <vladimir.barinov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
> ---
> arch/arm64/boot/dts/renesas/ulcb-kf.dtsi | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
> index 48a2e8f..2ecb6ac 100644
> --- a/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
> +++ b/arch/arm64/boot/dts/renesas/ulcb-kf.dtsi
> @@ -173,6 +173,11 @@
> groups = "usb0";
> function = "usb0";
> };
> +
> + usb30_pins: usb30 {
> + groups = "usb30";
> + function = "usb30";
This enabled USB30_PWEN and USB30_OVC.
However, these pins are routed via CN1A pins A97/A98 to HDMI_CS_A
and HDMI_CS_B, not to a USB PHY?
USB30_PWEN of the real USB PHY is provided by the i2c GPIO
expander U11.
I'm a bit puzzled by this... What am I missing?
> + };
> };
>
> &scif1 {
> @@ -191,5 +196,8 @@
> };
>
> &xhci0 {
> + pinctrl-0 = <&usb30_pins>;
> + pinctrl-names = "default";
> +
> status = "okay";
> };
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 5/5] misc serdev: w2sg0004: add debugging code and Kconfig
From: Ladislav Michl @ 2017-11-15 16:42 UTC (permalink / raw)
To: H. Nikolaus Schaller
Cc: Andreas Färber, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren, Russell King, Arnd Bergmann,
Greg Kroah-Hartman, Kevin Hilman, Thierry Reding,
Jonathan Cameron, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
letux-kernel-S0jZdbWzriLCfDggNXIi3w,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <DC57A290-669C-4B3C-A4EE-2ABEA37F47CE-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
On Wed, Nov 15, 2017 at 05:29:25PM +0100, H. Nikolaus Schaller wrote:
> Hi Andreas,
>
> > Am 15.11.2017 um 16:53 schrieb Andreas Färber <afaerber-l3A5Bk7waGM@public.gmane.org>:
> >
> > Hi,
> >
> > Am 15.11.2017 um 16:19 schrieb H. Nikolaus Schaller:
> >> This allows to set CONFIG_W2SG0004_DEBUG which will
> >> make the driver report more activities and it will turn on the
> >> GPS module during boot while the driver assumes that it
> >> is off. This can be used to debug the correct functioning of
> >> the hardware. Therefore we add it as an option to the driver
> >> because we think it is of general use (and a little tricky to
> >> add by system testers).
> >>
> >> Normally it should be off.
> >> ---
> >
> > If you want to merge this, it is lacking a Sob.
>
> Whats is a "Sob" in this context (https://acronyms.thefreedictionary.com/SOB)?
https://acronyms.thefreedictionary.com/Signed-Off-By
Also please read Documentation/process/submitting-patches.rst
ladis
> BR and thanks,
> Nikolaus Schaller
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2] arm64: dts: ulcb-kf: enable USB2 PHY of channel 0
From: Geert Uytterhoeven @ 2017-11-15 16:36 UTC (permalink / raw)
To: Vladimir Barinov
Cc: Simon Horman, Magnus Damm, Rob Herring, Mark Rutland,
Catalin Marinas, Will Deacon, devicetree@vger.kernel.org,
Linux-Renesas
In-Reply-To: <1510143698-17306-1-git-send-email-vladimir.barinov@cogentembedded.com>
Hi Vladimir,
On Wed, Nov 8, 2017 at 1:21 PM, Vladimir Barinov
<vladimir.barinov@cogentembedded.com> wrote:
> This supports USB2 PHY channel #0 on ULCB Kingfisher board
>
> The dedicated USB0_PWEN pin is used to control CN13 VBUS source from U43
> power supply.
> MAX3355 can also provide VBUS, hence it should be disabled via OTG_OFFVBUSn
> node coming from gpio expander TCA9539.
> Set MAX3355 enabled using OTG_EXTLPn node to be able to read OTG ID of CN13.
>
> Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> ---
> Changes in version 2:
> - added gpio hogs for MAX3355 VBUS and SHDN
Thanks for the update!
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH v3 5/5] misc serdev: w2sg0004: add debugging code and Kconfig
From: H. Nikolaus Schaller @ 2017-11-15 16:29 UTC (permalink / raw)
To: Andreas Färber
Cc: Mark Rutland, devicetree, linux-omap, Arnd Bergmann,
Tony Lindgren, Greg Kroah-Hartman, kernel, Russell King,
linux-kernel, Rob Herring, linux-arm-kernel, Benoît Cousson,
Kevin Hilman, letux-kernel, Thierry Reding, Jonathan Cameron
In-Reply-To: <28e16c7a-2688-a302-1548-1cdc2552f0ad@suse.de>
Hi Andreas,
> Am 15.11.2017 um 16:53 schrieb Andreas Färber <afaerber@suse.de>:
>
> Hi,
>
> Am 15.11.2017 um 16:19 schrieb H. Nikolaus Schaller:
>> This allows to set CONFIG_W2SG0004_DEBUG which will
>> make the driver report more activities and it will turn on the
>> GPS module during boot while the driver assumes that it
>> is off. This can be used to debug the correct functioning of
>> the hardware. Therefore we add it as an option to the driver
>> because we think it is of general use (and a little tricky to
>> add by system testers).
>>
>> Normally it should be off.
>> ---
>
> If you want to merge this, it is lacking a Sob.
Whats is a "Sob" in this context (https://acronyms.thefreedictionary.com/SOB)?
BR and thanks,
Nikolaus Schaller
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v3 3/5] misc serdev: Add w2sg0004 (gps receiver) power control driver
From: H. Nikolaus Schaller @ 2017-11-15 16:27 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Rob Herring, Mark Rutland, Benoît Cousson, Tony Lindgren,
Russell King, Greg Kroah-Hartman, Kevin Hilman,
Andreas Färber, Thierry Reding, Jonathan Cameron, DTML,
Linux Kernel Mailing List, linux-omap,
letux-kernel-S0jZdbWzriLCfDggNXIi3w,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf, Linux ARM
In-Reply-To: <CAK8P3a3ZtqXVobx5hdxUZyAQRYs2Y6Aw2Qpo2puSBb_AVa_aVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
Hi Arnd,
> Am 15.11.2017 um 16:54 schrieb Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>:
>
> On Wed, Nov 15, 2017 at 4:19 PM, H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> wrote:
>> Add driver for Wi2Wi W2SG0004/84 GPS module connected through uart.
>>
>> Use serdev API hooks to monitor and forward the UART traffic to /dev/GPSn
>> and turn on/off the module. It also detects if the module is turned on (sends data)
>> but should be off, e.g. if it was already turned on during boot or power-on-reset.
>>
>> Additionally, rfkill block/unblock can be used to control an external LNA
>> (and power down the module if not needed).
>>
>> The driver concept is based on code developed by NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
>> but simplified and adapted to use the new serdev API introduced in 4.11.
>>
>> Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
>
> I'm a bit confused by the concept here. Did I understand it right that this
> attaches to a tty_port and then registers another tty_driver with one
> tty_port for the first port?
Yes. It attaches to a serdev (which is a tty_port hidden from user-space) and
creates its own to be accessible from user-space.
It seems that this is very difficult to understand since I have to explain
it again and again every time I submit a new version :) Maybe I should write
some document to cite :)
Basically we only want to control power on/off of the chip but need to tap
the data stream to monitor the chip as described in the commit message. But
we do not need to modify data. The ideal solution would be that serdev wouldn't
hide the original /dev/tty for the UART but I was told that this is not possible
with serdev API.
We could also run the chip without a driver and use the original /dev/tty - but
then we have no power control of a power-hungry chip in a mobile device. And
without kernel driver, we can't turn it off automatically during suspend.
BTW: we did discuss how to do this chip right for years (IMHO the first proposal
was 2012 or 2013 by Neil Brown). Nowadays, the serdev DT structure demands that it
is a serdev and nothing else. Hence we have to live with what serdev provides
as API and make it a serdev driver.
There is one more goal. Some people are dreaming about a generic GPS interface.
Then, the driver wouldn't have to register a /dev/GPS tty any more but a
gps_interface and mangle serial data as requested by that API. This will become
a simple upgrade.
So you can consider creating a new tty as sort of temporary solution. Like we
had for years for UART HCI based bluetooth devices using a user-space daemon.
>
>> +static int w2sg_probe(struct serdev_device *serdev)
>> +{
>> + struct w2sg_pdata *pdata = NULL;
>> + struct w2sg_data *data;
>> + struct rfkill *rf_kill;
>> + int err;
>> + int minor;
>> +
>> + pr_debug("%s()\n", __func__);
>> +
>> + minor = 0;
>> + if (w2sg_by_minor[minor]) {
>> + pr_err("w2sg minor is already in use!\n");
>> + return -ENODEV;
>> + }
>> +
>> + if (serdev->dev.of_node) {
>> + struct device *dev = &serdev->dev;
>> + enum of_gpio_flags flags;
>> +
>> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>> + if (!pdata)
>> + return -ENOMEM;
>
> This looks like it's a leftover from pre-DT days, but it doesn't
> actually work without DT in the current form. How about
> merging the contents of w2sg_pdata into w2sg_data?
Ok. As said the driver core is very old...
I'll look into this asap.
>
>> +
>> + /* initialize the tty driver */
>> + data->tty_drv->owner = THIS_MODULE;
>> + data->tty_drv->driver_name = "w2sg0004";
>> + data->tty_drv->name = "ttyGPS";
>> + data->tty_drv->major = 0;
>> + data->tty_drv->minor_start = 0;
>> + data->tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
>> + data->tty_drv->subtype = SERIAL_TYPE_NORMAL;
>> + data->tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
>> + data->tty_drv->init_termios = tty_std_termios;
>> + data->tty_drv->init_termios.c_cflag = B9600 | CS8 | CREAD |
>> + HUPCL | CLOCAL;
>> + /*
>> + * optional:
>> + * tty_termios_encode_baud_rate(&data->tty_drv->init_termios,
>> + 115200, 115200);
>> + * w2sg_tty_termios(&data->tty_drv->init_termios);
>> + */
>> + tty_set_operations(data->tty_drv, &w2sg_serial_ops);
>
> While I'm still not sure about why we want nested tty port, it
> seems that we should have only one tty_driver that gets initialized
> at module load time, rather than one driver structure per port.
If we have several such chips connected to different serdev UARTs
we need different /dev/GPS to separate them in user-space.
>
>> + /* register the tty driver */
>> + err = tty_register_driver(data->tty_drv);
>> + if (err) {
>> + pr_err("%s - tty_register_driver failed(%d)\n",
>> + __func__, err);
>> + put_tty_driver(data->tty_drv);
>> + goto err_rfkill;
>> + }
>> +
>> + tty_port_init(&data->port);
>> + data->port.ops = &w2sg_port_ops;
>> +
>> +/*
>> + * FIXME: this appears to reenter this probe() function a second time
>> + * which only fails because the gpio is already assigned
>> + */
>> +
>> + data->dev = tty_port_register_device(&data->port,
>> + data->tty_drv, minor, &serdev->dev);
>
> This seems to be a result of having nested tty ports, and both
> ports point to the same device.
The UART tty would be e.g. /dev/ttyO2 (on OMAP3) if no driver is
installed. And the new one that is registered is /dev/GPS0. So the
tty subsystem doesn't (or shouldn't) know they are related. They
are only related/connected inside this driver. So I assume that
some locking or reentrancy happens in tty_port_register_device().
BR and thanks,
Nikolaus Schaller
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 3/3] arm64: dts: renesas: eagle: add EtherAVB pins
From: Geert Uytterhoeven @ 2017-11-15 16:21 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Simon Horman, Rob Herring, Catalin Marinas, Will Deacon,
Linux-Renesas, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Magnus Damm, Mark Rutland,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <1017d8fb-e353-f212-09a9-a28bf07eddc2-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Hi Sergei,
On Tue, Nov 14, 2017 at 7:00 PM, Sergei Shtylyov
<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org> wrote:
> On 11/14/2017 11:44 AM, Geert Uytterhoeven wrote:
>>> Add the (previously omitted) EtherAVB pin data to the Eagle board's
>>> device tree.
>>> --- renesas.orig/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
>>> +++ renesas/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
>>> @@ -34,6 +34,9 @@
>
> [...]
>>>
>>> @@ -53,6 +56,11 @@
>>> };
>>>
>>> &pfc {
>>> + avb_pins: avb {
>>> + groups = "avb0_mdio", "avb0_mii";
>>
>>
>> Oh no, its'called "avb0_mdio" here, but "avb(0)_mdc" on all other
>> R-Car Gen3 SoCs?
>
>
> Can you remember the reason? I don;t want to follow the bad example. :-)
Sorry, I don't know.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 2/2] arm64: dts: renesas: eagle: specify EtherAVB PHY IRQ
From: Geert Uytterhoeven @ 2017-11-15 16:15 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Simon Horman, Rob Herring, Catalin Marinas, Will Deacon,
Linux-Renesas, devicetree@vger.kernel.org, Magnus Damm,
Mark Rutland, linux-arm-kernel@lists.infradead.org
In-Reply-To: <20171113213152.819421744@cogentembedded.com>
On Mon, Nov 13, 2017 at 10:23 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Specify EtherAVB PHY IRQ in the Eagle board's device tree, now that we
> have the GPIO support (previously phylib had to resort to polling).
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH 1/2] arm64: dts: renesas: r8a77970: add GPIO support
From: Geert Uytterhoeven @ 2017-11-15 16:12 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Simon Horman, Rob Herring, Catalin Marinas, Will Deacon,
Linux-Renesas, devicetree@vger.kernel.org, Magnus Damm,
Mark Rutland, linux-arm-kernel@lists.infradead.org
In-Reply-To: <20171113213149.295833059@cogentembedded.com>
On Mon, Nov 13, 2017 at 10:23 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Describe all 6 GPIO controllers in the R8A77970 device tree.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH v3 2/2] rtc: sprd: Add Spreadtrum RTC driver
From: Alexandre Belloni @ 2017-11-15 16:01 UTC (permalink / raw)
To: Baolin Wang
Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rtc-u79uwXL29TY76Z2rM5mHXA, broonie-DgEjT+Ai2ygdnm+yROfE0A,
baolin.wang-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <1e1ee941cc59375627712c0e77036ff36389bb33.1510198341.git.baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
On 09/11/2017 at 11:34:17 +0800, Baolin Wang wrote:
> This patch adds the Spreadtrum RTC driver, which embedded in the
> Spreadtrum SC27xx series PMICs.
>
> Signed-off-by: Baolin Wang <baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
> ---
> Changes since v2:
> - Add checking if RTC values are valid.
>
> Changes since v1:
> - Change file name.
> - Should depend on the MFD parent.
> - Add more help documentation.
> - Remove regmap wrapper functions.
> - Modify the mothod of setting alarm.
> - Remove set_mmss64() method.
> - Remove checking RTC power-down.
> - Optimize lock/unlock alarm.
> ---
> drivers/rtc/Kconfig | 11 +
> drivers/rtc/Makefile | 1 +
> drivers/rtc/rtc-sc27xx.c | 662 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 674 insertions(+)
> create mode 100644 drivers/rtc/rtc-sc27xx.c
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 1/2] dt-bindings: rtc: Add Spreadtrum SC27xx RTC documentation
From: Alexandre Belloni @ 2017-11-15 16:01 UTC (permalink / raw)
To: Baolin Wang
Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rtc-u79uwXL29TY76Z2rM5mHXA, broonie-DgEjT+Ai2ygdnm+yROfE0A,
baolin.wang-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <c65b61e5e37cb43214973cb3e479ce06c4a73395.1510198341.git.baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
On 09/11/2017 at 11:34:16 +0800, Baolin Wang wrote:
> This patch adds the binding documentation for Spreadtrum SC27xx series
> RTC device.
>
> Signed-off-by: Baolin Wang <baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
> ---
> Changes since v2:
> - No updates.
>
> Changes since v1:
> - Use a specific chip name as compatible string.
> - Remove useless alias.
> - Add the parent MFD node.
> ---
> .../devicetree/bindings/rtc/sprd,sc27xx-rtc.txt | 27 ++++++++++++++++++++
> 1 file changed, 27 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/rtc/sprd,sc27xx-rtc.txt
>
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 3/5] misc serdev: Add w2sg0004 (gps receiver) power control driver
From: Arnd Bergmann @ 2017-11-15 15:54 UTC (permalink / raw)
To: H. Nikolaus Schaller
Cc: Rob Herring, Mark Rutland, Benoît Cousson, Tony Lindgren,
Russell King, Greg Kroah-Hartman, Kevin Hilman,
Andreas Färber, Thierry Reding, Jonathan Cameron, DTML,
Linux Kernel Mailing List, linux-omap,
letux-kernel-S0jZdbWzriLCfDggNXIi3w,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf, Linux ARM
In-Reply-To: <9e1525e72afe890ea390fd153c1f3a1b0866c986.1510759152.git.hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
On Wed, Nov 15, 2017 at 4:19 PM, H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org> wrote:
> Add driver for Wi2Wi W2SG0004/84 GPS module connected through uart.
>
> Use serdev API hooks to monitor and forward the UART traffic to /dev/GPSn
> and turn on/off the module. It also detects if the module is turned on (sends data)
> but should be off, e.g. if it was already turned on during boot or power-on-reset.
>
> Additionally, rfkill block/unblock can be used to control an external LNA
> (and power down the module if not needed).
>
> The driver concept is based on code developed by NeilBrown <neilb-l3A5Bk7waGM@public.gmane.org>
> but simplified and adapted to use the new serdev API introduced in 4.11.
>
> Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
I'm a bit confused by the concept here. Did I understand it right that this
attaches to a tty_port and then registers another tty_driver with one
tty_port for the first port?
> +static int w2sg_probe(struct serdev_device *serdev)
> +{
> + struct w2sg_pdata *pdata = NULL;
> + struct w2sg_data *data;
> + struct rfkill *rf_kill;
> + int err;
> + int minor;
> +
> + pr_debug("%s()\n", __func__);
> +
> + minor = 0;
> + if (w2sg_by_minor[minor]) {
> + pr_err("w2sg minor is already in use!\n");
> + return -ENODEV;
> + }
> +
> + if (serdev->dev.of_node) {
> + struct device *dev = &serdev->dev;
> + enum of_gpio_flags flags;
> +
> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
This looks like it's a leftover from pre-DT days, but it doesn't
actually work without DT in the current form. How about
merging the contents of w2sg_pdata into w2sg_data?
> +
> + /* initialize the tty driver */
> + data->tty_drv->owner = THIS_MODULE;
> + data->tty_drv->driver_name = "w2sg0004";
> + data->tty_drv->name = "ttyGPS";
> + data->tty_drv->major = 0;
> + data->tty_drv->minor_start = 0;
> + data->tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
> + data->tty_drv->subtype = SERIAL_TYPE_NORMAL;
> + data->tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
> + data->tty_drv->init_termios = tty_std_termios;
> + data->tty_drv->init_termios.c_cflag = B9600 | CS8 | CREAD |
> + HUPCL | CLOCAL;
> + /*
> + * optional:
> + * tty_termios_encode_baud_rate(&data->tty_drv->init_termios,
> + 115200, 115200);
> + * w2sg_tty_termios(&data->tty_drv->init_termios);
> + */
> + tty_set_operations(data->tty_drv, &w2sg_serial_ops);
While I'm still not sure about why we want nested tty port, it
seems that we should have only one tty_driver that gets initialized
at module load time, rather than one driver structure per port.
> + /* register the tty driver */
> + err = tty_register_driver(data->tty_drv);
> + if (err) {
> + pr_err("%s - tty_register_driver failed(%d)\n",
> + __func__, err);
> + put_tty_driver(data->tty_drv);
> + goto err_rfkill;
> + }
> +
> + tty_port_init(&data->port);
> + data->port.ops = &w2sg_port_ops;
> +
> +/*
> + * FIXME: this appears to reenter this probe() function a second time
> + * which only fails because the gpio is already assigned
> + */
> +
> + data->dev = tty_port_register_device(&data->port,
> + data->tty_drv, minor, &serdev->dev);
This seems to be a result of having nested tty ports, and both
ports point to the same device.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 5/5] misc serdev: w2sg0004: add debugging code and Kconfig
From: Andreas Färber @ 2017-11-15 15:53 UTC (permalink / raw)
To: H. Nikolaus Schaller, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren, Russell King, Arnd Bergmann,
Greg Kroah-Hartman, Kevin Hilman, Thierry Reding,
Jonathan Cameron
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
letux-kernel-S0jZdbWzriLCfDggNXIi3w,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
In-Reply-To: <9b4969c858d4c3801bb796f92dad5c580799b768.1510759152.git.hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
Hi,
Am 15.11.2017 um 16:19 schrieb H. Nikolaus Schaller:
> This allows to set CONFIG_W2SG0004_DEBUG which will
> make the driver report more activities and it will turn on the
> GPS module during boot while the driver assumes that it
> is off. This can be used to debug the correct functioning of
> the hardware. Therefore we add it as an option to the driver
> because we think it is of general use (and a little tricky to
> add by system testers).
>
> Normally it should be off.
> ---
If you want to merge this, it is lacking a Sob.
Cheers,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 3/5] media: i2c: Add TDA1997x HDMI receiver driver
From: Rob Herring @ 2017-11-15 15:52 UTC (permalink / raw)
To: Tim Harvey
Cc: devicetree, alsa-devel, linux-kernel, Hans Verkuil,
Mauro Carvalho Chehab, Philipp Zabel, Steve Longerbeam,
Hans Verkuil, shawnguo, linux-media
In-Reply-To: <1510253136-14153-4-git-send-email-tharvey@gateworks.com>
On Thu, Nov 09, 2017 at 10:45:34AM -0800, Tim Harvey wrote:
> Add support for the TDA1997x HDMI receivers.
>
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> v3:
> - use V4L2_DV_BT_FRAME_WIDTH/HEIGHT macros
> - fixed missing break
> - use only hdmi_infoframe_log for infoframe logging
> - simplify tda1997x_s_stream error handling
> - add delayed work proc to handle hotplug enable/disable
> - fix set_edid (disable HPD before writing, enable after)
> - remove enabling edid by default
> - initialize timings
> - take quant range into account in colorspace conversion
> - remove vendor/product tracking (we provide this in log_status via infoframes)
> - add v4l_controls
> - add more detail to log_status
> - calculate vhref generator timings
> - timing detection fixes (rounding errors, hswidth errors)
> - rename configure_input/configure_conv functions
>
> v2:
> - implement dv timings enum/cap
> - remove deprecated g_mbus_config op
> - fix dv_query_timings
> - add EDID get/set handling
> - remove max-pixel-rate support
> - add audio codec DAI support
> - change audio bindings
> ---
> drivers/media/i2c/Kconfig | 9 +
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/tda1997x.c | 3485 ++++++++++++++++++++++++++++++++++
> include/dt-bindings/media/tda1997x.h | 78 +
This belongs with the binding documentation patch.
> include/media/i2c/tda1997x.h | 53 +
> 5 files changed, 3626 insertions(+)
> create mode 100644 drivers/media/i2c/tda1997x.c
> create mode 100644 include/dt-bindings/media/tda1997x.h
> create mode 100644 include/media/i2c/tda1997x.h
^ permalink raw reply
* Re: [PATCH 4/8] dt-bindings: usb: document hub and host-controller properties
From: Rob Herring @ 2017-11-15 15:46 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Mark Rutland, Arnd Bergmann, Alan Stern,
Peter Chen, linux-usb-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171109170723.10960-5-johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Thu, Nov 09, 2017 at 06:07:19PM +0100, Johan Hovold wrote:
> Hub nodes and host-controller nodes with child nodes must specify values
> for #address-cells (1) and #size-cells (0).
>
> Also make the definition of the related reg property a bit more
> stringent, and add comments to the example source.
>
> Signed-off-by: Johan Hovold <johan-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> Documentation/devicetree/bindings/usb/usb-device.txt | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
I'm happy to apply patches 1-4 for 4.15 if you want.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/8] dt-bindings: usb: fix example hub node name
From: Rob Herring @ 2017-11-15 15:44 UTC (permalink / raw)
To: Johan Hovold
Cc: Greg Kroah-Hartman, Mark Rutland, Arnd Bergmann, Alan Stern,
Peter Chen, linux-usb, devicetree, linux-kernel
In-Reply-To: <20171109170723.10960-2-johan@kernel.org>
On Thu, Nov 09, 2017 at 06:07:16PM +0100, Johan Hovold wrote:
> According to the OF Recommended Practice for USB, hub nodes shall be
> named "hub", but the example had mixed up the label and node names. Fix
> the node name and drop the redundant label.
>
> While at it, remove a newline and add a missing semicolon to the example
> source.
>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
> Documentation/devicetree/bindings/usb/usb-device.txt | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH v4 11/12] ASoC: add bindings for stm32 DFSDM filter
From: Rob Herring @ 2017-11-15 15:43 UTC (permalink / raw)
To: Arnaud Pouliquen
Cc: Mark Rutland, Jonathan Cameron, Hartmut Knaack,
Lars-Peter Clausen, Peter Meerwald-Stadler, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-iio-u79uwXL29TY76Z2rM5mHXA,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Maxime Coquelin,
Alexandre Torgue
In-Reply-To: <1510222354-15290-12-git-send-email-arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
On Thu, Nov 09, 2017 at 11:12:33AM +0100, Arnaud Pouliquen wrote:
> Add bindings that describes audio settings to support
> Digital Filter for pulse density modulation(PDM) microphone.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen-qxv4g6HH51o@public.gmane.org>
> ---
> V3 -> V4 changes:
> - Update to move on of_graph description.
> - Link to DFSDM IIO bindings.
>
> .../devicetree/bindings/sound/st,stm32-adfsdm.txt | 63 ++++++++++++++++++++++
> 1 file changed, 63 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/sound/st,stm32-adfsdm.txt
>
> diff --git a/Documentation/devicetree/bindings/sound/st,stm32-adfsdm.txt b/Documentation/devicetree/bindings/sound/st,stm32-adfsdm.txt
> new file mode 100644
> index 0000000..75e298b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/st,stm32-adfsdm.txt
> @@ -0,0 +1,63 @@
> +STMicroelectronics audio DFSDM DT bindings
> +
> +This driver supports audio PDM microphone capture through Digital Filter format
Bindings aren't drivers.
> +Sigma Delta modulators (DFSDM).
> +
> +Required properties:
> + - compatible: "st,stm32h7-dfsdm-dai".
> +
> + - #sound-dai-cells : Must be equal to 0
> +
> + - io-channels : phandle to iio dfsdm instance node.
> + [See: ../iio/adc/st,stm32-dfsdm-adc.txt for DFSDM options]
> +
> +Example of a sound card using audio DFSDM node.
> +
> + sound_card {
> + compatible = "audio-graph-card";
> +
> + dais = <&cpu_port>;
> + };
> +
> + dfsdm: dfsdm@40017000 {
> + compatible = "st,stm32h7-dfsdm";
> + reg = <0x40017000 0x400>;
> + clocks = <&rcc DFSDM1_CK>;
> + clock-names = "dfsdm";
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + dfsdm_adc0: dfsdm-adc@0 {
> + compatible = "st,stm32-dfsdm-dmic";
> + reg = <0>;
> + interrupts = <110>;
> + dmas = <&dmamux1 101 0x400 0x00>;
> + dma-names = "rx";
> + st,adc-channels = <1>;
> + st,adc-channel-names = "dmic0";
> + st,adc-channel-types = "SPI_R";
> + st,adc-channel-clk-src = "CLKOUT";
> + st,filter-order = <5>;
> + };
> + }
> +
> + dfsdm_dai0:dfsdm_dai@0 {
Unit address without reg property is not valid. Building your dtb with
W=2 will tell you this.
Need a space after the ':'.
Should be a child of dfsdm?
> + compatible = "st,stm32h7-dfsdm-dai";
> + #sound-dai-cells = <0>;
> + io-channels = <&dfsdm_adc0 0>;
It doesn't seem like this is an actual h/w block. Why can't 'dais' point
directly to the ADC?
> + cpu_port: port {
> + dfsdm_endpoint: endpoint {
> + remote-endpoint = <&dmic0_endpoint>;
> + };
> + };
> + };
> +
> + dmic0: dmic@0 {
> + compatible = "dmic-codec";
> + #sound-dai-cells = <0>;
> + port {
> + dmic0_endpoint: endpoint {
> + remote-endpoint = <&dfsdm_endpoint>;
> + };
> + };
> + };
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v3 1/2] dt-bindings: rtc: Add Spreadtrum SC27xx RTC documentation
From: Rob Herring @ 2017-11-15 15:32 UTC (permalink / raw)
To: Baolin Wang
Cc: a.zummo-BfzFCNDTiLLj+vYz1yj4TQ,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-rtc-u79uwXL29TY76Z2rM5mHXA, broonie-DgEjT+Ai2ygdnm+yROfE0A,
baolin.wang-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <c65b61e5e37cb43214973cb3e479ce06c4a73395.1510198341.git.baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
On Thu, Nov 09, 2017 at 11:34:16AM +0800, Baolin Wang wrote:
> This patch adds the binding documentation for Spreadtrum SC27xx series
> RTC device.
>
> Signed-off-by: Baolin Wang <baolin.wang-lxIno14LUO0EEoCn2XhGlw@public.gmane.org>
> ---
> Changes since v2:
> - No updates.
>
> Changes since v1:
> - Use a specific chip name as compatible string.
> - Remove useless alias.
> - Add the parent MFD node.
> ---
> .../devicetree/bindings/rtc/sprd,sc27xx-rtc.txt | 27 ++++++++++++++++++++
> 1 file changed, 27 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/rtc/sprd,sc27xx-rtc.txt
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 07/17] ASoC: tlv320aic31xx: Add MICBIAS off setting
From: Rob Herring @ 2017-11-15 15:30 UTC (permalink / raw)
To: Andrew F. Davis
Cc: Mark Rutland, devicetree, alsa-devel, Tony Lindgren,
Liam Girdwood, linux-kernel, Mark Brown, Benoît Cousson
In-Reply-To: <20171109002741.10897-8-afd@ti.com>
On Wed, Nov 08, 2017 at 06:27:31PM -0600, Andrew F. Davis wrote:
> Leaving microphone bias off is a valid setting and even used in the DT
> binding document example. Add this setting here and document the same.
>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
> Documentation/devicetree/bindings/sound/tlv320aic31xx.txt | 1 +
> include/dt-bindings/sound/tlv320aic31xx-micbias.h | 1 +
> sound/soc/codecs/tlv320aic31xx.c | 1 +
> 3 files changed, 3 insertions(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH v3 1/4] dt-bindings: iio: at91-sama5d2_adc: add optional dma property
From: Rob Herring @ 2017-11-15 15:27 UTC (permalink / raw)
To: Eugen Hristev
Cc: nicolas.ferre-UWL1GkI3JZL3oGB3hsPCZA,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
linux-iio-u79uwXL29TY76Z2rM5mHXA, lars-Qo5EllUWu/uELgA04lAiVw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA,
jic23-DgEjT+Ai2ygdnm+yROfE0A
In-Reply-To: <1510750608-8697-2-git-send-email-eugen.hristev-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
On Wed, Nov 15, 2017 at 02:56:45PM +0200, Eugen Hristev wrote:
> Added property for DMA configuration of the device.
>
> Signed-off-by: Eugen Hristev <eugen.hristev-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
> ---
> Changes in v3:
> None, but we discussed on the ML about whether we should have "dma-names"
> present in the binding even if it's only one.
> The helpers in the kernel to retrieve the channel info rely on the
> presence of this property, so I am resending the patch based on this.
> If another solution is better, please advise and I can try it and
> resend the patch.
Really the kernel APIs should accept a NULL name and return the DMA
channel when there is only one. This is how the clk_get API works for
example.
> Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt | 7 +++++++
> 1 file changed, 7 insertions(+)
In any case, not really a big deal.
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
^ permalink raw reply
* [PATCH v3 5/5] misc serdev: w2sg0004: add debugging code and Kconfig
From: H. Nikolaus Schaller @ 2017-11-15 15:19 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Benoît Cousson, Tony Lindgren,
Russell King, Arnd Bergmann, Greg Kroah-Hartman,
H. Nikolaus Schaller, Kevin Hilman, Andreas Färber,
Thierry Reding, Jonathan Cameron
Cc: devicetree, linux-omap, linux-kernel, kernel, letux-kernel,
linux-arm-kernel
In-Reply-To: <cover.1510759152.git.hns@goldelico.com>
This allows to set CONFIG_W2SG0004_DEBUG which will
make the driver report more activities and it will turn on the
GPS module during boot while the driver assumes that it
is off. This can be used to debug the correct functioning of
the hardware. Therefore we add it as an option to the driver
because we think it is of general use (and a little tricky to
add by system testers).
Normally it should be off.
---
drivers/misc/Kconfig | 8 ++++++++
drivers/misc/w2sg0004.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 09d171d68408..f15ff5a97e42 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -528,4 +528,12 @@ config W2SG0004
is opened/closed.
It also provides a rfkill gps name to control the LNA power.
+config W2SG0004_DEBUG
+ bool "W2SG0004 on/off debugging"
+ depends on W2SG0004
+ help
+ Enable driver debugging mode of W2SG0004 GPS. If you say y here
+ this will turn on the module and you can check if it is turned
+ off by the driver.
+
endmenu
diff --git a/drivers/misc/w2sg0004.c b/drivers/misc/w2sg0004.c
index 385d35c99791..612e129aa639 100644
--- a/drivers/misc/w2sg0004.c
+++ b/drivers/misc/w2sg0004.c
@@ -22,6 +22,10 @@
*
*/
+#ifdef CONFIG_W2SG0004_DEBUG
+#define DEBUG 1
+#endif
+
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
@@ -251,6 +255,7 @@ static int w2sg_tty_install(struct tty_driver *driver, struct tty_struct *tty)
pr_debug("%s() tty = %p\n", __func__, tty);
data = w2sg_get_by_minor(tty->index);
+ pr_debug("%s() data = %p\n", __func__, data);
if (!data)
return -ENODEV;
@@ -363,6 +368,8 @@ static int w2sg_probe(struct serdev_device *serdev)
w2sg_by_minor[minor] = data;
+ pr_debug("w2sg serdev_device_set_drvdata\n");
+
serdev_device_set_drvdata(serdev, data);
data->lna_regulator = pdata->lna_regulator;
@@ -381,6 +388,8 @@ static int w2sg_probe(struct serdev_device *serdev)
INIT_DELAYED_WORK(&data->work, toggle_work);
+ pr_debug("w2sg devm_gpio_request\n");
+
err = devm_gpio_request(&serdev->dev, data->on_off_gpio,
"w2sg0004-on-off");
if (err < 0)
@@ -394,6 +403,8 @@ static int w2sg_probe(struct serdev_device *serdev)
serdev_device_set_baudrate(data->uart, 9600);
serdev_device_set_flow_control(data->uart, false);
+ pr_debug("w2sg rfkill_alloc\n");
+
rf_kill = rfkill_alloc("GPS", &serdev->dev, RFKILL_TYPE_GPS,
&w2sg0004_rfkill_ops, data);
if (rf_kill == NULL) {
@@ -401,6 +412,8 @@ static int w2sg_probe(struct serdev_device *serdev)
goto err_rfkill;
}
+ pr_debug("w2sg register rfkill\n");
+
err = rfkill_register(rf_kill);
if (err) {
dev_err(&serdev->dev, "Cannot register rfkill device\n");
@@ -409,6 +422,8 @@ static int w2sg_probe(struct serdev_device *serdev)
data->rf_kill = rf_kill;
+ pr_debug("w2sg alloc_tty_driver\n");
+
/* allocate the tty driver */
data->tty_drv = alloc_tty_driver(1);
if (!data->tty_drv)
@@ -434,6 +449,8 @@ static int w2sg_probe(struct serdev_device *serdev)
*/
tty_set_operations(data->tty_drv, &w2sg_serial_ops);
+ pr_debug("w2sg tty_register_driver\n");
+
/* register the tty driver */
err = tty_register_driver(data->tty_drv);
if (err) {
@@ -443,6 +460,8 @@ static int w2sg_probe(struct serdev_device *serdev)
goto err_rfkill;
}
+ pr_debug("w2sg call tty_port_init\n");
+
tty_port_init(&data->port);
data->port.ops = &w2sg_port_ops;
@@ -451,11 +470,27 @@ static int w2sg_probe(struct serdev_device *serdev)
* which only fails because the gpio is already assigned
*/
+ pr_debug("w2sg call tty_port_register_device\n");
+
data->dev = tty_port_register_device(&data->port,
data->tty_drv, minor, &serdev->dev);
+ pr_debug("w2sg tty_port_register_device -> %p\n", data->dev);
+ pr_debug("w2sg port.tty = %p\n", data->port.tty);
+
pr_debug("w2sg probed\n");
+#ifdef CONFIG_W2SG0004_DEBUG
+ pr_debug("w2sg DEBUGGING MODE enabled\n");
+ /* turn on for debugging rx notifications */
+ pr_debug("w2sg power gpio ON\n");
+ gpio_set_value_cansleep(data->on_off_gpio, 1);
+ mdelay(100);
+ pr_debug("w2sg power gpio OFF\n");
+ gpio_set_value_cansleep(data->on_off_gpio, 0);
+ mdelay(300);
+#endif
+
/* keep off until user space requests the device */
w2sg_set_power(data, false);
@@ -465,6 +500,8 @@ static int w2sg_probe(struct serdev_device *serdev)
rfkill_destroy(rf_kill);
serdev_device_close(data->uart);
out:
+ pr_debug("w2sg error %d\n", err);
+
return err;
}
--
2.12.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox