All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Brace <kevinbrace@gmx.com>
To: dri-devel@lists.freedesktop.org
Cc: Kevin Brace <kevinbrace@bracecomputerlab.com>
Subject: [PATCH 10/28] drm/via: Add via_display.c
Date: Fri, 24 Jun 2022 15:26:15 -0500	[thread overview]
Message-ID: <20220624202633.3978-11-kevinbrace@gmx.com> (raw)
In-Reply-To: <20220624202633.3978-1-kevinbrace@gmx.com>

From: Kevin Brace <kevinbrace@bracecomputerlab.com>

Signed-off-by: Kevin Brace <kevinbrace@bracecomputerlab.com>
---
 drivers/gpu/drm/via/via_display.c | 125 ++++++++++++++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 drivers/gpu/drm/via/via_display.c

diff --git a/drivers/gpu/drm/via/via_display.c b/drivers/gpu/drm/via/via_display.c
new file mode 100644
index 000000000000..2f82764038c0
--- /dev/null
+++ b/drivers/gpu/drm/via/via_display.c
@@ -0,0 +1,125 @@
+/*
+ * Copyright © 2017-2020 Kevin Brace.
+ * Copyright 2012 James Simmons. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Author(s):
+ * Kevin Brace <kevinbrace@bracecomputerlab.com>
+ * James Simmons <jsimmons@infradead.org>
+ */
+
+#include <linux/pci.h>
+
+#include <drm/drm_crtc.h>
+#include <drm/drm_crtc_helper.h>
+#include <drm/drm_probe_helper.h>
+
+#include "via_drv.h"
+
+void via_encoder_cleanup(struct drm_encoder *encoder)
+{
+	struct via_encoder *enc = container_of(encoder, struct via_encoder, base);
+
+	drm_encoder_cleanup(encoder);
+	kfree(enc);
+}
+
+void via_connector_destroy(struct drm_connector *connector)
+{
+	struct via_connector *con = container_of(connector, struct via_connector, base);
+	struct drm_property *property, *tmp;
+
+	list_for_each_entry_safe(property, tmp, &con->props, head)
+		drm_property_destroy(connector->dev, property);
+	list_del(&con->props);
+
+	drm_connector_update_edid_property(connector, NULL);
+	drm_connector_unregister(connector);
+	drm_connector_cleanup(connector);
+}
+
+int via_modeset_init(struct drm_device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev->dev);
+	struct via_drm_priv *dev_priv = to_via_drm_priv(dev);
+	uint32_t i;
+	int ret = 0;
+
+	via_mode_config_init(dev_priv);
+
+	/* Initialize the number of display connectors. */
+	dev_priv->number_fp = 0;
+	dev_priv->number_dvi = 0;
+
+	via_i2c_reg_init(dev_priv);
+	ret = via_i2c_init(dev);
+	if (ret) {
+		DRM_ERROR("Failed to initialize I2C bus!\n");
+		goto exit;
+	}
+
+	for (i = 0; i < VIA_MAX_CRTC; i++) {
+		ret = via_crtc_init(dev_priv, i);
+		if (ret) {
+			goto exit;
+		}
+	}
+
+	via_ext_dvi_probe(dev);
+	via_tmds_probe(dev);
+
+	via_lvds_probe(dev);
+
+	via_dac_probe(dev);
+
+
+	via_ext_dvi_init(dev);
+	via_tmds_init(dev);
+
+	via_dac_init(dev);
+
+	via_lvds_init(dev);
+
+	switch (pdev->device) {
+	case PCI_DEVICE_ID_VIA_VX900_VGA:
+		via_hdmi_init(dev, VIA_DI_PORT_NONE);
+		break;
+	default:
+		break;
+	}
+
+	drm_mode_config_reset(dev);
+
+	drm_kms_helper_poll_init(dev);
+exit:
+	return ret;
+}
+
+void via_modeset_fini(struct drm_device *dev)
+{
+	drm_kms_helper_poll_fini(dev);
+
+	drm_helper_force_disable_all(dev);
+
+	drm_mode_config_cleanup(dev);
+
+	via_i2c_exit();
+}
--
2.35.1


  parent reply	other threads:[~2022-06-24 20:28 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-24 20:26 [PATCH 00/28] OpenChrome DRM for Linux 5.20 Kevin Brace
2022-06-24 20:26 ` [PATCH 01/28] drm/via: Add via_3d_reg.h Kevin Brace
2022-06-24 20:26 ` [PATCH 02/28] drm/via: Add via_crtc_hw.h Kevin Brace
2022-06-24 20:26 ` [PATCH 03/28] drm/via: Add via_disp_reg.h Kevin Brace
2022-06-24 20:26 ` [PATCH 04/28] drm/via: Add via_drv.h Kevin Brace
2022-06-25  6:51   ` Sam Ravnborg
2022-06-28 14:33     ` Jani Nikula
2022-06-28 14:32   ` Jani Nikula
2022-06-24 20:26 ` [PATCH 05/28] drm/via: Add via_regs.h Kevin Brace
2022-06-24 20:26 ` [PATCH 06/28] drm/via: Add via_crtc.c Kevin Brace
2022-06-24 20:26 ` [PATCH 07/28] drm/via: Add via_crtc_hw.c Kevin Brace
2022-06-24 20:26 ` [PATCH 08/28] drm/via: Add via_cursor.c Kevin Brace
2022-06-25  6:59   ` Sam Ravnborg
2022-06-24 20:26 ` [PATCH 09/28] drm/via: Add via_dac.c Kevin Brace
2022-06-24 20:26 ` Kevin Brace [this message]
2022-06-24 20:26 ` [PATCH 11/28] drm/via: Add via_drv.c Kevin Brace
2022-06-25  7:15   ` Sam Ravnborg
2022-06-24 20:26 ` [PATCH 12/28] drm/via: Add via_encoder.c Kevin Brace
2022-06-24 20:26 ` [PATCH 13/28] drm/via: Add via_hdmi.c Kevin Brace
2022-06-24 20:26 ` [PATCH 14/28] drm/via: Add via_i2c.c Kevin Brace
2022-06-24 20:26 ` [PATCH 15/28] drm/via: Add via_init.c Kevin Brace
2022-06-24 20:26 ` [PATCH 16/28] drm/via: Add via_ioctl.c Kevin Brace
2022-06-24 20:26 ` [PATCH 17/28] drm/via: Add via_lvds.c Kevin Brace
2022-06-24 20:26 ` [PATCH 18/28] drm/via: Add via_object.c Kevin Brace
2022-06-24 20:26 ` [PATCH 19/28] drm/via: Add via_pll.c Kevin Brace
2022-06-24 21:15 ` [PATCH 00/28] OpenChrome DRM for Linux 5.20 Sam Ravnborg
2022-06-24 23:14   ` Kevin Brace
2022-06-27  7:37 ` Thomas Zimmermann
2022-06-27 21:32   ` Sam Ravnborg
2022-06-28 12:21     ` Thomas Zimmermann
2022-06-30  8:07       ` Javier Martinez Canillas
2022-06-30  8:19         ` Thomas Zimmermann
2022-06-30  8:27           ` Javier Martinez Canillas
2022-06-30  8:33           ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220624202633.3978-11-kevinbrace@gmx.com \
    --to=kevinbrace@gmx.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kevinbrace@bracecomputerlab.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.