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: 171743 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596059ily; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) X-Received: by 2002:a17:90a:bf91:: with SMTP id d17mr16211969pjs.111.1566255828518; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255828; cv=none; d=google.com; s=arc-20160816; b=MqaPIZkyZFU05ukDA+RiGUnhjth3noQlHYnT8d7e/bGea9uVZixNloiwpTzNKUripq WX9D73uPBaGSk5wBHmth4Qa8hZ9lAEf5UBgZr6keL6nnJ+BRI46Bmx6kFRBaqaogBlG9 fOtMRnTxoiF97ijHBp8WgkHuEnk/YzoDtB9p/wVJGoG9TI2bN8JFxGpFpdQ1igBL+LKL BVXZy33N0V9OeNfqh4luR4UEDhDvwPb6G84SaR2T+Vb9Msbb6usNwtBznQX+TehxJudc HR52rJOArZsUK5wTEbHdTPdGbX7BCQFMGn9+MhI9ukFUggkAw8L4CoAbmgxpR467l6DB 4P9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=K2z6QlmvvdzMGVWISK3Ahok9SCHH5796/9vep3JxftRt9GMHCSNUxbojBzRSsJoSNg tlLEnl0I11zhyBFvOJMt3sN0U5NIdsAo3UBBgVM5kYyI1HJG3WOxi4DlZefrFPvjH6D9 fC4r2rnA4rd9GvzR5ZAd4KI1MLS4EvgOcrzUYo3QS88nNw8LZ35o9sQKSrMv3x5EJ1H3 dbNVil975TSbRqIDzbxTK7Q8qQp8mRfzvovpaerQ8/16rZ3RjFxTmG7f/aN3cpcZA3UD o4nNfSidxdXW2NhH6PjVKWE3e0TE9TbzCHp5hRFtkybayDIXoEs856C1iK1s1tQ+Uaw7 6Sqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIK1wiCG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id ca12sor2539568pjb.6.2019.08.19.16.03.48 for (Google Transport Security); Mon, 19 Aug 2019 16:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIK1wiCG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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-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=ZJWCDp6DdL20GotdEdNaco/iE/4hetf4p/Gk0QnTul2y7sv54kJSfDpxz2gejih/8+ xYGsNc6OaJoCyua9PAjuBXbMNwGBAkWefvunLe1YNIA7q09GjNQU8yzgTpn1WJ4cO+i1 Y7xnhLyE4SmyRVRMNUG5HL75LDl9rzKnXSpmDdZ9VZz9j6j7bNeQuuFZeqcozrEG5ho5 iWaztdnOyCKPwEewMzmKafJpdxHgMXF+bwGQku76mW1OpefgNkaRTmS5jo+vrtAJQEZJ y1b1KV2HTLHOrIgUiicUk6RfYvhu+IIFW1q0JmoqQfI4W0n3YKyvmLotxQH6WEcVrSdy O4Eg== X-Gm-Message-State: APjAAAWRLFgLHFTyuM94XCbwDG0t2l1MbqxDIAnGiwlD68WMSf6hsD7N GagJveoqHdiq4FipiYh41eytRU8V 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) Return-Path: 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 Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz 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> 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(-) -- 2.17.1 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); };