2011-04-27 04:31:04

by Linus Torvalds

[permalink] [raw]
Subject: Linux 2.6.39-rc5

Another week, another keyboard destroyed by spilling coffee on it..
C'est la vie.

We have slightly fewer commits than in -rc4, which is good. At the
same time, I have to berate some people for merging some dubious
regression fixes. Sadly, the "people" I have to berate is me, because
-rc5 contains what technically _is_ a regression, but it's a
performance thing, and it's a bit scary. It's the patches from Andi
(with some editing by Eric) to make it possible to do the whole RCU
pathname walk even if you have SElinux enabled.

I've been alternately kicking myself for merging it, and just being so
pleased with the rcu pathname walk now extending outside of the
no-security confines ... I dunno. The patches are all pretty simple
(there's also a few dentry cleanup patches that were the result of me
looking at profiles and generated code), and it really is a rather
important performance thing, but at the same time I would shout at
others for trying to merge it to me this late. So I'll consider myself
properly chastised.

Other than that? We should have all the fallout from the block layer
plugging changes fixed now, and Tejun fixed the infinite CD-ROM
disk-change notification thing. So that's hopefully all good and done.

And then there are all the usual driver noise (including some hwmon
documentation), some ecryptfs and gfs2 updates and just various small
random fixups. The diffstat actually looks pretty good, most of it is
just one-liners and stuff like a few new device ID's etc.

Go forth and test,

Linus

---
Alex Deucher (4):
drm/radeon/kms: fix bad shift in atom iio table parser
drm/radeon/kms: add connectors even if i2c fails
drm/radeon/kms: adjust evergreen display watermark setup
drm/radeon/kms: pll tweaks for r7xx

Alex Williamson (2):
intel-iommu: Unlink domain from iommu
intel-iommu: Fix get_domain_for_dev() error path

Amit Kumar Salecha (1):
qlcnic: limit skb frags for non tso packet

Amit Shah (3):
virtio: Decrement avail idx on buffer detach
virtio_pci: Prevent double-free of pci regions after device hot-unplug
virtio: console: Enable call to hvc_remove() on console port remove

Anatolij Gustschin (1):
net: can: mscan: fix build breakage in mpc5xxx_can

Andi Kleen (2):
perf: Support Xeon E7's via the Westmere PMU driver
SECURITY: Move exec_permission RCU checks into security modules

Andre Przywara (1):
perf, x86: Fix pre-defined cache-misses event for AMD family 15h cpus

Arnaldo Carvalho de Melo (1):
perf evsel: Fix use of inherit

Artem Bityutskiy (3):
UBIFS: fix false space checking failure
UBIFS: fix false assertion warning in case of I/O failures
UBIFS: fix master node recovery

Axel Lin (1):
RTC: rtc-omap: Fix a leak of the IRQ during init failure

Ben Hutchings (4):
sfc: Do not use efx_process_channel_now() in online self-test
net: Disable all TSO features when SG is disabled
net: Disable NETIF_F_TSO_ECN when TSO is disabled
kconfig: Avoid buffer underrun in choice input

Ben Skeggs (4):
drm/nouveau: split ramin_lock into two locks, one hardirq safe
drm/nouveau: fix nv30 pcie boards
drm/nouveau: populate ttm_alloced with false, when it's not
drm/nouveau: fix pinning of notifier block

Benjamin Marzinski (1):
GFS2: directly write blocks past i_size

Bob Peterson (2):
GFS2: write_end error path fails to unlock transaction lock
GFS2: filesystem hang caused by incorrect lock order

Borislav Petkov (3):
amd64_edac: Remove node interleave warning
amd64_edac: Factor in CC6 save area
amd64_edac: Erratum #637 workaround

Brian Cavagnolo (1):
mwl8k: do not free unrequested irq

Carsten Otte (1):
[S390] kvm-390: Let kernel exit SIE instruction on work

Chris Mason (1):
Btrfs: do some plugging in the submit_bio threads

Chris Wilson (2):
drm/i915: Sanitize the output registers after resume
drm/i915: Initialise g4x watermarks for disabled pipes

Christian Lamparter (1):
ath: add missing regdomain pair 0x5c mapping

Christoph Hellwig (1):
add hlist_bl_lock/unlock helpers

CoolCold (1):
md: Update documentation for sync_min and sync_max entries

Cyrill Gorcunov (1):
perf, x86: P4 PMU - Don't forget to clear cpuc->active_mask on overflow

Cédric Cano (1):
drm/radeon/kms: fix IH writeback on r6xx+ on big endian machines

Dave Chinner (1):
xfs: fix duplicate message output

Dave Jones (1):
irda: fix locking unbalance in irda_sendmsg

David Rientjes (2):
Revert "x86, NUMA: Fix fakenuma boot failure"
x86, numa: Fix cpu nodemasks for NUMA emulation and
CONFIG_DEBUG_PER_CPU_MAPS

David S. Miller (3):
llc: Fix length check in llc_fixup_skb().
ieee802154: Remove hacked CFLAGS in net/ieee802154/Makefile
Revert "tcp: disallow bind() to reuse addr/port"

David Sterba (1):
btrfs: add missing spin_unlock to a rare exit path

Dilan Lee (1):
ASoC: WM8903: HP and Line out PGA/mixer DAPM fixes

Eric Dumazet (3):
bridge: reset IPCB in br_parse_ip_options
inetpeer: reduce stack usage
ip: ip_options_compile() resilient to NULL skb route

Eric Paris (1):
SELINUX: Make selinux cache VFS RCU walks safe

Felix Fietkau (2):
ath9k: fix missing ath9k_ps_wakeup/ath9k_ps_restore calls
ath9k_hw: fix stopping rx DMA during resets

Francois Romieu (1):
r8169: add Realtek as maintainer.

Giuseppe CAVALLARO (3):
stmmac: fixed dma lib build when turn-on the debug option
stmmac: fix open funct when exit on error
stmmac: fix Transmit Underflow error

Guennadi Liakhovetski (1):
ASoC: add a module alias to the FSI driver

Guenter Roeck (7):
hwmon: Add submitting-patches checklist to documentation
hwmon: (pmbus) Removed unused variable from struct pmbus_data
hwmon: (smm665) Fix spelling error in driver documentation
hwmon: (pmbus) Documentation updates
hwmon: (max8688) Add driver documentation
hwmon: (max16064) Add driver documentation
hwmon: (max34440) Add driver documentation

Hannes Reinecke (1):
ahci: EM supported message type sysfs attribute

Heiko Carstens (1):
[S390] pfault: fix token handling

Igor Plyatov (2):
ata: pata_at91.c bugfix for high master clock
ata: pata_at91.c bugfix for initial_timing initialisation

Ingo Molnar (1):
x86, perf event: Turn off unstructured raw event access to
offcore registers

Itaru Kitayama (1):
btrfs: fix wrong allocating flag when reading page

