Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1279816
| From | Archit Taneja <architt@codeaurora.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 2/5] drm/dsi: Try to match non-DT dsi devices |
| Date | 2015-11-30 13:10 +0100 |
| Message-ID | <qAvrk-3rH-19@gated-at.bofh.it> (permalink) |
| References | <qgwJk-21W-13@gated-at.bofh.it> <qAvrk-3rH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add a device name field in mipi_dsi_device. This name is different from
the actual dev 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 filed in 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>
---
drivers/gpu/drm/drm_mipi_dsi.c | 25 ++++++++++++++++++++++++-
include/drm/drm_mipi_dsi.h | 6 ++++++
2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 82bcdcd..143cce4 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -45,9 +45,26 @@
* subset of the MIPI DCS command set.
*/
+static const struct device_type mipi_dsi_device_type;
+
static int mipi_dsi_device_match(struct device *dev, struct device_driver *drv)
{
- return of_driver_match_device(dev, drv);
+ struct mipi_dsi_device *dsi;
+
+ if (dev->type == &mipi_dsi_device_type)
+ dsi = to_mipi_dsi_device(dev);
+ else
+ return 0;
+
+ /* attempt OF style match */
+ if (of_driver_match_device(dev, drv))
+ return 1;
+
+ /* compare dsi device and driver names */
+ if (!strcmp(dsi->name, drv->name))
+ return 1;
+
+ return 0;
}
static const struct dev_pm_ops mipi_dsi_device_pm_ops = {
@@ -125,6 +142,7 @@ struct mipi_dsi_device *mipi_dsi_device_new(struct mipi_dsi_host *host,
dsi->dev.type = &mipi_dsi_device_type;
dsi->dev.of_node = info->node;
dsi->channel = info->reg;
+ strlcpy(dsi->name, info->type, sizeof(dsi->name));
dev_set_name(&dsi->dev, "%s.%d", dev_name(host->dev), info->reg);
@@ -147,6 +165,11 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct device_node *node)
int ret;
u32 reg;
+ if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
+ dev_err(dev, "modalias failure on %s\n", node->full_name);
+ return ERR_PTR(-EINVAL);
+ }
+
ret = of_property_read_u32(node, "reg", ®);
if (ret) {
dev_err(dev, "device node %s has no valid reg property: %d\n",
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 90f4f3c..cb084af 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -139,8 +139,11 @@ enum mipi_dsi_pixel_format {
MIPI_DSI_FMT_RGB565,
};
+#define DSI_DEV_NAME_SIZE 20
+
/**
* struct mipi_dsi_device_info - template for creating a mipi_dsi_device
+ * @type: dsi peripheral chip type
* @reg: DSI virtual channel assigned to peripheral
* @node: pointer to OF device node
*
@@ -148,6 +151,7 @@ enum mipi_dsi_pixel_format {
* DSI device
*/
struct mipi_dsi_device_info {
+ char type[DSI_DEV_NAME_SIZE];
u32 reg;
struct device_node *node;
};
@@ -156,6 +160,7 @@ struct mipi_dsi_device_info {
* struct mipi_dsi_device - DSI peripheral device
* @host: DSI host for this peripheral
* @dev: driver model device node for this peripheral
+ * @name: dsi peripheral chip type
* @channel: virtual channel assigned to the peripheral
* @format: pixel format for video mode
* @lanes: number of active data lanes
@@ -165,6 +170,7 @@ struct mipi_dsi_device {
struct mipi_dsi_host *host;
struct device dev;
+ char name[DSI_DEV_NAME_SIZE];
unsigned int channel;
unsigned int lanes;
enum mipi_dsi_pixel_format format;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/5] drm/dsi: DSI for devices with different control bus Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
[PATCH v3 4/5] drm/dsi: Add routine to unregister dsi device Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
Re: [PATCH v3 4/5] drm/dsi: Add routine to unregister dsi device Andrzej Hajda <a.hajda@samsung.com> - 2015-11-30 13:40 +0100
[PATCH v3 1/5] drm/dsi: Refactor device creation Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
[PATCH v3 3/5] drm/dsi: Check for used channels Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
[PATCH v3 2/5] drm/dsi: Try to match non-DT dsi devices Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
[PATCH v3 5/5] drm/dsi: Get DSI host by DT device node Archit Taneja <architt@codeaurora.org> - 2015-11-30 13:10 +0100
[PATCH v4 3/6] drm/dsi: Try to match non-DT dsi devices Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 4/6] drm/dsi: Check for used channels Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 5/6] drm/dsi: Add routine to unregister dsi device Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 6/6] drm/dsi: Get DSI host by DT device node Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 2/6] drm/dsi: Refactor device creation Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 0/6] drm/dsi: DSI for devices with different control bus Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
[PATCH v4 1/6] drm/dsi: check for CONFIG_OF when defining of_mipi_dsi_device_add Archit Taneja <architt@codeaurora.org> - 2015-12-10 13:50 +0100
csiph-web