mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Jani Nikula" <jani.nikula@intel.com>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"Carsten Emde" <C.Emde@osadl.org>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>
Subject: [57/75] drm/i915: panel: invert brightness via quirk
Date: Mon, 22 Apr 2013 15:25:59 +0100	[thread overview]
Message-ID: <lsq.1366640759.773266578@decadent.org.uk> (raw)
In-Reply-To: <lsq.1366640759.151900666@decadent.org.uk>

3.2.44-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Carsten Emde <C.Emde@osadl.org>

commit 4dca20efb1a9c2efefc28ad2867e5d6c3f5e1955 upstream.

A machine may need to invert the panel backlight brightness value. This
patch adds the infrastructure for a quirk to do so.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 Documentation/kernel-parameters.txt  |   17 +++++++++++------
 drivers/gpu/drm/i915/i915_drv.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |    9 +++++++++
 drivers/gpu/drm/i915/intel_panel.c   |   15 +++++++++++----
 4 files changed, 32 insertions(+), 10 deletions(-)

--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -948,14 +948,19 @@ bytes respectively. Such letter suffixes
 	i8k.restricted	[HW] Allow controlling fans only if SYS_ADMIN
 			capability is set.
 
-	i915.invert_brightness
+	i915.invert_brightness=
 			[DRM] Invert the sense of the variable that is used to
 			set the brightness of the panel backlight. Normally a
-			value of 0 indicates backlight switched off, and the
-			maximum value sets the backlight to maximum brightness.
-			If this parameter is specified, a value of 0 sets the
-			backlight to maximum brightness, and the maximum value
-			switches the backlight off.
+			brightness value of 0 indicates backlight switched off,
+			and the maximum of the brightness value sets the backlight
+			to maximum brightness. If this parameter is set to 0
+			(default) and the machine requires it, or this parameter
+			is set to 1, a brightness value of 0 sets the backlight
+			to maximum brightness, and the maximum of the brightness
+			value switches the backlight off.
+			-1 -- never invert brightness
+			 0 -- machine default
+			 1 -- force brightness inversion
 
 	icn=		[HW,ISDN]
 			Format: <io>[,<membase>[,<icn_id>[,<icn_id2>]]]
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -274,6 +274,7 @@ enum intel_pch {
 
 #define QUIRK_PIPEA_FORCE (1<<0)
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)
+#define QUIRK_INVERT_BRIGHTNESS (1<<2)
 
 struct intel_fbdev;
 struct intel_fbc_work;
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -8831,6 +8831,15 @@ static void quirk_ssc_force_disable(stru
 	dev_priv->quirks |= QUIRK_LVDS_SSC_DISABLE;
 }
 