J. Bruce Fields (1):
nfsd4: fix struct file leak on delegation

Jan Glauber (3):
[S390] prng: prevent access beyond end of stack
[S390] fix page table walk for changing page attributes
[S390] qdio: reset error states immediately

Jan Kara (1):
vfs: Pass setxattr(2) flags properly

Jan Kiszka (1):
intel-iommu: Fix use after release during device attach

Jason Conti (1):
p54: Initialize extra_len in p54_tx_80211

Jassi Brar (1):
MAINTAINERS: Update Samsung ASoC maintainer's id

Jeff Mahoney (1):
libata: Pioneer DVR-216D can't do SETXFER

Jens Axboe (5):
block: kill blk_flush_plug_list() export
cfq-iosched: read_lock() does not always imply rcu_read_lock()
block: get rid of QUEUE_FLAG_REENTER
block: remove stale kerneldoc member from __blk_run_queue()
elevator: check for ELEVATOR_INSERT_SORT_MERGE in !elvpriv case too

Jian Peng (1):
libata: ahci_start_engine compliant to AHCI spec

Joakim Tjernlund (1):
net: Do not wrap sysctl igmp_max_memberships in IP_MULTICAST

Joerg Roedel (3):
x86, gart: Convert spaces to tabs in enable_gart_translation
x86, gart: Set DISTLBWALKPRB bit always
x86, gart: Make sure GART does not map physmem above 1TB

Johannes Berg (1):
iwlagn: override 5300 EEPROM # of chains

John W. Linville (1):
iwlegacy: make iwl3945 and iwl4965 select IWLWIFI_LEGACY

Jonathan Cameron (1):
ARM: 6881/1: cputype.h uses __attribute_const__ which requires
including kernel.h

Josef Bacik (2):
Btrfs: free bitmaps properly when evicting the cache
Btrfs: put the right bio if we have an error

Joseph Cihula (1):
intel_iommu: disable all VT-d PMRs when TXT launched

Jozsef Kadlecsik (5):
netfilter: ipset: list:set timeout variant fixes
netfilter: ipset: References are protected by rwlock instead of mutex
netfilter: ipset: bitmap:ip,mac type requires "src" for MAC
netfilter: ipset: set match and SET target fixes
netfilter: ipset: Fix the order of listing of sets

Krishna Kumar (1):
ip6_pol_route panic: Do not allow VLAN on loopback

Krzysztof Wojcik (1):
md: Cleanup after raid45->raid0 takeover

Kuninori Morimoto (3):
ASoC: fsi: take care in failing case of dai register
ASoC: fsi: modify vague PM control on probe
ASoC: fsi: driver safely remove for against irq

Lars-Peter Clausen (2):
ASoC: codecs: JZ4740: Fix OOPS
ARM: s3c2440: gta02; Register dfbmcs320 device for BT audio interface

Li Zefan (1):
Btrfs: Free free_space item properly in btrfs_trim_block_group()

Lin Ming (1):
perf hists browser: Fix seg fault when annotate null symbol

Linus Torvalds (5):
Revert "[media] V4L: videobuf, don't use dma addr as physical"
vfs: get rid of 'struct dcache_hash_bucket' abstraction
vfs: get rid of insane dentry hashing rules
bit_spinlock: don't play preemption games inside the busy loop
Linux 2.6.39-rc5

Linus Walleij (2):
mach-ux500: fix i2c0 device setup regression
rtc: fix coh901331 startup crash

Liu Yuan (1):
block, blk-sysfs: Fix an err return path in blk_register_queue()

Lu Guanqun (4):
ASoC: check channel mismatch between cpu_dai and codec_dai
ASoC: fix config error path
ASoC: sst_platform: Fix lock acquring
ASoC: sn95031: decorate function with __devexit_p()

Marcin Slusarz (2):
drm/nouveau: fix notifier memory corruption bug
drm/nouveau: fix allocation of notifier object

Mark Brown (2):
ASoC: Set left channel volume update bits for WM8994
ASoC: Fix output PGA enabling in wm_hubs CODECs

Markus Trippelsdorf (1):
EDAC: Remove debugging output in scrub rate handling

Mathew McKernan (2):
drm/i915/tv: Remember the detected TV type
drm/i915/tv: Only poll for TV connections

Maxime Bizon (1):
ahci: don't enable port irq before handler is registered

Mike Waychison (1):
ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME

Mikhail Kshevetskiy (1):
tty/n_gsm: fix bug in CRC calculation for gsm1 mode

Neil Turton (2):
sfc: Stop the TX queues during loopback self-tests
sfc: Use rmb() to ensure reads occur in order

NeilBrown (2):
md/raid5: remove setting of ->queue_lock
md: Fix dev_sectors on takeover from raid0 to raid4/5

Niels de Vos (1):
parport_pc.c: correctly release the requested region for the IT887x

OGAWA Hirofumi (1):
nfsd4: Fix filp leak

Otavio Salvador (2):
net/sis900: store MAC into perm_addr for SiS 900, 630E, 635 and
96x variants
net/natsami: store MAC into perm_addr

Patrick McHardy (1):
connector: fix skb double free in cn_rx_skb()

Pavel Shilovsky (1):
CIFS: Fix memory over bound bug in cifs_parse_mount_options

Peter Pan(潘卫平) (5):
bonding:set save_load to 0 when initializing
bonding:delete unused alb_timer
bonding:delete unused rlb_interval_counter
net: fix tranmitted/tranmitting typo
bonding:fix two typos

Peter Zijlstra (1):
perf, x86: Update/fix Intel Nehalem cache events

Rafael J. Wysocki (2):
PM: Fix error code paths executed after failing syscore_suspend()
PM: Add missing syscore_suspend() and syscore_resume() calls

Randy Dunlap (3):
PCI: pci-label: Fix build failure when CONFIG_NLS is set to 'm'
by allmodconfig
raid5: fix build error, sector_t usage
init/Kconfig: fix EXPERT menu list

Rasesh Mody (2):
bna: fix for clean fw re-initialization
bna: fix memory leak during RX path cleanup

Raymond Yau (1):
ALSA: emu10k1 - Fix "Music" controls to "Synth" controls in documents

Richard Cochran (1):
posix clocks: Replace mutex with reader/writer semaphore

Robert Richter (1):
perf, x86: Fix AMD family 15h FPU event constraints

Russell King (1):
ARM: Add new syscalls

Sachin Prabhu (1):
Open with O_CREAT flag set fails to open existing files on non
writable directories

Sangbeom Kim (1):
ASoC: SAMSUNG: Fix the inverted clocks handling for pcm driver

Seth Heasley (3):
ata_piix: IDE-mode SATA patch for Intel Panther Point DeviceIDs
ahci: AHCI-mode SATA patch for Intel Panther Point DeviceIDs
watchdog: iTCO_wdt: TCO Watchdog patch for Intel Panther Point PCH

Sitsofe Wheeler (1):
drm/i915/tv: Fix modeset flickering introduced in 7f58aabc3

Sjur Brændeland (2):
caif: Bugfix use for_each_safe when removing list nodes.
caif: performance bugfix - allow radio stack to prioritize packets.

Stanislaw Gruszka (1):
iwlegacy: fix tx_power initialization

Stefan Weinhuber (2):
[S390] dasd: fix race between open and offline
[S390] dasd: check sense type in device change handler

Stefano Stabellini (2):
xen: do not create the extra e820 region at an addr lower than 4G
xen: mask_rw_pte: do not apply the early_ioremap checks on x86_32

Stephen Warren (1):
ASoC: Tegra: Suspend/resume support

Steven Whitehouse (1):
GFS2: Don't try to deallocate unlinked inodes when mounted ro

Sujith Manoharan (1):
ath9k_htc: Fix ethtool reporting

Takashi Iwai (1):
ALSA: hda - Add a fix-up for Acer dmic with ALC271x codec

Tao Ma (1):
block: Remove the extra check in queue_requests_store

Tejun Heo (4):
block: don't propagate unlisted DISK_EVENTs to userland
ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd
libata: Kill unused ATA_DFLAG_{H|D}IPM flags
libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65

Thomas Gleixner (1):
xtensa: Fixup irq conversion fallout and nmi_count

Tsutomu Itoh (3):
Btrfs: fix missing mutex_unlock in btrfs_del_dir_entries_in_log()
Btrfs: check return value of kmalloc()
Btrfs: cleanup error handling in inode.c

Tyler Hicks (5):
eCryptfs: Remove extra d_delete in ecryptfs_rmdir
eCryptfs: dput dentries returned from dget_parent
eCryptfs: Add reference counting to lower files
eCryptfs: Handle failed metadata read in lookup
eCryptfs: Flush dirty pages in setattr

Uwe Kleine-König (1):
serial/imx: read cts state only after acking cts change irq

Vasiliy Kulikov (2):
agp: fix OOM and buffer overflow
agp: fix arbitrary kernel memory writes

Vlad Yasevich (1):
sctp: fix oops when updating retransmit path with DEBUG on

Wei Yongjun (1):
sctp: fix oops while removed transport still using as retran path

Yaniv Rosner (1):
bnx2x: Fix port identification problem

amit salecha (1):
netxen: limit skb frags for non tso packet

huajun li (1):
usbnet: Fix up 'FLAG_POINTTOPOINT' and 'FLAG_MULTI_PACKET' overlaps.


2011-04-29 15:58:13

by Melchior FRANZ

[permalink] [raw]
Subject: Re: Linux 2.6.39-rc5

* Linus Torvalds -- Wednesday 27 April 2011:
> Go forth and test,

Doesn't work on my notebook with i915/KMS. But then again, neither did
2.6.38 or any of its stable releases. The last working version was
2.6.38-rc8. The problem has been reported[1], but the bug got closed
in the wrong assumption that the bug is fixed. I reported that, too.
No reactions to that.

The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
by Takashi Iwai. The result is that when using KMS my notebook's[2] screen
remains dark, because the backlight isn't turned on.

Reverting commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0 makes my
notebook work correctly again as it used to in 2.6.38-rc8 and before.

m.



[1] https://bugzilla.kernel.org/show_bug.cgi?id=31522
[2] Acer TravelMate 5735Z-452G32Mnss, using Intel GM45

2011-04-29 17:09:57

by Takashi Iwai

[permalink] [raw]
Subject: Re: Linux 2.6.39-rc5

At Fri, 29 Apr 2011 17:58:06 +0200,
Melchior FRANZ wrote:
>
> * Linus Torvalds -- Wednesday 27 April 2011:
> > Go forth and test,
>
> Doesn't work on my notebook with i915/KMS. But then again, neither did
> 2.6.38 or any of its stable releases. The last working version was
> 2.6.38-rc8. The problem has been reported[1], but the bug got closed
> in the wrong assumption that the bug is fixed. I reported that, too.
> No reactions to that.
>
> The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
> by Takashi Iwai. The result is that when using KMS my notebook's[2] screen
> remains dark, because the backlight isn't turned on.
>
> Reverting commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0 makes my
> notebook work correctly again as it used to in 2.6.38-rc8 and before.

Could you check whether the patch below changes the behavior?
If this cures, it means that the backlight-combo mode doesn't work on
your machine.


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..bf61e02 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -116,11 +116,13 @@ static int is_backlight_combination_mode(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;

+#if 0
if (INTEL_INFO(dev)->gen >= 4)
return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;

if (IS_GEN2(dev))
return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+#endif

return 0;
}

2011-04-29 17:41:58

by Melchior FRANZ

[permalink] [raw]
Subject: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

* Takashi Iwai -- Friday 29 April 2011:
> Melchior FRANZ wrote:
> > The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
> > [...] when using KMS my notebook's[2] screen remains dark, because the
> > backlight isn't turned on.

> Could you check whether the patch below changes the behavior?
> If this cures, it means that the backlight-combo mode doesn't work on
> your machine.

Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
which is current HEAD.)

m.

2011-04-29 19:47:07

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

At Fri, 29 Apr 2011 19:41:53 +0200,
Melchior FRANZ wrote:
>
> * Takashi Iwai -- Friday 29 April 2011:
> > Melchior FRANZ wrote:
> > > The bug was introduced with commit ba3820ade317ee36e496b9b40d2ec3987dd4aef0
> > > [...] when using KMS my notebook's[2] screen remains dark, because the
> > > backlight isn't turned on.
>
> > Could you check whether the patch below changes the behavior?
> > If this cures, it means that the backlight-combo mode doesn't work on
> > your machine.
>
> Yes, that works. (Test was with fafc9929c668f8bae6dd1f109f33a86d2cb3c460,
> which is current HEAD.)

Looking at bugzilla, the problem seems like the case lbpc=0.
What about the patch below instead?


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..ba60218 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,7 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)

val &= ~1;
pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
- val *= lbpc;
+ if (lbpc)
+ val *= lbpc;
}
}

2011-04-29 20:09:59

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

