From: bugzilla-daemon-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org Subject: [Bug 31122] Cannot control backlight intensity on Powerbook Date: Thu, 18 Aug 2016 11:59:37 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1865588469==" Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: nouveau-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "Nouveau" To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: nouveau.vger.kernel.org --===============1865588469== Content-Type: multipart/alternative; boundary="14715215771.7b193.4484"; charset="UTF-8" --14715215771.7b193.4484 Date: Thu, 18 Aug 2016 11:59:37 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated https://bugs.freedesktop.org/show_bug.cgi?id=3D31122 --- Comment #21 from Karol Herbst --- Comment on attachment 125817 --> https://bugs.freedesktop.org/attachment.cgi?id=3D125817 backlight control w/ gpio check Review of attachment 125817: ----------------------------------------------------------------- yeah, it is much better now, just a few lines are oddish, comments inlined. With everything fixed you can add this to your patch: Reviewed-by: Karol Herbst Also please send it to the ML after you are done with the stuff: https://lists.freedesktop.org/mailman/listinfo/nouveau ::: /root/nouveau_backlight.c.orig @@ +47,5 @@ > + struct nouveau_drm *drm =3D bl_get_data(bd); > + struct nvif_object *device =3D &drm->device.object; > + int val =3D (nvif_rd32(device, > + NV30_PMC_BACKLIGHT) & > + NV30_PMC_BACKLIGHT_MASK) >> 16; this line is a bit odd (also contains spaces). Maybe it would be cleaner if you move the rd out of the calculation and do something like that (which looks much cleaner imho): int val =3D nvif_rd32(device, NV30_PMC_BACKLIGHT); val =3D (val & NV30_PMC_BACKLIGHT_MASK) >> 16; @@ +68,5 @@ > + level =3D val + NV30_BL_MIN_LEVEL - 1; > + nvif_wr32(device, > + NV30_PMC_BACKLIGHT, > + ((level << 16) + 0x535) | 0x80000000); > + /* workaround for disabled backlight after waking from suspend */ please move the comment before the code it refers to @@ +99,5 @@ > + > + memset(&props, 0, sizeof(struct backlight_properties)); > + props.type =3D BACKLIGHT_RAW; > + props.max_brightness =3D NV30_BL_MAX_LEVEL - NV30_BL_MIN_LEVEL;=20=20 > + /* includes an additional 0x00 level (backlight off) */ please move the comment before the code it refers to @@ +104,5 @@ > + > + bd =3D backlight_device_register("nv_backlight", > + connector->kdev, > + drm, > + &nv30_bl_ops, spaces in this line @@ +307,5 @@ > continue; >=20=20 > switch (device->info.family) { > + case NV_DEVICE_INFO_V0_RANKINE: > + return nv30_backlight_init(connector); both lines have spaces --=20 You are receiving this mail because: You are the assignee for the bug.= --14715215771.7b193.4484 Date: Thu, 18 Aug 2016 11:59:37 +0000 MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.freedesktop.org/ Auto-Submitted: auto-generated

Commen= t # 21 on bug 31122<= /a> from Karol Herbst
Comment on attac=
hment 125817 [details] [review]=

backlight control w/ gpio check

Review of attachment 125817 [details] [review]:
-----------------------------------------------------------------

yeah, it is much better now, just a few lines are oddish, comments inlined.

With everything fixed you can add this to your patch:

Reviewed-by: Karol Herbst <=
karolherbst@gmail.com>

Also please send it to the ML after you are done with the stuff:
https://=
lists.freedesktop.org/mailman/listinfo/nouveau

::: /root/nouveau_backlight.c.orig
@@ +47,5 @@
> +	struct nouveau_drm *drm =3D bl_get_data(bd);
> +	struct nvif_object *device =3D &drm->device.object;
> +	int val =3D (nvif_rd32(device,
> +			     NV30_PMC_BACKLIGHT) &
> +                             NV30_PMC_BACKLIGHT_MASK) >> 16;

this line is a bit odd (also contains spaces).
Maybe it would be cleaner if you move the rd out of the calculation and do
something like that (which looks much cleaner imho):

int val =3D nvif_rd32(device, NV30_PMC_BACKLIGHT);
val =3D (val & NV30_PMC_BACKLIGHT_MASK) >> 16;

@@ +68,5 @@
> +		level =3D val + NV30_BL_MIN_LEVEL - 1;
> +	nvif_wr32(device,
> +		  NV30_PMC_BACKLIGHT,
> +		  ((level << 16) + 0x535) | 0x80000000);
> +	/* workaround for disabled backlight after waking from suspend */

please move the comment before the code it refers to

@@ +99,5 @@
> +
> +	memset(&props, 0, sizeof(struct backlight_properties));
> +	props.type =3D BACKLIGHT_RAW;
> +	props.max_brightness =3D NV30_BL_MAX_LEVEL - NV30_BL_MIN_LEVEL;=20=20
> +	/* includes an additional 0x00 level (backlight off) */

please move the comment before the code it refers to

@@ +104,5 @@
> +
> +	bd =3D backlight_device_register("nv_backlight",
> +				       connector->kdev,
> +				       drm,
> +                                       &nv30_bl_ops,

spaces in this line

@@ +307,5 @@
>  			continue;
>=20=20
>  		switch (device->info.family) {
> +                case NV_DEVICE_INFO_V0_RANKINE:
> +                        return nv30_backlight_init(connector);

both lines have spaces


You are receiving this mail because:
  • You are the assignee for the bug.
= --14715215771.7b193.4484-- --===============1865588469== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KTm91dmVhdSBt YWlsaW5nIGxpc3QKTm91dmVhdUBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9ub3V2ZWF1Cg== --===============1865588469==--