aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2016-02-12 04:18:32 -0500
committerThierry Reding <treding@nvidia.com>2016-03-02 11:01:09 -0500
commitbf4363ce3a67ba06042351f40841ef4da9b30787 (patch)
tree5e15709da138043973dcafd43a0933e3e600818f /drivers
parentc63ae8a9686bb8c87154a31dc5ebadbda778a8e5 (diff)
drm/dsi: Try to match non-DT DSI devices
Add a device name field in struct mipi_dsi_device. This name is not the same as the device name (which is of the format "hostname.reg"). When the device is created via DT, this name is set to the modalias string. In the non-DT case, the driver creating the DSI device provides the name by populating a field in struct mipi_dsi_device_info. Matching for DT case would be as it was before. For the non-DT case, we compare the device and driver names. Other buses (like I2C/SPI) perform a non-DT match by comparing the device name and entries in the driver's id_table. Such a mechanism isn't used for the DSI bus. Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_mipi_dsi.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 5d7243da2323..42a7aacf7a2f 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -47,7 +47,17 @@
47 47
48static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv) 48static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
49{ 49{
50 return of_driver_match_device(dev, drv); 50 struct mipi_dsi_device *dsi = to_mipi_dsi_device(dev);
51
52 /* attempt OF style match */
53 if (of_driver_match_device(dev, drv))
54 return 1;
55
56 /* compare DSI device and driver names */
57 if (!strcmp(dsi->name, drv->name))
58 return 1;
59
60 return 0;
51} 61}
52 62
53static const struct dev_pm_ops mipi_dsi_device_pm_ops = { 63static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
@@ -138,6 +148,11 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
138 int ret; 148 int ret;
139 u32 reg; 149 u32 reg;
140 150
151 if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
152 dev_err(dev, "modalias failure on %s\n", node->full_name);
153 return ERR_PTR(-EINVAL);
154 }
155
141 ret = of_property_read_u32(node, "reg", &reg); 156 ret = of_property_read_u32(node, "reg", &reg);
142 if (ret) { 157 if (ret) {
143 dev_err(dev, "device node %s has no valid reg property: %d\n", 158 dev_err(dev, "device node %s has no valid reg property: %d\n",
@@ -197,6 +212,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
197 212
198 dsi->dev.of_node = info->node; 213 dsi->dev.of_node = info->node;
199 dsi->channel = info->channel; 214 dsi->channel = info->channel;
215 strlcpy(dsi->name, info->type, sizeof(dsi->name));
200 216
201 ret = mipi_dsi_device_add(dsi); 217 ret = mipi_dsi_device_add(dsi);
202 if (ret) { 218 if (ret) {