Re: [PATCH v10 3/4] drm/lsdc: add drm driver for loongson display controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2022/2/22 16:27, Maxime Ripard wrote:
Hi,

On Sun, Feb 20, 2022 at 10:55:53PM +0800, Sui Jingfeng wrote:
+/* lsdc_get_display_timings_from_dtb - Get display timings from the device tree
+ *
+ * @np: point to the device node contain the display timings
+ * @pptim: point to where the pointer of struct display_timings is store to
+ */
+static void lsdc_get_display_timings_from_dtb(struct device_node *np,
+					      struct display_timings **pptim)
+{
+	struct display_timings *timings;
+
+	if (!np)
+		return;
+
+	timings = of_get_display_timings(np);
+	if (timings)
+		*pptim = timings;
+}
This is not documented in your binding.

+static int lsdc_get_connector_type(struct drm_device *ddev,
+				   struct device_node *output,
+				   unsigned int index)
+{
+	const char *name;
+	int ret;
+
+	ret = of_property_read_string(output, "connector", &name);
+	if (ret < 0)
+		return DRM_MODE_CONNECTOR_Unknown;
+
+	if (strncmp(name, "vga-connector", 13) == 0) {
+		ret = DRM_MODE_CONNECTOR_VGA;
+		drm_info(ddev, "connector%d is VGA\n", index);
+	} else if (strncmp(name, "dvi-connector", 13) == 0) {
+		bool analog, digital;
+
+		analog = of_property_read_bool(output, "analog");
+		digital = of_property_read_bool(output, "digital");
+
+		if (analog && !digital)
+			ret = DRM_MODE_CONNECTOR_DVIA;
+		else if (analog && digital)
+			ret = DRM_MODE_CONNECTOR_DVII;
+		else
+			ret = DRM_MODE_CONNECTOR_DVID;
+
+		drm_info(ddev, "connector%d is DVI\n", index);
+	} else if (strncmp(name, "virtual-connector", 17) == 0) {
+		ret = DRM_MODE_CONNECTOR_VIRTUAL;
+		drm_info(ddev, "connector%d is virtual\n", index);
+	} else if (strncmp(name, "dpi-connector", 13) == 0) {
+		ret = DRM_MODE_CONNECTOR_DPI;
+		drm_info(ddev, "connector%d is DPI\n", index);
+	} else if (strncmp(name, "hdmi-connector", 14) == 0) {
+		int res;
+		const char *hdmi_type;
+
+		ret = DRM_MODE_CONNECTOR_HDMIA;
+
+		res = of_property_read_string(output, "type", &hdmi_type);
+		if (res == 0 && !strcmp(hdmi_type, "b"))
+			ret = DRM_MODE_CONNECTOR_HDMIB;
+
+		drm_info(ddev, "connector%d is HDMI, type is %s\n", index, hdmi_type);
+	} else {
+		ret = DRM_MODE_CONNECTOR_Unknown;
+		drm_info(ddev, "The type of connector%d is unknown\n", index);
+	}
+
+	return ret;
+}
Your ports and that you're using the connectors bindings either.

+struct lsdc_connector *lsdc_connector_init(struct lsdc_device *ldev, unsigned int index)
+{
+	struct drm_device *ddev = &ldev->drm;
+	struct device_node *np = ddev->dev->of_node;
+	struct device_node *output = NULL;
+	unsigned int connector_type = DRM_MODE_CONNECTOR_Unknown;
+	struct device_node *disp_tims_np;
+	struct lsdc_connector *lconn;
+	struct drm_connector *connector;
+	int ret;
+
+	lconn = devm_kzalloc(ddev->dev, sizeof(*lconn), GFP_KERNEL);
+	if (!lconn)
+		return ERR_PTR(-ENOMEM);
+
+	lconn->index = index;
+	lconn->has_disp_tim = false;
+	lconn->ddc = NULL;
+
+	output = of_parse_phandle(np, "output-ports", index);
+	if (!output) {
+		drm_warn(ddev, "no output-ports property, please update dtb\n");
+		/*
+		 * Providing a blindly support even though no output-ports
+		 * property is provided in the dtb.
+		 */
+		goto DT_SKIPED;
+	}
output-ports is not documented either.
Thanks for you take time review my patch, i will try to document it at next version.



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux