Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 1 | /* |
| 2 | * i.MX drm driver - parallel display implementation |
| 3 | * |
| 4 | * Copyright (C) 2012 Sascha Hauer, Pengutronix |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 14 | */ |
| 15 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 16 | #include <linux/component.h> |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 17 | #include <linux/module.h> |
| 18 | #include <drm/drmP.h> |
Liu Ying | 255c35f | 2016-07-08 17:40:56 +0800 | [diff] [blame] | 19 | #include <drm/drm_atomic_helper.h> |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 20 | #include <drm/drm_fb_helper.h> |
| 21 | #include <drm/drm_crtc_helper.h> |
Philipp Zabel | 628f435b | 2014-02-25 11:55:04 +0100 | [diff] [blame] | 22 | #include <drm/drm_panel.h> |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 23 | #include <linux/videodev2.h> |
Lothar Waßmann | 075c457 | 2014-01-13 11:24:33 +0100 | [diff] [blame] | 24 | #include <video/of_display_timing.h> |
Philipp Zabel | 553a59f | 2015-05-19 16:28:12 +0200 | [diff] [blame] | 25 | #include <linux/of_graph.h> |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 26 | |
| 27 | #include "imx-drm.h" |
| 28 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 29 | struct imx_parallel_display { |
| 30 | struct drm_connector connector; |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 31 | struct drm_encoder encoder; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 32 | struct device *dev; |
| 33 | void *edid; |
| 34 | int edid_len; |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 35 | u32 bus_format; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 36 | struct drm_display_mode mode; |
Philipp Zabel | 628f435b | 2014-02-25 11:55:04 +0100 | [diff] [blame] | 37 | struct drm_panel *panel; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 38 | }; |
| 39 | |
Philipp Zabel | 3df0739 | 2016-07-06 15:47:11 +0200 | [diff] [blame^] | 40 | static inline struct imx_parallel_display *con_to_imxpd(struct drm_connector *c) |
| 41 | { |
| 42 | return container_of(c, struct imx_parallel_display, connector); |
| 43 | } |
| 44 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 45 | static inline struct imx_parallel_display *enc_to_imxpd(struct drm_encoder *e) |
| 46 | { |
| 47 | return container_of(e, struct imx_parallel_display, encoder); |
| 48 | } |
| 49 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 50 | static enum drm_connector_status imx_pd_connector_detect( |
| 51 | struct drm_connector *connector, bool force) |
| 52 | { |
| 53 | return connector_status_connected; |
| 54 | } |
| 55 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 56 | static int imx_pd_connector_get_modes(struct drm_connector *connector) |
| 57 | { |
| 58 | struct imx_parallel_display *imxpd = con_to_imxpd(connector); |
Marek Vasut | afb12ed | 2013-04-03 12:36:28 -0300 | [diff] [blame] | 59 | struct device_node *np = imxpd->dev->of_node; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 60 | int num_modes = 0; |
| 61 | |
Philipp Zabel | 628f435b | 2014-02-25 11:55:04 +0100 | [diff] [blame] | 62 | if (imxpd->panel && imxpd->panel->funcs && |
| 63 | imxpd->panel->funcs->get_modes) { |
| 64 | num_modes = imxpd->panel->funcs->get_modes(imxpd->panel); |
| 65 | if (num_modes > 0) |
| 66 | return num_modes; |
| 67 | } |
| 68 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 69 | if (imxpd->edid) { |
| 70 | drm_mode_connector_update_edid_property(connector, imxpd->edid); |
| 71 | num_modes = drm_add_edid_modes(connector, imxpd->edid); |
| 72 | } |
| 73 | |
Marek Vasut | afb12ed | 2013-04-03 12:36:28 -0300 | [diff] [blame] | 74 | if (np) { |
| 75 | struct drm_display_mode *mode = drm_mode_create(connector->dev); |
Quentin Lambert | 63bc516 | 2014-08-04 21:07:07 +0200 | [diff] [blame] | 76 | |
Fabio Estevam | 39dcf4f | 2014-02-26 20:53:42 -0300 | [diff] [blame] | 77 | if (!mode) |
| 78 | return -EINVAL; |
Lothar Waßmann | 075c457 | 2014-01-13 11:24:33 +0100 | [diff] [blame] | 79 | of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE); |
Marek Vasut | afb12ed | 2013-04-03 12:36:28 -0300 | [diff] [blame] | 80 | drm_mode_copy(mode, &imxpd->mode); |
| 81 | mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, |
| 82 | drm_mode_probed_add(connector, mode); |
| 83 | num_modes++; |
| 84 | } |
| 85 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 86 | return num_modes; |
| 87 | } |
| 88 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 89 | static struct drm_encoder *imx_pd_connector_best_encoder( |
| 90 | struct drm_connector *connector) |
| 91 | { |
| 92 | struct imx_parallel_display *imxpd = con_to_imxpd(connector); |
| 93 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 94 | return &imxpd->encoder; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 95 | } |
| 96 | |
Liu Ying | f6e396e | 2016-07-08 17:41:01 +0800 | [diff] [blame] | 97 | static void imx_pd_encoder_enable(struct drm_encoder *encoder) |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 98 | { |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 99 | struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); |
Philipp Zabel | ad92c8b | 2014-11-03 15:54:47 +0100 | [diff] [blame] | 100 | |
| 101 | drm_panel_prepare(imxpd->panel); |
| 102 | drm_panel_enable(imxpd->panel); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 103 | } |
| 104 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 105 | static void imx_pd_encoder_disable(struct drm_encoder *encoder) |
| 106 | { |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 107 | struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); |
Philipp Zabel | ad92c8b | 2014-11-03 15:54:47 +0100 | [diff] [blame] | 108 | |
| 109 | drm_panel_disable(imxpd->panel); |
| 110 | drm_panel_unprepare(imxpd->panel); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 111 | } |
| 112 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 113 | static int imx_pd_encoder_atomic_check(struct drm_encoder *encoder, |
| 114 | struct drm_crtc_state *crtc_state, |
| 115 | struct drm_connector_state *conn_state) |
| 116 | { |
| 117 | struct imx_crtc_state *imx_crtc_state = to_imx_crtc_state(crtc_state); |
| 118 | struct drm_display_info *di = &conn_state->connector->display_info; |
| 119 | struct imx_parallel_display *imxpd = enc_to_imxpd(encoder); |
| 120 | |
| 121 | imx_crtc_state->bus_flags = di->bus_flags; |
| 122 | if (!imxpd->bus_format && di->num_bus_formats) |
| 123 | imx_crtc_state->bus_format = di->bus_formats[0]; |
| 124 | else |
| 125 | imx_crtc_state->bus_format = imxpd->bus_format; |
| 126 | imx_crtc_state->di_hsync_pin = 2; |
| 127 | imx_crtc_state->di_vsync_pin = 3; |
| 128 | |
| 129 | return 0; |
| 130 | } |
| 131 | |
Ville Syrjälä | 7ae847d | 2015-12-15 12:21:09 +0100 | [diff] [blame] | 132 | static const struct drm_connector_funcs imx_pd_connector_funcs = { |
Liu Ying | f6e396e | 2016-07-08 17:41:01 +0800 | [diff] [blame] | 133 | .dpms = drm_atomic_helper_connector_dpms, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 134 | .fill_modes = drm_helper_probe_single_connector_modes, |
| 135 | .detect = imx_pd_connector_detect, |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 136 | .destroy = imx_drm_connector_destroy, |
Liu Ying | 255c35f | 2016-07-08 17:40:56 +0800 | [diff] [blame] | 137 | .reset = drm_atomic_helper_connector_reset, |
| 138 | .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, |
| 139 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 140 | }; |
| 141 | |
Ville Syrjälä | 7ae847d | 2015-12-15 12:21:09 +0100 | [diff] [blame] | 142 | static const struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = { |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 143 | .get_modes = imx_pd_connector_get_modes, |
| 144 | .best_encoder = imx_pd_connector_best_encoder, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 145 | }; |
| 146 | |
Ville Syrjälä | 7ae847d | 2015-12-15 12:21:09 +0100 | [diff] [blame] | 147 | static const struct drm_encoder_funcs imx_pd_encoder_funcs = { |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 148 | .destroy = imx_drm_encoder_destroy, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 149 | }; |
| 150 | |
Ville Syrjälä | 7ae847d | 2015-12-15 12:21:09 +0100 | [diff] [blame] | 151 | static const struct drm_encoder_helper_funcs imx_pd_encoder_helper_funcs = { |
Liu Ying | f6e396e | 2016-07-08 17:41:01 +0800 | [diff] [blame] | 152 | .enable = imx_pd_encoder_enable, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 153 | .disable = imx_pd_encoder_disable, |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 154 | .atomic_check = imx_pd_encoder_atomic_check, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 155 | }; |
| 156 | |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 157 | static int imx_pd_register(struct drm_device *drm, |
| 158 | struct imx_parallel_display *imxpd) |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 159 | { |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 160 | struct drm_encoder *encoder = &imxpd->encoder; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 161 | int ret; |
| 162 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 163 | ret = imx_drm_encoder_parse_of(drm, encoder, imxpd->dev->of_node); |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 164 | if (ret) |
| 165 | return ret; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 166 | |
Denis Carikli | c026a3f | 2014-06-17 15:34:51 +0200 | [diff] [blame] | 167 | /* set the connector's dpms to OFF so that |
| 168 | * drm_helper_connector_dpms() won't return |
| 169 | * immediately since the current state is ON |
| 170 | * at this point. |
| 171 | */ |
| 172 | imxpd->connector.dpms = DRM_MODE_DPMS_OFF; |
| 173 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 174 | drm_encoder_helper_add(encoder, &imx_pd_encoder_helper_funcs); |
| 175 | drm_encoder_init(drm, encoder, &imx_pd_encoder_funcs, |
| 176 | DRM_MODE_ENCODER_NONE, NULL); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 177 | |
| 178 | drm_connector_helper_add(&imxpd->connector, |
| 179 | &imx_pd_connector_helper_funcs); |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 180 | drm_connector_init(drm, &imxpd->connector, &imx_pd_connector_funcs, |
| 181 | DRM_MODE_CONNECTOR_VGA); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 182 | |
Philipp Zabel | 628f435b | 2014-02-25 11:55:04 +0100 | [diff] [blame] | 183 | if (imxpd->panel) |
| 184 | drm_panel_attach(imxpd->panel, &imxpd->connector); |
| 185 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 186 | drm_mode_connector_attach_encoder(&imxpd->connector, encoder); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 187 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 188 | return 0; |
| 189 | } |
| 190 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 191 | static int imx_pd_bind(struct device *dev, struct device *master, void *data) |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 192 | { |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 193 | struct drm_device *drm = data; |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 194 | struct device_node *np = dev->of_node; |
Philipp Zabel | 3a1c117 | 2016-05-03 14:39:29 +0200 | [diff] [blame] | 195 | struct device_node *ep; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 196 | const u8 *edidp; |
| 197 | struct imx_parallel_display *imxpd; |
| 198 | int ret; |
Liu Ying | 032003c | 2016-07-08 17:40:58 +0800 | [diff] [blame] | 199 | u32 bus_format = 0; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 200 | const char *fmt; |
| 201 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 202 | imxpd = devm_kzalloc(dev, sizeof(*imxpd), GFP_KERNEL); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 203 | if (!imxpd) |
| 204 | return -ENOMEM; |
| 205 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 206 | edidp = of_get_property(np, "edid", &imxpd->edid_len); |
| 207 | if (edidp) |
| 208 | imxpd->edid = kmemdup(edidp, imxpd->edid_len, GFP_KERNEL); |
| 209 | |
| 210 | ret = of_property_read_string(np, "interface-pix-fmt", &fmt); |
| 211 | if (!ret) { |
| 212 | if (!strcmp(fmt, "rgb24")) |
Liu Ying | 032003c | 2016-07-08 17:40:58 +0800 | [diff] [blame] | 213 | bus_format = MEDIA_BUS_FMT_RGB888_1X24; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 214 | else if (!strcmp(fmt, "rgb565")) |
Liu Ying | 032003c | 2016-07-08 17:40:58 +0800 | [diff] [blame] | 215 | bus_format = MEDIA_BUS_FMT_RGB565_1X16; |
Marek Vasut | 7d0a66c | 2013-04-22 23:19:31 +0200 | [diff] [blame] | 216 | else if (!strcmp(fmt, "bgr666")) |
Liu Ying | 032003c | 2016-07-08 17:40:58 +0800 | [diff] [blame] | 217 | bus_format = MEDIA_BUS_FMT_RGB666_1X18; |
Emil Renner Berthing | 9e74d29 | 2014-03-29 13:57:44 +0100 | [diff] [blame] | 218 | else if (!strcmp(fmt, "lvds666")) |
Liu Ying | 032003c | 2016-07-08 17:40:58 +0800 | [diff] [blame] | 219 | bus_format = MEDIA_BUS_FMT_RGB666_1X24_CPADHI; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 220 | } |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 221 | imxpd->bus_format = bus_format; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 222 | |
Philipp Zabel | 553a59f | 2015-05-19 16:28:12 +0200 | [diff] [blame] | 223 | /* port@1 is the output port */ |
Philipp Zabel | 3a1c117 | 2016-05-03 14:39:29 +0200 | [diff] [blame] | 224 | ep = of_graph_get_endpoint_by_regs(np, 1, -1); |
| 225 | if (ep) { |
| 226 | struct device_node *remote; |
Philipp Zabel | 553a59f | 2015-05-19 16:28:12 +0200 | [diff] [blame] | 227 | |
Philipp Zabel | 3a1c117 | 2016-05-03 14:39:29 +0200 | [diff] [blame] | 228 | remote = of_graph_get_remote_port_parent(ep); |
| 229 | of_node_put(ep); |
| 230 | if (remote) { |
| 231 | imxpd->panel = of_drm_find_panel(remote); |
| 232 | of_node_put(remote); |
Philipp Zabel | 553a59f | 2015-05-19 16:28:12 +0200 | [diff] [blame] | 233 | } |
Philipp Zabel | 3a1c117 | 2016-05-03 14:39:29 +0200 | [diff] [blame] | 234 | if (!imxpd->panel) |
| 235 | return -EPROBE_DEFER; |
Liu Ying | d70e96a | 2015-02-23 11:09:51 +0800 | [diff] [blame] | 236 | } |
Philipp Zabel | 628f435b | 2014-02-25 11:55:04 +0100 | [diff] [blame] | 237 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 238 | imxpd->dev = dev; |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 239 | |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 240 | ret = imx_pd_register(drm, imxpd); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 241 | if (ret) |
| 242 | return ret; |
| 243 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 244 | dev_set_drvdata(dev, imxpd); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 245 | |
| 246 | return 0; |
| 247 | } |
| 248 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 249 | static void imx_pd_unbind(struct device *dev, struct device *master, |
| 250 | void *data) |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 251 | { |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 252 | struct imx_parallel_display *imxpd = dev_get_drvdata(dev); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 253 | |
Philipp Zabel | 49f98bc | 2016-07-06 14:49:24 +0200 | [diff] [blame] | 254 | imxpd->encoder.funcs->destroy(&imxpd->encoder); |
Russell King | 1b3f767 | 2013-11-03 13:30:48 +0000 | [diff] [blame] | 255 | imxpd->connector.funcs->destroy(&imxpd->connector); |
Peter Seiderer | dcbc9eb | 2013-12-08 22:03:58 +0100 | [diff] [blame] | 256 | |
| 257 | kfree(imxpd->edid); |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 258 | } |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 259 | |
Russell King | 17b5001 | 2013-11-03 11:23:34 +0000 | [diff] [blame] | 260 | static const struct component_ops imx_pd_ops = { |
| 261 | .bind = imx_pd_bind, |
| 262 | .unbind = imx_pd_unbind, |
| 263 | }; |
| 264 | |
| 265 | static int imx_pd_probe(struct platform_device *pdev) |
| 266 | { |
| 267 | return component_add(&pdev->dev, &imx_pd_ops); |
| 268 | } |
| 269 | |
| 270 | static int imx_pd_remove(struct platform_device *pdev) |
| 271 | { |
| 272 | component_del(&pdev->dev, &imx_pd_ops); |
Peter Seiderer | dcbc9eb | 2013-12-08 22:03:58 +0100 | [diff] [blame] | 273 | |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | static const struct of_device_id imx_pd_dt_ids[] = { |
| 278 | { .compatible = "fsl,imx-parallel-display", }, |
| 279 | { /* sentinel */ } |
| 280 | }; |
Jiada Wang | fa45f2c | 2013-06-07 18:36:46 +0900 | [diff] [blame] | 281 | MODULE_DEVICE_TABLE(of, imx_pd_dt_ids); |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 282 | |
| 283 | static struct platform_driver imx_pd_driver = { |
| 284 | .probe = imx_pd_probe, |
Bill Pemberton | 99c28f1 | 2012-11-19 13:20:51 -0500 | [diff] [blame] | 285 | .remove = imx_pd_remove, |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 286 | .driver = { |
| 287 | .of_match_table = imx_pd_dt_ids, |
| 288 | .name = "imx-parallel-display", |
Sascha Hauer | 19022aa | 2012-09-21 10:07:48 +0200 | [diff] [blame] | 289 | }, |
| 290 | }; |
| 291 | |
| 292 | module_platform_driver(imx_pd_driver); |
| 293 | |
| 294 | MODULE_DESCRIPTION("i.MX parallel display driver"); |
| 295 | MODULE_AUTHOR("Sascha Hauer, Pengutronix"); |
| 296 | MODULE_LICENSE("GPL"); |
Fabio Estevam | b2da05f | 2013-08-18 21:40:05 -0300 | [diff] [blame] | 297 | MODULE_ALIAS("platform:imx-parallel-display"); |