From patchwork Thu Aug 1 03:44:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 170294 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4836336ile; Wed, 31 Jul 2019 20:45:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3DPjlLItXDoOLpZKSq6k+0nxYZfh0liCVuwUSEaNap9KHupn8+Otw9S7oVaWivKKrJ6G7 X-Received: by 2002:a17:90a:20c6:: with SMTP id f64mr6242883pjg.57.1564631110904; Wed, 31 Jul 2019 20:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564631110; cv=none; d=google.com; s=arc-20160816; b=miLFpnmp5Y6+94DKZsaRiTHvLMdCG/khp7K8q7vTgfYD6flzt24c5cusHnTOUxLuGB HNTlrFs5vPc0wjFWGSqPpl9agVW+dWbtDXdgvqOZ2YuAAzB/RFkdavNe1Ty5fnDO8XMa jX7WbR0j3xPE2+0Dx5ojITicy79emELaYH2jbp10XPAZs3NkF9TazuuLeiYyVGkQnk/c DlzPsssC5yYnmNcd7sJGPR9iGbRX/ljxdoDPwLt7DnA/EKXxrnntivqTByyZus4u1SCD doyAEJvbIljVrk22qphO3tVdDQzTZDH40CIkkCf2z4g9Rze1n3dsqEjcbdvv2Wo/OAFO 8Ttw== 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=hacTr+Rt7PnotfrZR5zVBYm7ZOKYwXIHrnyDsefpjMk=; b=jRL8m0mLbEirzBZhFECHJ7PTeDrcm3YJncHRXZ7L2R4XnsqJeTTYqW7MzV40T1kc+U PpwqD5ptZuSiB6W8uU0JLz3b8PTvM6agGgUzlmRoHaBvcJf6rWgBqmW0O1TTwPvJWyOq KEf4Iqvkjad8aVB3UV5OCC5X8+dJWKDpSPhoV9m9H123mwk3KOfuk8YdKo8zPVfLsmEo YkFAs1+7jmnumSPfamno0K6C7s/9Z96KoCLIoL142m4YAHC7R3kTAlAE7dnSVslti5UW BY07bFsIqO5ZhR8Md7HwTAL+DP/WRo1faPKTDwClNTRyq0eAi4qPjw4g/YG1TOJLQlWq wYuw== 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 f3si29552823plr.187.2019.07.31.20.45.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 20:45:10 -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 083C26E347; Thu, 1 Aug 2019 03:45:07 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id D057E6E347 for ; Thu, 1 Aug 2019 03:45:05 +0000 (UTC) Received: by mail-pf1-x444.google.com with SMTP id q10so33140442pff.9 for ; Wed, 31 Jul 2019 20:45:05 -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=I6qZv0NvjQC+of1GCo/KYasdnS8lE77yp0QRLPQskL4=; b=WkhJBdLbEDcvM5Fi3hYzuYjsES+/7Os9sS2fzHXnbBMM215Px+zJmV6/JOqgoMb1pA y81w+VnvXAZ1e1edN0S3Mm4WmUhs0tQZNuVXOVXGd1V6RCjSl+8GGv2d3R2xL7+N2d3R fyyFXwG7FgXp+SHYQ2qZ6bpo6HthEAfKDC+GX8za/GnKN444JmYPiXF2CWRETwZKrmvH cRGiWVfyn+zeM3+1GsO54JVhgvkMnq/hwXVZ8Pb9d135bGuZm3Nwyta6G5cMAqEY5XaG lEHHtyclHNE+k/QvN0APbWpRRnzUR1nxOUXxtQ26cUUpbg1cVIjuu+zQgpoYe0SG4jxn FLKg== X-Gm-Message-State: APjAAAX6/afnA3pJFbZhzzaoEXvhvZVg3xih7WB9j2APnovLl0RAAnAi IaYEHombx/4a/a4U4JAuu7/Opw== X-Received: by 2002:aa7:858b:: with SMTP id w11mr48729384pfn.68.1564631103854; Wed, 31 Jul 2019 20:45:03 -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.02 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:03 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 12/26] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Thu, 1 Aug 2019 03:44:25 +0000 Message-Id: <20190801034439.98227-13-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=I6qZv0NvjQC+of1GCo/KYasdnS8lE77yp0QRLPQskL4=; b=LBUfraRwXQ6hIm+t+I/z/szQ5a8tgSCA4WdSllvNls0e5Nmk1uCQ2OME2rTVKCxaFd fngthY7x8jwqxMzhlDSSAPuf7WZ/nRF64rC4vBNmFt1GkBc12ggTPnQ09OsaW5LTRiWr x82tyGYfkY6Y0pm6An9Iy3boW/JM1v+63ieHcOcRDe9sTqNCyHocXaIithN1zPNnjO6F LSxl8VHiwJTxo1qKuN9yWyqIgv27CRxkW4enkqZuYxbfrLwwl6AD744a7bnYyMT22jJN Vpv8LCFdZCA8Max387n4rr8xtsDps7DxU9Jw5g1CzEMtVoAxbfuGn4h0tSUa40Vf7FYP QA9g== 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 some shared structures and helpers to the common kirin_drm_drv.h These structures will later used by both kirin620 and future kirin960 driver Cc: Rongrong Zou Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 +++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index ec4857e45b6e..3ad1e290bf58 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,12 +38,6 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc(crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane(plane) \ - container_of(plane, struct kirin_plane, base) - struct ade_hw_ctx { void __iomem *base; @@ -59,18 +53,6 @@ struct ade_hw_ctx { struct drm_crtc *crtc; }; -struct kirin_crtc { - struct drm_crtc base; - void *hw_ctx; - bool enable; -}; - -struct kirin_plane { - struct drm_plane base; - void *hw_ctx; - u32 ch; -}; - struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; @@ -78,12 +60,7 @@ struct ade_data { }; /* ade-format info: */ -struct ade_format { - u32 pixel_format; - enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = { /* 16bpp RGB: */ { DRM_FORMAT_RGB565, ADE_RGB_565 }, { DRM_FORMAT_BGR565, ADE_BGR_565 }, @@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format) for (i = 0; i < ARRAY_SIZE(ade_formats); i++) if (ade_formats[i].pixel_format == pixel_format) - return ade_formats[i].ade_format; + return ade_formats[i].hw_format; /* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n", diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 22d1291668cd..d47cbb427979 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -9,6 +9,30 @@ #define MAX_CRTC 2 +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { + u32 pixel_format; + u32 hw_format; +}; + +struct kirin_crtc { + struct drm_crtc base; + void *hw_ctx; + bool enable; +}; + +struct kirin_plane { + struct drm_plane base; + void *hw_ctx; + u32 ch; +}; + /* display controller init/cleanup ops */ struct kirin_dc_ops { int (*init)(struct platform_device *pdev); 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); }; From patchwork Thu Aug 1 03:44:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 170304 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp4836713ile; Wed, 31 Jul 2019 20:45:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyI2jXl4vf1Y0WjnFKsAdaQk4UA3AzYA54bke09L+Ty1xwEph+S/lyjwvnhYLeomYfUtGq X-Received: by 2002:a65:5cca:: with SMTP id b10mr119726429pgt.365.1564631129778; Wed, 31 Jul 2019 20:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564631129; cv=none; d=google.com; s=arc-20160816; b=vIEcraVIr43LiejF9qQnsJCtLstVh4IwEaicTqWxAzF2C9JI3dQLqF4L95ikydVYCI KRs/l2jDlSiJnLQBgpjS+TSan4wicIP4wdjKJaRwX1+GIpUzujeoMdiVYMcHwbsmABkY 3B/eIfMyO5HcCd3qIeAJs+orFIDtoOr6eVnha+wZbARWRbRl/BeiF6mcIXm7EqdON31k VHDAx0ehJ91mJxfex16tRxeEoOwcck2CqVfVU8Adpn1KZinAWTk2IYCcgzZ7fMdX4OFQ trUzXlIEW4fQjeXuvG2csz/v2Z0bF/p3VkYC/0R4b1qpsz/5ToVkB7vyPui9he7XVESq 6Eag== 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=HHcx+BxITb3HMq0O64rfrztTCSi4I7DVYy57GWZl2cQ=; b=WGOrzRrbVVdFBLu7LjqXZvzERDRHzsjisR6vo/G8hQ3yGRw/Gxg0hV+XJ28jT1h+Ef MRqVtRRiBrDOaoANfhMmfeijufBYoZ4HdWstBAx8U6cGziNj3baG8YqzEfzNfAQ7l9in n7m6D2A8vTI5PKvapM5e9n5Dy87xxfWLwOV/72WM2vvQ76XXtv5S0HV2YBwZ84ydGLnW shYa1iTqLHWt9ypnIn5IR4AkB2kNkrT8ue2R2x0SMGij2AZkBjHgBuuRAJefsiwMr3w8 GWu+ZAyitu3rqfz4uVNXXN5UZgkjq/xpEBUxBafGGvOf0byRIRkl6CY0Z8SXE/cZ82N0 4Ogg== 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 2610:10:20:722:a800:ff:fe36:1795 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. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id 138si33585506pfy.77.2019.07.31.20.45.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 31 Jul 2019 20:45:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 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 CBAB56E354; Thu, 1 Aug 2019 03:45:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id D9B2A6E354 for ; Thu, 1 Aug 2019 03:45:20 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id n190so1833577pgn.0 for ; Wed, 31 Jul 2019 20:45:20 -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=l0iGU7OjgEb+jEdW4ORscHtkcmdOvreVfILRvjj1+Oo=; b=TEnyUTatYHmHb2Vld1dDvKV0cPVf+RKuGouyacCpyuwG8DTCQGpIuUvamO0ZhsZLf9 sg6sPlhkONiaBb/Bi7oiAW5uO09wpki7aVdq9C47QKgoKmyw0VOpm2Rrqi8iRP6ZFV4k /ldvQGJAKJ0TRtTcoWSX3+oJFLDJPKed/po0lQZpLPgQtnD67HkYfRZ0f5tEbYMybgUO 37HoNHzOV5HpxmSiiDtdKsiKQ+t2a4CPKosaZlgTaZnzmOLagTbC7KueCRndXVJ7vFI4 8HvJkNLVJgD2tcbpVi+Ch/wy45NmyLu8Ib0kNpUAv2+FO1mIViEEzZ9hEG/1tRH2K3t9 7F3g== X-Gm-Message-State: APjAAAX6/dr9Puhmom6Iyr5OXQ8nnWAA6e0Re/Y81aCe/p+UIOMir+DW cw0QcAlyphFDKFUADoQfvs5uMw== X-Received: by 2002:a17:90a:32ec:: with SMTP id l99mr6319509pjb.44.1564631119659; Wed, 31 Jul 2019 20:45:19 -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.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 31 Jul 2019 20:45:18 -0700 (PDT) From: John Stultz To: lkml Subject: [PATCH v3 22/26] drm: kirin: Fix dev->driver_data setting Date: Thu, 1 Aug 2019 03:44:35 +0000 Message-Id: <20190801034439.98227-23-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=l0iGU7OjgEb+jEdW4ORscHtkcmdOvreVfILRvjj1+Oo=; b=gzFKilZEeoz2ZWeGIlMCgbyjJirnk+SAY0OJ2oLnv6TDgPgy7gDOwYDgjgIFUQubIG 7+Y0HrHWaAB0e4dKi7eNz9DgY21doX491Hl5Sy+Sh8g5nK7pOWCIhguyG2hxQxlCJ3m+ V4lAkD5jZ1rxH+J1N3BMCfzf18dtcWa/tWf/bedn8Eoqbl0x//3hvJmPq5KY71XxHIb8 YdSwvhZxwjRcpluUmA+MymwndWUTD9T4yvsljP4JherbrCQlpvIfRr+p9hgxD0MBxlfi s3ziTT38BUOG0VrYrqLn0j3u59fVughR5SE25urd1EMxgHBxruMmZnuXjTImZQZ7Mj3O JUgw== 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 changes the dev->driver_data to point to a drm_device, not ade_data. Thus we set the driver data to drm device after alloc. Cc: Rongrong Zou Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0bdcac981d8b..09dc2c07533d 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -998,7 +998,6 @@ static int ade_drm_init(struct platform_device *pdev) DRM_ERROR("failed to alloc ade_data\n"); return -ENOMEM; } - platform_set_drvdata(pdev, ade); ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 1c9658e9565e..f1853b84ab58 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -43,8 +43,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) { int ret; - dev_set_drvdata(dev->dev, dev); - /* dev->mode_config initialization */ drm_mode_config_init(dev); dev->mode_config.min_width = 0; @@ -139,6 +137,7 @@ static int kirin_drm_bind(struct device *dev) drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); + dev_set_drvdata(dev, drm_dev); ret = kirin_drm_kms_init(drm_dev); if (ret)