+/*
+ * A machine may need to invert the panel backlight brightness value
+ */
+static void quirk_invert_brightness(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	dev_priv->quirks |= QUIRK_INVERT_BRIGHTNESS;
+}
+
 struct intel_quirk {
 	int device;
 	int subsystem_vendor;
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -192,15 +192,22 @@ u32 intel_panel_get_max_backlight(struct
 	return max;
 }
 
-static bool i915_panel_invert_brightness;
-MODULE_PARM_DESC(invert_brightness, "Invert backlight brightness, please "
+static int i915_panel_invert_brightness;
+MODULE_PARM_DESC(invert_brightness, "Invert backlight brightness "
+	"(-1 force normal, 0 machine defaults, 1 force inversion), please "
 	"report PCI device ID, subsystem vendor and subsystem device ID "
 	"to dri-devel@lists.freedesktop.org, if your machine needs it. "
 	"It will then be included in an upcoming module version.");
-module_param_named(invert_brightness, i915_panel_invert_brightness, bool, 0600);
+module_param_named(invert_brightness, i915_panel_invert_brightness, int, 0600);
 static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val)
 {
-	if (i915_panel_invert_brightness)
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	if (i915_panel_invert_brightness < 0)
+		return val;
+
+	if (i915_panel_invert_brightness > 0 ||
+	    dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS)
 		return intel_panel_get_max_backlight(dev) - val;
 
 	return val;


  parent reply	other threads:[~2013-04-22 14:44 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 14:25 [00/75] 3.2.44-rc1 review Ben Hutchings
2013-04-22 14:25 ` [29/75] PM / reboot: call syscore_shutdown() after disable_nonboot_cpus() Ben Hutchings
2013-04-22 14:25 ` [31/75] ASoC: wm8903: Fix the bypass to HP/LINEOUT when no DAC or ADC is running Ben Hutchings
2013-04-22 14:25 ` [66/75] block: avoid using uninitialized value in from queue_var_store Ben Hutchings
2013-04-22 14:25 ` [71/75] KVM: x86: fix for buffer overflow in handling of MSR_KVM_SYSTEM_TIME (CVE-2013-1796) Ben Hutchings
2013-04-22 14:25 ` [48/75] ARM: 7696/1: Fix kexec by setting outer_cache.inv_all for Feroceon Ben Hutchings
2013-04-22 14:25 ` [19/75] rt2x00: rt2x00pci_regbusy_read() - only print register access failure once Ben Hutchings
2013-04-22 14:25 ` [20/75] libata: Use integer return value for atapi_command_packet_set Ben Hutchings
2013-04-22 14:25 ` [22/75] ata_piix: Fix DVD not dectected at some Haswell platforms Ben Hutchings
2013-04-22 14:25 ` [10/75] USB: mos7840: fix broken TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [69/75] fbcon: fix locking harder Ben Hutchings
2013-04-22 14:25 ` [62/75] drm/i915: add quirk to invert brightness on Packard Bell NCL20 Ben Hutchings
2013-04-22 14:25 ` [26/75] powerpc: pSeries_lpar_hpte_remove fails from Adjunct partition being performed before the ANDCOND test Ben Hutchings
2013-04-22 14:25 ` [12/75] USB: oti6858: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [74/75] KVM: Allow cross page reads and writes from cached translations Ben Hutchings
2013-04-22 14:25 ` Ben Hutchings [this message]
2013-04-22 14:25 ` [27/75] sched_clock: Prevent 64bit inatomicity on 32bit systems Ben Hutchings
2013-04-22 14:25 ` [08/75] USB: io_ti: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [37/75] target: Fix incorrect fallthrough of ALUA Standby/Offline/Transition CDBs Ben Hutchings
2013-04-22 14:25 ` [21/75] libata: Set max sector to 65535 for Slimtype DVD A DS8A8SH drive Ben Hutchings
2013-04-22 14:25 ` [06/75] USB: ftdi_sio: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [50/75] hugetlbfs: add swap entry check in follow_hugetlb_page() Ben Hutchings
2013-04-22 14:25 ` [09/75] USB: mct_u232: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [61/75] drm/i915: add quirk to invert brightness on eMachines e725 Ben Hutchings
2013-04-22 14:25 ` [75/75] sched: Convert BUG_ON()s in try_to_wake_up_local() to WARN_ON_ONCE()s Ben Hutchings
2013-04-22 14:25 ` [63/75] msi-wmi: Fix memory leak Ben Hutchings
2013-04-22 14:25 ` [25/75] alpha: Add irongate_io to PCI bus resources Ben Hutchings
2013-04-22 14:25 ` [45/75] of: introduce helper to manage boolean Ben Hutchings
2013-04-22 14:25 ` [59/75] DRM/i915: Add QUIRK_INVERT_BRIGHTNESS for NCR machines Ben Hutchings
2013-04-22 14:25 ` [58/75] drm/i915: panel: invert brightness acer aspire 5734z Ben Hutchings
2013-04-22 14:25 ` [34/75] x86, mm, paravirt: Fix vmalloc_fault oops during lazy MMU updates Ben Hutchings
2013-04-22 14:25 ` [38/75] tracing: Fix possible NULL pointer dereferences Ben Hutchings
2013-04-22 14:25 ` [28/75] ftrace: Consistently restore trace function on sysctl enabling Ben Hutchings
2013-04-22 14:25 ` [40/75] kref: Implement kref_get_unless_zero v3 Ben Hutchings
2013-04-22 14:25 ` [18/75] crypto: gcm - fix assumption that assoc has one segment Ben Hutchings
2013-04-22 14:25 ` [46/75] can: sja1000: fix handling on dt properties on little endian systems Ben Hutchings
2013-04-22 14:25 ` [03/75] USB: ark3116: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [30/75] can: gw: use kmem_cache_free() instead of kfree() Ben Hutchings
2013-04-22 14:25 ` [13/75] USB: pl2303: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [49/75] ARM: 7698/1: perf: fix group validation when using enable_on_exec Ben Hutchings
2013-04-22 14:25 ` [01/75] USB: serial: add modem-status-change wait queue Ben Hutchings
2013-04-22 14:25 ` [32/75] spinlocks and preemption points need to be at least compiler barriers Ben Hutchings
2013-04-22 14:25 ` [53/75] thermal: return an error on failure to register thermal class Ben Hutchings
2013-04-22 14:25 ` [64/75] ALSA: hda - Enabling Realtek ALC 671 codec Ben Hutchings
2013-04-22 14:25 ` [51/75] kernel/signal.c: stop info leak via the tkill and the tgkill syscalls Ben Hutchings
2013-04-22 14:25 ` [41/75] kobject: fix kset_find_obj() race with concurrent last kobject_put() Ben Hutchings
2013-04-22 14:25 ` [43/75] ARM: Do 15e0d9e37c (ARM: pm: let platforms select cpu_suspend support) properly Ben Hutchings
2013-04-22 14:25 ` [36/75] target: Fix MAINTENANCE_IN service action CDB checks to use lower 5 bits Ben Hutchings
2013-04-22 14:25 ` [70/75] hfsplus: fix potential overflow in hfsplus_file_truncate() Ben Hutchings
2013-04-22 14:25 ` [35/75] x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal Ben Hutchings
2013-04-22 14:25 ` [16/75] USB: ti_usb_3410_5052: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [47/75] ath9k_hw: change AR9580 initvals to fix a stability issue Ben Hutchings
2013-04-22 14:25 ` [23/75] hwspinlock: fix __hwspin_lock_request error path Ben Hutchings
2013-04-22 14:25 ` [56/75] drm/i915: panel: invert brightness via parameter Ben Hutchings
2013-04-22 14:25 ` [33/75] tracing: Fix double free when function profile init failed Ben Hutchings
2013-04-22 14:25 ` [39/75] Btrfs: make sure nbytes are right after log replay Ben Hutchings
2013-04-22 14:25 ` [67/75] r8169: fix auto speed down issue Ben Hutchings
2013-04-22 14:25 ` [24/75] ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_* Ben Hutchings
2013-04-22 14:25 ` [73/75] KVM: Fix bounds checking in ioapic indirect register reads (CVE-2013-1798) Ben Hutchings
2013-04-22 14:25 ` [60/75] drm/i915: add quirk to invert brightness on eMachines G725 Ben Hutchings
2013-04-22 14:25 ` [14/75] USB: spcp8x5: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [05/75] USB: cypress_m8: " Ben Hutchings
2013-04-22 14:25 ` [02/75] USB: serial: fix hang when opening port Ben Hutchings
2013-04-22 14:25 ` [52/75] net: fix incorrect credentials passing Ben Hutchings
2013-04-22 14:25 ` [17/75] hrtimer: Don't reinitialize a cpu_base lock on CPU_UP Ben Hutchings
2013-04-22 14:25 ` [55/75] Btrfs: fix race between mmap writes and compression Ben Hutchings
2013-04-22 14:25 ` [15/75] USB: ssu100: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [65/75] ALSA: hda - fix typo in proc output Ben Hutchings
2013-04-22 14:25 ` [42/75] vfs: Revert spurious fix to spinning prevention in prune_icache_sb Ben Hutchings
2013-04-22 14:25 ` [44/75] ath9k_htc: accept 1.x firmware newer than 1.3 Ben Hutchings
2013-04-22 14:25 ` [11/75] USB: mos7840: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [07/75] USB: io_edgeport: " Ben Hutchings
2013-04-22 14:25 ` [54/75] writeback: fix dirtied pages accounting on redirty Ben Hutchings
2013-04-22 14:25 ` [04/75] USB: ch341: fix use-after-free in TIOCMIWAIT Ben Hutchings
2013-04-22 14:25 ` [72/75] KVM: x86: Convert MSR_KVM_SYSTEM_TIME to use gfn_to_hva_cache functions (CVE-2013-1797) Ben Hutchings
2013-04-22 14:25 ` [68/75] mtd: Disable mtdchar mmap on MMU systems Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lsq.1366640759.773266578@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=C.Emde@osadl.org \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=jani.nikula@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®