From: YH Huang <yh.huang@mediatek.com>
To: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Thierry Reding <thierry.reding@gmail.com>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
<linux-pwm@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
srv_heupstream <srv_heupstream@mediatek.com>,
<linux-mediatek@lists.infradead.org>,
"Sascha Hauer" <kernel@pengutronix.de>, <yh.huang@mediatek.com>
Subject: Re: [PATCH 2/2] pwm: add Mediatek display PWM driver support
Date: Thu, 14 May 2015 22:45:10 +0800 [thread overview]
Message-ID: <1431614710.15140.31.camel@mtksdaap41> (raw)
In-Reply-To: <CABuKBeJc3Kvdoejyi0XFbQMU2saztzV5S7jiXCg-09juYeh4pg@mail.gmail.com>
On Tue, 2015-05-12 at 14:44 +0200, Matthias Brugger wrote:
> 2015-05-12 14:37 GMT+02:00 Matthias Brugger <matthias.bgg@gmail.com>:
> > Hi YH,
> >
> > 2015-05-11 11:26 GMT+02:00 YH Huang <yh.huang@mediatek.com>:
> >> Add display PWM driver support to modify backlight for MT8173/MT6595.
> >>
> >> Signed-off-by: YH Huang <yh.huang@mediatek.com>
> >> ---
> >> drivers/pwm/Kconfig | 9 ++
> >> drivers/pwm/Makefile | 1 +
> >> drivers/pwm/pwm-disp-mediatek.c | 225 ++++++++++++++++++++++++++++++++++++++++
> >> 3 files changed, 235 insertions(+)
> >> create mode 100644 drivers/pwm/pwm-disp-mediatek.c
> >>
> >> diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
> >> index b1541f4..9edbb5a 100644
> >> --- a/drivers/pwm/Kconfig
> >> +++ b/drivers/pwm/Kconfig
> >> @@ -111,6 +111,15 @@ config PWM_CLPS711X
> >> To compile this driver as a module, choose M here: the module
> >> will be called pwm-clps711x.
> >>
> >> +config PWM_DISP_MEDIATEK
> >> + tristate "MEDIATEK display PWM driver"
> >> + depends on OF
> >> + help
> >> + Generic PWM framework driver for mediatek disp-pwm device.
> >> +
> >> + To compile this driver as a module, choose M here: the module
> >> + will be called pwm-disp-mediatek.
> >> +
> >> config PWM_EP93XX
> >> tristate "Cirrus Logic EP93xx PWM support"
> >> depends on ARCH_EP93XX
> >> diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
> >> index ec50eb5..c5ff72a 100644
> >> --- a/drivers/pwm/Makefile
> >> +++ b/drivers/pwm/Makefile
> >> @@ -8,6 +8,7 @@ obj-$(CONFIG_PWM_BCM_KONA) += pwm-bcm-kona.o
> >> obj-$(CONFIG_PWM_BCM2835) += pwm-bcm2835.o
> >> obj-$(CONFIG_PWM_BFIN) += pwm-bfin.o
> >> obj-$(CONFIG_PWM_CLPS711X) += pwm-clps711x.o
> >> +obj-$(CONFIG_PWM_DISP_MEDIATEK) += pwm-disp-mediatek.o
> >> obj-$(CONFIG_PWM_EP93XX) += pwm-ep93xx.o
> >> obj-$(CONFIG_PWM_FSL_FTM) += pwm-fsl-ftm.o
> >> obj-$(CONFIG_PWM_IMG) += pwm-img.o
> >> diff --git a/drivers/pwm/pwm-disp-mediatek.c b/drivers/pwm/pwm-disp-mediatek.c
> >> new file mode 100644
> >> index 0000000..38293af
> >> --- /dev/null
> >> +++ b/drivers/pwm/pwm-disp-mediatek.c
> >> @@ -0,0 +1,225 @@
> >> +/*
> >> + * Mediatek display pulse-width-modulation controller driver.
> >> + * Copyright (c) 2015 MediaTek Inc.
> >> + * Author: YH Huang <yh.huang@mediatek.com>
> >> + *
> >> + * This program is free software; you can redistribute it and/or modify
> >> + * it under the terms of the GNU General Public License version 2 as
> >> + * published by the Free Software Foundation.
> >> + *
> >> + * 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.
> >> + */
> >> +
> >> +#include <linux/clk.h>
> >> +#include <linux/err.h>
> >> +#include <linux/io.h>
> >> +#include <linux/module.h>
> >> +#include <linux/of.h>
> >> +#include <linux/pwm.h>
> >> +#include <linux/platform_device.h>
> >> +#include <linux/slab.h>
> >> +
> >> +#define DISP_PWM_EN_OFF (0x0)
> >> +#define PWM_ENABLE_SHIFT (0x0)
> >> +#define PWM_ENABLE_MASK (0x1 << PWM_ENABLE_SHIFT)
> >
> > Get rid of the _SHIFT which are actually zero, it will make the code
> > more readable.
> >
> >> +
> >> +#define DISP_PWM_COMMIT_OFF (0x08)
> >> +#define PWM_COMMIT_SHIFT (0x0)
> >> +#define PWM_COMMIT_MASK (0x1 << PWM_COMMIT_SHIFT)
> >> +
> >> +#define DISP_PWM_CON_0_OFF (0x10)
> >> +#define PWM_CLKDIV_SHIFT (0x10)
>
> I prefer to have the shift values in decimal instead of hex, as it
> makes it easier to see which bits in the registers are the relevant
> ones.
> Sorry forgot that one.
>
I think you are right.
> Cheers,
> Matthias
Thank for your suggestion.
Regards,
YH Huang
next prev parent reply other threads:[~2015-05-14 14:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-11 9:26 [PATCH 0/2] Add Mediatek display PWM driver YH Huang
2015-05-11 9:26 ` [PATCH 1/2] dt-bindings: pwm: add Mediatek display PWM bindings YH Huang
2015-05-11 9:26 ` [PATCH 2/2] pwm: add Mediatek display PWM driver support YH Huang
2015-05-12 12:37 ` Matthias Brugger
2015-05-12 12:44 ` Matthias Brugger
2015-05-14 14:45 ` YH Huang [this message]
2015-05-14 14:39 ` YH Huang
2015-05-12 13:00 ` Sascha Hauer
2015-05-14 14:52 ` YH Huang
2015-05-12 13:32 ` Thierry Reding
2015-05-12 14:34 ` Matthias Brugger
2015-05-14 15:39 ` YH Huang
2015-05-14 15:35 ` YH Huang
2015-05-18 3:42 ` Daniel Kurtz
2015-05-21 8:22 ` YH Huang
2015-05-26 6:05 ` Sascha Hauer
2015-05-26 8:29 ` Yingjoe Chen
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=1431614710.15140.31.camel@mtksdaap41 \
--to=yh.huang@mediatek.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=srv_heupstream@mediatek.com \
--cc=thierry.reding@gmail.com \
/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