Skip to content

Commit

Permalink
Merge branch 'fbdev-3.11' of git://gitorious.org/linux-omap-dss2/linu…
Browse files Browse the repository at this point in the history
…x into fbdev/for-next
  • Loading branch information
Jean-Christophe PLAGNIOL-VILLARD committed Jun 14, 2013
2 parents 317ddd2 + ffa3fd2 commit 8ea2c86
Show file tree
Hide file tree
Showing 4 changed files with 339 additions and 120 deletions.
10 changes: 7 additions & 3 deletions Documentation/devicetree/bindings/video/ssd1307fb.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
* Solomon SSD1307 Framebuffer Driver

Required properties:
- compatible: Should be "solomon,ssd1307fb-<bus>". The only supported bus for
now is i2c.
- compatible: Should be "solomon,<chip>fb-<bus>". The only supported bus for
now is i2c, and the supported chips are ssd1306 and ssd1307.
- reg: Should contain address of the controller on the I2C bus. Most likely
0x3c or 0x3d
- pwm: Should contain the pwm to use according to the OF device tree PWM
specification [0]
specification [0]. Only required for the ssd1307.
- reset-gpios: Should contain the GPIO used to reset the OLED display
- solomon,height: Height in pixel of the screen driven by the controller
- solomon,width: Width in pixel of the screen driven by the controller
- solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is
mapped to.

Optional properties:
- reset-active-low: Is the reset gpio is active on physical low?
Expand Down
55 changes: 42 additions & 13 deletions drivers/video/of_display_timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,16 @@ static int parse_timing_property(struct device_node *np, const char *name,
}

/**
* of_get_display_timing - parse display_timing entry from device_node
* of_parse_display_timing - parse display_timing entry from device_node
* @np: device_node with the properties
**/
static struct display_timing *of_get_display_timing(struct device_node *np)
static int of_parse_display_timing(struct device_node *np,
struct display_timing *dt)
{
struct display_timing *dt;
u32 val = 0;
int ret = 0;

dt = kzalloc(sizeof(*dt), GFP_KERNEL);
if (!dt) {
pr_err("%s: could not allocate display_timing struct\n",
of_node_full_name(np));
return NULL;
}
memset(dt, 0, sizeof(*dt));

ret |= parse_timing_property(np, "hback-porch", &dt->hback_porch);
ret |= parse_timing_property(np, "hfront-porch", &dt->hfront_porch);
Expand Down Expand Up @@ -101,12 +96,38 @@ static struct display_timing *of_get_display_timing(struct device_node *np)
if (ret) {
pr_err("%s: error reading timing properties\n",
of_node_full_name(np));
kfree(dt);
return NULL;
return -EINVAL;
}

return 0;
}

/**
* of_get_display_timing - parse a display_timing entry
* @np: device_node with the timing subnode
* @name: name of the timing node
* @dt: display_timing struct to fill
**/
int of_get_display_timing(struct device_node *np, const char *name,
struct display_timing *dt)
{
struct device_node *timing_np;

if (!np) {
pr_err("%s: no devicenode given\n", of_node_full_name(np));
return -EINVAL;
}

return dt;
timing_np = of_find_node_by_name(np, name);
if (!timing_np) {
pr_err("%s: could not find node '%s'\n",
of_node_full_name(np), name);
return -ENOENT;
}

return of_parse_display_timing(timing_np, dt);
}
EXPORT_SYMBOL_GPL(of_get_display_timing);

/**
* of_get_display_timings - parse all display_timing entries from a device_node
Expand Down Expand Up @@ -174,9 +195,17 @@ struct display_timings *of_get_display_timings(struct device_node *np)

for_each_child_of_node(timings_np, entry) {
struct display_timing *dt;
int r;

dt = of_get_display_timing(entry);
dt = kzalloc(sizeof(*dt), GFP_KERNEL);
if (!dt) {
pr_err("%s: could not allocate display_timing struct\n",
of_node_full_name(np));
goto timingfail;
}

r = of_parse_display_timing(entry, dt);
if (r) {
/*
* to not encourage wrong devicetrees, fail in case of
* an error
Expand Down
Loading

0 comments on commit 8ea2c86

Please sign in to comment.