mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
staging: olpc_dcon: checkpatch.pl fixes for olpc_dcon.c file.
Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
a90dcd4f7d
commit
e107e6ebdd
1 changed files with 46 additions and 38 deletions
|
@ -24,7 +24,7 @@
|
||||||
#include <linux/backlight.h>
|
#include <linux/backlight.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
#include <asm/tsc.h>
|
#include <asm/tsc.h>
|
||||||
|
@ -87,14 +87,14 @@ static unsigned short dcon_disp_mode;
|
||||||
/* Variables used during switches */
|
/* Variables used during switches */
|
||||||
static int dcon_switched;
|
static int dcon_switched;
|
||||||
static struct timespec dcon_irq_time;
|
static struct timespec dcon_irq_time;
|
||||||
static struct timespec dcon_load_time;
|
static struct timespec dcon_load_time;
|
||||||
|
|
||||||
static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue);
|
static DECLARE_WAIT_QUEUE_HEAD(dcon_wait_queue);
|
||||||
|
|
||||||
static unsigned short normal_i2c[] = { 0x0d, I2C_CLIENT_END };
|
static unsigned short normal_i2c[] = { 0x0d, I2C_CLIENT_END };
|
||||||
|
|
||||||
#define dcon_write(reg,val) i2c_smbus_write_word_data(dcon_client,reg,val)
|
#define dcon_write(reg, val) i2c_smbus_write_word_data(dcon_client, reg, val)
|
||||||
#define dcon_read(reg) i2c_smbus_read_word_data(dcon_client,reg)
|
#define dcon_read(reg) i2c_smbus_read_word_data(dcon_client, reg)
|
||||||
|
|
||||||
/* The current backlight value - this saves us some smbus traffic */
|
/* The current backlight value - this saves us some smbus traffic */
|
||||||
static int bl_val = -1;
|
static int bl_val = -1;
|
||||||
|
@ -117,7 +117,8 @@ static int dcon_hw_init(struct i2c_client *client, int is_init)
|
||||||
if (is_init) {
|
if (is_init) {
|
||||||
printk(KERN_INFO "olpc-dcon: Discovered DCON version %x\n",
|
printk(KERN_INFO "olpc-dcon: Discovered DCON version %x\n",
|
||||||
ver & 0xFF);
|
ver & 0xFF);
|
||||||
if ((rc = pdata->init()) != 0) {
|
rc = pdata->init();
|
||||||
|
if (rc != 0) {
|
||||||
printk(KERN_ERR "olpc-dcon: Unable to init.\n");
|
printk(KERN_ERR "olpc-dcon: Unable to init.\n");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -133,14 +134,13 @@ static int dcon_hw_init(struct i2c_client *client, int is_init)
|
||||||
i2c_smbus_write_word_data(client, 0x0b, 0x007a);
|
i2c_smbus_write_word_data(client, 0x0b, 0x007a);
|
||||||
i2c_smbus_write_word_data(client, 0x36, 0x025c);
|
i2c_smbus_write_word_data(client, 0x36, 0x025c);
|
||||||
i2c_smbus_write_word_data(client, 0x37, 0x025e);
|
i2c_smbus_write_word_data(client, 0x37, 0x025e);
|
||||||
|
|
||||||
/* Initialise SDRAM */
|
/* Initialise SDRAM */
|
||||||
|
|
||||||
i2c_smbus_write_word_data(client, 0x3b, 0x002b);
|
i2c_smbus_write_word_data(client, 0x3b, 0x002b);
|
||||||
i2c_smbus_write_word_data(client, 0x41, 0x0101);
|
i2c_smbus_write_word_data(client, 0x41, 0x0101);
|
||||||
i2c_smbus_write_word_data(client, 0x42, 0x0101);
|
i2c_smbus_write_word_data(client, 0x42, 0x0101);
|
||||||
}
|
} else if (!noinit) {
|
||||||
else if (!noinit) {
|
|
||||||
/* SDRAM setup/hold time */
|
/* SDRAM setup/hold time */
|
||||||
i2c_smbus_write_word_data(client, 0x3a, 0xc040);
|
i2c_smbus_write_word_data(client, 0x3a, 0xc040);
|
||||||
i2c_smbus_write_word_data(client, 0x41, 0x0000);
|
i2c_smbus_write_word_data(client, 0x41, 0x0000);
|
||||||
|
@ -181,14 +181,15 @@ static int dcon_bus_stabilize(struct i2c_client *client, int is_powered_down)
|
||||||
power_up:
|
power_up:
|
||||||
if (is_powered_down) {
|
if (is_powered_down) {
|
||||||
x = 1;
|
x = 1;
|
||||||
if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0))) {
|
x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0);
|
||||||
|
if (x) {
|
||||||
printk(KERN_WARNING "olpc-dcon: unable to force dcon "
|
printk(KERN_WARNING "olpc-dcon: unable to force dcon "
|
||||||
"to power up: %d!\n", x);
|
"to power up: %d!\n", x);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
msleep(10); /* we'll be conservative */
|
msleep(10); /* we'll be conservative */
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata->bus_stabilize_wiggle();
|
pdata->bus_stabilize_wiggle();
|
||||||
|
|
||||||
for (x = -1, timeout = 50; timeout && x < 0; timeout--) {
|
for (x = -1, timeout = 50; timeout && x < 0; timeout--) {
|
||||||
|
@ -261,8 +262,7 @@ static int dcon_set_output(int arg)
|
||||||
if (arg == DCON_OUTPUT_MONO) {
|
if (arg == DCON_OUTPUT_MONO) {
|
||||||
dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA);
|
dcon_disp_mode &= ~(MODE_CSWIZZLE | MODE_COL_AA);
|
||||||
dcon_disp_mode |= MODE_MONO_LUMA;
|
dcon_disp_mode |= MODE_MONO_LUMA;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dcon_disp_mode &= ~(MODE_MONO_LUMA);
|
dcon_disp_mode &= ~(MODE_MONO_LUMA);
|
||||||
dcon_disp_mode |= MODE_CSWIZZLE;
|
dcon_disp_mode |= MODE_CSWIZZLE;
|
||||||
if (useaa)
|
if (useaa)
|
||||||
|
@ -291,18 +291,18 @@ static void dcon_sleep(int state)
|
||||||
|
|
||||||
if (state == DCON_SLEEP) {
|
if (state == DCON_SLEEP) {
|
||||||
x = 0;
|
x = 0;
|
||||||
if ((x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0)))
|
x = olpc_ec_cmd(0x26, (unsigned char *) &x, 1, NULL, 0);
|
||||||
|
if (x)
|
||||||
printk(KERN_WARNING "olpc-dcon: unable to force dcon "
|
printk(KERN_WARNING "olpc-dcon: unable to force dcon "
|
||||||
"to power down: %d!\n", x);
|
"to power down: %d!\n", x);
|
||||||
else
|
else
|
||||||
dcon_sleep_val = state;
|
dcon_sleep_val = state;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Only re-enable the backlight if the backlight value is set */
|
/* Only re-enable the backlight if the backlight value is set */
|
||||||
if (bl_val != 0)
|
if (bl_val != 0)
|
||||||
dcon_disp_mode |= MODE_BL_ENABLE;
|
dcon_disp_mode |= MODE_BL_ENABLE;
|
||||||
|
x = dcon_bus_stabilize(dcon_client, 1);
|
||||||
if ((x=dcon_bus_stabilize(dcon_client, 1)))
|
if (x)
|
||||||
printk(KERN_WARNING "olpc-dcon: unable to reinit dcon"
|
printk(KERN_WARNING "olpc-dcon: unable to reinit dcon"
|
||||||
" hardware: %d!\n", x);
|
" hardware: %d!\n", x);
|
||||||
else
|
else
|
||||||
|
@ -316,14 +316,14 @@ static void dcon_sleep(int state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the DCON seems to get confused if we change DCONLOAD too
|
/* the DCON seems to get confused if we change DCONLOAD too
|
||||||
* frequently -- i.e., approximately faster than frame time.
|
* frequently -- i.e., approximately faster than frame time.
|
||||||
* normally we don't change it this fast, so in general we won't
|
* normally we don't change it this fast, so in general we won't
|
||||||
* delay here.
|
* delay here.
|
||||||
*/
|
*/
|
||||||
void dcon_load_holdoff(void)
|
void dcon_load_holdoff(void)
|
||||||
{
|
{
|
||||||
struct timespec delta_t, now;
|
struct timespec delta_t, now;
|
||||||
while(1) {
|
while (1) {
|
||||||
getnstimeofday(&now);
|
getnstimeofday(&now);
|
||||||
delta_t = timespec_sub(now, dcon_load_time);
|
delta_t = timespec_sub(now, dcon_load_time);
|
||||||
if (delta_t.tv_sec != 0 ||
|
if (delta_t.tv_sec != 0 ||
|
||||||
|
@ -352,10 +352,12 @@ static void dcon_source_switch(struct work_struct *work)
|
||||||
printk("dcon_source_switch to CPU\n");
|
printk("dcon_source_switch to CPU\n");
|
||||||
/* Enable the scanline interrupt bit */
|
/* Enable the scanline interrupt bit */
|
||||||
if (dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT))
|
if (dcon_write(DCON_REG_MODE, dcon_disp_mode | MODE_SCAN_INT))
|
||||||
printk(KERN_ERR "olpc-dcon: couldn't enable scanline interrupt!\n");
|
printk(KERN_ERR
|
||||||
|
"olpc-dcon: couldn't enable scanline interrupt!\n");
|
||||||
else {
|
else {
|
||||||
/* Wait up to one second for the scanline interrupt */
|
/* Wait up to one second for the scanline interrupt */
|
||||||
wait_event_timeout(dcon_wait_queue, dcon_switched == 1, HZ);
|
wait_event_timeout(dcon_wait_queue,
|
||||||
|
dcon_switched == 1, HZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dcon_switched)
|
if (!dcon_switched)
|
||||||
|
@ -396,7 +398,7 @@ static void dcon_source_switch(struct work_struct *work)
|
||||||
int t;
|
int t;
|
||||||
struct timespec delta_t;
|
struct timespec delta_t;
|
||||||
|
|
||||||
printk("dcon_source_switch to DCON\n");
|
printk(KERN_INFO "dcon_source_switch to DCON\n");
|
||||||
|
|
||||||
add_wait_queue(&dcon_wait_queue, &wait);
|
add_wait_queue(&dcon_wait_queue, &wait);
|
||||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||||
|
@ -420,7 +422,7 @@ static void dcon_source_switch(struct work_struct *work)
|
||||||
* the time between asserting DCONLOAD and the IRQ --
|
* the time between asserting DCONLOAD and the IRQ --
|
||||||
* if it's less than 20msec, then the DCON couldn't
|
* if it's less than 20msec, then the DCON couldn't
|
||||||
* have seen two VSYNC pulses. in that case we
|
* have seen two VSYNC pulses. in that case we
|
||||||
* deassert and reassert, and hope for the best.
|
* deassert and reassert, and hope for the best.
|
||||||
* see http://dev.laptop.org/ticket/9664
|
* see http://dev.laptop.org/ticket/9664
|
||||||
*/
|
*/
|
||||||
delta_t = timespec_sub(dcon_irq_time, dcon_load_time);
|
delta_t = timespec_sub(dcon_irq_time, dcon_load_time);
|
||||||
|
@ -471,7 +473,8 @@ static void dcon_set_source_sync(int arg)
|
||||||
flush_scheduled_work();
|
flush_scheduled_work();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dconbl_set(struct backlight_device *dev) {
|
static int dconbl_set(struct backlight_device *dev)
|
||||||
|
{
|
||||||
|
|
||||||
int level = dev->props.brightness;
|
int level = dev->props.brightness;
|
||||||
|
|
||||||
|
@ -482,7 +485,8 @@ static int dconbl_set(struct backlight_device *dev) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dconbl_get(struct backlight_device *dev) {
|
static int dconbl_get(struct backlight_device *dev)
|
||||||
|
{
|
||||||
return dcon_get_backlight();
|
return dcon_get_backlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +525,7 @@ static int _strtoul(const char *buf, int len, unsigned int *val)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *endp;
|
char *endp;
|
||||||
unsigned int output = simple_strtoul(buf, &endp, 0);
|
unsigned int output = strict_strtoul(buf, &endp, 0);
|
||||||
int size = endp - buf;
|
int size = endp - buf;
|
||||||
|
|
||||||
if (*endp && isspace(*endp))
|
if (*endp && isspace(*endp))
|
||||||
|
@ -559,7 +563,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
|
||||||
if (_strtoul(buf, count, &output))
|
if (_strtoul(buf, count, &output))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
printk("dcon_freeze_store: %d\n", output);
|
printk(KERN_INFO "dcon_freeze_store: %d\n", output);
|
||||||
|
|
||||||
switch (output) {
|
switch (output) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -568,7 +572,7 @@ static ssize_t dcon_freeze_store(struct device *dev,
|
||||||
case 1:
|
case 1:
|
||||||
dcon_set_source_sync(DCON_SOURCE_DCON);
|
dcon_set_source_sync(DCON_SOURCE_DCON);
|
||||||
break;
|
break;
|
||||||
case 2: // normally unused
|
case 2: /* normally unused */
|
||||||
dcon_set_source(DCON_SOURCE_DCON);
|
dcon_set_source(DCON_SOURCE_DCON);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -620,7 +624,8 @@ static const struct backlight_ops dcon_bl_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int dcon_reboot_notify(struct notifier_block *nb, unsigned long foo, void *bar)
|
static int dcon_reboot_notify(struct notifier_block *nb,
|
||||||
|
unsigned long foo, void *bar)
|
||||||
{
|
{
|
||||||
if (dcon_client == NULL)
|
if (dcon_client == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -636,7 +641,8 @@ static struct notifier_block dcon_nb = {
|
||||||
.priority = -1,
|
.priority = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int unfreeze_on_panic(struct notifier_block *nb, unsigned long e, void *p)
|
static int unfreeze_on_panic(struct notifier_block *nb,
|
||||||
|
unsigned long e, void *p)
|
||||||
{
|
{
|
||||||
pdata->set_dconload(1);
|
pdata->set_dconload(1);
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
@ -650,7 +656,8 @@ static struct notifier_block dcon_panic_nb = {
|
||||||
* When the framebuffer sleeps due to external sources (e.g. user idle), power
|
* When the framebuffer sleeps due to external sources (e.g. user idle), power
|
||||||
* down the DCON as well. Power it back up when the fb comes back to life.
|
* down the DCON as well. Power it back up when the fb comes back to life.
|
||||||
*/
|
*/
|
||||||
static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data)
|
static int fb_notifier_callback(struct notifier_block *self,
|
||||||
|
unsigned long event, void *data)
|
||||||
{
|
{
|
||||||
struct fb_event *evdata = data;
|
struct fb_event *evdata = data;
|
||||||
int *blank = (int *) evdata->data;
|
int *blank = (int *) evdata->data;
|
||||||
|
@ -688,19 +695,20 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
dcon_device = platform_device_alloc("dcon", -1);
|
dcon_device = platform_device_alloc("dcon", -1);
|
||||||
|
|
||||||
if (dcon_device == NULL) {
|
if (dcon_device == NULL) {
|
||||||
printk("dcon: Unable to create the DCON device\n");
|
printk(KERN_ERR "dcon: Unable to create the DCON device\n");
|
||||||
rc = -ENOMEM;
|
rc = -ENOMEM;
|
||||||
goto eirq;
|
goto eirq;
|
||||||
}
|
}
|
||||||
/* Place holder...*/
|
/* Place holder...*/
|
||||||
i2c_set_clientdata(client, dcon_device);
|
i2c_set_clientdata(client, dcon_device);
|
||||||
|
rc = platform_device_add(dcon_device);
|
||||||
|
|
||||||
if ((rc = platform_device_add(dcon_device))) {
|
if (rc) {
|
||||||
printk("dcon: Unable to add the DCON device\n");
|
printk(KERN_ERR "dcon: Unable to add the DCON device\n");
|
||||||
goto edev;
|
goto edev;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = 0; i < ARRAY_SIZE(dcon_device_files); i++) {
|
for (i = 0; i < ARRAY_SIZE(dcon_device_files); i++) {
|
||||||
rc = device_create_file(&dcon_device->dev,
|
rc = device_create_file(&dcon_device->dev,
|
||||||
&dcon_device_files[i]);
|
&dcon_device_files[i]);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
@ -717,10 +725,10 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
||||||
NULL, &dcon_bl_ops, NULL);
|
NULL, &dcon_bl_ops, NULL);
|
||||||
|
|
||||||
if (IS_ERR(dcon_bl_dev)) {
|
if (IS_ERR(dcon_bl_dev)) {
|
||||||
printk("Could not register the backlight device for the DCON (%ld)\n", PTR_ERR(dcon_bl_dev));
|
printk(KERN_ERR "Cannot register the backlight device (%ld)\n",
|
||||||
|
PTR_ERR(dcon_bl_dev));
|
||||||
dcon_bl_dev = NULL;
|
dcon_bl_dev = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
dcon_bl_dev->props.max_brightness = 15;
|
dcon_bl_dev->props.max_brightness = 15;
|
||||||
dcon_bl_dev->props.power = FB_BLANK_UNBLANK;
|
dcon_bl_dev->props.power = FB_BLANK_UNBLANK;
|
||||||
dcon_bl_dev->props.brightness = dcon_get_backlight();
|
dcon_bl_dev->props.brightness = dcon_get_backlight();
|
||||||
|
|
Loading…
Reference in a new issue