> -----Original Message-----
> From: Rasmus Villemoes <li...@rasmusvillemoes.dk>
> Sent: Friday, February 26, 2021 9:14 AM
> To: Greg Kroah-Hartman <gre...@linuxfoundation.org>; Rob Herring
> <robh...@kernel.org>
> Cc: devicet...@vger.kernel.org; linux-kernel@vger.kernel.org; Arnd Bergmann
> <a...@arndb.de>; linux-...@vger.kernel.org; Rasmus Villemoes
> <li...@rasmusvillemoes.dk>
> Subject: [PATCH 2/2] drivers: misc: add ripple counter driver
> 
> The only purpose of this driver is to serve as a consumer of the input
> clock, to prevent it from being disabled by clk_disable_unused().
> 
> Signed-off-by: Rasmus Villemoes <li...@rasmusvillemoes.dk>
> ---
>  drivers/misc/Kconfig      |  7 +++++++
>  drivers/misc/Makefile     |  1 +
>  drivers/misc/ripple-ctr.c | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 39 insertions(+)
>  create mode 100644 drivers/misc/ripple-ctr.c
> 
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index f532c59bb59b..44b0b6ce42df 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -445,6 +445,13 @@ config HISI_HIKEY_USB
>         switching between the dual-role USB-C port and the USB-A host ports
>         using only one USB controller.
> 
> +config RIPPLE_CTR
> +     tristate "Trivial ripple counter driver"
> +     help
> +       This provides a stub driver for a ripple counter, whose
> +       only purpose is to request and enable the clock source
> +       driving the counter.
> +
>  source "drivers/misc/c2port/Kconfig"
>  source "drivers/misc/eeprom/Kconfig"
>  source "drivers/misc/cb710/Kconfig"
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 99b6f15a3c70..d560163068a9 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI)             += habanalabs/
>  obj-$(CONFIG_UACCE)          += uacce/
>  obj-$(CONFIG_XILINX_SDFEC)   += xilinx_sdfec.o
>  obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o
> +obj-$(CONFIG_RIPPLE_CTR)     += ripple-ctr.o
> diff --git a/drivers/misc/ripple-ctr.c b/drivers/misc/ripple-ctr.c
> new file mode 100644
> index 000000000000..f086eaf335df
> --- /dev/null
> +++ b/drivers/misc/ripple-ctr.c
> @@ -0,0 +1,31 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +
> +static int ripple_ctr_probe(struct platform_device *pdev)
> +{
> +     struct clk *clk;
> +
> +     clk = devm_clk_get(&pdev->dev, NULL);
> +     if (IS_ERR(clk))
> +             return PTR_ERR(clk);
> +     return clk_prepare_enable(clk);
> +}
> +
> +static const struct of_device_id ripple_ctr_ids[] = {
> +     { .compatible = "linux,ripple-counter", },
> +     { }
> +};
> +MODULE_DEVICE_TABLE(of, ripple_ctr_ids);
> +
> +static struct platform_driver ripple_ctr_driver = {
> +     .driver = {
> +             .name           = "ripple-counter",
> +             .of_match_table = ripple_ctr_ids,
> +     },
> +     .probe  = ripple_ctr_probe,
> +};
> +module_platform_driver(ripple_ctr_driver);

Missing MODULE_LICENSE() tag?
See 
https://www.kernel.org/doc/html/latest/process/license-rules.html#license-identifiers

> --
> 2.29.2

Reply via email to