|
22 | 22 | #include <linux/module.h>
|
23 | 23 | #include <linux/of.h>
|
24 | 24 | #include <linux/of_device.h>
|
| 25 | +#include <video/of_videomode.h> |
25 | 26 | #include <video/of_display_timing.h>
|
26 | 27 | #include <linux/regulator/consumer.h>
|
27 | 28 | #include <video/videomode.h>
|
@@ -1028,11 +1029,11 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
|
1028 | 1029 | struct device *dev = &sinfo->pdev->dev;
|
1029 | 1030 | struct device_node *np =dev->of_node;
|
1030 | 1031 | struct device_node *display_np;
|
1031 |
| - struct device_node *timings_np; |
1032 |
| - struct display_timings *timings; |
1033 | 1032 | struct atmel_lcdfb_power_ctrl_gpio *og;
|
1034 | 1033 | bool is_gpio_power = false;
|
| 1034 | + struct fb_videomode fb_vm; |
1035 | 1035 | struct gpio_desc *gpiod;
|
| 1036 | + struct videomode vm; |
1036 | 1037 | int ret = -ENOENT;
|
1037 | 1038 | int i;
|
1038 | 1039 |
|
@@ -1105,44 +1106,18 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo)
|
1105 | 1106 | pdata->lcdcon_is_backlight = of_property_read_bool(display_np, "atmel,lcdcon-backlight");
|
1106 | 1107 | pdata->lcdcon_pol_negative = of_property_read_bool(display_np, "atmel,lcdcon-backlight-inverted");
|
1107 | 1108 |
|
1108 |
| - timings = of_get_display_timings(display_np); |
1109 |
| - if (!timings) { |
1110 |
| - dev_err(dev, "failed to get display timings\n"); |
1111 |
| - ret = -EINVAL; |
| 1109 | + ret = of_get_videomode(display_np, &vm, OF_USE_NATIVE_MODE); |
| 1110 | + if (ret) { |
| 1111 | + dev_err(dev, "failed to get videomode from DT\n"); |
1112 | 1112 | goto put_display_node;
|
1113 | 1113 | }
|
1114 | 1114 |
|
1115 |
| - timings_np = of_get_child_by_name(display_np, "display-timings"); |
1116 |
| - if (!timings_np) { |
1117 |
| - dev_err(dev, "failed to find display-timings node\n"); |
1118 |
| - ret = -ENODEV; |
| 1115 | + ret = fb_videomode_from_videomode(&vm, &fb_vm); |
| 1116 | + if (ret < 0) |
1119 | 1117 | goto put_display_node;
|
1120 |
| - } |
1121 | 1118 |
|
1122 |
| - for (i = 0; i < of_get_child_count(timings_np); i++) { |
1123 |
| - struct videomode vm; |
1124 |
| - struct fb_videomode fb_vm; |
1125 |
| - |
1126 |
| - ret = videomode_from_timings(timings, &vm, i); |
1127 |
| - if (ret < 0) |
1128 |
| - goto put_timings_node; |
1129 |
| - ret = fb_videomode_from_videomode(&vm, &fb_vm); |
1130 |
| - if (ret < 0) |
1131 |
| - goto put_timings_node; |
1132 |
| - |
1133 |
| - fb_add_videomode(&fb_vm, &info->modelist); |
1134 |
| - } |
1135 |
| - |
1136 |
| - /* |
1137 |
| - * FIXME: Make sure we are not referencing any fields in display_np |
1138 |
| - * and timings_np and drop our references to them before returning to |
1139 |
| - * avoid leaking the nodes on probe deferral and driver unbind. |
1140 |
| - */ |
1141 |
| - |
1142 |
| - return 0; |
| 1119 | + fb_add_videomode(&fb_vm, &info->modelist); |
1143 | 1120 |
|
1144 |
| -put_timings_node: |
1145 |
| - of_node_put(timings_np); |
1146 | 1121 | put_display_node:
|
1147 | 1122 | of_node_put(display_np);
|
1148 | 1123 | return ret;
|
|
0 commit comments