Commit 0a86b0db authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2022-06-23' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes



Multiple fixes in sun4i for suspend, DDC, DMA setup; A rework of vc4 to
properly split the driver between hardware capabilities that wasn't done
properly causing multiple crashes; and a panel quirk for Aya Neo Next

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220623064152.ubjmnpj7tdejdcw6@houat
parents 382cf35f 85016f66
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -152,6 +152,12 @@ static const struct dmi_system_id orientation_data[] = {
		  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"),
		},
		.driver_data = (void *)&lcd800x1280_rightside_up,
	}, {	/* AYA NEO NEXT */
		.matches = {
		  DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
		  DMI_MATCH(DMI_BOARD_NAME, "NEXT"),
		},
		.driver_data = (void *)&lcd800x1280_rightside_up,
	}, {	/* Chuwi HiBook (CWI514) */
		.matches = {
			DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
+11 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
 */

#include <linux/component.h>
#include <linux/dma-mapping.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/of_graph.h>
@@ -73,7 +74,6 @@ static int sun4i_drv_bind(struct device *dev)
		goto free_drm;
	}

	dev_set_drvdata(dev, drm);
	drm->dev_private = drv;
	INIT_LIST_HEAD(&drv->frontend_list);
	INIT_LIST_HEAD(&drv->engine_list);
@@ -114,6 +114,8 @@ static int sun4i_drv_bind(struct device *dev)

	drm_fbdev_generic_setup(drm, 32);

	dev_set_drvdata(dev, drm);

	return 0;

finish_poll:
@@ -130,6 +132,7 @@ static void sun4i_drv_unbind(struct device *dev)
{
	struct drm_device *drm = dev_get_drvdata(dev);

	dev_set_drvdata(dev, NULL);
	drm_dev_unregister(drm);
	drm_kms_helper_poll_fini(drm);
	drm_atomic_helper_shutdown(drm);
@@ -367,6 +370,13 @@ static int sun4i_drv_probe(struct platform_device *pdev)

	INIT_KFIFO(list.fifo);

	/*
	 * DE2 and DE3 cores actually supports 40-bit addresses, but
	 * driver does not.
	 */
	dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
	dma_set_max_seg_size(&pdev->dev, UINT_MAX);

	for (i = 0;; i++) {
		struct device_node *pipeline = of_parse_phandle(np,
								"allwinner,pipelines",
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static bool sun4i_layer_format_mod_supported(struct drm_plane *plane,
	struct sun4i_layer *layer = plane_to_sun4i_layer(plane);

	if (IS_ERR_OR_NULL(layer->backend->frontend))
		sun4i_backend_format_is_supported(format, modifier);
		return sun4i_backend_format_is_supported(format, modifier);

	return sun4i_backend_format_is_supported(format, modifier) ||
	       sun4i_frontend_format_is_supported(format, modifier);
+4 −50
Original line number Diff line number Diff line
@@ -93,34 +93,10 @@ static u32 sun8i_dw_hdmi_find_possible_crtcs(struct drm_device *drm,
	return crtcs;
}

static int sun8i_dw_hdmi_find_connector_pdev(struct device *dev,
					     struct platform_device **pdev_out)
{
	struct platform_device *pdev;
	struct device_node *remote;

	remote = of_graph_get_remote_node(dev->of_node, 1, -1);
	if (!remote)
		return -ENODEV;

	if (!of_device_is_compatible(remote, "hdmi-connector")) {
		of_node_put(remote);
		return -ENODEV;
	}

	pdev = of_find_device_by_node(remote);
	of_node_put(remote);
	if (!pdev)
		return -ENODEV;

	*pdev_out = pdev;
	return 0;
}

static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
			      void *data)
{
	struct platform_device *pdev = to_platform_device(dev), *connector_pdev;
	struct platform_device *pdev = to_platform_device(dev);
	struct dw_hdmi_plat_data *plat_data;
	struct drm_device *drm = data;
	struct device_node *phy_node;
@@ -167,30 +143,16 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
		return dev_err_probe(dev, PTR_ERR(hdmi->regulator),
				     "Couldn't get regulator\n");

	ret = sun8i_dw_hdmi_find_connector_pdev(dev, &connector_pdev);
	if (!ret) {
		hdmi->ddc_en = gpiod_get_optional(&connector_pdev->dev,
						  "ddc-en", GPIOD_OUT_HIGH);
		platform_device_put(connector_pdev);

		if (IS_ERR(hdmi->ddc_en)) {
			dev_err(dev, "Couldn't get ddc-en gpio\n");
			return PTR_ERR(hdmi->ddc_en);
		}
	}

	ret = regulator_enable(hdmi->regulator);
	if (ret) {
		dev_err(dev, "Failed to enable regulator\n");
		goto err_unref_ddc_en;
		return ret;
	}

	gpiod_set_value(hdmi->ddc_en, 1);

	ret = reset_control_deassert(hdmi->rst_ctrl);
	if (ret) {
		dev_err(dev, "Could not deassert ctrl reset control\n");
		goto err_disable_ddc_en;
		goto err_disable_regulator;
	}

	ret = clk_prepare_enable(hdmi->clk_tmds);
@@ -245,12 +207,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master,
	clk_disable_unprepare(hdmi->clk_tmds);
err_assert_ctrl_reset:
	reset_control_assert(hdmi->rst_ctrl);
err_disable_ddc_en:
	gpiod_set_value(hdmi->ddc_en, 0);
err_disable_regulator:
	regulator_disable(hdmi->regulator);
err_unref_ddc_en:
	if (hdmi->ddc_en)
		gpiod_put(hdmi->ddc_en);

	return ret;
}
@@ -264,11 +222,7 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master,
	sun8i_hdmi_phy_deinit(hdmi->phy);
	clk_disable_unprepare(hdmi->clk_tmds);
	reset_control_assert(hdmi->rst_ctrl);
	gpiod_set_value(hdmi->ddc_en, 0);
	regulator_disable(hdmi->regulator);

	if (hdmi->ddc_en)
		gpiod_put(hdmi->ddc_en);
}

static const struct component_ops sun8i_dw_hdmi_ops = {
+0 −2
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include <drm/bridge/dw_hdmi.h>
#include <drm/drm_encoder.h>
#include <linux/clk.h>
#include <linux/gpio/consumer.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
@@ -193,7 +192,6 @@ struct sun8i_dw_hdmi {
	struct regulator		*regulator;
	const struct sun8i_dw_hdmi_quirks *quirks;
	struct reset_control		*rst_ctrl;
	struct gpio_desc		*ddc_en;
};

extern struct platform_driver sun8i_hdmi_phy_driver;
Loading