* Takashi Iwai -- Friday 29 April 2011:
[https://bugzilla.kernel.org/show_bug.cgi?id=31522]
> Looking at bugzilla, the problem seems like the case lbpc=0.
> What about the patch below instead?

> - val *= lbpc;
> + if (lbpc)
> + val *= lbpc;

Yes, that works as well. (I had assumed that this was the problem,
but wasn't sure if a zero was even a legitimate value, or rather
a sign for a problem or wrong assumption elsewhere.)

m.

2011-04-30 08:12:00

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

At Fri, 29 Apr 2011 22:09:54 +0200,
Melchior FRANZ wrote:
>
> * Takashi Iwai -- Friday 29 April 2011:
> [https://bugzilla.kernel.org/show_bug.cgi?id=31522]
> > Looking at bugzilla, the problem seems like the case lbpc=0.
> > What about the patch below instead?
>
> > - val *= lbpc;
> > + if (lbpc)
> > + val *= lbpc;
>
> Yes, that works as well. (I had assumed that this was the problem,
> but wasn't sure if a zero was even a legitimate value, or rather
> a sign for a problem or wrong assumption elsewhere.)

Well, this was just my wild guess. I remember vaguely that the value
zero could be interpreted as the max. It might be depending on the
hardware.

So, the patch below may work better in your case.

Also, with the patch, does the backlight level can be adjusted
correctly to different values? I wonder whether LBPC adjustment
really works or not on your machine.


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..aaa1f9e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -207,6 +207,8 @@ u32 intel_panel_get_backlight(struct drm_device *dev)

val &= ~1;
pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
+ if (!lbpc)
+ lbpc = 0xff; /* max value */
val *= lbpc;
}
}

2011-04-30 08:32:13

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

* Takashi Iwai -- Saturday 30 April 2011:
> I remember vaguely that the value zero could be interpreted as the max.

> Also, with the patch, does the backlight level can be adjusted
> correctly to different values? I wonder whether LBPC adjustment
> really works or not on your machine.

> + if (!lbpc)
> + lbpc = 0xff; /* max value */

This change does *not* work on my machine. The screen stays black
again.

Yes, backlight adjustment generally works on this notebook, but only
with "acpi_osi=Linux" on the command line.

m.

2011-04-30 10:27:28

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

At Sat, 30 Apr 2011 10:32:04 +0200,
Melchior FRANZ wrote:
>
> * Takashi Iwai -- Saturday 30 April 2011:
> > I remember vaguely that the value zero could be interpreted as the max.
>
> > Also, with the patch, does the backlight level can be adjusted
> > correctly to different values? I wonder whether LBPC adjustment
> > really works or not on your machine.
>
> > + if (!lbpc)
> > + lbpc = 0xff; /* max value */
>
> This change does *not* work on my machine. The screen stays black
> again.

Hrm, then it's really hard to say how exactly the system behaves when
lbpc=0... I guess we should avoid controlling LBPC in such a case,
e.g. something like the patch below (totally untested).

But Intel guys must know of this better... I leave this to their
hands.

>
> Yes, backlight adjustment generally works on this notebook, but only
> with "acpi_osi=Linux" on the command line.

acpi_osi quirk should be better added statically, then.


thanks,

Takashi

---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c1b27c..c0ab771 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -328,6 +328,7 @@ typedef struct drm_i915_private {
struct intel_overlay *overlay;

/* LVDS info */
+ int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
int backlight_level; /* restore backlight to this value */
bool backlight_enabled;
struct drm_display_mode *panel_fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..320dd5f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -115,14 +115,24 @@ done:
static int is_backlight_combination_mode(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
-
- if (INTEL_INFO(dev)->gen >= 4)
- return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
-
- if (IS_GEN2(dev))
- return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
-
- return 0;
+ int combo_mode;
+ u8 lbpc;
+
+ if (dev_priv->backlight_combination_mode)
+ return dev_priv->backlight_combination_mode > 0;
+
+ pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
+ if (!lbpc)
+ combo_mode = 0;
+ else if (INTEL_INFO(dev)->gen >= 4)
+ combo_mode = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
+ else if (IS_GEN2(dev))
+ combo_mode = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+ else
+ combo_mode = 0;
+
+ dev_priv->backlight_combination_mode = combo_mode ? -1 : 1;
+ return combo_mode;
}

static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)

2011-04-30 11:34:59

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

Dropping Linus from the CC.


* Takashi Iwai -- Saturday 30 April 2011:
* * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > Yes, backlight adjustment generally works on this notebook, but only
> > with "acpi_osi=Linux" on the command line.
>
> acpi_osi quirk should be better added statically, then.

No, I guess the problem here is that acer_wmi doesn't support this
machine yet. I told the ACER WMI maintainer and sent a DSDT image,
but this message was thoroughly ignored.


