Re: [Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks

2015-12-02 Thread Emil Velikov
On 2 December 2015 at 12:21, Karol Herbst  wrote:
>> Pierre Moreau  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 
>> > +#include 
>> > #include 
>> > #include 
>> > #include 
>> > @@ -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
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks

2015-12-02 Thread Karol Herbst
> Pierre Moreau  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 
> > +#include 
> > #include 
> > #include 
> > #include 
> > @@ -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@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks

2015-12-01 Thread Pierre Moreau
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 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -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(_clk, device, index, 0, >subdev);
> + bios = device->bios;
> +
> + if (bios && !nvbios_baseclock_parse(bios, )) {
> + struct nvbios_baseclock_entry base_entry, boost_entry;
> + if (nvbios_baseclock_get_entry(bios, , 
> header.base_entry, _entry))
> + nvkm_error(>subdev, "couldn't parse base clock\n");
> + else if (nvbios_baseclock_get_entry(bios, , 
> header.boost_entry, _entry))
> + nvkm_error(>subdev, "couldn't parse boost 
> clock\n");
> + else
> + nvkm_info(>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(>states);
>   clk->domains = func->domains;
> -- 
> 2.6.3
> 
> ___
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau


[Nouveau] [RFC PATCH 4/5] subdev/clk: print the base clocks

2015-12-01 Thread Karol Herbst
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 
+#include 
 #include 
 #include 
 #include 
@@ -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(_clk, device, index, 0, >subdev);
+   bios = device->bios;
+
+   if (bios && !nvbios_baseclock_parse(bios, )) {
+   struct nvbios_baseclock_entry base_entry, boost_entry;
+   if (nvbios_baseclock_get_entry(bios, , 
header.base_entry, _entry))
+   nvkm_error(>subdev, "couldn't parse base clock\n");
+   else if (nvbios_baseclock_get_entry(bios, , 
header.boost_entry, _entry))
+   nvkm_error(>subdev, "couldn't parse boost 
clock\n");
+   else
+   nvkm_info(>subdev, "base: %i MHz, boost: %i MHz\n",
+   base_entry.clock_mhz / 2, boost_entry.clock_mhz 
/ 2);
+   }
+
clk->func = func;
INIT_LIST_HEAD(>states);
clk->domains = func->domains;
-- 
2.6.3

___
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau