From patchwork Thu Jul 28 12:40:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 12931247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 29236C04A68 for ; Thu, 28 Jul 2022 12:41:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09CBB8BCCD; Thu, 28 Jul 2022 12:41:41 +0000 (UTC) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86DD189286 for ; Thu, 28 Jul 2022 12:41:08 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A8515205BA; Thu, 28 Jul 2022 12:41:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1659012066; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JWIgO3WZYu2JWWbTmWGVEMDDbgg6oXChUW/mkaV6IPc=; b=BspX3eTo27+oaLTMdcYpDiERPiVjx5XFBq9Sx3x1HU9BEXsR4xOBDCMvnEA6wF2V9mUmyG TcdqD+HLoQbEVLV+kYDBOaV9ERgc0i3JbJCdb7pOqLZU7IS8/AkwRa3nSA/2NKNK3CBLf3 CFrlGxo1itXalszydaXmtcLAQOfvtXs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1659012066; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JWIgO3WZYu2JWWbTmWGVEMDDbgg6oXChUW/mkaV6IPc=; b=Pt9ar/5pHRV3NNcrhdDC+AetM4Z9BB/LtjS7YzWA/E+6RynZH2f2vDwoJk/MbKYsurpT5j IesgZxsVmC4p+DAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7CF3313AB4; Thu, 28 Jul 2022 12:41:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6E2THeKD4mJwMAAAMHmgww (envelope-from ); Thu, 28 Jul 2022 12:41:06 +0000 From: Thomas Zimmermann To: jfalempe@redhat.com, sam@ravnborg.org, airlied@redhat.com, airlied@linux.ie, daniel@ffwll.ch Subject: [PATCH v3 09/14] drm/mgag200: Add per-device callbacks Date: Thu, 28 Jul 2022 14:40:58 +0200 Message-Id: <20220728124103.30159-10-tzimmermann@suse.de> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220728124103.30159-1-tzimmermann@suse.de> References: <20220728124103.30159-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" While currently empty, the device callbacks will allow mgag200's modesetting code to interact with the BMC and PIXPLLC. Signed-off-by: Thomas Zimmermann Reviewed-by: Jocelyn Falempe Tested-by: Jocelyn Falempe Acked-by: Sam Ravnborg --- drivers/gpu/drm/mgag200/mgag200_drv.c | 4 +++- drivers/gpu/drm/mgag200/mgag200_drv.h | 7 ++++++- drivers/gpu/drm/mgag200/mgag200_g200.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200eh.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200eh3.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200er.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200ev.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200ew3.c | 6 +++++- drivers/gpu/drm/mgag200/mgag200_g200se.c | 5 ++++- drivers/gpu/drm/mgag200/mgag200_g200wb.c | 6 +++++- 10 files changed, 48 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 251a1bb648cc..9296b9f5455b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -156,13 +156,15 @@ int mgag200_device_preinit(struct mga_device *mdev) } int mgag200_device_init(struct mga_device *mdev, enum mga_type type, - const struct mgag200_device_info *info) + const struct mgag200_device_info *info, + const struct mgag200_device_funcs *funcs) { struct drm_device *dev = &mdev->base; u8 crtcext3, misc; int ret; mdev->info = info; + mdev->funcs = funcs; mdev->type = type; ret = drmm_mutex_init(dev, &mdev->rmmio_lock); diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.h b/drivers/gpu/drm/mgag200/mgag200_drv.h index b0433985ec0d..db29eef8981b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.h +++ b/drivers/gpu/drm/mgag200/mgag200_drv.h @@ -262,10 +262,14 @@ struct mgag200_device_info { .bug_no_startadd = (_bug_no_startadd), \ } +struct mgag200_device_funcs { +}; + struct mga_device { struct drm_device base; const struct mgag200_device_info *info; + const struct mgag200_device_funcs *funcs; struct resource *rmmio_res; void __iomem *rmmio; @@ -322,7 +326,8 @@ resource_size_t mgag200_probe_vram(void __iomem *mem, resource_size_t size); resource_size_t mgag200_device_probe_vram(struct mga_device *mdev); int mgag200_device_preinit(struct mga_device *mdev); int mgag200_device_init(struct mga_device *mdev, enum mga_type type, - const struct mgag200_device_info *info); + const struct mgag200_device_info *info, + const struct mgag200_device_funcs *funcs); /* mgag200_.c */ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv, diff --git a/drivers/gpu/drm/mgag200/mgag200_g200.c b/drivers/gpu/drm/mgag200/mgag200_g200.c index 4a5af20efa36..e11b485d470d 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200.c @@ -183,6 +183,9 @@ static void mgag200_g200_init_refclk(struct mgag200_g200_device *g200) pci_unmap_rom(pdev, rom); } +static const struct mgag200_device_funcs mgag200_g200_device_funcs = { +}; + struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -210,7 +213,8 @@ struct mga_device *mgag200_g200_device_create(struct pci_dev *pdev, const struct mgag200_g200_init_refclk(g200); - ret = mgag200_device_init(mdev, type, &mgag200_g200_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200_device_info, + &mgag200_g200_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200eh.c b/drivers/gpu/drm/mgag200/mgag200_g200eh.c index f2c53fe8d927..473ff5217db5 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200eh.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200eh.c @@ -37,6 +37,9 @@ void mgag200_g200eh_init_registers(struct mga_device *mdev) static const struct mgag200_device_info mgag200_g200eh_device_info = MGAG200_DEVICE_INFO_INIT(2048, 2048, 37500, false, 1, 0, false); +static const struct mgag200_device_funcs mgag200_g200eh_device_funcs = { +}; + struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -60,7 +63,8 @@ struct mga_device *mgag200_g200eh_device_create(struct pci_dev *pdev, const stru if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200eh_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200eh_device_info, + &mgag200_g200eh_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200eh3.c b/drivers/gpu/drm/mgag200/mgag200_g200eh3.c index adb9190b62af..99e00aa848e1 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200eh3.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200eh3.c @@ -13,6 +13,9 @@ static const struct mgag200_device_info mgag200_g200eh3_device_info = MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, false, 1, 0, false); +static const struct mgag200_device_funcs mgag200_g200eh3_device_funcs = { +}; + struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) @@ -37,7 +40,8 @@ struct mga_device *mgag200_g200eh3_device_create(struct pci_dev *pdev, if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200eh3_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200eh3_device_info, + &mgag200_g200eh3_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200er.c b/drivers/gpu/drm/mgag200/mgag200_g200er.c index 8ff050906e1c..1c9a963dd9c5 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200er.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200er.c @@ -38,6 +38,9 @@ static void mgag200_g200er_init_registers(struct mga_device *mdev) static const struct mgag200_device_info mgag200_g200er_device_info = MGAG200_DEVICE_INFO_INIT(2048, 2048, 55000, false, 1, 0, false); +static const struct mgag200_device_funcs mgag200_g200er_device_funcs = { +}; + struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -57,7 +60,8 @@ struct mga_device *mgag200_g200er_device_create(struct pci_dev *pdev, const stru if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200er_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200er_device_info, + &mgag200_g200er_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ev.c b/drivers/gpu/drm/mgag200/mgag200_g200ev.c index 0dc5c342e7c4..a0dc72a69f52 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ev.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ev.c @@ -38,6 +38,9 @@ static void mgag200_g200ev_init_registers(struct mga_device *mdev) static const struct mgag200_device_info mgag200_g200ev_device_info = MGAG200_DEVICE_INFO_INIT(2048, 2048, 32700, false, 0, 1, false); +static const struct mgag200_device_funcs mgag200_g200ev_device_funcs = { +}; + struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -61,7 +64,8 @@ struct mga_device *mgag200_g200ev_device_create(struct pci_dev *pdev, const stru if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200ev_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200ev_device_info, + &mgag200_g200ev_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c index a4ecdd3784a3..202db00bb62e 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200ew3.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200ew3.c @@ -20,6 +20,9 @@ static void mgag200_g200ew3_init_registers(struct mga_device *mdev) static const struct mgag200_device_info mgag200_g200ew3_device_info = MGAG200_DEVICE_INFO_INIT(2048, 2048, 0, true, 0, 1, false); +static const struct mgag200_device_funcs mgag200_g200ew3_device_funcs = { +}; + static resource_size_t mgag200_g200ew3_device_probe_vram(struct mga_device *mdev) { resource_size_t vram_size = resource_size(mdev->vram_res); @@ -53,7 +56,8 @@ struct mga_device *mgag200_g200ew3_device_create(struct pci_dev *pdev, if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200ew3_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200ew3_device_info, + &mgag200_g200ew3_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200se.c b/drivers/gpu/drm/mgag200/mgag200_g200se.c index bd8fc7a177c2..7a7648d7de93 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200se.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200se.c @@ -93,6 +93,9 @@ static int mgag200_g200se_init_unique_rev_id(struct mgag200_g200se_device *g200s return 0; } +static const struct mgag200_device_funcs mgag200_g200se_device_funcs = { +}; + struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -144,7 +147,7 @@ struct mga_device *mgag200_g200se_device_create(struct pci_dev *pdev, const stru return ERR_PTR(-EINVAL); } - ret = mgag200_device_init(mdev, type, info); + ret = mgag200_device_init(mdev, type, info, &mgag200_g200se_device_funcs); if (ret) return ERR_PTR(ret); diff --git a/drivers/gpu/drm/mgag200/mgag200_g200wb.c b/drivers/gpu/drm/mgag200/mgag200_g200wb.c index 05f17986b95a..2b5dd0cc38e2 100644 --- a/drivers/gpu/drm/mgag200/mgag200_g200wb.c +++ b/drivers/gpu/drm/mgag200/mgag200_g200wb.c @@ -35,6 +35,9 @@ void mgag200_g200wb_init_registers(struct mga_device *mdev) static const struct mgag200_device_info mgag200_g200wb_device_info = MGAG200_DEVICE_INFO_INIT(1280, 1024, 31877, true, 0, 1, false); +static const struct mgag200_device_funcs mgag200_g200wb_device_funcs = { +}; + struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const struct drm_driver *drv, enum mga_type type) { @@ -58,7 +61,8 @@ struct mga_device *mgag200_g200wb_device_create(struct pci_dev *pdev, const stru if (ret) return ERR_PTR(ret); - ret = mgag200_device_init(mdev, type, &mgag200_g200wb_device_info); + ret = mgag200_device_init(mdev, type, &mgag200_g200wb_device_info, + &mgag200_g200wb_device_funcs); if (ret) return ERR_PTR(ret);