$ dmesg|grep -i acer
[ 0.000000] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
[ 71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
[ 72.350278] acer_wmi: Unable to detect available WMID devices

Machine: Acer Travelmate 5735Z-452G32Mnss

m.

2011-04-30 14:38:07

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

Hi Melchior,

於 六,2011-04-30 於 13:34 +0200,Melchior FRANZ 提到:
> Dropping Linus from the CC.
>
>
> * Takashi Iwai -- Saturday 30 April 2011:
> * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > Yes, backlight adjustment generally works on this notebook, but only
> > > with "acpi_osi=Linux" on the command line.
> >
> > acpi_osi quirk should be better added statically, then.
>
> No, I guess the problem here is that acer_wmi doesn't support this
> machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> but this message was thoroughly ignored.
>
>
> $ dmesg|grep -i acer
> [ 0.000000] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
> [ 71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
> [ 72.350278] acer_wmi: Unable to detect available WMID devices
>
> Machine: Acer Travelmate 5735Z-452G32Mnss
>
> m.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

Could you please attach DSDT on this mail or share your kernel bugzilla
number to us?

I found cann't access BKO now?


Thank's
Joey Lee

2011-05-02 12:09:05

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

At Sat, 30 Apr 2011 13:34:51 +0200,
Melchior FRANZ wrote:
>
> Dropping Linus from the CC.
>
>
> * Takashi Iwai -- Saturday 30 April 2011:
> * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > Yes, backlight adjustment generally works on this notebook, but only
> > > with "acpi_osi=Linux" on the command line.
> >
> > acpi_osi quirk should be better added statically, then.
>
> No, I guess the problem here is that acer_wmi doesn't support this
> machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> but this message was thoroughly ignored.
>
>
> $ dmesg|grep -i acer
> [ 0.000000] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
> [ 71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
> [ 72.350278] acer_wmi: Unable to detect available WMID devices
>
> Machine: Acer Travelmate 5735Z-452G32Mnss

Hm, but the backlight control is done via the standard ACPI, no?
If so, the fact that acer_wmi doesn't work sounds irrelevant.

BTW, did you try my previous patch?


Takashi

2011-05-02 13:12:46

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

* Takashi Iwai -- Monday 02 May 2011:
* > At Sat, 30 Apr 2011 13:34:51 +0200, Melchior FRANZ wrote:
> > * Takashi Iwai -- Saturday 30 April 2011:
> > > acpi_osi quirk should be better added statically, then.
> >
> > No, I guess the problem here is that acer_wmi doesn't support this
> > machine yet.

> Hm, but the backlight control is done via the standard ACPI, no?

I have no idea. If I were an expert, I would just have sent a
patch, not a bug report. And I prefer fixes to "quirks". :-P



> BTW, did you try my previous patch?

Works. I hadn't tested it before, because you seemed to wait
for the opinion of some Intel people, and so did I. But thanks
for that code!

m.

2011-05-04 07:07:10

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

Hi Melchior,

於 一,2011-05-02 於 14:08 +0200,Takashi Iwai 提到:
> At Sat, 30 Apr 2011 13:34:51 +0200,
> Melchior FRANZ wrote:
> >
> > Dropping Linus from the CC.
> >
> >
> > * Takashi Iwai -- Saturday 30 April 2011:
> > * * At Sat, 30 Apr 2011 10:32:04 +0200, Melchior FRANZ wrote:
> > > > Yes, backlight adjustment generally works on this notebook, but only
> > > > with "acpi_osi=Linux" on the command line.
> > >
> > > acpi_osi quirk should be better added statically, then.
> >
> > No, I guess the problem here is that acer_wmi doesn't support this
> > machine yet. I told the ACER WMI maintainer and sent a DSDT image,
> > but this message was thoroughly ignored.
> >
> >
> > $ dmesg|grep -i acer
> > [ 0.000000] DMI: Acer TM5735/BA51_MV, BIOS V1.04 09/23/2010
> > [ 71.850534] acer_wmi: Acer Laptop ACPI-WMI Extras
> > [ 72.350278] acer_wmi: Unable to detect available WMID devices
> >
> > Machine: Acer Travelmate 5735Z-452G32Mnss
>
> Hm, but the backlight control is done via the standard ACPI, no?
> If so, the fact that acer_wmi doesn't work sounds irrelevant.
>
> BTW, did you try my previous patch?
>
>
> Takashi

Yes, please try Takashi's previous patch.

I am tracing bko#34142, but this issue does not related to your
backlight control, because there have _BCM, _BQC declare in your DSDT,
your machine MUST SUPPORTED by standard acpi backlight interface.

Even the acer-wmi can probed on your machine, it cann't help anything
for your backlight control.


Thank's a lot!
Joey Lee

2011-05-05 20:42:27

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)

* Takashi Iwai -- Thursday 05 May 2011:
> Try the fixed patch below.

> ---
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 456f404..4c6e187 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -332,6 +332,7 @@ typedef struct drm_i915_private {
> struct intel_overlay *overlay;
>
> /* LVDS info */
> + int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
> int backlight_level; /* restore backlight to this value */
> bool backlight_enabled;
> struct drm_display_mode *panel_fixed_mode;
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index f8f86e5..5a6be04 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -115,14 +115,24 @@ done:
> static int is_backlight_combination_mode(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> -
> - if (INTEL_INFO(dev)->gen >= 4)
> - return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
> -
> - if (IS_GEN2(dev))
> - return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
> -
> - return 0;
> + int combo_mode;
> + u8 lbpc;
> +
> + if (dev_priv->backlight_combination_mode)
> + return dev_priv->backlight_combination_mode > 0;
> +
> + pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
> + if (!lbpc)
> + combo_mode = 0;
> + else if (INTEL_INFO(dev)->gen >= 4)
> + combo_mode = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
> + else if (IS_GEN2(dev))
> + combo_mode = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
> + else
> + combo_mode = 0;
> +
> + dev_priv->backlight_combination_mode = combo_mode ? 1 : -1;
> + return combo_mode;
> }
>
> static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)

The first patch had a problem. Without the lbpc check for zero the backlight
still stayed off and could only be activated with the brightness-down key.
This revised patch works correctly for me. Thanks!

m.

2011-05-06 08:52:11

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

* Melchior FRANZ -- Thursday 05 May 2011:
> This revised patch works correctly for me.

... and changing backlight brightness worked with acpi_osi=Linux, too.
Unfortunately, that does no longer work now, although I haven't changed
anything. Pressing the brightness buttons causes some ACPI debug output,
but it doesn't adjust anything.

m.

2011-05-06 12:42:06

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

Hi Melchior,

於 五,2011-05-06 於 10:52 +0200,Melchior FRANZ 提到:
> * Melchior FRANZ -- Thursday 05 May 2011:
> > This revised patch works correctly for me.
>
> ... and changing backlight brightness worked with acpi_osi=Linux, too.
> Unfortunately, that does no longer work now, although I haven't changed
> anything. Pressing the brightness buttons causes some ACPI debug output,
> but it doesn't adjust anything.
>
> m.

hmm........ Takashi's patch works before, but doesn't work now?

Does that because my new patch for bko#34142 ? Could you please add
acer-wmi to /etc/modprobe.d/blacklist then reboot machine ?

Step:
- add acer-wmi to /etc/modprobe.d/blacklist
- shutdown your machine
- remove AC power and notebook's battery
- plugin AC power then boot your notebook
- check the brightness control


Thank's
Joey Lee

2011-05-06 16:23:12

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

* Joey Lee -- Friday 06 May 2011:
> 於 五,2011-05-06 於 10:52 +0200,Melchior FRANZ 提到:
> > ... and changing backlight brightness worked with acpi_osi=Linux, too.
> > Unfortunately, that does no longer work now, although I haven't changed
> > anything. Pressing the brightness buttons causes some ACPI debug output,
> > but it doesn't adjust anything.

> hmm........ Takashi's patch works before, but doesn't work now?

Argh ... sorry Takashi. Joey is right. I thought I had tested that,
but apparently not. Indeed, your last patch prevents the backlight
from being turned off, but it also breaks the brightness adjustment
keys at runtime with acpi_osi=Linux. And without that it doesn't
work, anyway, just like before. I'll add some more debug messages ...



> Does that because my new patch for bko#34142 ? Could you please add
> acer-wmi to /etc/modprobe.d/blacklist then reboot machine ?

Done. No, your patch is not involved. But backing out Takashi's
patch and re-applying confirmed that it's that patch.

m.

2011-05-07 20:22:49

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

* Melchior FRANZ -- Friday 06 May 2011:
> last patch prevents the backlight from being turned off, but it also
> breaks the brightness adjustment keys at runtime with acpi_osi=Linux.

It has turned out that acpi key events seem to be handled correctly
and even the state of /sys/class/backlight/acer-wmi/brightness is
updated accordingly. The only problem is that this maintained
brightness state isn't applied to the actual backlight. It remains
at highest level. Google pointed me to this workaround for another
Acer notebook:

https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10

This uses the acpid to write the brightness value to the display
using setpci. And this works on my notebook as well (Acer Travelmate
5735Z-452G32Mnss). Not pretty but better than nothing. Is Acer
not able to build proper notebooks? Or is it a kernel bug?

m.

2011-05-08 13:41:45

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

於 六,2011-05-07 於 22:22 +0200,Melchior FRANZ 提到:
> * Melchior FRANZ -- Friday 06 May 2011:
> > last patch prevents the backlight from being turned off, but it also
> > breaks the brightness adjustment keys at runtime with acpi_osi=Linux.
>
> It has turned out that acpi key events seem to be handled correctly
> and even the state of /sys/class/backlight/acer-wmi/brightness is

That's interesting for acer-wmi generated brightness interface when this
machine declare acpi brightness interface in DSDT.

> updated accordingly. The only problem is that this maintained

Does it work to you direct control brightness by access
by /sys/class/backlight/acer-wmi/brightness ?

> brightness state isn't applied to the actual backlight. It remains
> at highest level. Google pointed me to this workaround for another
> Acer notebook:
>
> https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10
>
> This uses the acpid to write the brightness value to the display
> using setpci. And this works on my notebook as well (Acer Travelmate

As I remember, use setpci to control brightness is not recommended
because BIOS or ACPI will also touch brightness level. That will be
better control brightness by the function that was provided by BIOS.
e.g. ACPI or WMI interface, or direct control by EC.

That means that will be better fix your Fn key control brightness like
before, you just need press Fn key to change brightness and don't need
have any workaround.

> 5735Z-452G32Mnss). Not pretty but better than nothing. Is Acer
> not able to build proper notebooks? Or is it a kernel bug?
>
> m.

Looks like current status is we try to fix bko#31522 but the patch
causes your brightness no work by press Fn key even with acpi_osi=Linux.
Does it right?

Could you please also help to check:
replace acpi_osi=Linux by acpi_osi="!Windows 2006"

Does it also works to you for backlight control?


Thank's
Joey Lee

2011-05-08 14:05:51

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

* Joey Lee -- Sunday 08 May 2011:
> 於 六,2011-05-07 於 22:22 +0200,Melchior FRANZ 提到:
> > It has turned out that acpi key events seem to be handled correctly
> > and even the state of /sys/class/backlight/acer-wmi/brightness is
>
> That's interesting for acer-wmi generated brightness interface when this
> machine declare acpi brightness interface in DSDT.

I'm sorry to give contradicting info. Yesterday I saw a subdir acer-wmi
(or acer_wmi) in /sys/class/backlight/ during one of my tests (with/without
acer_wmi, with/without acpi_osi=Linux). Now I left acpi_osi=Linux
away and allow acer_wmi, and it's subdir acpi_video0. Next time I'll
make notes.



> Does it work to you direct control brightness by access
> by /sys/class/backlight/acer-wmi/brightness ?

No. A number written to this virtual file is accepted and remembered,
but it doesn't actually change the brightness. It takes setpci to do
that.



> As I remember, use setpci to control brightness is not recommended
> because BIOS or ACPI will also touch brightness level. That will be
> better control brightness by the function that was provided by BIOS.
> e.g. ACPI or WMI interface, or direct control by EC.

Well, sounds plausible. And I wouldn't do it if it weren't the only
way at the moment. :-)



> That means that will be better fix your Fn key control brightness like
> before, you just need press Fn key to change brightness and don't need
> have any workaround.

OK. I have added a lot of debug messages to intel_panel.c yesterday.
All it told me was that it seems to work correctly wiht acpi_osi=Linux.
Except that it doesn't actually change the brightness. Without acpi_osi
the functions aren't called at all and none of my messages showed up.



> Looks like current status is we try to fix bko#31522 but the patch
> causes your brightness no work by press Fn key even with acpi_osi=Linux.
> Does it right?

The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
worked (IIRC) including key adjustment. Later patches broke keys.



> replace acpi_osi=Linux by acpi_osi="!Windows 2006"
>
> Does it also works to you for backlight control?

No, doesn't work.

m.

2011-05-09 08:50:57

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

Add Cc. Michael Chang for he is our i915 expert.

Hi Melchior,

於 日,2011-05-08 於 16:05 +0200,Melchior FRANZ 提到:
>
> > Does it work to you direct control brightness by access
> > by /sys/class/backlight/acer-wmi/brightness ?
>
> No. A number written to this virtual file is accepted and remembered,
> but it doesn't actually change the brightness. It takes setpci to do
> that.
>

I thought the video driver still is the KEY component for backlight
issues, need fix the problem in video driver first.

>
>
> > As I remember, use setpci to control brightness is not recommended
> > because BIOS or ACPI will also touch brightness level. That will be
> > better control brightness by the function that was provided by BIOS.
> > e.g. ACPI or WMI interface, or direct control by EC.
>
> Well, sounds plausible. And I wouldn't do it if it weren't the only
> way at the moment. :-)
>
>
>
> > That means that will be better fix your Fn key control brightness like
> > before, you just need press Fn key to change brightness and don't need
> > have any workaround.
>
> OK. I have added a lot of debug messages to intel_panel.c yesterday.
> All it told me was that it seems to work correctly wiht acpi_osi=Linux.
> Except that it doesn't actually change the brightness. Without acpi_osi
> the functions aren't called at all and none of my messages showed up.
>

