Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235966
b: refs/heads/master
c: 097cd83
h: refs/heads/master
v: v3
  • Loading branch information
Andres Salomon authored and Greg Kroah-Hartman committed Feb 18, 2011
1 parent 7d0a743 commit 76925bb
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 23 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: 8f2fb16a9cd015072b3da9038084930287e11985
refs/heads/master: 097cd83a4c312e1ae0d9c14526f846666cab4f3a
20 changes: 20 additions & 0 deletions trunk/drivers/staging/olpc_dcon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,23 @@ config FB_OLPC_DCON
Add support for the OLPC XO DCON controller. This controller is
only available on OLPC platforms. Unless you have one of these
platforms, you will want to say 'N'.

config FB_OLPC_DCON_1
bool "OLPC XO-1 DCON support"
depends on FB_OLPC_DCON
default y
---help---
Enable support for the DCON in XO-1 model laptops. The kernel
communicates with the DCON using model-specific code. If you
have an XO-1 (or if you're unsure what model you have), you should
say 'Y'.

config FB_OLPC_DCON_1_5
bool "OLPC XO-1.5 DCON support"
depends on FB_OLPC_DCON
default y
---help---
Enable support for the DCON in XO-1.5 model laptops. The kernel
communicates with the DCON using model-specific code. If you
have an XO-1.5 (or if you're unsure what model you have), you
should say 'Y'.
7 changes: 6 additions & 1 deletion trunk/drivers/staging/olpc_dcon/Makefile
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
obj-$(CONFIG_FB_OLPC_DCON) += olpc_dcon.o
olpc-dcon-objs += olpc_dcon.o
olpc-dcon-$(CONFIG_FB_OLPC_DCON_1) += olpc_dcon_xo_1.o
olpc-dcon-$(CONFIG_FB_OLPC_DCON_1_5) += olpc_dcon_xo_1_5.o
obj-$(CONFIG_FB_OLPC_DCON) += olpc-dcon.o


34 changes: 17 additions & 17 deletions trunk/drivers/staging/olpc_dcon/olpc_dcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Copyright © 2006-2007 Red Hat, Inc.
* Copyright © 2006-2007 Advanced Micro Devices, Inc.
* Copyright © 2009 VIA Technology, Inc.
* Copyright (c) 2010 Andres Salomon <dilinger@queued.net>
* Copyright (c) 2010-2011 Andres Salomon <dilinger@queued.net>
*
* This program is free software. You can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
Expand Down Expand Up @@ -44,13 +44,6 @@ module_param(noinit, int, 0444);
static int useaa = 1;
module_param(useaa, int, 0444);

struct dcon_platform_data {
int (*init)(void);
void (*bus_stabilize_wiggle)(void);
void (*set_dconload)(int);
u8 (*read_status)(void);
};

static struct dcon_platform_data *pdata;

struct dcon_priv {
Expand All @@ -73,19 +66,17 @@ struct dcon_priv {

/* I2C structures */

static struct i2c_driver dcon_driver;

/* Platform devices */
static struct platform_device *dcon_device;

/* Backlight device */
static struct backlight_device *dcon_bl_dev;

/* Current source, initialized at probe time */
static int dcon_source;
int dcon_source;

/* Desired source */
static int dcon_pending;
int dcon_pending;

/* Variables used during switches */
static int dcon_switched;
Expand Down Expand Up @@ -693,6 +684,9 @@ static int dcon_probe(struct i2c_client *client, const struct i2c_device_id *id)
struct dcon_priv *dcon;
int rc, i, j;

if (!pdata)
return -ENXIO;

dcon = kzalloc(sizeof(*dcon), GFP_KERNEL);
if (!dcon)
return -ENOMEM;
Expand Down Expand Up @@ -830,7 +824,7 @@ static int dcon_resume(struct i2c_client *client)
#endif


static irqreturn_t dcon_interrupt(int irq, void *id)
irqreturn_t dcon_interrupt(int irq, void *id)
{
int status = pdata->read_status();

Expand Down Expand Up @@ -877,7 +871,7 @@ static const struct i2c_device_id dcon_idtable[] = {

MODULE_DEVICE_TABLE(i2c, dcon_idtable);

static struct i2c_driver dcon_driver = {
struct i2c_driver dcon_driver = {
.driver = {
.name = "olpc_dcon",
},
Expand All @@ -893,11 +887,17 @@ static struct i2c_driver dcon_driver = {
#endif
};

#include "olpc_dcon_xo_1.c"

static int __init olpc_dcon_init(void)
{
pdata = &dcon_pdata_xo_1;
#ifdef CONFIG_FB_OLPC_DCON_1_5
/* XO-1.5 */
if (olpc_board_at_least(olpc_board(0xd0)))
pdata = &dcon_pdata_xo_1_5;
#endif
#ifdef CONFIG_FB_OLPC_DCON_1
if (!pdata)
pdata = &dcon_pdata_xo_1;
#endif

return i2c_add_driver(&dcon_driver);
}
Expand Down
22 changes: 22 additions & 0 deletions trunk/drivers/staging/olpc_dcon/olpc_dcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,26 @@
/* Interrupt */
#define DCON_IRQ 6

struct dcon_platform_data {
int (*init)(void);
void (*bus_stabilize_wiggle)(void);
void (*set_dconload)(int);
u8 (*read_status)(void);
};

#include <linux/interrupt.h>

extern int dcon_source;
extern int dcon_pending;
extern irqreturn_t dcon_interrupt(int irq, void *id);
extern struct i2c_driver dcon_driver;

#ifdef CONFIG_FB_OLPC_DCON_1
extern struct dcon_platform_data dcon_pdata_xo_1;
#endif

#ifdef CONFIG_FB_OLPC_DCON_1_5
extern struct dcon_platform_data dcon_pdata_xo_1_5;
#endif

#endif
2 changes: 1 addition & 1 deletion trunk/drivers/staging/olpc_dcon/olpc_dcon_xo_1.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static u8 dcon_read_status_xo_1(void)
return status;
}

static struct dcon_platform_data dcon_pdata_xo_1 = {
struct dcon_platform_data dcon_pdata_xo_1 = {
.init = dcon_init_xo_1,
.bus_stabilize_wiggle = dcon_wiggle_xo_1,
.set_dconload = dcon_set_dconload_1,
Expand Down
18 changes: 15 additions & 3 deletions trunk/drivers/staging/olpc_dcon/olpc_dcon_xo_1_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
*/

#include <linux/acpi.h>
#include <linux/pci.h>
#include <linux/gpio.h>
#include <asm/olpc.h>

/* TODO: this eventually belongs in linux/vx855.h */
#define NR_VX855_GPI 14
#define NR_VX855_GPO 13
#define NR_VX855_GPIO 15

#define VX855_GPI(n) (n)
#define VX855_GPO(n) (NR_VX855_GPI + (n))
#define VX855_GPIO(n) (NR_VX855_GPI + NR_VX855_GPO + (n))

#include "olpc_dcon.h"

/* Hardware setup on the XO 1.5:
* DCONLOAD connects to
Expand All @@ -26,8 +40,6 @@

#define PREFIX "OLPC DCON:"

static struct dcon_platform_data dcon_pdata_xo_1_5;

static void dcon_clear_irq(void)
{
/* irq status will appear in PMIO_Rx50[6] (RW1C) on gpio12 */
Expand Down Expand Up @@ -173,7 +185,7 @@ static u8 dcon_read_status_xo_1_5(void)
return status;
}

static struct dcon_platform_data dcon_pdata_xo_1_5 = {
struct dcon_platform_data dcon_pdata_xo_1_5 = {
.init = dcon_init_xo_1_5,
.bus_stabilize_wiggle = dcon_wiggle_xo_1_5,
.set_dconload = dcon_set_dconload_xo_1_5,
Expand Down

0 comments on commit 76925bb

Please sign in to comment.