Linux-PWM Archive mirror
 help / color / mirror / Atom feed
From: William Qiu <william.qiu@starfivetech.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, linux-pwm@vger.kernel.org,
	"Emil Renner Berthing" <kernel@esmil.dk>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Hal Feng" <hal.feng@starfivetech.com>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v9 2/4] pwm: opencores: Add PWM driver support
Date: Fri, 15 Dec 2023 16:17:27 +0800	[thread overview]
Message-ID: <1c26fe9b-20f9-4b03-b263-ca030d20a5ce@starfivetech.com> (raw)
In-Reply-To: <62bb91ad-5d4b-4ec6-80c8-6c3edf5d25cd@starfivetech.com>



On 2023/12/13 17:27, William Qiu wrote:
> 
> 
> On 2023/12/12 1:41, Rob Herring wrote:
>> On Fri, Dec 8, 2023 at 3:42 AM William Qiu <william.qiu@starfivetech.com> wrote:
>>>
>>> Add driver for OpenCores PWM Controller. And add compatibility code
>>> which based on StarFive SoC.
>>>
>>> Co-developed-by: Hal Feng <hal.feng@starfivetech.com>
>>> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
>>> Signed-off-by: William Qiu <william.qiu@starfivetech.com>
>>> ---
>>>  MAINTAINERS              |   7 ++
>>>  drivers/pwm/Kconfig      |  12 ++
>>>  drivers/pwm/Makefile     |   1 +
>>>  drivers/pwm/pwm-ocores.c | 229 +++++++++++++++++++++++++++++++++++++++
>>>  4 files changed, 249 insertions(+)
>>>  create mode 100644 drivers/pwm/pwm-ocores.c
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 788be9ab5b73..7a11a22da09e 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -16204,6 +16204,13 @@ F:     Documentation/i2c/busses/i2c-ocores.rst
>>>  F:     drivers/i2c/busses/i2c-ocores.c
>>>  F:     include/linux/platform_data/i2c-ocores.h
>>>
>>> +OPENCORES PWM DRIVER
>>> +M:     William Qiu <william.qiu@starfivetech.com>
>>> +M:     Hal Feng <hal.feng@starfivetech.com>
>>> +S:     Supported
>>> +F:     Documentation/devicetree/bindings/pwm/opencores,pwm.yaml
>>> +F:     drivers/pwm/pwm-ocores.c
>>> +
>>>  OPENRISC ARCHITECTURE
>>>  M:     Jonas Bonn <jonas@southpole.se>
>>>  M:     Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
>>> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
>>> index 4b956d661755..d87e1bb350ba 100644
>>> --- a/drivers/pwm/Kconfig
>>> +++ b/drivers/pwm/Kconfig
>>> @@ -444,6 +444,18 @@ config PWM_NTXEC
>>>           controller found in certain e-book readers designed by the original
>>>           design manufacturer Netronix.
>>>
>>> +config PWM_OCORES
>>> +       tristate "OpenCores PWM support"
>>> +       depends on HAS_IOMEM && OF
>>> +       depends on COMMON_CLK && RESET_CONTROLLER
>>> +       depends on ARCH_STARFIVE || COMPILE_TEST
>>> +       help
>>> +         If you say yes to this option, support will be included for the
>>> +         OpenCores PWM. For details see https://opencores.org/projects/ptc.
>>> +
>>> +         To compile this driver as a module, choose M here: the module
>>> +         will be called pwm-ocores.
>>> +
>>>  config PWM_OMAP_DMTIMER
>>>         tristate "OMAP Dual-Mode Timer PWM support"
>>>         depends on OF
>>> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
>>> index c5ec9e168ee7..517c4f643058 100644
>>> --- a/drivers/pwm/Makefile
>>> +++ b/drivers/pwm/Makefile
>>> @@ -40,6 +40,7 @@ obj-$(CONFIG_PWM_MICROCHIP_CORE)      += pwm-microchip-core.o
>>>  obj-$(CONFIG_PWM_MTK_DISP)     += pwm-mtk-disp.o
>>>  obj-$(CONFIG_PWM_MXS)          += pwm-mxs.o
>>>  obj-$(CONFIG_PWM_NTXEC)                += pwm-ntxec.o
>>> +obj-$(CONFIG_PWM_OCORES)       += pwm-ocores.o
>>>  obj-$(CONFIG_PWM_OMAP_DMTIMER) += pwm-omap-dmtimer.o
>>>  obj-$(CONFIG_PWM_PCA9685)      += pwm-pca9685.o
>>>  obj-$(CONFIG_PWM_PXA)          += pwm-pxa.o
>>> diff --git a/drivers/pwm/pwm-ocores.c b/drivers/pwm/pwm-ocores.c
>>> new file mode 100644
>>> index 000000000000..996ca3805901
>>> --- /dev/null
>>> +++ b/drivers/pwm/pwm-ocores.c
>>> @@ -0,0 +1,229 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * OpenCores PWM Driver
>>> + *
>>> + * https://opencores.org/projects/ptc
>>> + *
>>> + * Copyright (C) 2018-2023 StarFive Technology Co., Ltd.
>>> + *
>>> + * Limitations:
>>> + * - The hardware only do inverted polarity.
>>> + * - The hardware minimum period / duty_cycle is (1 / pwm_apb clock frequency) ns.
>>> + * - The hardware maximum period / duty_cycle is (U32_MAX / pwm_apb clock frequency) ns.
>>> + */
>>> +
>>> +#include <linux/clk.h>
>>> +#include <linux/io.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of.h>
>>> +#include <linux/of_device.h>
>> 
>> You probably don't need this header and the implicit includes it makes
>> are dropped now in linux-next. Please check what you actually need and
>> make them explicit.
>> 
>> Rob
> Will drop.
> 
> Thank you for spending time on this patchset.
> 
> Best Regards
> William
Hi Rob,

After checking, I need to use of_match_device() in of_device.h, so this
interface will be moved to which header in linux-next?

Thanks,
William

  reply	other threads:[~2023-12-15  8:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  9:42 [PATCH v9 0/4] StarFive's Pulse Width Modulation driver support William Qiu
2023-12-08  9:42 ` [PATCH v9 1/4] dt-bindings: pwm: Add bindings for OpenCores PWM Controller William Qiu
2023-12-08 14:45   ` Conor Dooley
2023-12-08  9:42 ` [PATCH v9 2/4] pwm: opencores: Add PWM driver support William Qiu
2023-12-08 11:47   ` Philipp Zabel
2023-12-13  9:03     ` William Qiu
2023-12-11 17:41   ` Rob Herring
2023-12-13  9:27     ` William Qiu
2023-12-15  8:17       ` William Qiu [this message]
2023-12-08  9:42 ` [PATCH v9 3/4] riscv: dts: starfive: jh7100: Add PWM node and pins configuration William Qiu
2023-12-08  9:42 ` [PATCH v9 4/4] riscv: dts: starfive: jh7110: " William Qiu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c26fe9b-20f9-4b03-b263-ca030d20a5ce@starfivetech.com \
    --to=william.qiu@starfivetech.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=hal.feng@starfivetech.com \
    --cc=kernel@esmil.dk \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=p.zabel@pengutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).