I traced _Q event in your DSDT, when acpi_osi=Linux, it run the Intel
OpRegion logic for change brightness. And, finally, intel_opregion will
access the function the were provided by intel_panel. So, the problem
still back to intel_panel.

After discuss with Michael chang, we thought there have problem in your
brightness level after add combination mode:

vi driver/gpu/drm/i915/intel_panel.c

void intel_panel_set_backlight(struct drm_device *dev, u32 level)
{
struct drm_i915_private *dev_priv = dev->dev_private;
u32 tmp;

DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);

if (HAS_PCH_SPLIT(dev))
return intel_pch_panel_set_backlight(dev, level);

if (is_backlight_combination_mode(dev)){
u32 max = intel_panel_get_max_backlight(dev);
u8 lbpc;

lbpc = level * 0xfe / max + 1;
level /= lbpc; /* maybe the level changed by lbpc */
pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
}

tmp = I915_READ(BLC_PWM_CTL);
if (IS_PINEVIEW(dev)) {
tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
level <<= 1;
} else
tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
I915_WRITE(BLC_PWM_CTL, tmp | level);
}

We need to know some run time value when intel_panel_set_backlight call by funciton key.
Please help to apply the attached debug patch to intel_panel.c then attached dmesg.

>
>
> > Looks like current status is we try to fix bko#31522 but the patch
> > causes your brightness no work by press Fn key even with acpi_osi=Linux.
> > Does it right?
>
> The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
> With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
> worked (IIRC) including key adjustment. Later patches broke keys.
>
>
>
> > replace acpi_osi=Linux by acpi_osi="!Windows 2006"
> >
> > Does it also works to you for backlight control?
>
> No, doesn't work.
>

We can test the acpi_osi="!Windows 2006" again after we fix the i915's
problem.


Thank's
Joey Lee

The following is debug patch, and please add kernel parameter
drm.debug=0x02 :

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index f8f86e5..f62dbd9 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -236,17 +236,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
u32 max = intel_panel_get_max_backlight(dev);
u8 lbpc;

