Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236136
b: refs/heads/master
c: 50d1ae2
h: refs/heads/master
v: v3
  • Loading branch information
Nils Faerber authored and Greg Kroah-Hartman committed Feb 27, 2011
1 parent 4abf80d commit 9c31f43
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 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: 8aa2bb43646aa24bcee5298bf83051a8ce9967a6
refs/heads/master: 50d1ae2f8084807be80313796548a46f756dff91
32 changes: 25 additions & 7 deletions trunk/drivers/staging/samsung-laptop/samsung-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ struct sabi_config {
const struct sabi_header_offsets header_offsets;
const struct sabi_commands commands;
const struct sabi_performance_level performance_levels[4];
u8 min_brightness;
u8 max_brightness;
};

static const struct sabi_config sabi_configs[] = {
Expand Down Expand Up @@ -158,6 +160,8 @@ static const struct sabi_config sabi_configs[] = {
},
{ },
},
.min_brightness = 1,
.max_brightness = 8,
},
{
.test_string = "SwSmi@",
Expand Down Expand Up @@ -207,6 +211,8 @@ static const struct sabi_config sabi_configs[] = {
},
{ },
},
.min_brightness = 0,
.max_brightness = 8,
},
{ },
};
Expand Down Expand Up @@ -362,17 +368,19 @@ static u8 read_brightness(void)

retval = sabi_get_command(sabi_config->commands.get_brightness,
&sretval);
if (!retval)
if (!retval) {
user_brightness = sretval.retval[0];
if (user_brightness != 0)
--user_brightness;
user_brightness -= sabi_config->min_brightness;
}
return user_brightness;
}

static void set_brightness(u8 user_brightness)
{
sabi_set_command(sabi_config->commands.set_brightness,
user_brightness + 1);
u8 user_level = user_brightness - sabi_config->min_brightness;

sabi_set_command(sabi_config->commands.set_brightness, user_level);
}

static int get_brightness(struct backlight_device *bd)
Expand Down Expand Up @@ -592,6 +600,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
},
.callback = dmi_check_cb,
},
{
.ident = "N150P/N210P/N220P",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR,
"SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"),
DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"),
},
.callback = dmi_check_cb,
},
{
.ident = "R530/R730",
.matches = {
Expand Down Expand Up @@ -675,7 +693,7 @@ static int __init samsung_init(void)
if (!force && !dmi_check_system(samsung_dmi_table))
return -ENODEV;

f0000_segment = ioremap(0xf0000, 0xffff);
f0000_segment = ioremap_nocache(0xf0000, 0xffff);
if (!f0000_segment) {
pr_err("Can't map the segment at 0xf0000\n");
return -EINVAL;
Expand Down Expand Up @@ -719,7 +737,7 @@ static int __init samsung_init(void)
/* Get a pointer to the SABI Interface */
ifaceP = (readw(sabi + sabi_config->header_offsets.data_segment) & 0x0ffff) << 4;
ifaceP += readw(sabi + sabi_config->header_offsets.data_offset) & 0x0ffff;
sabi_iface = ioremap(ifaceP, 16);
sabi_iface = ioremap_nocache(ifaceP, 16);
if (!sabi_iface) {
pr_err("Can't remap %x\n", ifaceP);
goto exit;
Expand Down Expand Up @@ -753,7 +771,7 @@ static int __init samsung_init(void)

/* create a backlight device to talk to this one */
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = MAX_BRIGHT;
props.max_brightness = sabi_config->max_brightness;
backlight_device = backlight_device_register("samsung", &sdev->dev,
NULL, &backlight_ops,
&props);
Expand Down

0 comments on commit 9c31f43

Please sign in to comment.