From patchwork Thu Aug 1 03:44:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 170300 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4836535ile; Wed, 31 Jul 2019 20:45:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfj1CjkWhFNMEq0FkbY9+wkUPhngY7ubQ+SSlzYdOuoybEj0G2MCkez+DQcOjKlb0GrT5q X-Received: by 2002:a63:5048:: with SMTP id q8mr115319415pgl.446.1564631120736; Wed, 31 Jul 2019 20:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564631120; cv=none; d=google.com; s=arc-20160816; b=OCzyrzqMSRYYmoXiP2RcsN0rpfK78MyYoH/1T+GRLO9fxq9hjCDdIYHekRPNAapg9K zWflo1VtJDf2RmtZkYi+IFWb8TXV4dokoRizQoGvd7zxPwd0AOxGbic0AL1yzRiJdRJx mcVvmCqb22FcPKB4vwA836Yrx9qm5Bf/js0k12a+1aDC62WGSwtPMx2mM1TGzKFkzOzY ffrFNoFP1l+jaSQBhRrHbfRKIX1qg3TXv1ioq4MdzjKkaB7QZ8Nhjj4ytfd5ROAwxkzK 0SFI2IjSJl5C0BtXVTWTM9+g5NOMm17Z4okUdKcvBTsdxxw9c/bfvVPO+5cuBXV5riZR xZTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:delivered-to; bh=SiZifo+o6zv4LCM0lA/Q7d7fZp9urgMA1QOXh1bS0GA=; b=uBweD3UJPOMhj+bEr/xkA3D+0FeJifUAxGHuqtIJTu0IC9DItClE+cbuuvoo8VHBZK +BgzBihpWW+kLBgYc39j3Lq+OBKnFYDqUqxtTDJTc3V6B5l3nihFSrqbelFh7QUICjpQ yAunZgfuHSEZ1LXI49KYJZhcD8XqasfO3aRDa3CpcDrExhutWBgpUTVsmRTtwf87IcHE hUcsKXisryfh7NqQWqx0iCq7ERkoPFmygSwBHufaCcQZJg1qnF1oXFyC4wedk4oeSjv2 Sq1aUykNoyZtKBB0nC4UOBAImiJRkhJIGG0gE57p/ZAMZwCKxAYAxDc1iBoLP1l/AN4x rq5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id w11si32863443pgr.321.2019.07.31.20.45.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 20:45:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04FE96E34E; Thu, 1 Aug 2019 03:45:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id B58336E34A for ; Thu, 1 Aug 2019 03:45:11 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id t132so33262569pgb.9 for ; Wed, 31 Jul 2019 20:45:11 -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=565VaDK+D7HMx0tprEDJj/7+3RMbouv2sqfsU1m6AlI=; b=PLPMMx0zm6nSZlNIt4+Yp3ETK4cmSvbRzKZxLztEoiZGMNP/btUwoM639CpDlS1gSi fWkcbIpH1wGzst8f6/P8BD3WrUJ3b+MCEqlyz5HE49bmtXAqiKtkSrpEY9d6XBNtarvm 8piyHIsw5g0xO2TDb/sunAVl3b/q/uNfn9XgDoyiQ3EASKHm3ccaNimRWit71kLMVSFq 9vdgWg/PFJBAco9n6miRka53znOCH5vjshjGaDP/BpC7YWIpmn3NgfwYCwyY3PCqcvFx SiIGHH3Bo44XYsX5/bPV2pA8KDE5P/rksyo+eOippDHeH/o729DUkNNIKEzMQ45CVgx8 4VHQ== X-Gm-Message-State: APjAAAUuPymvg3lgwl/co3NdPdwTY/m+XvdtzWCLJOgR0ixBidy9nh7t VxJnsoEt5ELakuOGoO3p1MfNug== X-Received: by 2002:a62:1515:: with SMTP id 21mr52131943pfv.100.1564631110569; Wed, 31 Jul 2019 20:45:10 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id h70sm64775674pgc.36.2019.07.31.20.45.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:09 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 16/26] drm: kirin: Move mode config function to driver_data Date: Thu, 1 Aug 2019 03:44:29 +0000 Message-Id: <20190801034439.98227-17-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190801034439.98227-1-john.stultz@linaro.org> References: <20190801034439.98227-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=565VaDK+D7HMx0tprEDJj/7+3RMbouv2sqfsU1m6AlI=; b=UumO8T4UFAhCGi2wV38MNxrxfoIXcvUhLIo+UDwQbHXJpPiR1UpNWfYhB56019xFWv omPeb7ZqVe6yVp2nQPcZ6ApLQuQP1OSiGXWpFkVVlcdbk6Cq07J2GzD46js/3ly8+xKv srjdVWGisDzNusPt2Uh2q0Ac+6ctEDx/QnIay++h5EihedQ/M/mEscL8pYbF8lbrUnpa I1tCZh+FL1GAVGLbG7zfNrvVd6tkPg7bT2qDqe3sDyjKnY9YGuKlhpcKhkYVlB2y2Xdf IGFLZpZU6+n0khrwqrwxZYIHFYm25OTwJ57mZSoMJz8esPYKZ6RcX8wC7VYsDaqBezDq pMtQ== 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 , 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: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg 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 99dfd15af771..bca080e14009 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 60c164623f56..bf1e601fb367 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -39,12 +39,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; @@ -53,7 +47,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); };