From patchwork Fri Jul 8 20:54:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911879 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318ABC43334 for ; Fri, 8 Jul 2022 20:54:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240301AbiGHUyb (ORCPT ); Fri, 8 Jul 2022 16:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240285AbiGHUya (ORCPT ); Fri, 8 Jul 2022 16:54:30 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 765441AF12; Fri, 8 Jul 2022 13:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313661; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gDom/uPmSe9UiwdDAFbjIzOeDiIX+x98YrGKZn/GFRU=; b=EgWJ4HV/Vkvqm0qcPZ2jWu76bMes33ds1tI2iDm/nRa7H2hSqoLtMVAx8K0OhK6xMSWZ3C NYjnchaPA1lYy3L3u4LKXf1Pvk+B4EK9xrE2B+ATt3svos+IMkbXRcl7HbWbbY21vaNRoI BBCvfG0prmzbmpcc/PLhMkrBaM4j1S8= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org Subject: [PATCH 1/6] dt-bindings/display: ingenic: Add compatible string for the JZ4760(B) Date: Fri, 8 Jul 2022 21:54:01 +0100 Message-Id: <20220708205406.96473-2-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Add compatible strings for the LCD controllers found in the JZ4760 and JZ4760B SoCs from Ingenic. Signed-off-by: Paul Cercueil Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: devicetree@vger.kernel.org Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/display/ingenic,lcd.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/display/ingenic,lcd.yaml b/Documentation/devicetree/bindings/display/ingenic,lcd.yaml index 0049010b37ca..c0bb02fb49f4 100644 --- a/Documentation/devicetree/bindings/display/ingenic,lcd.yaml +++ b/Documentation/devicetree/bindings/display/ingenic,lcd.yaml @@ -17,6 +17,8 @@ properties: enum: - ingenic,jz4740-lcd - ingenic,jz4725b-lcd + - ingenic,jz4760-lcd + - ingenic,jz4760b-lcd - ingenic,jz4770-lcd - ingenic,jz4780-lcd From patchwork Fri Jul 8 20:54:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911880 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB3E8C43334 for ; Fri, 8 Jul 2022 20:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240309AbiGHUyi (ORCPT ); Fri, 8 Jul 2022 16:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240308AbiGHUyg (ORCPT ); Fri, 8 Jul 2022 16:54:36 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A05E1CFDD; Fri, 8 Jul 2022 13:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313662; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FYgqLSUgOUPjjJXK0NhPam949HCvw65D5TBh/S76VPc=; b=i2o6KSOyIMyxJAhPP2GAkvn3iQb1ygKYo57gDKA6Qc2TcDbzl52O6j2E+NeUg/hYoeW15n WynxsPbrQuStRXOgL0BWHSakMkqcOTqL4kGKguuliirTNnP59CMABRvLqZuydhW6bEtmqv BmPxWTvVlj9V4ExBtkb2+DUVG9/Fsj0= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 2/6] drm/ingenic: Fix MODULE_LICENSE() string Date: Fri, 8 Jul 2022 21:54:02 +0100 Message-Id: <20220708205406.96473-3-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org The previous "GPL v2" string is deprecated. For more info, see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity") Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index eb8208bfe5ab..e435c19d54d5 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1616,4 +1616,4 @@ module_exit(ingenic_drm_exit); MODULE_AUTHOR("Paul Cercueil "); MODULE_DESCRIPTION("DRM driver for the Ingenic SoCs\n"); -MODULE_LICENSE("GPL v2"); +MODULE_LICENSE("GPL"); From patchwork Fri Jul 8 20:54:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911881 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FC93C43334 for ; Fri, 8 Jul 2022 20:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240323AbiGHUyo (ORCPT ); Fri, 8 Jul 2022 16:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240317AbiGHUyo (ORCPT ); Fri, 8 Jul 2022 16:54:44 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A4F21EED8; Fri, 8 Jul 2022 13:54:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313664; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZsmOgxVVFKAi6We+Fa/t9BWj1gjKa2nAi7YQfMy/OG4=; b=DgsHAiF2KQTgAd3uK9vqRF2PFq3Meig+1VcimiGTQtsuJ169HT/acSLFmTg+S+W5V6L+3Q AFkpFRd9W4gIjkt8BnfSIzJEmp4PfDpLxwpWRsy2/eCGYAUvM2amSTbA0mjKhXveAqZmdm LaP7B/KWdfVHHWAf/PspQI04Xzsm/4o= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 3/6] drm/ingenic: Add support for the JZ4760(B) Date: Fri, 8 Jul 2022 21:54:03 +0100 Message-Id: <20220708205406.96473-4-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Add support for the JZ4760 and JZ4760B SoCs to the ingenic-drm display driver. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index e435c19d54d5..78d0b035e2d7 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1541,6 +1541,32 @@ static const struct jz_soc_info jz4725b_soc_info = { .num_formats_f0 = ARRAY_SIZE(jz4725b_formats_f0), }; +static const struct jz_soc_info jz4760_soc_info = { + .needs_dev_clk = false, + .has_osd = true, + .map_noncoherent = false, + .max_width = 1280, + .max_height = 720, + .max_burst = JZ_LCD_CTRL_BURST_32, + .formats_f1 = jz4770_formats_f1, + .num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1), + .formats_f0 = jz4770_formats_f0, + .num_formats_f0 = ARRAY_SIZE(jz4770_formats_f0), +}; + +static const struct jz_soc_info jz4760b_soc_info = { + .needs_dev_clk = false, + .has_osd = true, + .map_noncoherent = false, + .max_width = 1280, + .max_height = 720, + .max_burst = JZ_LCD_CTRL_BURST_64, + .formats_f1 = jz4770_formats_f1, + .num_formats_f1 = ARRAY_SIZE(jz4770_formats_f1), + .formats_f0 = jz4770_formats_f0, + .num_formats_f0 = ARRAY_SIZE(jz4770_formats_f0), +}; + static const struct jz_soc_info jz4770_soc_info = { .needs_dev_clk = false, .has_osd = true, @@ -1572,6 +1598,8 @@ static const struct jz_soc_info jz4780_soc_info = { static const struct of_device_id ingenic_drm_of_match[] = { { .compatible = "ingenic,jz4740-lcd", .data = &jz4740_soc_info }, { .compatible = "ingenic,jz4725b-lcd", .data = &jz4725b_soc_info }, + { .compatible = "ingenic,jz4760-lcd", .data = &jz4760_soc_info }, + { .compatible = "ingenic,jz4760b-lcd", .data = &jz4760b_soc_info }, { .compatible = "ingenic,jz4770-lcd", .data = &jz4770_soc_info }, { .compatible = "ingenic,jz4780-lcd", .data = &jz4780_soc_info }, { /* sentinel */ }, From patchwork Fri Jul 8 20:54:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911882 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 905E2C43334 for ; Fri, 8 Jul 2022 20:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240332AbiGHUyy (ORCPT ); Fri, 8 Jul 2022 16:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240335AbiGHUyx (ORCPT ); Fri, 8 Jul 2022 16:54:53 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D6B7240B8; Fri, 8 Jul 2022 13:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313665; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CstdOR1GH8PTss/tJU+TspqDPaPgCuNQmeryFjsonoU=; b=TPmZ7n5f1FV3VmbioC9/itJnqP+g7Wd+oEJvJgMscumGiuhjgGrq75k36fLXS2/cnIR/yE H0ulKt9cE8YSO7jkAhHeztipZVZmMtGTmHgMw87bRNGh9fZ8harlsb9UYwqjjgmLsKlIWs AkzukoBLeReRnCs8F1cNUF+lUN46108= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 4/6] drm/ingenic: Don't request full modeset if property is not modified Date: Fri, 8 Jul 2022 21:54:04 +0100 Message-Id: <20220708205406.96473-5-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Avoid requesting a full modeset if the sharpness property is not modified, because then we don't actually need it. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-ipu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c index 32a50935aa6d..d13f58ad4769 100644 --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c @@ -697,10 +697,12 @@ ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane, { struct ingenic_ipu *ipu = plane_to_ingenic_ipu(plane); struct drm_crtc_state *crtc_state; + bool mode_changed; if (property != ipu->sharpness_prop) return -EINVAL; + mode_changed = val != ipu->sharpness; ipu->sharpness = val; if (state->crtc) { @@ -708,7 +710,7 @@ ingenic_ipu_plane_atomic_set_property(struct drm_plane *plane, if (WARN_ON(!crtc_state)) return -EINVAL; - crtc_state->mode_changed = true; + crtc_state->mode_changed |= mode_changed; } return 0; From patchwork Fri Jul 8 20:54:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911883 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F676C43334 for ; Fri, 8 Jul 2022 20:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240361AbiGHUzF (ORCPT ); Fri, 8 Jul 2022 16:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240356AbiGHUzC (ORCPT ); Fri, 8 Jul 2022 16:55:02 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C4087365; Fri, 8 Jul 2022 13:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313666; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=J3za2o5fHO/UXzjf7ToxHWFd4R5/d/tS3sCIOjVRiIs=; b=f7Em+wIFnv/2Fe1Le76SpeJs8bLFGZImpRs9Wlj2V+ZDlt9XCiJ8Ig7ZetPBosfsSgkB3V /F2JDWBQTh4si7xiqYi7mqi10TEolb2yaFugb78x6AJrBpCw1y7ojFzIuaPlyX73J76nAD xXCLauNeU9NfqD8bVjmR3uPMBG0CT1E= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 5/6] drm/ingenic: Make IPU driver its own module Date: Fri, 8 Jul 2022 21:54:05 +0100 Message-Id: <20220708205406.96473-6-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Instead of building the IPU driver code into the ingenic-drm driver, create a ingenic-ipu driver. Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/Kconfig | 2 +- drivers/gpu/drm/ingenic/Makefile | 2 +- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 33 +++++------------------ drivers/gpu/drm/ingenic/ingenic-drm.h | 3 --- drivers/gpu/drm/ingenic/ingenic-ipu.c | 6 ++++- 5 files changed, 14 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/ingenic/Kconfig b/drivers/gpu/drm/ingenic/Kconfig index 090830bcbde7..daa1aa81b46b 100644 --- a/drivers/gpu/drm/ingenic/Kconfig +++ b/drivers/gpu/drm/ingenic/Kconfig @@ -18,7 +18,7 @@ config DRM_INGENIC if DRM_INGENIC config DRM_INGENIC_IPU - bool "IPU support for Ingenic SoCs" + tristate "IPU support for Ingenic SoCs" help Choose this option to enable support for the IPU found in Ingenic SoCs. diff --git a/drivers/gpu/drm/ingenic/Makefile b/drivers/gpu/drm/ingenic/Makefile index f10cc1c5a5f2..e650d4ec895b 100644 --- a/drivers/gpu/drm/ingenic/Makefile +++ b/drivers/gpu/drm/ingenic/Makefile @@ -1,4 +1,4 @@ obj-$(CONFIG_DRM_INGENIC) += ingenic-drm.o ingenic-drm-y = ingenic-drm-drv.o -ingenic-drm-$(CONFIG_DRM_INGENIC_IPU) += ingenic-ipu.o +obj-$(CONFIG_DRM_INGENIC_IPU) += ingenic-ipu.o obj-$(CONFIG_DRM_INGENIC_DW_HDMI) += ingenic-dw-hdmi.o diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 78d0b035e2d7..98ff038d95d6 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -550,6 +550,7 @@ void ingenic_drm_plane_disable(struct device *dev, struct drm_plane *plane) regmap_clear_bits(priv->map, JZ_REG_LCD_OSDC, en_bit); } } +EXPORT_SYMBOL_GPL(ingenic_drm_plane_disable); static void ingenic_drm_plane_atomic_disable(struct drm_plane *plane, struct drm_atomic_state *state) @@ -633,6 +634,7 @@ void ingenic_drm_plane_config(struct device *dev, state->crtc_h << JZ_LCD_SIZE01_HEIGHT_LSB); } } +EXPORT_SYMBOL_GPL(ingenic_drm_plane_config); bool ingenic_drm_map_noncoherent(const struct device *dev) { @@ -640,6 +642,7 @@ bool ingenic_drm_map_noncoherent(const struct device *dev) return priv->soc_info->map_noncoherent; } +EXPORT_SYMBOL_GPL(ingenic_drm_map_noncoherent); static void ingenic_drm_update_palette(struct ingenic_drm *priv, const struct drm_color_lut *lut) @@ -1438,6 +1441,9 @@ static int ingenic_drm_probe(struct platform_device *pdev) struct component_match *match = NULL; struct device_node *np; + if (drm_firmware_drivers_only()) + return -ENODEV; + if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) return ingenic_drm_bind(dev, false); @@ -1615,32 +1621,7 @@ static struct platform_driver ingenic_drm_driver = { .probe = ingenic_drm_probe, .remove = ingenic_drm_remove, }; - -static int ingenic_drm_init(void) -{ - int err; - - if (drm_firmware_drivers_only()) - return -ENODEV; - - if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) { - err = platform_driver_register(ingenic_ipu_driver_ptr); - if (err) - return err; - } - - return platform_driver_register(&ingenic_drm_driver); -} -module_init(ingenic_drm_init); - -static void ingenic_drm_exit(void) -{ - platform_driver_unregister(&ingenic_drm_driver); - - if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) - platform_driver_unregister(ingenic_ipu_driver_ptr); -} -module_exit(ingenic_drm_exit); +module_platform_driver(ingenic_drm_driver); MODULE_AUTHOR("Paul Cercueil "); MODULE_DESCRIPTION("DRM driver for the Ingenic SoCs\n"); diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.h b/drivers/gpu/drm/ingenic/ingenic-drm.h index e5bd007ea93d..9b89929b81bc 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm.h +++ b/drivers/gpu/drm/ingenic/ingenic-drm.h @@ -220,13 +220,10 @@ struct device; struct drm_plane; struct drm_plane_state; -struct platform_driver; void ingenic_drm_plane_config(struct device *dev, struct drm_plane *plane, u32 fourcc); void ingenic_drm_plane_disable(struct device *dev, struct drm_plane *plane); bool ingenic_drm_map_noncoherent(const struct device *dev); -extern struct platform_driver *ingenic_ipu_driver_ptr; - #endif /* DRIVERS_GPU_DRM_INGENIC_INGENIC_DRM_H */ diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c index d13f58ad4769..fb62c27819ea 100644 --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -995,5 +996,8 @@ static struct platform_driver ingenic_ipu_driver = { .probe = ingenic_ipu_probe, .remove = ingenic_ipu_remove, }; +module_platform_driver(ingenic_ipu_driver); -struct platform_driver *ingenic_ipu_driver_ptr = &ingenic_ipu_driver; +MODULE_AUTHOR("Paul Cercueil "); +MODULE_DESCRIPTION("DRM driver for the IPU of Ingenic SoCs\n"); +MODULE_LICENSE("GPL"); From patchwork Fri Jul 8 20:54:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 12911884 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95572C433EF for ; Fri, 8 Jul 2022 20:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240350AbiGHUzY (ORCPT ); Fri, 8 Jul 2022 16:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240388AbiGHUzJ (ORCPT ); Fri, 8 Jul 2022 16:55:09 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98ED021833; Fri, 8 Jul 2022 13:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1657313667; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/je/yixPYeA/QHCrkMiLMxqQF45GlsX63kQIV1/14JU=; b=N5DYcY6vfio+hGOYhjp5KGAwIn0xck8GrJpptyYgr9A91DSQmVmuginnSV4Tm1tHgHorjd GRdvIpaxt+DL7FnRb4LbfStQe34uwvlnsGWaWwcYODG2lPUjTLRv0YmqTLctf6/TOQavsq bZ5+cg9MeLHh8hcb+Wsy+QSRfyEqE2k= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: Sam Ravnborg , Christophe Branchereau , list@opendingux.net, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 6/6] drm/ingenic: Use the new PM macros Date: Fri, 8 Jul 2022 21:54:06 +0100 Message-Id: <20220708205406.96473-7-paul@crapouillou.net> In-Reply-To: <20220708205406.96473-1-paul@crapouillou.net> References: <20220708205406.96473-1-paul@crapouillou.net> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org - Use DEFINE_SIMPLE_DEV_PM_OPS() instead of the SIMPLE_DEV_PM_OPS() macro. This makes it possible to remove the __maybe_unused flags on the callback functions. - Since we only have callbacks for suspend/resume, we can conditionally compile the dev_pm_ops structure for when CONFIG_PM_SLEEP is enabled; so use the pm_sleep_ptr() macro instead of pm_ptr(). Signed-off-by: Paul Cercueil --- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 98ff038d95d6..d5dcff59b9a8 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -1470,21 +1470,22 @@ static int ingenic_drm_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused ingenic_drm_suspend(struct device *dev) +static int ingenic_drm_suspend(struct device *dev) { struct ingenic_drm *priv = dev_get_drvdata(dev); return drm_mode_config_helper_suspend(&priv->drm); } -static int __maybe_unused ingenic_drm_resume(struct device *dev) +static int ingenic_drm_resume(struct device *dev) { struct ingenic_drm *priv = dev_get_drvdata(dev); return drm_mode_config_helper_resume(&priv->drm); } -static SIMPLE_DEV_PM_OPS(ingenic_drm_pm_ops, ingenic_drm_suspend, ingenic_drm_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ingenic_drm_pm_ops, + ingenic_drm_suspend, ingenic_drm_resume); static const u32 jz4740_formats[] = { DRM_FORMAT_XRGB1555, @@ -1615,7 +1616,7 @@ MODULE_DEVICE_TABLE(of, ingenic_drm_of_match); static struct platform_driver ingenic_drm_driver = { .driver = { .name = "ingenic-drm", - .pm = pm_ptr(&ingenic_drm_pm_ops), + .pm = pm_sleep_ptr(&ingenic_drm_pm_ops), .of_match_table = of_match_ptr(ingenic_drm_of_match), }, .probe = ingenic_drm_probe,