Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806470/?format=api
{ "id": 806470, "url": "http://patchwork.ozlabs.org/api/patches/806470/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/patch/1503914654-19963-7-git-send-email-fabrice.gasnier@st.com/", "project": { "id": 38, "url": "http://patchwork.ozlabs.org/api/projects/38/?format=api", "name": "Linux PWM development", "link_name": "linux-pwm", "list_id": "linux-pwm.vger.kernel.org", "list_email": "linux-pwm@vger.kernel.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1503914654-19963-7-git-send-email-fabrice.gasnier@st.com>", "list_archive_url": null, "date": "2017-08-28T10:04:11", "name": "[RESEND,v3,6/9] iio: trigger: Add STM32 LPTimer trigger driver", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "381ffb17e43b46ec7ac26fc9b8341f626d425a52", "submitter": { "id": 65902, "url": "http://patchwork.ozlabs.org/api/people/65902/?format=api", "name": "Fabrice Gasnier", "email": "fabrice.gasnier@st.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pwm/patch/1503914654-19963-7-git-send-email-fabrice.gasnier@st.com/mbox/", "series": [ { "id": 122, "url": "http://patchwork.ozlabs.org/api/series/122/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pwm/list/?series=122", "date": "2017-08-28T10:04:06", "name": "Add STM32 LPTimer: PWM, trigger and counter", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/122/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806470/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806470/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pwm-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pwm-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xgnTw0GXlz9rxm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 20:06:12 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751811AbdH1KF5 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 28 Aug 2017 06:05:57 -0400", "from mx07-00178001.pphosted.com ([62.209.51.94]:41866 \"EHLO\n\tmx07-00178001.pphosted.com\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1751700AbdH1KF1 (ORCPT\n\t<rfc822; linux-pwm@vger.kernel.org>); Mon, 28 Aug 2017 06:05:27 -0400", "from pps.filterd (m0046037.ppops.net [127.0.0.1])\n\tby mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id\n\tv7SA4TDx028034; Mon, 28 Aug 2017 12:04:42 +0200", "from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35])\n\tby mx07-.pphosted.com with ESMTP id 2cjxrqscta-1\n\t(version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT);\n\tMon, 28 Aug 2017 12:04:42 +0200", "from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9])\n\tby beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 1C5B831;\n\tMon, 28 Aug 2017 10:04:40 +0000 (GMT)", "from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15])\n\tby zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E171A200A;\n\tMon, 28 Aug 2017 10:04:39 +0000 (GMT)", "from localhost (10.75.127.48) by SFHDAG5NODE3.st.com (10.75.127.15)\n\twith Microsoft SMTP Server (TLS) id 15.0.1178.4;\n\tMon, 28 Aug 2017 12:04:39 +0200" ], "From": "Fabrice Gasnier <fabrice.gasnier@st.com>", "To": "<lee.jones@linaro.org>, <benjamin.gaignard@linaro.org>,\n\t<jic23@kernel.org>, <thierry.reding@gmail.com>, <robh+dt@kernel.org>", "CC": "<mark.rutland@arm.com>, <alexandre.torgue@st.com>,\n\t<mcoquelin.stm32@gmail.com>, <fabrice.gasnier@st.com>,\n\t<benjamin.gaignard@st.com>, <linux-iio@vger.kernel.org>,\n\t<devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>,\n\t<linux-kernel@vger.kernel.org>, <linux-pwm@vger.kernel.org>,\n\t<vilhelm.gray@gmail.com>", "Subject": "[RESEND PATCH v3 6/9] iio: trigger: Add STM32 LPTimer trigger driver", "Date": "Mon, 28 Aug 2017 12:04:11 +0200", "Message-ID": "<1503914654-19963-7-git-send-email-fabrice.gasnier@st.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1503914654-19963-1-git-send-email-fabrice.gasnier@st.com>", "References": "<1503914654-19963-1-git-send-email-fabrice.gasnier@st.com>", "MIME-Version": "1.0", "Content-Type": "text/plain", "X-Originating-IP": "[10.75.127.48]", "X-ClientProxiedBy": "SFHDAG8NODE3.st.com (10.75.127.24) To SFHDAG5NODE3.st.com\n\t(10.75.127.15)", "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10432:, ,\n\tdefinitions=2017-08-28_06:, , signatures=0", "Sender": "linux-pwm-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pwm.vger.kernel.org>", "X-Mailing-List": "linux-pwm@vger.kernel.org" }, "content": "Add support for LPTIMx_OUT triggers that can be found on some STM32\ndevices. These triggers can be used then by ADC or DAC.\nTypical usage is to configure LPTimer as PWM output (via pwm-stm32-lp)\nand have synchronised analog conversions with these triggers.\n\nSigned-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>\nReviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>\n---\nChanges in v3:\n- Add validate_device callback\n\nChanges in v2:\n- s/Low Power/Low-Power\n- update few comments\n---\n drivers/iio/trigger/Kconfig | 11 +++\n drivers/iio/trigger/Makefile | 1 +\n drivers/iio/trigger/stm32-lptimer-trigger.c | 118 ++++++++++++++++++++++++++\n include/linux/iio/timer/stm32-lptim-trigger.h | 27 ++++++\n 4 files changed, 157 insertions(+)\n create mode 100644 drivers/iio/trigger/stm32-lptimer-trigger.c\n create mode 100644 include/linux/iio/timer/stm32-lptim-trigger.h", "diff": "diff --git a/drivers/iio/trigger/Kconfig b/drivers/iio/trigger/Kconfig\nindex e4d4e63..a633d2c 100644\n--- a/drivers/iio/trigger/Kconfig\n+++ b/drivers/iio/trigger/Kconfig\n@@ -24,6 +24,17 @@ config IIO_INTERRUPT_TRIGGER\n \t To compile this driver as a module, choose M here: the\n \t module will be called iio-trig-interrupt.\n \n+config IIO_STM32_LPTIMER_TRIGGER\n+\ttristate \"STM32 Low-Power Timer Trigger\"\n+\tdepends on MFD_STM32_LPTIMER || COMPILE_TEST\n+\thelp\n+\t Select this option to enable STM32 Low-Power Timer Trigger.\n+\t This can be used as trigger source for STM32 internal ADC\n+\t and/or DAC.\n+\n+\t To compile this driver as a module, choose M here: the\n+\t module will be called stm32-lptimer-trigger.\n+\n config IIO_STM32_TIMER_TRIGGER\n \ttristate \"STM32 Timer Trigger\"\n \tdepends on (ARCH_STM32 && OF && MFD_STM32_TIMERS) || COMPILE_TEST\ndiff --git a/drivers/iio/trigger/Makefile b/drivers/iio/trigger/Makefile\nindex 5c4ecd3..0a72a2a 100644\n--- a/drivers/iio/trigger/Makefile\n+++ b/drivers/iio/trigger/Makefile\n@@ -6,6 +6,7 @@\n \n obj-$(CONFIG_IIO_HRTIMER_TRIGGER) += iio-trig-hrtimer.o\n obj-$(CONFIG_IIO_INTERRUPT_TRIGGER) += iio-trig-interrupt.o\n+obj-$(CONFIG_IIO_STM32_LPTIMER_TRIGGER) += stm32-lptimer-trigger.o\n obj-$(CONFIG_IIO_STM32_TIMER_TRIGGER) += stm32-timer-trigger.o\n obj-$(CONFIG_IIO_SYSFS_TRIGGER) += iio-trig-sysfs.o\n obj-$(CONFIG_IIO_TIGHTLOOP_TRIGGER) += iio-trig-loop.o\ndiff --git a/drivers/iio/trigger/stm32-lptimer-trigger.c b/drivers/iio/trigger/stm32-lptimer-trigger.c\nnew file mode 100644\nindex 0000000..241eae6\n--- /dev/null\n+++ b/drivers/iio/trigger/stm32-lptimer-trigger.c\n@@ -0,0 +1,118 @@\n+/*\n+ * STM32 Low-Power Timer Trigger driver\n+ *\n+ * Copyright (C) STMicroelectronics 2017\n+ *\n+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.\n+ *\n+ * License terms: GNU General Public License (GPL), version 2\n+ *\n+ * Inspired by Benjamin Gaignard's stm32-timer-trigger driver\n+ */\n+\n+#include <linux/iio/timer/stm32-lptim-trigger.h>\n+#include <linux/mfd/stm32-lptimer.h>\n+#include <linux/module.h>\n+#include <linux/platform_device.h>\n+\n+/* List Low-Power Timer triggers */\n+static const char * const stm32_lptim_triggers[] = {\n+\tLPTIM1_OUT,\n+\tLPTIM2_OUT,\n+\tLPTIM3_OUT,\n+};\n+\n+struct stm32_lptim_trigger {\n+\tstruct device *dev;\n+\tconst char *trg;\n+};\n+\n+static int stm32_lptim_validate_device(struct iio_trigger *trig,\n+\t\t\t\t struct iio_dev *indio_dev)\n+{\n+\tif (indio_dev->modes & INDIO_HARDWARE_TRIGGERED)\n+\t\treturn 0;\n+\n+\treturn -EINVAL;\n+}\n+\n+static const struct iio_trigger_ops stm32_lptim_trigger_ops = {\n+\t.owner = THIS_MODULE,\n+\t.validate_device = stm32_lptim_validate_device,\n+};\n+\n+/**\n+ * is_stm32_lptim_trigger\n+ * @trig: trigger to be checked\n+ *\n+ * return true if the trigger is a valid STM32 IIO Low-Power Timer Trigger\n+ * either return false\n+ */\n+bool is_stm32_lptim_trigger(struct iio_trigger *trig)\n+{\n+\treturn (trig->ops == &stm32_lptim_trigger_ops);\n+}\n+EXPORT_SYMBOL(is_stm32_lptim_trigger);\n+\n+static int stm32_lptim_setup_trig(struct stm32_lptim_trigger *priv)\n+{\n+\tstruct iio_trigger *trig;\n+\n+\ttrig = devm_iio_trigger_alloc(priv->dev, \"%s\", priv->trg);\n+\tif (!trig)\n+\t\treturn -ENOMEM;\n+\n+\ttrig->dev.parent = priv->dev->parent;\n+\ttrig->ops = &stm32_lptim_trigger_ops;\n+\tiio_trigger_set_drvdata(trig, priv);\n+\n+\treturn devm_iio_trigger_register(priv->dev, trig);\n+}\n+\n+static int stm32_lptim_trigger_probe(struct platform_device *pdev)\n+{\n+\tstruct stm32_lptim_trigger *priv;\n+\tu32 index;\n+\tint ret;\n+\n+\tpriv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);\n+\tif (!priv)\n+\t\treturn -ENOMEM;\n+\n+\tif (of_property_read_u32(pdev->dev.of_node, \"reg\", &index))\n+\t\treturn -EINVAL;\n+\n+\tif (index >= ARRAY_SIZE(stm32_lptim_triggers))\n+\t\treturn -EINVAL;\n+\n+\tpriv->dev = &pdev->dev;\n+\tpriv->trg = stm32_lptim_triggers[index];\n+\n+\tret = stm32_lptim_setup_trig(priv);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tplatform_set_drvdata(pdev, priv);\n+\n+\treturn 0;\n+}\n+\n+static const struct of_device_id stm32_lptim_trig_of_match[] = {\n+\t{ .compatible = \"st,stm32-lptimer-trigger\", },\n+\t{},\n+};\n+MODULE_DEVICE_TABLE(of, stm32_lptim_trig_of_match);\n+\n+static struct platform_driver stm32_lptim_trigger_driver = {\n+\t.probe = stm32_lptim_trigger_probe,\n+\t.driver = {\n+\t\t.name = \"stm32-lptimer-trigger\",\n+\t\t.of_match_table = stm32_lptim_trig_of_match,\n+\t},\n+};\n+module_platform_driver(stm32_lptim_trigger_driver);\n+\n+MODULE_AUTHOR(\"Fabrice Gasnier <fabrice.gasnier@st.com>\");\n+MODULE_ALIAS(\"platform:stm32-lptimer-trigger\");\n+MODULE_DESCRIPTION(\"STMicroelectronics STM32 LPTIM trigger driver\");\n+MODULE_LICENSE(\"GPL v2\");\ndiff --git a/include/linux/iio/timer/stm32-lptim-trigger.h b/include/linux/iio/timer/stm32-lptim-trigger.h\nnew file mode 100644\nindex 0000000..34d59bf\n--- /dev/null\n+++ b/include/linux/iio/timer/stm32-lptim-trigger.h\n@@ -0,0 +1,27 @@\n+/*\n+ * Copyright (C) STMicroelectronics 2017\n+ *\n+ * Author: Fabrice Gasnier <fabrice.gasnier@st.com>\n+ *\n+ * License terms: GNU General Public License (GPL), version 2\n+ */\n+\n+#ifndef _STM32_LPTIM_TRIGGER_H_\n+#define _STM32_LPTIM_TRIGGER_H_\n+\n+#include <linux/iio/iio.h>\n+#include <linux/iio/trigger.h>\n+\n+#define LPTIM1_OUT\t\"lptim1_out\"\n+#define LPTIM2_OUT\t\"lptim2_out\"\n+#define LPTIM3_OUT\t\"lptim3_out\"\n+\n+#if IS_ENABLED(CONFIG_IIO_STM32_LPTIMER_TRIGGER)\n+bool is_stm32_lptim_trigger(struct iio_trigger *trig);\n+#else\n+static inline bool is_stm32_lptim_trigger(struct iio_trigger *trig)\n+{\n+\treturn false;\n+}\n+#endif\n+#endif\n", "prefixes": [ "RESEND", "v3", "6/9" ] }