[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
Hi Lin, On 2016ë 07ì 25ì¼ 17:47, hl wrote: > Hi Chanwoo Choi, > > On 2016å¹´07æ25æ¥ 14:01, Chanwoo Choi wrote: >> Hi Lin, >> >> I'm glad to support the for dmc ddr clock scaling with devfreq/devfreq-event. >> >> But, I think that you have to use the standard interface. >> As I already mentioned[1] on previous mail, devfreq fwk support >> the standard DEVFREQ_TRANSITION_NOTIFIER notifier which has the two >> notifications. >> - DEVFREQ_PRECHANGE >> - DEVFREQ_POSTCHANGE >> [1] https://patchwork.kernel.org/patch/9194305/ >> >> You can use the DEVFREQ_PRECHANGE instead of DMCFREQ_ADJUST >> and use the DEVFREQ_POSTCHANGE instead of DMCFREQ_FINISH. >> >> On 2016ë 07ì 22ì¼ 18:07, Lin Huang wrote: >>> base on dfi result, we do ddr frequency scaling, register >>> dmc driver to devfreq framework, and use simple-ondemand >>> policy. >>> >>> Signed-off-by: Lin Huang >>> --- >>> Changes in v3: >>> - operate dram setting through sip call >>> - imporve set rate flow >>> >>> Changes in v2: >>> - None >>> Changes in v1: >>> - move dfi controller to event >>> - fix set voltage sequence when set rate fail >>> - change Kconfig type from tristate to bool >>> - move unuse EXPORT_SYMBOL_GPL() >>> >>> drivers/devfreq/Kconfig | 1 + >>> drivers/devfreq/Makefile| 1 + >>> drivers/devfreq/rockchip/Kconfig| 15 + >>> drivers/devfreq/rockchip/Makefile | 2 + >>> drivers/devfreq/rockchip/rk3399_dmc.c | 482 >>> >>> drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ >>> include/soc/rockchip/rockchip_dmc.h | 45 +++ >>> 7 files changed, 689 insertions(+) >>> create mode 100644 drivers/devfreq/rockchip/Kconfig >>> create mode 100644 drivers/devfreq/rockchip/Makefile >>> create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c >>> create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c >>> create mode 100644 include/soc/rockchip/rockchip_dmc.h >>> >>> diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig >>> index a5be56e..cb67246 100644 >>> --- a/drivers/devfreq/Kconfig >>> +++ b/drivers/devfreq/Kconfig >>> @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ >>>operating frequencies and voltages with OPP support. >>> source "drivers/devfreq/event/Kconfig" >>> +source "drivers/devfreq/rockchip/Kconfig" >>> endif # PM_DEVFREQ >>> diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile >>> index 09f11d9..48e2ae6 100644 >>> --- a/drivers/devfreq/Makefile >>> +++ b/drivers/devfreq/Makefile >>> @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE)+= governor_passive.o >>> # DEVFREQ Drivers >>> obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ)+= exynos-bus.o >>> obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o >>> +obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/ >>> # DEVFREQ Event Drivers >>> obj-$(CONFIG_PM_DEVFREQ_EVENT)+= event/ >>> diff --git a/drivers/devfreq/rockchip/Kconfig >>> b/drivers/devfreq/rockchip/Kconfig >>> new file mode 100644 >>> index 000..7fb1cff >>> --- /dev/null >>> +++ b/drivers/devfreq/rockchip/Kconfig >>> @@ -0,0 +1,15 @@ >>> +config ARM_ROCKCHIP_DMC_DEVFREQ >>> +bool "ARM ROCKCHIP DMC DEVFREQ Driver" >>> +depends on ARCH_ROCKCHIP >>> +help >>> + This adds the DEVFREQ driver framework for the rockchip dmc. >>> + >>> +config ARM_RK3399_DMC_DEVFREQ >>> +bool "ARM RK3399 DMC DEVFREQ Driver" >>> +depends on ARM_ROCKCHIP_DMC_DEVFREQ >>> +select PM_OPP >>> +select DEVFREQ_GOV_SIMPLE_ONDEMAND >>> +help >>> + This adds the DEVFREQ driver for the RK3399 dmc. It sets the >>> frequency >>> + for the memory controller and reads the usage counts from >>> hardware. >>> + >>> diff --git a/drivers/devfreq/rockchip/Makefile >>> b/drivers/devfreq/rockchip/Makefile >>> new file mode 100644 >>> index 000..caca525 >>> --- /dev/null >>> +++ b/drivers/devfreq/rockchip/Makefile >>> @@ -0,0 +1,2 @@ >>> +obj-$(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ)+= rockchip_dmc.o >>> +obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ)+= rk3399_dmc.o >>> diff --git a/drivers/devfreq/rockchip/rk3399_dmc.c >>> b/drivers/devfreq/rockchip/rk3399_dmc.c >>> new file mode 100644 >>> index 000..f1d6120 >>> --- /dev/null >>> +++ b/drivers/devfreq/rockchip/rk3399_dmc.c >>> @@ -0,0 +1,482 @@ >>> +/* >>> + * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd >>> + * Author: Lin Huang >>> + * >>> + * This program is free software; you can redistribute it and/or modify it >>> + * under the terms and conditions of the GNU General Public License, >>> + * version 2, as published by the Free Software Foundation. >>> + * >>> + * This program is distributed in the hope 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 >>>
[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
Hi Chanwoo Choi, On 2016å¹´07æ25æ¥ 14:01, Chanwoo Choi wrote: > Hi Lin, > > I'm glad to support the for dmc ddr clock scaling with devfreq/devfreq-event. > > But, I think that you have to use the standard interface. > As I already mentioned[1] on previous mail, devfreq fwk support > the standard DEVFREQ_TRANSITION_NOTIFIER notifier which has the two > notifications. > - DEVFREQ_PRECHANGE > - DEVFREQ_POSTCHANGE > [1] https://patchwork.kernel.org/patch/9194305/ > > You can use the DEVFREQ_PRECHANGE instead of DMCFREQ_ADJUST > and use the DEVFREQ_POSTCHANGE instead of DMCFREQ_FINISH. > > On 2016ë 07ì 22ì¼ 18:07, Lin Huang wrote: >> base on dfi result, we do ddr frequency scaling, register >> dmc driver to devfreq framework, and use simple-ondemand >> policy. >> >> Signed-off-by: Lin Huang >> --- >> Changes in v3: >> - operate dram setting through sip call >> - imporve set rate flow >> >> Changes in v2: >> - None >> >> Changes in v1: >> - move dfi controller to event >> - fix set voltage sequence when set rate fail >> - change Kconfig type from tristate to bool >> - move unuse EXPORT_SYMBOL_GPL() >> >> drivers/devfreq/Kconfig | 1 + >> drivers/devfreq/Makefile| 1 + >> drivers/devfreq/rockchip/Kconfig| 15 + >> drivers/devfreq/rockchip/Makefile | 2 + >> drivers/devfreq/rockchip/rk3399_dmc.c | 482 >> >> drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ >> include/soc/rockchip/rockchip_dmc.h | 45 +++ >> 7 files changed, 689 insertions(+) >> create mode 100644 drivers/devfreq/rockchip/Kconfig >> create mode 100644 drivers/devfreq/rockchip/Makefile >> create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c >> create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c >> create mode 100644 include/soc/rockchip/rockchip_dmc.h >> >> diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig >> index a5be56e..cb67246 100644 >> --- a/drivers/devfreq/Kconfig >> +++ b/drivers/devfreq/Kconfig >> @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ >>operating frequencies and voltages with OPP support. >> >> source "drivers/devfreq/event/Kconfig" >> +source "drivers/devfreq/rockchip/Kconfig" >> >> endif # PM_DEVFREQ >> diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile >> index 09f11d9..48e2ae6 100644 >> --- a/drivers/devfreq/Makefile >> +++ b/drivers/devfreq/Makefile >> @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE)+= governor_passive.o >> # DEVFREQ Drivers >> obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o >> obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o >> +obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ >> >> # DEVFREQ Event Drivers >> obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ >> diff --git a/drivers/devfreq/rockchip/Kconfig >> b/drivers/devfreq/rockchip/Kconfig >> new file mode 100644 >> index 000..7fb1cff >> --- /dev/null >> +++ b/drivers/devfreq/rockchip/Kconfig >> @@ -0,0 +1,15 @@ >> +config ARM_ROCKCHIP_DMC_DEVFREQ >> +bool "ARM ROCKCHIP DMC DEVFREQ Driver" >> +depends on ARCH_ROCKCHIP >> +help >> + This adds the DEVFREQ driver framework for the rockchip dmc. >> + >> +config ARM_RK3399_DMC_DEVFREQ >> +bool "ARM RK3399 DMC DEVFREQ Driver" >> +depends on ARM_ROCKCHIP_DMC_DEVFREQ >> +select PM_OPP >> +select DEVFREQ_GOV_SIMPLE_ONDEMAND >> +help >> + This adds the DEVFREQ driver for the RK3399 dmc. It sets the >> frequency >> + for the memory controller and reads the usage counts from >> hardware. >> + >> diff --git a/drivers/devfreq/rockchip/Makefile >> b/drivers/devfreq/rockchip/Makefile >> new file mode 100644 >> index 000..caca525 >> --- /dev/null >> +++ b/drivers/devfreq/rockchip/Makefile >> @@ -0,0 +1,2 @@ >> +obj-$(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ) += rockchip_dmc.o >> +obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ)+= rk3399_dmc.o >> diff --git a/drivers/devfreq/rockchip/rk3399_dmc.c >> b/drivers/devfreq/rockchip/rk3399_dmc.c >> new file mode 100644 >> index 000..f1d6120 >> --- /dev/null >> +++ b/drivers/devfreq/rockchip/rk3399_dmc.c >> @@ -0,0 +1,482 @@ >> +/* >> + * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd >> + * Author: Lin Huang >> + * >> + * This program is free software; you can redistribute it and/or modify it >> + * under the terms and conditions of the GNU General Public License, >> + * version 2, as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope 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 >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >>
[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
Hi Lin, I'm glad to support the for dmc ddr clock scaling with devfreq/devfreq-event. But, I think that you have to use the standard interface. As I already mentioned[1] on previous mail, devfreq fwk support the standard DEVFREQ_TRANSITION_NOTIFIER notifier which has the two notifications. - DEVFREQ_PRECHANGE - DEVFREQ_POSTCHANGE [1] https://patchwork.kernel.org/patch/9194305/ You can use the DEVFREQ_PRECHANGE instead of DMCFREQ_ADJUST and use the DEVFREQ_POSTCHANGE instead of DMCFREQ_FINISH. On 2016ë 07ì 22ì¼ 18:07, Lin Huang wrote: > base on dfi result, we do ddr frequency scaling, register > dmc driver to devfreq framework, and use simple-ondemand > policy. > > Signed-off-by: Lin Huang > --- > Changes in v3: > - operate dram setting through sip call > - imporve set rate flow > > Changes in v2: > - None > > Changes in v1: > - move dfi controller to event > - fix set voltage sequence when set rate fail > - change Kconfig type from tristate to bool > - move unuse EXPORT_SYMBOL_GPL() > > drivers/devfreq/Kconfig | 1 + > drivers/devfreq/Makefile| 1 + > drivers/devfreq/rockchip/Kconfig| 15 + > drivers/devfreq/rockchip/Makefile | 2 + > drivers/devfreq/rockchip/rk3399_dmc.c | 482 > > drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ > include/soc/rockchip/rockchip_dmc.h | 45 +++ > 7 files changed, 689 insertions(+) > create mode 100644 drivers/devfreq/rockchip/Kconfig > create mode 100644 drivers/devfreq/rockchip/Makefile > create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c > create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c > create mode 100644 include/soc/rockchip/rockchip_dmc.h > > diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig > index a5be56e..cb67246 100644 > --- a/drivers/devfreq/Kconfig > +++ b/drivers/devfreq/Kconfig > @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ > operating frequencies and voltages with OPP support. > > source "drivers/devfreq/event/Kconfig" > +source "drivers/devfreq/rockchip/Kconfig" > > endif # PM_DEVFREQ > diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile > index 09f11d9..48e2ae6 100644 > --- a/drivers/devfreq/Makefile > +++ b/drivers/devfreq/Makefile > @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE) += governor_passive.o > # DEVFREQ Drivers > obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o > obj-$(CONFIG_ARM_TEGRA_DEVFREQ) += tegra-devfreq.o > +obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ > > # DEVFREQ Event Drivers > obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ > diff --git a/drivers/devfreq/rockchip/Kconfig > b/drivers/devfreq/rockchip/Kconfig > new file mode 100644 > index 000..7fb1cff > --- /dev/null > +++ b/drivers/devfreq/rockchip/Kconfig > @@ -0,0 +1,15 @@ > +config ARM_ROCKCHIP_DMC_DEVFREQ > + bool "ARM ROCKCHIP DMC DEVFREQ Driver" > + depends on ARCH_ROCKCHIP > + help > + This adds the DEVFREQ driver framework for the rockchip dmc. > + > +config ARM_RK3399_DMC_DEVFREQ > + bool "ARM RK3399 DMC DEVFREQ Driver" > + depends on ARM_ROCKCHIP_DMC_DEVFREQ > + select PM_OPP > + select DEVFREQ_GOV_SIMPLE_ONDEMAND > + help > + This adds the DEVFREQ driver for the RK3399 dmc. It sets the > frequency > + for the memory controller and reads the usage counts from hardware. > + > diff --git a/drivers/devfreq/rockchip/Makefile > b/drivers/devfreq/rockchip/Makefile > new file mode 100644 > index 000..caca525 > --- /dev/null > +++ b/drivers/devfreq/rockchip/Makefile > @@ -0,0 +1,2 @@ > +obj-$(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ) += rockchip_dmc.o > +obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o > diff --git a/drivers/devfreq/rockchip/rk3399_dmc.c > b/drivers/devfreq/rockchip/rk3399_dmc.c > new file mode 100644 > index 000..f1d6120 > --- /dev/null > +++ b/drivers/devfreq/rockchip/rk3399_dmc.c > @@ -0,0 +1,482 @@ > +/* > + * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd > + * Author: Lin Huang > + * > + * This program is free software; you can redistribute it and/or modify it > + * under the terms and conditions of the GNU General Public License, > + * version 2, as published by the Free Software Foundation. > + * > + * This program is distributed in the hope 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 > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include "../../firmware/rockchip_sip.h" > + > +struct dram_timing { > + unsigned int ddr3_speed_bin; > + unsigned int pd_idle; > + unsigned int sr_idle; > + unsigned int
[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
Hi Paul, On 2016å¹´07æ23æ¥ 04:24, Paul Gortmaker wrote: > On Fri, Jul 22, 2016 at 5:07 AM, Lin Huang wrote: >> base on dfi result, we do ddr frequency scaling, register >> dmc driver to devfreq framework, and use simple-ondemand >> policy. >> >> Signed-off-by: Lin Huang >> --- >> Changes in v3: >> - operate dram setting through sip call >> - imporve set rate flow >> >> Changes in v2: >> - None >> >> Changes in v1: >> - move dfi controller to event >> - fix set voltage sequence when set rate fail >> - change Kconfig type from tristate to bool >> - move unuse EXPORT_SYMBOL_GPL() >> >> drivers/devfreq/Kconfig | 1 + >> drivers/devfreq/Makefile| 1 + >> drivers/devfreq/rockchip/Kconfig| 15 + >> drivers/devfreq/rockchip/Makefile | 2 + >> drivers/devfreq/rockchip/rk3399_dmc.c | 482 >> >> drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ >> include/soc/rockchip/rockchip_dmc.h | 45 +++ >> 7 files changed, 689 insertions(+) >> create mode 100644 drivers/devfreq/rockchip/Kconfig >> create mode 100644 drivers/devfreq/rockchip/Makefile >> create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c >> create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c >> create mode 100644 include/soc/rockchip/rockchip_dmc.h >> >> diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig >> index a5be56e..cb67246 100644 >> --- a/drivers/devfreq/Kconfig >> +++ b/drivers/devfreq/Kconfig >> @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ >>operating frequencies and voltages with OPP support. >> >> source "drivers/devfreq/event/Kconfig" >> +source "drivers/devfreq/rockchip/Kconfig" >> >> endif # PM_DEVFREQ >> diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile >> index 09f11d9..48e2ae6 100644 >> --- a/drivers/devfreq/Makefile >> +++ b/drivers/devfreq/Makefile >> @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE) += governor_passive.o >> # DEVFREQ Drivers >> obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o >> obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o >> +obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/ >> >> # DEVFREQ Event Drivers >> obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ >> diff --git a/drivers/devfreq/rockchip/Kconfig >> b/drivers/devfreq/rockchip/Kconfig >> new file mode 100644 >> index 000..7fb1cff >> --- /dev/null >> +++ b/drivers/devfreq/rockchip/Kconfig >> @@ -0,0 +1,15 @@ >> +config ARM_ROCKCHIP_DMC_DEVFREQ >> + bool "ARM ROCKCHIP DMC DEVFREQ Driver" >> + depends on ARCH_ROCKCHIP >> + help >> + This adds the DEVFREQ driver framework for the rockchip dmc. >> + >> +config ARM_RK3399_DMC_DEVFREQ >> + bool "ARM RK3399 DMC DEVFREQ Driver" > Since you are using bool Kconfigs for your driver, please do not use > module.h or MODULE_ tags in your driver, and use the builtin > register function. > > Alternatively if there really is a use case for it to be a modular driver > then use a tristate Kconfig. Thanks for pointing it, will fix it next version. > THanks, > Paul. > -- > >> + depends on ARM_ROCKCHIP_DMC_DEVFREQ >> + select PM_OPP >> + select DEVFREQ_GOV_SIMPLE_ONDEMAND >> + help >> + This adds the DEVFREQ driver for the RK3399 dmc. It sets the >> frequency >> + for the memory controller and reads the usage counts from >> hardware. >> + > ___ > Linux-rockchip mailing list > Linux-rockchip at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip > > > -- Lin Huang
[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
base on dfi result, we do ddr frequency scaling, register dmc driver to devfreq framework, and use simple-ondemand policy. Signed-off-by: Lin Huang --- Changes in v3: - operate dram setting through sip call - imporve set rate flow Changes in v2: - None Changes in v1: - move dfi controller to event - fix set voltage sequence when set rate fail - change Kconfig type from tristate to bool - move unuse EXPORT_SYMBOL_GPL() drivers/devfreq/Kconfig | 1 + drivers/devfreq/Makefile| 1 + drivers/devfreq/rockchip/Kconfig| 15 + drivers/devfreq/rockchip/Makefile | 2 + drivers/devfreq/rockchip/rk3399_dmc.c | 482 drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ include/soc/rockchip/rockchip_dmc.h | 45 +++ 7 files changed, 689 insertions(+) create mode 100644 drivers/devfreq/rockchip/Kconfig create mode 100644 drivers/devfreq/rockchip/Makefile create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c create mode 100644 include/soc/rockchip/rockchip_dmc.h diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig index a5be56e..cb67246 100644 --- a/drivers/devfreq/Kconfig +++ b/drivers/devfreq/Kconfig @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ operating frequencies and voltages with OPP support. source "drivers/devfreq/event/Kconfig" +source "drivers/devfreq/rockchip/Kconfig" endif # PM_DEVFREQ diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile index 09f11d9..48e2ae6 100644 --- a/drivers/devfreq/Makefile +++ b/drivers/devfreq/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE) += governor_passive.o # DEVFREQ Drivers obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o +obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/ # DEVFREQ Event Drivers obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ diff --git a/drivers/devfreq/rockchip/Kconfig b/drivers/devfreq/rockchip/Kconfig new file mode 100644 index 000..7fb1cff --- /dev/null +++ b/drivers/devfreq/rockchip/Kconfig @@ -0,0 +1,15 @@ +config ARM_ROCKCHIP_DMC_DEVFREQ + bool "ARM ROCKCHIP DMC DEVFREQ Driver" + depends on ARCH_ROCKCHIP + help + This adds the DEVFREQ driver framework for the rockchip dmc. + +config ARM_RK3399_DMC_DEVFREQ + bool "ARM RK3399 DMC DEVFREQ Driver" + depends on ARM_ROCKCHIP_DMC_DEVFREQ + select PM_OPP + select DEVFREQ_GOV_SIMPLE_ONDEMAND + help + This adds the DEVFREQ driver for the RK3399 dmc. It sets the frequency + for the memory controller and reads the usage counts from hardware. + diff --git a/drivers/devfreq/rockchip/Makefile b/drivers/devfreq/rockchip/Makefile new file mode 100644 index 000..caca525 --- /dev/null +++ b/drivers/devfreq/rockchip/Makefile @@ -0,0 +1,2 @@ +obj-$(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ) += rockchip_dmc.o +obj-$(CONFIG_ARM_RK3399_DMC_DEVFREQ) += rk3399_dmc.o diff --git a/drivers/devfreq/rockchip/rk3399_dmc.c b/drivers/devfreq/rockchip/rk3399_dmc.c new file mode 100644 index 000..f1d6120 --- /dev/null +++ b/drivers/devfreq/rockchip/rk3399_dmc.c @@ -0,0 +1,482 @@ +/* + * Copyright (c) 2016, Fuzhou Rockchip Electronics Co., Ltd + * Author: Lin Huang + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "../../firmware/rockchip_sip.h" + +struct dram_timing { + unsigned int ddr3_speed_bin; + unsigned int pd_idle; + unsigned int sr_idle; + unsigned int sr_mc_gate_idle; + unsigned int srpd_lite_idle; + unsigned int standby_idle; + unsigned int dram_dll_dis_freq; + unsigned int phy_dll_dis_freq; + unsigned int ddr3_odt_dis_freq; + unsigned int ddr3_drv; + unsigned int ddr3_odt; + unsigned int phy_ddr3_ca_drv; + unsigned int phy_ddr3_dq_drv; + unsigned int phy_ddr3_odt; + unsigned int lpddr3_odt_dis_freq; + unsigned int lpddr3_drv; + unsigned int lpddr3_odt; + unsigned int phy_lpddr3_ca_drv; + unsigned int phy_lpddr3_dq_drv; + unsigned int phy_lpddr3_odt; + unsigned int lpddr4_odt_dis_freq; + unsigned int lpddr4_drv; + unsigned int lpddr4_dq_odt; + unsigned int lpddr4_ca_odt; + unsigned int phy_lpddr4_ca_drv; + unsigned
[PATCH v3 6/7] PM / devfreq: rockchip: add devfreq driver for rk3399 dmc
On Fri, Jul 22, 2016 at 5:07 AM, Lin Huang wrote: > base on dfi result, we do ddr frequency scaling, register > dmc driver to devfreq framework, and use simple-ondemand > policy. > > Signed-off-by: Lin Huang > --- > Changes in v3: > - operate dram setting through sip call > - imporve set rate flow > > Changes in v2: > - None > > Changes in v1: > - move dfi controller to event > - fix set voltage sequence when set rate fail > - change Kconfig type from tristate to bool > - move unuse EXPORT_SYMBOL_GPL() > > drivers/devfreq/Kconfig | 1 + > drivers/devfreq/Makefile| 1 + > drivers/devfreq/rockchip/Kconfig| 15 + > drivers/devfreq/rockchip/Makefile | 2 + > drivers/devfreq/rockchip/rk3399_dmc.c | 482 > > drivers/devfreq/rockchip/rockchip_dmc.c | 143 ++ > include/soc/rockchip/rockchip_dmc.h | 45 +++ > 7 files changed, 689 insertions(+) > create mode 100644 drivers/devfreq/rockchip/Kconfig > create mode 100644 drivers/devfreq/rockchip/Makefile > create mode 100644 drivers/devfreq/rockchip/rk3399_dmc.c > create mode 100644 drivers/devfreq/rockchip/rockchip_dmc.c > create mode 100644 include/soc/rockchip/rockchip_dmc.h > > diff --git a/drivers/devfreq/Kconfig b/drivers/devfreq/Kconfig > index a5be56e..cb67246 100644 > --- a/drivers/devfreq/Kconfig > +++ b/drivers/devfreq/Kconfig > @@ -101,5 +101,6 @@ config ARM_TEGRA_DEVFREQ > operating frequencies and voltages with OPP support. > > source "drivers/devfreq/event/Kconfig" > +source "drivers/devfreq/rockchip/Kconfig" > > endif # PM_DEVFREQ > diff --git a/drivers/devfreq/Makefile b/drivers/devfreq/Makefile > index 09f11d9..48e2ae6 100644 > --- a/drivers/devfreq/Makefile > +++ b/drivers/devfreq/Makefile > @@ -9,6 +9,7 @@ obj-$(CONFIG_DEVFREQ_GOV_PASSIVE) += governor_passive.o > # DEVFREQ Drivers > obj-$(CONFIG_ARM_EXYNOS_BUS_DEVFREQ) += exynos-bus.o > obj-$(CONFIG_ARM_TEGRA_DEVFREQ)+= tegra-devfreq.o > +obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/ > > # DEVFREQ Event Drivers > obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/ > diff --git a/drivers/devfreq/rockchip/Kconfig > b/drivers/devfreq/rockchip/Kconfig > new file mode 100644 > index 000..7fb1cff > --- /dev/null > +++ b/drivers/devfreq/rockchip/Kconfig > @@ -0,0 +1,15 @@ > +config ARM_ROCKCHIP_DMC_DEVFREQ > + bool "ARM ROCKCHIP DMC DEVFREQ Driver" > + depends on ARCH_ROCKCHIP > + help > + This adds the DEVFREQ driver framework for the rockchip dmc. > + > +config ARM_RK3399_DMC_DEVFREQ > + bool "ARM RK3399 DMC DEVFREQ Driver" Since you are using bool Kconfigs for your driver, please do not use module.h or MODULE_ tags in your driver, and use the builtin register function. Alternatively if there really is a use case for it to be a modular driver then use a tristate Kconfig. THanks, Paul. -- > + depends on ARM_ROCKCHIP_DMC_DEVFREQ > + select PM_OPP > + select DEVFREQ_GOV_SIMPLE_ONDEMAND > + help > + This adds the DEVFREQ driver for the RK3399 dmc. It sets the > frequency > + for the memory controller and reads the usage counts from hardware. > +