+ DRM_DEBUG_DRIVER("set backlight max = % lbpc = level * 0xfe / max + 1;
+ DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
level /= lbpc;
pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
}

tmp = I915_READ(BLC_PWM_CTL);
+ DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
if (IS_PINEVIEW(dev)) {
tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
level <<= 1;
} else
tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+ DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
+ DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
I915_WRITE(BLC_PWM_CTL, tmp | level);
}


2011-05-09 08:58:21

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

At Sat, 7 May 2011 22:22:40 +0200,
Melchior FRANZ wrote:
>
> * Melchior FRANZ -- Friday 06 May 2011:
> > last patch prevents the backlight from being turned off, but it also
> > breaks the brightness adjustment keys at runtime with acpi_osi=Linux.
>
> It has turned out that acpi key events seem to be handled correctly
> and even the state of /sys/class/backlight/acer-wmi/brightness is
> updated accordingly. The only problem is that this maintained
> brightness state isn't applied to the actual backlight. It remains
> at highest level. Google pointed me to this workaround for another
> Acer notebook:
>
> https://help.ubuntu.com/community/AspireTimeline/Fixes#Alternative%20fix%20for%2010.10
>
> This uses the acpid to write the brightness value to the display
> using setpci. And this works on my notebook as well (Acer Travelmate
> 5735Z-452G32Mnss).

Then we miss something. With the hack above, you are doing nothing
but writing LBPC register value externally from setpci. It implies
that the write to LBPC basically works on your machine.


Takashi

2011-05-09 09:00:12

by Takashi Iwai

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

At Mon, 09 May 2011 02:50:50 -0600,
Joey Lee wrote:
>
> Add Cc. Michael Chang for he is our i915 expert.
>
> Hi Melchior,
>
> 於 日,2011-05-08 於 16:05 +0200,Melchior FRANZ 提到:
> >
> > > Does it work to you direct control brightness by access
> > > by /sys/class/backlight/acer-wmi/brightness ?
> >
> > No. A number written to this virtual file is accepted and remembered,
> > but it doesn't actually change the brightness. It takes setpci to do
> > that.
> >
>
> I thought the video driver still is the KEY component for backlight
> issues, need fix the problem in video driver first.
>
> >
> >
> > > As I remember, use setpci to control brightness is not recommended
> > > because BIOS or ACPI will also touch brightness level. That will be
> > > better control brightness by the function that was provided by BIOS.
> > > e.g. ACPI or WMI interface, or direct control by EC.
> >
> > Well, sounds plausible. And I wouldn't do it if it weren't the only
> > way at the moment. :-)
> >
> >
> >
> > > That means that will be better fix your Fn key control brightness like
> > > before, you just need press Fn key to change brightness and don't need
> > > have any workaround.
> >
> > OK. I have added a lot of debug messages to intel_panel.c yesterday.
> > All it told me was that it seems to work correctly wiht acpi_osi=Linux.
> > Except that it doesn't actually change the brightness. Without acpi_osi
> > the functions aren't called at all and none of my messages showed up.
> >
>
> I traced _Q event in your DSDT, when acpi_osi=Linux, it run the Intel
> OpRegion logic for change brightness. And, finally, intel_opregion will
> access the function the were provided by intel_panel. So, the problem
> still back to intel_panel.
>
> After discuss with Michael chang, we thought there have problem in your
> brightness level after add combination mode:
>
> vi driver/gpu/drm/i915/intel_panel.c
>
> void intel_panel_set_backlight(struct drm_device *dev, u32 level)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> u32 tmp;
>
> DRM_DEBUG_DRIVER("set backlight PWM = %d\n", level);
>
> if (HAS_PCH_SPLIT(dev))
> return intel_pch_panel_set_backlight(dev, level);
>
> if (is_backlight_combination_mode(dev)){
> u32 max = intel_panel_get_max_backlight(dev);
> u8 lbpc;
>
> lbpc = level * 0xfe / max + 1;
> level /= lbpc; /* maybe the level changed by lbpc */
> pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
> }
>
> tmp = I915_READ(BLC_PWM_CTL);
> if (IS_PINEVIEW(dev)) {
> tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
> level <<= 1;
> } else
> tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
> I915_WRITE(BLC_PWM_CTL, tmp | level);
> }
>
> We need to know some run time value when intel_panel_set_backlight call by funciton key.

Yes, that'll help understanding.

> Please help to apply the attached debug patch to intel_panel.c then attached dmesg.

The patch has an obvious typo :)
Also, we should track the value in intel_panel_get_backlight(), too.


Takashi


> > > Looks like current status is we try to fix bko#31522 but the patch
> > > causes your brightness no work by press Fn key even with acpi_osi=Linux.
> > > Does it right?
> >
> > The history is: with acpi_osi=Linux everything worked with 2.6.38-rc8.
> > With 2.6.38 the screen stayed black. The patch that only ignored lbpc=0
> > worked (IIRC) including key adjustment. Later patches broke keys.
> >
> >
> >
> > > replace acpi_osi=Linux by acpi_osi="!Windows 2006"
> > >
> > > Does it also works to you for backlight control?
> >
> > No, doesn't work.
> >
>
> We can test the acpi_osi="!Windows 2006" again after we fix the i915's
> problem.
>
>
> Thank's
> Joey Lee
>
> The following is debug patch, and please add kernel parameter
> drm.debug=0x02 :
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index f8f86e5..f62dbd9 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -236,17 +236,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
> u32 max = intel_panel_get_max_backlight(dev);
> u8 lbpc;
>
> + DRM_DEBUG_DRIVER("set backlight max = % lbpc = level * 0xfe / max + 1;
> + DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
> level /= lbpc;
> pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
> }
>
> tmp = I915_READ(BLC_PWM_CTL);
> + DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
> if (IS_PINEVIEW(dev)) {
> tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
> level <<= 1;
> } else
> tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
> + DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
> + DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
> I915_WRITE(BLC_PWM_CTL, tmp | level);
> }
>
>
>

2011-05-09 09:35:29

by Joey Lee

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

於 一,2011-05-09 於 11:00 +0200,Takashi Iwai 提到:
> At Mon, 09 May 2011 02:50:50 -0600,
> Joey Lee wrote:
> >
> > We need to know some run time value when intel_panel_set_backlight call by funciton key.
>
> Yes, that'll help understanding.
>
> > Please help to apply the attached debug patch to intel_panel.c then attached dmesg.
>
> The patch has an obvious typo :)
> Also, we should track the value in intel_panel_get_backlight(), too.
>
>
> Takashi
>

Thank's for Takashi's review and sorry for my typo.
Follow Takashi's suggestion, I added a debug message in get_backlight,
the following is new debug patch:

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index f8f86e5..9695840 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -199,6 +199,7 @@ u32 intel_panel_get_backlight(struct drm_device *dev)
val = I915_READ(BLC_PWM_CPU_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
} else {
val = I915_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK;
+ DRM_DEBUG_DRIVER("get backlight val = %d\n", val);
if (IS_PINEVIEW(dev))
val >>= 1;

@@ -236,17 +237,22 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level)
u32 max = intel_panel_get_max_backlight(dev);
u8 lbpc;

