From patchwork Mon Aug 19 23:03:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 11102321 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA6DA1399 for ; Mon, 19 Aug 2019 23:04:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B46CA22CEC for ; Mon, 19 Aug 2019 23:04:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B46CA22CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB2F66E487; Mon, 19 Aug 2019 23:03:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3BB406E47C for ; Mon, 19 Aug 2019 23:03:49 +0000 (UTC) Received: by mail-pg1-x541.google.com with SMTP id w10so2034060pgj.7 for ; Mon, 19 Aug 2019 16:03:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=bTIjcPw3XddAy3VLMgsXwaOzvSjUNVMMpdFK/T3Znz3+0uQLSlAp0w8+UvlHbFV4vM glTv7sLGs0Cl/FshouYGdi3Dukvncb80MBfIwpNYFWSCZGO0nrdq8xld7C3ySfQtT3+X 7uhHm0WRyE9OM9cADgIrg1nigL/JQmbowwskZBYs69TmbfXgaOT0DvuISvROo9TJtKpB 0o6GHgY4NBUvJVtJw1vlYsRTt54FS4laFCOiRVmtUUxltjpNwpibCoQ5joTqjYLu1Zj9 Cl0ufHhNQgKuuoXX1Axtw9t/T7xdlmdzeD4o1UrcOKXTQqPrJYIitDUAx48xMEmctB5+ Kl4g== X-Gm-Message-State: APjAAAUSC14xs8b/Zxv7uuL92/4E43ZEyOilTi1I0XwsPeHQsh9ws8dd mAkBmUsuZMGEtpeqnwvtWJ6LHw== X-Google-Smtp-Source: APXvYqxGlTATZutwqllpn0Cdq6dR8Gqs5Xkn+OaYXid2MpAdEyXcQQ11zpaOyj6EORGBwrrjFzG+hA== X-Received: by 2002:a17:90a:650c:: with SMTP id i12mr23034754pjj.11.1566255828114; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:47 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v4 15/25] drm: kirin: Move mode config function to driver_data Date: Mon, 19 Aug 2019 23:03:11 +0000 Message-Id: <20190819230321.56480-16-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=mIK1wiCGCfCbW9eeYKsjGhEfiwX87TUJabWOr/z7riNobTnag2/wiOzDocjjPydHwk MHz7laeYwFopBqLOhN+pbIqU4csA2GjPSK+tnZ4KyZoz59wWajqDy9W5AkNjXNuIVQuX bjxvFHTVH7cEdxB+a7/i5rxeGf3k6Nxy8P9s3JmIxF/mBOzjXNiwFyTiSowA1cPRXJqC ULqerCtuQtvQjug5pS5mdfYhX0M/m4u7m3z8eZaZVYlrsaCQz53DrklKlBKInbP40o0l 3hAIviRyvG7f+95YRh5I6MEUEkjll7Bh0iKStDESsJABXxXjjFkQA1mn24z7wQYbM2wb 5UTQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xu YiPing , David Airlie , dri-devel , Xinliang Liu , Rongrong Zou , Sam Ravnborg MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the mode config initialization values into the kirin_drm_data structure. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index cf542430a659..4001f060e580 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" @@ -1038,6 +1039,13 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } +static const struct drm_mode_config_funcs ade_mode_config_funcs = { + .fb_create = drm_gem_fb_create, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, + +}; + struct kirin_drm_data ade_driver_data = { .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), @@ -1045,6 +1053,8 @@ struct kirin_drm_data ade_driver_data = { .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, .plane_funcs = &ade_plane_funcs, + .mode_config_funcs = &ade_mode_config_funcs, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 3d22f944a840..25191824b64e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -40,12 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { - .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, -}; - static void kirin_drm_mode_config_init(struct drm_device *dev) { dev->mode_config.min_width = 0; @@ -54,7 +48,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev) dev->mode_config.max_width = 2048; dev->mode_config.max_height = 2048; - dev->mode_config.funcs = &kirin_drm_mode_config_funcs; + dev->mode_config.funcs = driver_data->mode_config_funcs; } static int kirin_drm_kms_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 66916502a9e6..ce9ddccc67a8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -42,7 +42,7 @@ struct kirin_drm_data { const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs; const struct drm_plane_funcs *plane_funcs; - + const struct drm_mode_config_funcs *mode_config_funcs; int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); };