Pierre Moreau
2015-Dec-02 01:34 UTC
[Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks
Hi, On 05:42 PM - Dec 01 2015, Karol Herbst wrote:> this is just a nice thing to know and there is no harm in printing them > --- > drm/nouveau/nvkm/subdev/clk/base.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c > index d731bc3..df9173e 100644 > --- a/drm/nouveau/nvkm/subdev/clk/base.c > +++ b/drm/nouveau/nvkm/subdev/clk/base.c > @@ -24,6 +24,7 @@ > #include "priv.h" > > #include <subdev/bios.h> > +#include <subdev/bios/baseclock.h> > #include <subdev/bios/boost.h> > #include <subdev/bios/cstep.h> > #include <subdev/bios/perf.h> > @@ -562,10 +563,25 @@ int > nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device, > int index, bool allow_reclock, struct nvkm_clk *clk) > { > + struct nvkm_bios *bios; > int ret, idx, arglen; > const char *mode; > + struct nvbios_baseclock_header header; > > nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev); > + bios = device->bios; > + > + if (bios && !nvbios_baseclock_parse(bios, &header)) { > + struct nvbios_baseclock_entry base_entry, boost_entry; > + if (nvbios_baseclock_get_entry(bios, &header, header.base_entry, &base_entry)) > + nvkm_error(&clk->subdev, "couldn't parse base clock\n"); > + else if (nvbios_baseclock_get_entry(bios, &header, header.boost_entry, &boost_entry)) > + nvkm_error(&clk->subdev, "couldn't parse boost clock\n"); > + else > + nvkm_info(&clk->subdev, "base: %i MHz, boost: %i MHz\n", > + base_entry.clock_mhz / 2, boost_entry.clock_mhz / 2);This is probably just me missing some elementary electronic knowledge about clocks, but why do you divide the clock frequency by two? Regards, Pierre> + } > + > clk->func = func; > INIT_LIST_HEAD(&clk->states); > clk->domains = func->domains; > -- > 2.6.3 > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/nouveau
Karol Herbst
2015-Dec-02 12:21 UTC
[Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks
> Pierre Moreau <pierre.morrow at free.fr> hat am 2. Dezember 2015 um 02:34 > geschrieben: > > Hi, > > On 05:42 PM - Dec 01 2015, Karol Herbst wrote: > > this is just a nice thing to know and there is no harm in printing them > > --- > > drm/nouveau/nvkm/subdev/clk/base.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/drm/nouveau/nvkm/subdev/clk/base.c > > b/drm/nouveau/nvkm/subdev/clk/base.c > > index d731bc3..df9173e 100644 > > --- a/drm/nouveau/nvkm/subdev/clk/base.c > > +++ b/drm/nouveau/nvkm/subdev/clk/base.c > > @@ -24,6 +24,7 @@ > > #include "priv.h" > > > > #include <subdev/bios.h> > > +#include <subdev/bios/baseclock.h> > > #include <subdev/bios/boost.h> > > #include <subdev/bios/cstep.h> > > #include <subdev/bios/perf.h> > > @@ -562,10 +563,25 @@ int > > nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device, > > int index, bool allow_reclock, struct nvkm_clk *clk) > > { > > + struct nvkm_bios *bios; > > int ret, idx, arglen; > > const char *mode; > > + struct nvbios_baseclock_header header; > > > > nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev); > > + bios = device->bios; > > + > > + if (bios && !nvbios_baseclock_parse(bios, &header)) { > > + struct nvbios_baseclock_entry base_entry, boost_entry; > > + if (nvbios_baseclock_get_entry(bios, &header, header.base_entry, > > &base_entry)) > > + nvkm_error(&clk->subdev, "couldn't parse base clock\n"); > > + else if (nvbios_baseclock_get_entry(bios, &header, header.boost_entry, > > &boost_entry)) > > + nvkm_error(&clk->subdev, "couldn't parse boost clock\n"); > > + else > > + nvkm_info(&clk->subdev, "base: %i MHz, boost: %i MHz\n", > > + base_entry.clock_mhz / 2, boost_entry.clock_mhz / 2); > > This is probably just me missing some elementary electronic knowledge about > clocks, but why do you divide the clock frequency by two? >This is because if the card was sold with 800/850 MHz the table contains 1600/1700. And because I don't want that confusion I stick with the "halfed" clocks. I don't know why they are doubled though or the marketing ones halfed.> Regards, > Pierre > > > + } > > + > > clk->func = func; > > INIT_LIST_HEAD(&clk->states); > > clk->domains = func->domains; > > -- > > 2.6.3 > > > > _______________________________________________ > > Nouveau mailing list > > Nouveau at lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/nouveau
Emil Velikov
2015-Dec-02 12:29 UTC
[Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks
On 2 December 2015 at 12:21, Karol Herbst <nouveau at karolherbst.de> wrote:>> Pierre Moreau <pierre.morrow at free.fr> hat am 2. Dezember 2015 um 02:34 >> geschrieben: >> >> Hi, >> >> On 05:42 PM - Dec 01 2015, Karol Herbst wrote: >> > this is just a nice thing to know and there is no harm in printing them >> > --- >> > drm/nouveau/nvkm/subdev/clk/base.c | 16 ++++++++++++++++ >> > 1 file changed, 16 insertions(+) >> > >> > diff --git a/drm/nouveau/nvkm/subdev/clk/base.c >> > b/drm/nouveau/nvkm/subdev/clk/base.c >> > index d731bc3..df9173e 100644 >> > --- a/drm/nouveau/nvkm/subdev/clk/base.c >> > +++ b/drm/nouveau/nvkm/subdev/clk/base.c >> > @@ -24,6 +24,7 @@ >> > #include "priv.h" >> > >> > #include <subdev/bios.h> >> > +#include <subdev/bios/baseclock.h> >> > #include <subdev/bios/boost.h> >> > #include <subdev/bios/cstep.h> >> > #include <subdev/bios/perf.h> >> > @@ -562,10 +563,25 @@ int >> > nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device, >> > int index, bool allow_reclock, struct nvkm_clk *clk) >> > { >> > + struct nvkm_bios *bios; >> > int ret, idx, arglen; >> > const char *mode; >> > + struct nvbios_baseclock_header header; >> > >> > nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev); >> > + bios = device->bios; >> > + >> > + if (bios && !nvbios_baseclock_parse(bios, &header)) { >> > + struct nvbios_baseclock_entry base_entry, boost_entry; >> > + if (nvbios_baseclock_get_entry(bios, &header, header.base_entry, >> > &base_entry)) >> > + nvkm_error(&clk->subdev, "couldn't parse base clock\n"); >> > + else if (nvbios_baseclock_get_entry(bios, &header, header.boost_entry, >> > &boost_entry)) >> > + nvkm_error(&clk->subdev, "couldn't parse boost clock\n"); >> > + else >> > + nvkm_info(&clk->subdev, "base: %i MHz, boost: %i MHz\n", >> > + base_entry.clock_mhz / 2, boost_entry.clock_mhz / 2); >> >> This is probably just me missing some elementary electronic knowledge about >> clocks, but why do you divide the clock frequency by two? >> > This is because if the card was sold with 800/850 MHz the table contains > 1600/1700. And because I don't want that confusion I stick with the "halfed" > clocks. > I don't know why they are doubled though or the marketing ones halfed. >A short (and not 100% accurate) description comes from DDR - double data rate. I.e. effective = 2x actual clock rate. In some cases the vbios use(d) to store the actual, while in other cases the effective rate. -Emil
Maybe Matching Threads
- [RFC PATCH 4/5] subdev/clk: print the base clocks
- [RFC PATCH 4/5] subdev/clk: print the base clocks
- [RFC PATCH 5/5] clk: allow boosting only when NvBoost is set
- [RFC PATCH 5/5] clk: allow boosting only when NvBoost is set
- [RFC PATCH 5/5] clk: allow boosting only when NvBoost is set