+ DRM_DEBUG_DRIVER("set backlight max = %d\n", max);
lbpc = level * 0xfe / max + 1;
+ DRM_DEBUG_DRIVER("set backlight lbpc = %d\n", lbpc);
level /= lbpc;
pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc);
}

tmp = I915_READ(BLC_PWM_CTL);
+ DRM_DEBUG_DRIVER("set backlight tmp(1) = %d\n", tmp);
if (IS_PINEVIEW(dev)) {
tmp &= ~(BACKLIGHT_DUTY_CYCLE_MASK - 1);
level <<= 1;
} else
tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+ DRM_DEBUG_DRIVER("set backlight tmp(2) = %d\n", tmp);
+ DRM_DEBUG_DRIVER("set backlight level = %d\n", level);
I915_WRITE(BLC_PWM_CTL, tmp | level);
}


2011-05-09 10:08:17

by Melchior FRANZ

[permalink] [raw]
Subject: Re: i915/kms/backlight-combo mode problem

* Joey Lee -- Monday 09 May 2011:
> The following is debug patch, and please add kernel parameter
> drm.debug=0x02 :

The result is with acpi_osi=Linux:


boot phase:
[ 3.310274] [drm:intel_panel_get_backlight], get backlight val = 2890
[ 3.310280] [drm:intel_panel_get_backlight], get backlight PWM = 2890
[ 3.310615] [drm:intel_panel_get_backlight], get backlight val = 2890
[ 3.310617] [drm:intel_panel_get_backlight], get backlight PWM = 2890
[ 3.310619] [drm:intel_panel_set_backlight], set backlight PWM = 0
[ 3.310622] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[ 3.310624] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 3.310626] [drm:intel_panel_set_backlight], set backlight level = 0

[ 3.641522] [drm:intel_panel_set_backlight], set backlight PWM = 2890
[ 3.641525] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399040
[ 3.641527] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 3.641529] [drm:intel_panel_set_backlight], set backlight level = 2890

[ 11.410563] video LNXVIDEO:01: Restoring backlight state



brightness up:
[no output]



brightness down:
[ 152.697127] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 152.697136] [drm:intel_panel_set_backlight], set backlight PWM = 283
[ 152.697141] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401930
[ 152.697146] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 152.697150] [drm:intel_panel_set_backlight], set backlight level = 283

[ 166.720631] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 166.720640] [drm:intel_panel_set_backlight], set backlight PWM = 578
[ 166.720645] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[ 166.720649] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 166.720654] [drm:intel_panel_set_backlight], set backlight level = 578

[ 178.091776] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 178.091784] [drm:intel_panel_set_backlight], set backlight PWM = 861
[ 178.091789] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399618
[ 178.091793] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 178.091797] [drm:intel_panel_set_backlight], set backlight level = 861

[ 188.888370] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 188.888379] [drm:intel_panel_set_backlight], set backlight PWM = 1156
[ 188.888383] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399901
[ 188.888388] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 188.888392] [drm:intel_panel_set_backlight], set backlight level = 1156

[ 196.411657] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 196.411665] [drm:intel_panel_set_backlight], set backlight PWM = 1439
[ 196.411670] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400196
[ 196.411674] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 196.411678] [drm:intel_panel_set_backlight], set backlight level = 1439

[ 201.256229] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 201.256238] [drm:intel_panel_set_backlight], set backlight PWM = 1734
[ 201.256243] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400479
[ 201.256247] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 201.256252] [drm:intel_panel_set_backlight], set backlight level = 1734

[ 206.939838] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 206.939846] [drm:intel_panel_set_backlight], set backlight PWM = 2017
[ 206.939851] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400774
[ 206.939856] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 206.939860] [drm:intel_panel_set_backlight], set backlight level = 2017

[ 213.779732] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 213.779740] [drm:intel_panel_set_backlight], set backlight PWM = 2312
[ 213.779744] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401057
[ 213.779749] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 213.779753] [drm:intel_panel_set_backlight], set backlight level = 2312

[ 222.583806] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 222.583814] [drm:intel_panel_set_backlight], set backlight PWM = 2595
[ 222.583819] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401352
[ 222.583824] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 222.583828] [drm:intel_panel_set_backlight], set backlight level = 2595

[ 229.345860] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 229.345870] [drm:intel_panel_set_backlight], set backlight PWM = 2595
[ 229.345874] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401635
[ 229.345879] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 229.345883] [drm:intel_panel_set_backlight], set backlight level = 2595



brightness up:
[ 240.594464] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 240.594474] [drm:intel_panel_set_backlight], set backlight PWM = 2312
[ 240.594479] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401635
[ 240.594483] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 240.594487] [drm:intel_panel_set_backlight], set backlight level = 2312

[ 240.816722] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 240.816730] [drm:intel_panel_set_backlight], set backlight PWM = 2017
[ 240.816734] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401352
[ 240.816739] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 240.816743] [drm:intel_panel_set_backlight], set backlight level = 2017

[ 240.999973] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 240.999981] [drm:intel_panel_set_backlight], set backlight PWM = 1734
[ 240.999985] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189401057
[ 240.999990] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 240.999994] [drm:intel_panel_set_backlight], set backlight level = 1734

[ 241.212456] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 241.212464] [drm:intel_panel_set_backlight], set backlight PWM = 1439
[ 241.212469] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400774
[ 241.212473] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 241.212478] [drm:intel_panel_set_backlight], set backlight level = 1439

[ 241.395611] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 241.395619] [drm:intel_panel_set_backlight], set backlight PWM = 1156
[ 241.395624] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400479
[ 241.395628] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 241.395633] [drm:intel_panel_set_backlight], set backlight level = 1156

[ 242.039460] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 242.039470] [drm:intel_panel_set_backlight], set backlight PWM = 283
[ 242.039475] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189400196
[ 242.039479] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 242.039484] [drm:intel_panel_set_backlight], set backlight level = 283

[ 242.044495] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 242.044502] [drm:intel_panel_set_backlight], set backlight PWM = 283
[ 242.044507] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[ 242.044511] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 242.044515] [drm:intel_panel_set_backlight], set backlight level = 283

[ 242.077032] [drm:intel_panel_get_max_backlight], max backlight PWM = 2890
[ 242.077038] [drm:intel_panel_set_backlight], set backlight PWM = 0
[ 242.077043] [drm:intel_panel_set_backlight], set backlight tmp(1) = 189399323
[ 242.077047] [drm:intel_panel_set_backlight], set backlight tmp(2) = 189399040
[ 242.077052] [drm:intel_panel_set_backlight], set backlight level = 0

m.