mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
6c56e8adc0
UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuXvWqAysSYEJGuVH/lWMcqZwE8MFAl34lkkACgkQ/lWMcqZw E8M76g//WRYl9fWnV063s44FBVJYjGxaus0vQJSGidaPCIE6Ep6TNjXp8DVzV82M HR79P9glL02DC9B8pflioNNXdIRGSVk/FJcKVB2seFAqEFCAknvWDM/X/y+mOUpp fUeFl+Znlwx3YlM8f4Qujdbm+CbTewfbya4VAWeWd8XG2V8jfq5cmODPPlUMNenZ J6Ja+W3ph741uSIfAKaP69LVJgOcuUjXINE4SWhRk/i5QF3GIRej/A7ZjWGLQ/t2 2zUUF7EiCzhPomM40H3ddKtXb4ZjNJuc5pOD4GpxR8ciNbe2gUOHEZ5aenwYBdsU 5MwbxNKyMbKXATtn3yv3fSc4jH3DtmEKpmovONeO8ZDBrQBnxeYa3tQvfkNghA2f acoZMzYUImV+ft6DMIgpXppASvo7mQYDAbLPOGEJ9E44AL4UP00jesEjnK5FOHSR 3BEzGUnK/6QL5zFNPni8YZQ8dan4jDIno1mqIV+cQ4WCGlaKckzIWO6243Bf13b/ kROSJpgWkiK6Ngq0ofhD0MHyT/m1QnqUzWRKTJhRtPflSWRBsDZqWCQ5Vx1QlNIE /HfTNbTpXWwa+5wXbbB8TkDw5t9cQGnR+QcrEd9HgoIec7B5Re8rx9i0TJAT4N05 03RCQCecSfD8gwKd2wgaFIpFGRl9lTdLYSpffSmyL2X5a20lZhM= =b15X -----END PGP SIGNATURE----- Merge tag 'drm-misc-next-2019-12-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for v5.6: UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
253 lines
5.7 KiB
C
253 lines
5.7 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2012 Avionic Design GmbH
|
|
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
|
|
*/
|
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
#include <drm/drm_panel.h>
|
|
|
|
#include "drm.h"
|
|
#include "dc.h"
|
|
|
|
#include <media/cec-notifier.h>
|
|
|
|
int tegra_output_connector_get_modes(struct drm_connector *connector)
|
|
{
|
|
struct tegra_output *output = connector_to_output(connector);
|
|
struct edid *edid = NULL;
|
|
int err = 0;
|
|
|
|
/*
|
|
* If the panel provides one or more modes, use them exclusively and
|
|
* ignore any other means of obtaining a mode.
|
|
*/
|
|
if (output->panel) {
|
|
err = drm_panel_get_modes(output->panel, connector);
|
|
if (err > 0)
|
|
return err;
|
|
}
|
|
|
|
if (output->edid)
|
|
edid = kmemdup(output->edid, sizeof(*edid), GFP_KERNEL);
|
|
else if (output->ddc)
|
|
edid = drm_get_edid(connector, output->ddc);
|
|
|
|
cec_notifier_set_phys_addr_from_edid(output->cec, edid);
|
|
drm_connector_update_edid_property(connector, edid);
|
|
|
|
if (edid) {
|
|
err = drm_add_edid_modes(connector, edid);
|
|
kfree(edid);
|
|
}
|
|
|
|
return err;
|
|
}
|
|
|
|
enum drm_connector_status
|
|
tegra_output_connector_detect(struct drm_connector *connector, bool force)
|
|
{
|
|
struct tegra_output *output = connector_to_output(connector);
|
|
enum drm_connector_status status = connector_status_unknown;
|
|
|
|
if (output->hpd_gpio) {
|
|
if (gpiod_get_value(output->hpd_gpio) == 0)
|
|
status = connector_status_disconnected;
|
|
else
|
|
status = connector_status_connected;
|
|
} else {
|
|
if (!output->panel)
|
|
status = connector_status_disconnected;
|
|
else
|
|
status = connector_status_connected;
|
|
}
|
|
|
|
if (status != connector_status_connected)
|
|
cec_notifier_phys_addr_invalidate(output->cec);
|
|
|
|
return status;
|
|
}
|
|
|
|
void tegra_output_connector_destroy(struct drm_connector *connector)
|
|
{
|
|
struct tegra_output *output = connector_to_output(connector);
|
|
|
|
if (output->cec)
|
|
cec_notifier_conn_unregister(output->cec);
|
|
|
|
drm_connector_unregister(connector);
|
|
drm_connector_cleanup(connector);
|
|
}
|
|
|
|
void tegra_output_encoder_destroy(struct drm_encoder *encoder)
|
|
{
|
|
drm_encoder_cleanup(encoder);
|
|
}
|
|
|
|
static irqreturn_t hpd_irq(int irq, void *data)
|
|
{
|
|
struct tegra_output *output = data;
|
|
|
|
if (output->connector.dev)
|
|
drm_helper_hpd_irq_event(output->connector.dev);
|
|
|
|
return IRQ_HANDLED;
|
|
}
|
|
|
|
int tegra_output_probe(struct tegra_output *output)
|
|
{
|
|
struct device_node *ddc, *panel;
|
|
unsigned long flags;
|
|
int err, size;
|
|
|
|
if (!output->of_node)
|
|
output->of_node = output->dev->of_node;
|
|
|
|
panel = of_parse_phandle(output->of_node, "nvidia,panel", 0);
|
|
if (panel) {
|
|
output->panel = of_drm_find_panel(panel);
|
|
if (IS_ERR(output->panel))
|
|
return PTR_ERR(output->panel);
|
|
|
|
of_node_put(panel);
|
|
}
|
|
|
|
output->edid = of_get_property(output->of_node, "nvidia,edid", &size);
|
|
|
|
ddc = of_parse_phandle(output->of_node, "nvidia,ddc-i2c-bus", 0);
|
|
if (ddc) {
|
|
output->ddc = of_find_i2c_adapter_by_node(ddc);
|
|
if (!output->ddc) {
|
|
err = -EPROBE_DEFER;
|
|
of_node_put(ddc);
|
|
return err;
|
|
}
|
|
|
|
of_node_put(ddc);
|
|
}
|
|
|
|
output->hpd_gpio = devm_gpiod_get_from_of_node(output->dev,
|
|
output->of_node,
|
|
"nvidia,hpd-gpio", 0,
|
|
GPIOD_IN,
|
|
"HDMI hotplug detect");
|
|
if (IS_ERR(output->hpd_gpio)) {
|
|
if (PTR_ERR(output->hpd_gpio) != -ENOENT)
|
|
return PTR_ERR(output->hpd_gpio);
|
|
|
|
output->hpd_gpio = NULL;
|
|
}
|
|
|
|
if (output->hpd_gpio) {
|
|
err = gpiod_to_irq(output->hpd_gpio);
|
|
if (err < 0) {
|
|
dev_err(output->dev, "gpiod_to_irq(): %d\n", err);
|
|
return err;
|
|
}
|
|
|
|
output->hpd_irq = err;
|
|
|
|
flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
|
|
IRQF_ONESHOT;
|
|
|
|
err = request_threaded_irq(output->hpd_irq, NULL, hpd_irq,
|
|
flags, "hpd", output);
|
|
if (err < 0) {
|
|
dev_err(output->dev, "failed to request IRQ#%u: %d\n",
|
|
output->hpd_irq, err);
|
|
return err;
|
|
}
|
|
|
|
output->connector.polled = DRM_CONNECTOR_POLL_HPD;
|
|
|
|
/*
|
|
* Disable the interrupt until the connector has been
|
|
* initialized to avoid a race in the hotplug interrupt
|
|
* handler.
|
|
*/
|
|
disable_irq(output->hpd_irq);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void tegra_output_remove(struct tegra_output *output)
|
|
{
|
|
if (output->hpd_gpio)
|
|
free_irq(output->hpd_irq, output);
|
|
|
|
if (output->ddc)
|
|
put_device(&output->ddc->dev);
|
|
}
|
|
|
|
int tegra_output_init(struct drm_device *drm, struct tegra_output *output)
|
|
{
|
|
int connector_type;
|
|
int err;
|
|
|
|
if (output->panel) {
|
|
err = drm_panel_attach(output->panel, &output->connector);
|
|
if (err < 0)
|
|
return err;
|
|
}
|
|
|
|
/*
|
|
* The connector is now registered and ready to receive hotplug events
|
|
* so the hotplug interrupt can be enabled.
|
|
*/
|
|
if (output->hpd_gpio)
|
|
enable_irq(output->hpd_irq);
|
|
|
|
connector_type = output->connector.connector_type;
|
|
/*
|
|
* Create a CEC notifier for HDMI connector.
|
|
*/
|
|
if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
|
|
connector_type == DRM_MODE_CONNECTOR_HDMIB) {
|
|
struct cec_connector_info conn_info;
|
|
|
|
cec_fill_conn_info_from_drm(&conn_info, &output->connector);
|
|
output->cec = cec_notifier_conn_register(output->dev, NULL,
|
|
&conn_info);
|
|
if (!output->cec)
|
|
return -ENOMEM;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void tegra_output_exit(struct tegra_output *output)
|
|
{
|
|
/*
|
|
* The connector is going away, so the interrupt must be disabled to
|
|
* prevent the hotplug interrupt handler from potentially crashing.
|
|
*/
|
|
if (output->hpd_gpio)
|
|
disable_irq(output->hpd_irq);
|
|
|
|
if (output->panel)
|
|
drm_panel_detach(output->panel);
|
|
}
|
|
|
|
void tegra_output_find_possible_crtcs(struct tegra_output *output,
|
|
struct drm_device *drm)
|
|
{
|
|
struct device *dev = output->dev;
|
|
struct drm_crtc *crtc;
|
|
unsigned int mask = 0;
|
|
|
|
drm_for_each_crtc(crtc, drm) {
|
|
struct tegra_dc *dc = to_tegra_dc(crtc);
|
|
|
|
if (tegra_dc_has_output(dc, dev))
|
|
mask |= drm_crtc_mask(crtc);
|
|
}
|
|
|
|
if (mask == 0) {
|
|
dev_warn(dev, "missing output definition for heads in DT\n");
|
|
mask = 0x3;
|
|
}
|
|
|
|
output->encoder.possible_crtcs = mask;
|
|
}
|