Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 142053
b: refs/heads/master
c: 1a468ba
h: refs/heads/master
i:
  142051: 61db920
v: v3
  • Loading branch information
Mario Schwalbe authored and Richard Purdie committed Apr 6, 2009
1 parent 1b0e7a5 commit 087e273
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c78a628849675580c7c5e1f07193c632e4b6827f
refs/heads/master: 1a468ba10c3bdbc25ef7aa7fecda20ee27007bdf
33 changes: 31 additions & 2 deletions trunk/drivers/video/backlight/mbp_nvidia_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,40 @@ struct dmi_match_data {
struct backlight_ops backlight_ops;
};

/* Module parameters. */
static int debug;
module_param_named(debug, debug, int, 0644);
MODULE_PARM_DESC(debug, "Set to one to enable debugging messages.");

/*
* Implementation for MacBooks with Intel chipset.
*/
static int intel_chipset_send_intensity(struct backlight_device *bd)
{
int intensity = bd->props.brightness;

if (debug)
printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n",
intensity);

outb(0x04 | (intensity << 4), 0xb3);
outb(0xbf, 0xb2);
return 0;
}

static int intel_chipset_get_intensity(struct backlight_device *bd)
{
int intensity;

outb(0x03, 0xb3);
outb(0xbf, 0xb2);
return inb(0xb3) >> 4;
intensity = inb(0xb3) >> 4;

if (debug)
printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n",
intensity);

return intensity;
}

static const struct dmi_match_data intel_chipset_data = {
Expand All @@ -72,16 +89,28 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd)
{
int intensity = bd->props.brightness;

if (debug)
printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n",
intensity);

outb(0x04 | (intensity << 4), 0x52f);
outb(0xbf, 0x52e);
return 0;
}

static int nvidia_chipset_get_intensity(struct backlight_device *bd)
{
int intensity;

outb(0x03, 0x52f);
outb(0xbf, 0x52e);
return inb(0x52f) >> 4;
intensity = inb(0x52f) >> 4;

if (debug)
printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n",
intensity);

return intensity;
}

static const struct dmi_match_data nvidia_chipset_data = {
Expand Down

0 comments on commit 087e273

Please sign in to comment.