forked from luck/tmp_suning_uos_patched
A few DMA-related fixes, an OOB fix for virtio and a probe-related fix for
analogix_dp -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCXo7nVgAKCRDj7w1vZxhR xZT+AP9i6qVtOQo9uB0DVZbpB2tc8G0h1afHnnsp1cIksXr6JwEAy9UjIHH0anh5 WZwptuq2aiMmGcQgHgvZPp2xSt4Esg4= =J8n9 -----END PGP SIGNATURE----- Merge tag 'drm-misc-next-fixes-2020-04-09' of git://anongit.freedesktop.org/drm/drm-misc into drm-next A few DMA-related fixes, an OOB fix for virtio and a probe-related fix for analogix_dp Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20200409091424.cfpqqbqjxtkgnfme@gilmour.lan
This commit is contained in:
commit
cb6d406641
|
@ -1652,8 +1652,7 @@ static ssize_t analogix_dpaux_transfer(struct drm_dp_aux *aux,
|
|||
}
|
||||
|
||||
struct analogix_dp_device *
|
||||
analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
|
||||
struct analogix_dp_plat_data *plat_data)
|
||||
analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct analogix_dp_device *dp;
|
||||
|
@ -1756,22 +1755,30 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
|
|||
irq_flags, "analogix-dp", dp);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to request irq\n");
|
||||
goto err_disable_pm_runtime;
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
disable_irq(dp->irq);
|
||||
|
||||
return dp;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(analogix_dp_probe);
|
||||
|
||||
int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dp->drm_dev = drm_dev;
|
||||
dp->encoder = dp->plat_data->encoder;
|
||||
|
||||
dp->aux.name = "DP-AUX";
|
||||
dp->aux.transfer = analogix_dpaux_transfer;
|
||||
dp->aux.dev = &pdev->dev;
|
||||
dp->aux.dev = dp->dev;
|
||||
|
||||
ret = drm_dp_aux_register(&dp->aux);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
return ret;
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
pm_runtime_enable(dp->dev);
|
||||
|
||||
ret = analogix_dp_create_bridge(drm_dev, dp);
|
||||
if (ret) {
|
||||
|
@ -1779,13 +1786,12 @@ analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
|
|||
goto err_disable_pm_runtime;
|
||||
}
|
||||
|
||||
return dp;
|
||||
return 0;
|
||||
|
||||
err_disable_pm_runtime:
|
||||
pm_runtime_disable(dp->dev);
|
||||
|
||||
pm_runtime_disable(dev);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(analogix_dp_bind);
|
||||
|
||||
|
@ -1802,10 +1808,15 @@ void analogix_dp_unbind(struct analogix_dp_device *dp)
|
|||
|
||||
drm_dp_aux_unregister(&dp->aux);
|
||||
pm_runtime_disable(dp->dev);
|
||||
clk_disable_unprepare(dp->clock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(analogix_dp_unbind);
|
||||
|
||||
void analogix_dp_remove(struct analogix_dp_device *dp)
|
||||
{
|
||||
clk_disable_unprepare(dp->clock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(analogix_dp_remove);
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int analogix_dp_suspend(struct analogix_dp_device *dp)
|
||||
{
|
||||
|
|
|
@ -962,27 +962,40 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
|
|||
unsigned count;
|
||||
struct scatterlist *sg;
|
||||
struct page *page;
|
||||
u32 len, index;
|
||||
u32 page_len, page_index;
|
||||
dma_addr_t addr;
|
||||
u32 dma_len, dma_index;
|
||||
|
||||
index = 0;
|
||||
/*
|
||||
* Scatterlist elements contains both pages and DMA addresses, but
|
||||
* one shoud not assume 1:1 relation between them. The sg->length is
|
||||
* the size of the physical memory chunk described by the sg->page,
|
||||
* while sg_dma_len(sg) is the size of the DMA (IO virtual) chunk
|
||||
* described by the sg_dma_address(sg).
|
||||
*/
|
||||
page_index = 0;
|
||||
dma_index = 0;
|
||||
for_each_sg(sgt->sgl, sg, sgt->nents, count) {
|
||||
len = sg_dma_len(sg);
|
||||
page_len = sg->length;
|
||||
page = sg_page(sg);
|
||||
dma_len = sg_dma_len(sg);
|
||||
addr = sg_dma_address(sg);
|
||||
|
||||
while (len > 0) {
|
||||
if (WARN_ON(index >= max_entries))
|
||||
while (pages && page_len > 0) {
|
||||
if (WARN_ON(page_index >= max_entries))
|
||||
return -1;
|
||||
if (pages)
|
||||
pages[index] = page;
|
||||
if (addrs)
|
||||
addrs[index] = addr;
|
||||
|
||||
pages[page_index] = page;
|
||||
page++;
|
||||
page_len -= PAGE_SIZE;
|
||||
page_index++;
|
||||
}
|
||||
while (addrs && dma_len > 0) {
|
||||
if (WARN_ON(dma_index >= max_entries))
|
||||
return -1;
|
||||
addrs[dma_index] = addr;
|
||||
addr += PAGE_SIZE;
|
||||
len -= PAGE_SIZE;
|
||||
index++;
|
||||
dma_len -= PAGE_SIZE;
|
||||
dma_index++;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -159,15 +159,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
|
|||
struct drm_device *drm_dev = data;
|
||||
int ret;
|
||||
|
||||
dp->dev = dev;
|
||||
dp->drm_dev = drm_dev;
|
||||
|
||||
dp->plat_data.dev_type = EXYNOS_DP;
|
||||
dp->plat_data.power_on_start = exynos_dp_poweron;
|
||||
dp->plat_data.power_off = exynos_dp_poweroff;
|
||||
dp->plat_data.attach = exynos_dp_bridge_attach;
|
||||
dp->plat_data.get_modes = exynos_dp_get_modes;
|
||||
|
||||
if (!dp->plat_data.panel && !dp->ptn_bridge) {
|
||||
ret = exynos_dp_dt_parse_panel(dp);
|
||||
if (ret)
|
||||
|
@ -185,13 +178,11 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)
|
|||
|
||||
dp->plat_data.encoder = encoder;
|
||||
|
||||
dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
|
||||
if (IS_ERR(dp->adp)) {
|
||||
ret = analogix_dp_bind(dp->adp, dp->drm_dev);
|
||||
if (ret)
|
||||
dp->encoder.funcs->destroy(&dp->encoder);
|
||||
return PTR_ERR(dp->adp);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void exynos_dp_unbind(struct device *dev, struct device *master,
|
||||
|
@ -222,6 +213,7 @@ static int exynos_dp_probe(struct platform_device *pdev)
|
|||
if (!dp)
|
||||
return -ENOMEM;
|
||||
|
||||
dp->dev = dev;
|
||||
/*
|
||||
* We just use the drvdata until driver run into component
|
||||
* add function, and then we would set drvdata to null, so
|
||||
|
@ -247,16 +239,29 @@ static int exynos_dp_probe(struct platform_device *pdev)
|
|||
|
||||
/* The remote port can be either a panel or a bridge */
|
||||
dp->plat_data.panel = panel;
|
||||
dp->plat_data.dev_type = EXYNOS_DP;
|
||||
dp->plat_data.power_on_start = exynos_dp_poweron;
|
||||
dp->plat_data.power_off = exynos_dp_poweroff;
|
||||
dp->plat_data.attach = exynos_dp_bridge_attach;
|
||||
dp->plat_data.get_modes = exynos_dp_get_modes;
|
||||
dp->plat_data.skip_connector = !!bridge;
|
||||
|
||||
dp->ptn_bridge = bridge;
|
||||
|
||||
out:
|
||||
dp->adp = analogix_dp_probe(dev, &dp->plat_data);
|
||||
if (IS_ERR(dp->adp))
|
||||
return PTR_ERR(dp->adp);
|
||||
|
||||
return component_add(&pdev->dev, &exynos_dp_ops);
|
||||
}
|
||||
|
||||
static int exynos_dp_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct exynos_dp_device *dp = platform_get_drvdata(pdev);
|
||||
|
||||
component_del(&pdev->dev, &exynos_dp_ops);
|
||||
analogix_dp_remove(dp->adp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -325,15 +325,9 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
|
|||
void *data)
|
||||
{
|
||||
struct rockchip_dp_device *dp = dev_get_drvdata(dev);
|
||||
const struct rockchip_dp_chip_data *dp_data;
|
||||
struct drm_device *drm_dev = data;
|
||||
int ret;
|
||||
|
||||
dp_data = of_device_get_match_data(dev);
|
||||
if (!dp_data)
|
||||
return -ENODEV;
|
||||
|
||||
dp->data = dp_data;
|
||||
dp->drm_dev = drm_dev;
|
||||
|
||||
ret = rockchip_dp_drm_create_encoder(dp);
|
||||
|
@ -344,16 +338,9 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
|
|||
|
||||
dp->plat_data.encoder = &dp->encoder;
|
||||
|
||||
dp->plat_data.dev_type = dp->data->chip_type;
|
||||
dp->plat_data.power_on_start = rockchip_dp_poweron_start;
|
||||
dp->plat_data.power_off = rockchip_dp_powerdown;
|
||||
dp->plat_data.get_modes = rockchip_dp_get_modes;
|
||||
|
||||
dp->adp = analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
|
||||
if (IS_ERR(dp->adp)) {
|
||||
ret = PTR_ERR(dp->adp);
|
||||
ret = analogix_dp_bind(dp->adp, drm_dev);
|
||||
if (ret)
|
||||
goto err_cleanup_encoder;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err_cleanup_encoder:
|
||||
|
@ -368,8 +355,6 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master,
|
|||
|
||||
analogix_dp_unbind(dp->adp);
|
||||
dp->encoder.funcs->destroy(&dp->encoder);
|
||||
|
||||
dp->adp = ERR_PTR(-ENODEV);
|
||||
}
|
||||
|
||||
static const struct component_ops rockchip_dp_component_ops = {
|
||||
|
@ -380,10 +365,15 @@ static const struct component_ops rockchip_dp_component_ops = {
|
|||
static int rockchip_dp_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
const struct rockchip_dp_chip_data *dp_data;
|
||||
struct drm_panel *panel = NULL;
|
||||
struct rockchip_dp_device *dp;
|
||||
int ret;
|
||||
|
||||
dp_data = of_device_get_match_data(dev);
|
||||
if (!dp_data)
|
||||
return -ENODEV;
|
||||
|
||||
ret = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
@ -394,7 +384,12 @@ static int rockchip_dp_probe(struct platform_device *pdev)
|
|||
|
||||
dp->dev = dev;
|
||||
dp->adp = ERR_PTR(-ENODEV);
|
||||
dp->data = dp_data;
|
||||
dp->plat_data.panel = panel;
|
||||
dp->plat_data.dev_type = dp->data->chip_type;
|
||||
dp->plat_data.power_on_start = rockchip_dp_poweron_start;
|
||||
dp->plat_data.power_off = rockchip_dp_powerdown;
|
||||
dp->plat_data.get_modes = rockchip_dp_get_modes;
|
||||
|
||||
ret = rockchip_dp_of_probe(dp);
|
||||
if (ret < 0)
|
||||
|
@ -402,12 +397,19 @@ static int rockchip_dp_probe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, dp);
|
||||
|
||||
dp->adp = analogix_dp_probe(dev, &dp->plat_data);
|
||||
if (IS_ERR(dp->adp))
|
||||
return PTR_ERR(dp->adp);
|
||||
|
||||
return component_add(dev, &rockchip_dp_component_ops);
|
||||
}
|
||||
|
||||
static int rockchip_dp_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rockchip_dp_device *dp = platform_get_drvdata(pdev);
|
||||
|
||||
component_del(&pdev->dev, &rockchip_dp_component_ops);
|
||||
analogix_dp_remove(dp->adp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -123,15 +123,17 @@ bool virtio_gpu_is_shmem(struct virtio_gpu_object *bo)
|
|||
struct drm_gem_object *virtio_gpu_create_object(struct drm_device *dev,
|
||||
size_t size)
|
||||
{
|
||||
struct virtio_gpu_object *bo;
|
||||
struct virtio_gpu_object_shmem *shmem;
|
||||
struct drm_gem_shmem_object *dshmem;
|
||||
|
||||
bo = kzalloc(sizeof(*bo), GFP_KERNEL);
|
||||
if (!bo)
|
||||
shmem = kzalloc(sizeof(*shmem), GFP_KERNEL);
|
||||
if (!shmem)
|
||||
return NULL;
|
||||
|
||||
bo->base.base.funcs = &virtio_gpu_shmem_funcs;
|
||||
bo->base.map_cached = true;
|
||||
return &bo->base.base;
|
||||
dshmem = &shmem->base.base;
|
||||
dshmem->base.funcs = &virtio_gpu_shmem_funcs;
|
||||
dshmem->map_cached = true;
|
||||
return &dshmem->base;
|
||||
}
|
||||
|
||||
static int virtio_gpu_object_shmem_init(struct virtio_gpu_device *vgdev,
|
||||
|
|
|
@ -42,9 +42,10 @@ int analogix_dp_resume(struct analogix_dp_device *dp);
|
|||
int analogix_dp_suspend(struct analogix_dp_device *dp);
|
||||
|
||||
struct analogix_dp_device *
|
||||
analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
|
||||
struct analogix_dp_plat_data *plat_data);
|
||||
analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data);
|
||||
int analogix_dp_bind(struct analogix_dp_device *dp, struct drm_device *drm_dev);
|
||||
void analogix_dp_unbind(struct analogix_dp_device *dp);
|
||||
void analogix_dp_remove(struct analogix_dp_device *dp);
|
||||
|
||||
int analogix_dp_start_crc(struct drm_connector *connector);
|
||||
int analogix_dp_stop_crc(struct drm_connector *connector);
|
||||
|
|
|
@ -136,7 +136,7 @@ struct drm_sg_mem {
|
|||
* Kernel side of a mapping
|
||||
*/
|
||||
struct drm_local_map {
|
||||
resource_size_t offset; /**< Requested physical address (0 for SAREA)*/
|
||||
dma_addr_t offset; /**< Requested physical address (0 for SAREA)*/
|
||||
unsigned long size; /**< Requested physical size (bytes) */
|
||||
enum drm_map_type type; /**< Type of memory to map */
|
||||
enum drm_map_flags flags; /**< Flags */
|
||||
|
|
Loading…
Reference in New Issue
Block a user