From patchwork Fri Apr 5 04:35:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharma Balasubiramani X-Patchwork-Id: 13618449 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1A8CCCD129A for ; Fri, 5 Apr 2024 04:37:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=h3LLgu9qjFy1BJ50wjJhNxlCHtNgTJDdSdOgFCXYtGM=; b=rhezZIuRfjkUXU BBz7JqsO9qJshTNpIMa9nncuItR+5cUihQv9xvfdOpWv2RMgQT4GqptvFE/ynw2jW3kkpmkZUuvab afE9e90v5rIqRGXW8Wg6VT2XlkR/nTbUWxX+t85ugkFF+iF16h0x1pqBO04h+3VzocuPmh14ibcNh 7CNJAENQpa/nEDFQbGa65F9ySC2bZbzw1ymVo9t+xs1ipPHDPDWpdRvdHtX/MQR2jX4FN2CT0C0Gk /+ICnkE54EEt8zP2GtCuxBHXnQo6IsELPLRRp6FG0iMN7P6QljNH/yfIVSt+B3Elnv+OeVqIc5WUC gYRpa2Q0d3Z7LUlyBL0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKF-000000059wu-2ayH; Fri, 05 Apr 2024 04:37:15 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbK9-000000059pl-3NEs for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 04:37:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712291829; x=1743827829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F4NdfRj42NRb2Mmv7KrOUs+hfeyYq0cff96CrBzC5GY=; b=e/ZD1ieCGsYRYk4+XB72YkY5fdtwc28Hff7Q7lU8AlHGL9FT9Cs/GJvQ fsJslK9Yhxslel59jtnKoBXD14aXtJRJAt+NF09QzrlM235RgDnfewZ9v ujNg9eBoAJDxkV2pNP7dcj0qI7PtjKYNqvbx/QlBc9cYPvrf2gYzeXWR3 to+v0LUPwR1LHsiLrB20f91/ZZ5C/15bbPLb49ouR1tPFoqd3Sx7oY/Xt SqU0L8we8ZrMgVR44VOLi0vKDwtOsyE4m/WZ9yjAYipLqv81KTIhY1fTb AIlLVrqzT/R28sK8umVoC3F/3jWhN6LJ03+urFz+XjeYobqtsIc0mf/7W g==; X-CSE-ConnectionGUID: I3x9LaISQ1uPgH0YvRkiJw== X-CSE-MsgGUID: KGNen9/sTWSNNAZ0Gyt+CQ== X-IronPort-AV: E=Sophos;i="6.07,180,1708412400"; d="scan'208";a="19541026" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Apr 2024 21:36:54 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Apr 2024 21:36:36 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 4 Apr 2024 21:36:23 -0700 From: Dharma Balasubiramani To: "andrzej . hajda @ intel . com" , "neil . armstrong @ linaro . org" , "rfoss @ kernel . org" , "Laurent . pinchart @ ideasonboard . com" , "jonas @ kwiboo . se" , "jernej . skrabec @ gmail . com" , "maarten . lankhorst @ linux . intel . com" , "mripard @ kernel . org" , "tzimmermann @ suse . de" , "airlied @ gmail . com" , "daniel @ ffwll . ch" , "robh+dt @ kernel . org" , "krzysztof . kozlowski+dt @ linaro . org" , "conor+dt @ kernel . org" , "linux @ armlinux . org . uk" , "Nicolas . Ferre @ microchip . com" , "alexandre . belloni @ bootlin . com" , "claudiu . beznea @ tuxon . dev" , "Manikandan . M @ microchip . com" , "Dharma . B @ microchip . com" , "arnd @ arndb . de" , "geert+renesas @ glider . be" , "Jason @ zx2c4 . com" , "mpe @ ellerman . id . au" , "gerg @ linux-m68k . org" , "rdunlap @ infradead . org" , "vbabka @ suse . cz" , "dri-devel @ lists . freedesktop . org" , "devicetree @ vger . kernel . org" , "linux-kernel @ vger . kernel . org" , "linux-arm-kernel @ lists . infradead . org" , "Hari . PrasathGE @ microchip . com" , "akpm @ linux-foundation . org" , "deller @ gmx . de" CC: Dharma Balasubiramani , Rob Herring Subject: [PATCH v5 1/4] dt-bindings: display: bridge: add sam9x75-lvds binding Date: Fri, 5 Apr 2024 10:05:33 +0530 Message-ID: <20240405043536.274220-2-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240405043536.274220-1-dharma.b@microchip.com> References: <20240405043536.274220-1-dharma.b@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_213709_988086_79F1F4DF X-CRM114-Status: GOOD ( 15.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the 'sam9x75-lvds' compatible binding, which describes the Low Voltage Differential Signaling (LVDS) Controller found on some Microchip's sam9x7 series System-on-Chip (SoC) devices. This binding will be used to define the properties and configuration for the LVDS Controller in DT. Signed-off-by: Dharma Balasubiramani Reviewed-by: Rob Herring --- Changelog v4 -> v5 - No changes. v3 -> v4 - Rephrase the commit subject. v2 -> v3 - No changes. v1 -> v2 - Remove '|' in description, as there is no formatting to preserve. - Remove 'gclk' from clock-names as there is only one clock(pclk). - Remove the unused headers and include only used ones. - Change the compatible name specific to SoC (sam9x75) instead of entire series. - Change file name to match the compatible name. --- .../bridge/microchip,sam9x75-lvds.yaml | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml b/Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml new file mode 100644 index 000000000000..862ef441ac9f --- /dev/null +++ b/Documentation/devicetree/bindings/display/bridge/microchip,sam9x75-lvds.yaml @@ -0,0 +1,55 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/display/bridge/microchip,sam9x75-lvds.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Microchip SAM9X75 LVDS Controller + +maintainers: + - Dharma Balasubiramani + +description: + The Low Voltage Differential Signaling Controller (LVDSC) manages data + format conversion from the LCD Controller internal DPI bus to OpenLDI + LVDS output signals. LVDSC functions include bit mapping, balanced mode + management, and serializer. + +properties: + compatible: + const: microchip,sam9x75-lvds + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Peripheral Bus Clock + + clock-names: + items: + - const: pclk + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +additionalProperties: false + +examples: + - | + #include + #include + lvds-controller@f8060000 { + compatible = "microchip,sam9x75-lvds"; + reg = <0xf8060000 0x100>; + interrupts = <56 IRQ_TYPE_LEVEL_HIGH 0>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 56>; + clock-names = "pclk"; + }; From patchwork Fri Apr 5 04:35:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharma Balasubiramani X-Patchwork-Id: 13618447 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1F215CD11C2 for ; Fri, 5 Apr 2024 04:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SByg9xHkJ7UcxL6b4i4kiBrW4I9MGCNH6II8oCHKyfU=; b=IXLyE4k9ZVP1fS rP1G1OIh8t04Zjglm4jHm6io65zBXaGJqOOOy9siWiJ5MZu//4vedliPtbpRoGQNA0SsFseIxMY/v cSs1lOawXkx2UrZgBvv/vZtpFP604+Rb1B25+aoQ2rsSRazK7bwJdY4QQW9E0wNaJufvgZHViUYEj 4saUyhnFCIYx6fc88nU6p4S/6JmodBXoXlXlySCzHmAglE44UJMIkgJzdDA1klWcTe2Ei6P6CcdOJ Yxl050itpztmGze0hRGHCEslgUFF8Q1zUXnJrnItJS6U4O9x2MOJSzrUdgr90FBHvgTAMI/9ngSNv eloetzIziFMkqxmgTeXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKG-000000059wz-0kVh; Fri, 05 Apr 2024 04:37:16 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKA-000000059tF-02V9 for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 04:37:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712291829; x=1743827829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=kj6gp/nRHiQgmwDs8Z+dbAz4uAmOd3LQTa13FyxbWtc=; b=raYzZD2TqMupCy84+w80iNllL8xzypjTuEE3yInyQjz88VnfEPMaSFRj WcWH6vo1uG7VQvIevh3IgLUCgAXGjnNmyCrfffdAS+3cEYhgQPAoJtWAU HUD53zLFQ7kSoYbadGgpAzBe7HmYfEYc/nfd06vrpPdi3n2H7a0gLI3md OzSWNnOeFlULXZJ/j2ik1XBLezERt9mlSSS0qSJZEOCeQkECLGIQAPxz3 CV0GJ9xpoECGyz/wA12LAPcL3VaByIyk52ucLVXYOzH/ohxVlppoWLVHJ xThR62qrN5FFnZwViXeJw2QKJwjlN6tKnX/dlmjeApDchtgG3GJgR/Uzi A==; X-CSE-ConnectionGUID: I3x9LaISQ1uPgH0YvRkiJw== X-CSE-MsgGUID: 5sRsHkRaSDCQKzAs+atuTw== X-IronPort-AV: E=Sophos;i="6.07,180,1708412400"; d="scan'208";a="19541028" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Apr 2024 21:36:54 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Apr 2024 21:36:49 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 4 Apr 2024 21:36:37 -0700 From: Dharma Balasubiramani To: "andrzej . hajda @ intel . com" , "neil . armstrong @ linaro . org" , "rfoss @ kernel . org" , "Laurent . pinchart @ ideasonboard . com" , "jonas @ kwiboo . se" , "jernej . skrabec @ gmail . com" , "maarten . lankhorst @ linux . intel . com" , "mripard @ kernel . org" , "tzimmermann @ suse . de" , "airlied @ gmail . com" , "daniel @ ffwll . ch" , "robh+dt @ kernel . org" , "krzysztof . kozlowski+dt @ linaro . org" , "conor+dt @ kernel . org" , "linux @ armlinux . org . uk" , "Nicolas . Ferre @ microchip . com" , "alexandre . belloni @ bootlin . com" , "claudiu . beznea @ tuxon . dev" , "Manikandan . M @ microchip . com" , "Dharma . B @ microchip . com" , "arnd @ arndb . de" , "geert+renesas @ glider . be" , "Jason @ zx2c4 . com" , "mpe @ ellerman . id . au" , "gerg @ linux-m68k . org" , "rdunlap @ infradead . org" , "vbabka @ suse . cz" , "dri-devel @ lists . freedesktop . org" , "devicetree @ vger . kernel . org" , "linux-kernel @ vger . kernel . org" , "linux-arm-kernel @ lists . infradead . org" , "Hari . PrasathGE @ microchip . com" , "akpm @ linux-foundation . org" , "deller @ gmx . de" CC: Dharma Balasubiramani , Manikandan Muralidharan Subject: [PATCH v5 2/4] drm/bridge: add lvds controller support for sam9x7 Date: Fri, 5 Apr 2024 10:05:34 +0530 Message-ID: <20240405043536.274220-3-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240405043536.274220-1-dharma.b@microchip.com> References: <20240405043536.274220-1-dharma.b@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_213710_210555_1770E3DE X-CRM114-Status: GOOD ( 28.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a new LVDS controller driver for sam9x7 which does the following: - Prepares and enables the LVDS Peripheral clock - Defines its connector type as DRM_MODE_CONNECTOR_LVDS and adds itself to the global bridge list. - Identifies its output endpoint as panel and adds it to the encoder display pipeline - Enables the LVDS serializer Signed-off-by: Manikandan Muralidharan Signed-off-by: Dharma Balasubiramani Acked-by: Hari Prasath Gujulan Elango --- Changelog v4 -> v5 - Drop the unused variable 'format'. - Use DRM wrapper for dev_err() to maintain uniformity. - return -ENODEV instead of -EINVAL to maintain consistency with other DRM bridge drivers. v3 -> v4 - No changes. v2 ->v3 - Correct Typo error "serializer". - Consolidate get() and prepare() functions and use devm_clk_get_prepared(). - Remove unused variable 'ret' in probe(). - Use devm_pm_runtime_enable() and drop the mchp_lvds_remove(). v1 -> v2 - Drop 'res' variable and combine two lines into one. - Handle deferred probe properly, use dev_err_probe(). - Don't print anything on deferred probe. Dropped print. - Remove the MODULE_ALIAS and add MODULE_DEVICE_TABLE(). - symbol 'mchp_lvds_driver' was not declared. It should be static. --- drivers/gpu/drm/bridge/Kconfig | 7 + drivers/gpu/drm/bridge/Makefile | 1 + drivers/gpu/drm/bridge/microchip-lvds.c | 228 ++++++++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 drivers/gpu/drm/bridge/microchip-lvds.c diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index efd996f6c138..889098e2d65f 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -190,6 +190,13 @@ config DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW to DP++. This is used with the i.MX6 imx-ldb driver. You are likely to say N here. +config DRM_MICROCHIP_LVDS_SERIALIZER + tristate "Microchip LVDS serializer support" + depends on OF + depends on DRM_ATMEL_HLCDC + help + Support for Microchip's LVDS serializer. + config DRM_NWL_MIPI_DSI tristate "Northwest Logic MIPI DSI Host controller" depends on DRM diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index 017b5832733b..7df87b582dca 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -13,6 +13,7 @@ obj-$(CONFIG_DRM_LONTIUM_LT9611) += lontium-lt9611.o obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) += lontium-lt9611uxc.o obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o +obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) += microchip-lvds.o obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o diff --git a/drivers/gpu/drm/bridge/microchip-lvds.c b/drivers/gpu/drm/bridge/microchip-lvds.c new file mode 100644 index 000000000000..149704f498a6 --- /dev/null +++ b/drivers/gpu/drm/bridge/microchip-lvds.c @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries + * + * Author: Manikandan Muralidharan + * Author: Dharma Balasubiramani + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define LVDS_POLL_TIMEOUT_MS 1000 + +/* LVDSC register offsets */ +#define LVDSC_CR 0x00 +#define LVDSC_CFGR 0x04 +#define LVDSC_SR 0x0C +#define LVDSC_WPMR 0xE4 + +/* Bitfields in LVDSC_CR (Control Register) */ +#define LVDSC_CR_SER_EN BIT(0) + +/* Bitfields in LVDSC_CFGR (Configuration Register) */ +#define LVDSC_CFGR_PIXSIZE_24BITS 0 +#define LVDSC_CFGR_DEN_POL_HIGH 0 +#define LVDSC_CFGR_DC_UNBALANCED 0 +#define LVDSC_CFGR_MAPPING_JEIDA BIT(6) + +/*Bitfields in LVDSC_SR */ +#define LVDSC_SR_CS BIT(0) + +/* Bitfields in LVDSC_WPMR (Write Protection Mode Register) */ +#define LVDSC_WPMR_WPKEY_MASK GENMASK(31, 8) +#define LVDSC_WPMR_WPKEY_PSSWD 0x4C5644 + +struct mchp_lvds { + struct device *dev; + void __iomem *regs; + struct clk *pclk; + struct drm_panel *panel; + struct drm_bridge bridge; + struct drm_bridge *panel_bridge; +}; + +static inline struct mchp_lvds *bridge_to_lvds(struct drm_bridge *bridge) +{ + return container_of(bridge, struct mchp_lvds, bridge); +} + +static inline u32 lvds_readl(struct mchp_lvds *lvds, u32 offset) +{ + return readl_relaxed(lvds->regs + offset); +} + +static inline void lvds_writel(struct mchp_lvds *lvds, u32 offset, u32 val) +{ + writel_relaxed(val, lvds->regs + offset); +} + +static void lvds_serialiser_on(struct mchp_lvds *lvds) +{ + unsigned long timeout = jiffies + msecs_to_jiffies(LVDS_POLL_TIMEOUT_MS); + + /* The LVDSC registers can only be written if WPEN is cleared */ + lvds_writel(lvds, LVDSC_WPMR, (LVDSC_WPMR_WPKEY_PSSWD & + LVDSC_WPMR_WPKEY_MASK)); + + /* Wait for the status of configuration registers to be changed */ + while (lvds_readl(lvds, LVDSC_SR) & LVDSC_SR_CS) { + if (time_after(jiffies, timeout)) { + DRM_DEV_ERROR(lvds->dev, "%s: timeout error\n", + __func__); + return; + } + usleep_range(1000, 2000); + } + + /* Configure the LVDSC */ + lvds_writel(lvds, LVDSC_CFGR, (LVDSC_CFGR_MAPPING_JEIDA | + LVDSC_CFGR_DC_UNBALANCED | + LVDSC_CFGR_DEN_POL_HIGH | + LVDSC_CFGR_PIXSIZE_24BITS)); + + /* Enable the LVDS serializer */ + lvds_writel(lvds, LVDSC_CR, LVDSC_CR_SER_EN); +} + +static int mchp_lvds_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct mchp_lvds *lvds = bridge_to_lvds(bridge); + + bridge->encoder->encoder_type = DRM_MODE_ENCODER_LVDS; + + return drm_bridge_attach(bridge->encoder, lvds->panel_bridge, + bridge, flags); +} + +static void mchp_lvds_enable(struct drm_bridge *bridge) +{ + struct mchp_lvds *lvds = bridge_to_lvds(bridge); + int ret; + + ret = clk_enable(lvds->pclk); + if (ret < 0) { + DRM_DEV_ERROR(lvds->dev, "failed to enable lvds pclk %d\n", ret); + return; + } + + ret = pm_runtime_get_sync(lvds->dev); + if (ret < 0) { + DRM_DEV_ERROR(lvds->dev, "failed to get pm runtime: %d\n", ret); + clk_disable(lvds->pclk); + return; + } + + lvds_serialiser_on(lvds); +} + +static void mchp_lvds_disable(struct drm_bridge *bridge) +{ + struct mchp_lvds *lvds = bridge_to_lvds(bridge); + + pm_runtime_put(lvds->dev); + clk_disable(lvds->pclk); +} + +static const struct drm_bridge_funcs mchp_lvds_bridge_funcs = { + .attach = mchp_lvds_attach, + .enable = mchp_lvds_enable, + .disable = mchp_lvds_disable, +}; + +static int mchp_lvds_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct mchp_lvds *lvds; + struct device_node *port; + + if (!dev->of_node) + return -ENODEV; + + lvds = devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); + if (!lvds) + return -ENOMEM; + + lvds->dev = dev; + + lvds->regs = devm_ioremap_resource(lvds->dev, + platform_get_resource(pdev, IORESOURCE_MEM, 0)); + if (IS_ERR(lvds->regs)) + return PTR_ERR(lvds->regs); + + lvds->pclk = devm_clk_get_prepared(lvds->dev, "pclk"); + if (IS_ERR(lvds->pclk)) + return dev_err_probe(lvds->dev, PTR_ERR(lvds->pclk), + "could not get pclk_lvds prepared\n"); + + port = of_graph_get_remote_node(dev->of_node, 1, 0); + if (!port) { + DRM_DEV_ERROR(dev, + "can't find port point, please init lvds panel port!\n"); + return -ENODEV; + } + + lvds->panel = of_drm_find_panel(port); + of_node_put(port); + + if (IS_ERR(lvds->panel)) + return -EPROBE_DEFER; + + lvds->panel_bridge = devm_drm_panel_bridge_add(dev, lvds->panel); + + if (IS_ERR(lvds->panel_bridge)) + return PTR_ERR(lvds->panel_bridge); + + lvds->bridge.of_node = dev->of_node; + lvds->bridge.type = DRM_MODE_CONNECTOR_LVDS; + lvds->bridge.funcs = &mchp_lvds_bridge_funcs; + + dev_set_drvdata(dev, lvds); + devm_pm_runtime_enable(dev); + + drm_bridge_add(&lvds->bridge); + + return 0; +} + +static const struct of_device_id mchp_lvds_dt_ids[] = { + { + .compatible = "microchip,sam9x75-lvds", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, mchp_lvds_dt_ids); + +static struct platform_driver mchp_lvds_driver = { + .probe = mchp_lvds_probe, + .driver = { + .name = "microchip-lvds", + .of_match_table = mchp_lvds_dt_ids, + }, +}; +module_platform_driver(mchp_lvds_driver); + +MODULE_AUTHOR("Manikandan Muralidharan "); +MODULE_AUTHOR("Dharma Balasubiramani "); +MODULE_DESCRIPTION("Low Voltage Differential Signaling Controller Driver"); +MODULE_LICENSE("GPL"); From patchwork Fri Apr 5 04:35:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharma Balasubiramani X-Patchwork-Id: 13618450 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 2E813CD1284 for ; Fri, 5 Apr 2024 04:37:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EnYi+6o0lMK2rz7LWpmQyzYekgz/CPHre5Xi5dY4++w=; b=t/rJgABYZS8/Gl 3/+pGnXu0Xgc1Buf6h1zQ3BWBgIc/clW5CLMF7IjgUlsrEm3hD0O5iYIIyI8TBfycBrfTAhF9+Exs aJYg6G0K59a0bfYV3Z4Rf/esazxblsYRlH61miYBq25fosZjissRn13Az+zlVStcNVIndbZXAtp4h rXvOAjF3F3uI3583gqBl30bvAhrXYjf580ZeHoGhl44B+ufacM6C3polT1YBGxPz4kzrs4yOABJDN WZXQViTroqq/icf0xgx6kyEt7IWP44vpkZHOO3xWYrYyS2UksXgei/ZgwVRGdzs4AmXZBQkHz7BWq hr1fFfuj1fMUy01aeDbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKO-00000005A15-3pQE; Fri, 05 Apr 2024 04:37:24 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKM-000000059z3-0qh0 for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 04:37:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712291841; x=1743827841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9uINqyvWMsG3URlq2A0h6yqig1bkApNedwXa+jRDhH0=; b=1sDzpl60INqaLIAGISXKUBkt8tAGj/SBBHUVucpJIQ/hgOedxVWSC2qq C3q2sLMJkK8Wm2V5uYzG3FsUrfwRDma9JWPFyDwEGHOJI5FpcLfuu5hxz oO5xJNXErajViOOLsgifMqlPRoU5Pxt4J0RefbDpdTvXyRIXcMU1s0ol7 O+xCm+s4k3Ox03Eqf4AtIDhNDKKTkyBVIi0ecgVMzEyB6iOVZKIrBs9ZT TgnOztX4WUDtHz1oBaWdgFbuBjT3ldHkUFv09FdXUt7hMpUu7AX+5tNC2 SHeiF0g/zphvghfkLrVUXzi4RQfV+Byyjkv/cqm/1+MoNR+J5lj6S+Ov/ A==; X-CSE-ConnectionGUID: pa7nRkquTYe1ezaz9E3PHg== X-CSE-MsgGUID: ppkgSPbcQh6PVDkk0xUVZQ== X-IronPort-AV: E=Sophos;i="6.07,180,1708412400"; d="scan'208";a="186866933" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Apr 2024 21:37:20 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Apr 2024 21:37:01 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 4 Apr 2024 21:36:49 -0700 From: Dharma Balasubiramani To: "andrzej . hajda @ intel . com" , "neil . armstrong @ linaro . org" , "rfoss @ kernel . org" , "Laurent . pinchart @ ideasonboard . com" , "jonas @ kwiboo . se" , "jernej . skrabec @ gmail . com" , "maarten . lankhorst @ linux . intel . com" , "mripard @ kernel . org" , "tzimmermann @ suse . de" , "airlied @ gmail . com" , "daniel @ ffwll . ch" , "robh+dt @ kernel . org" , "krzysztof . kozlowski+dt @ linaro . org" , "conor+dt @ kernel . org" , "linux @ armlinux . org . uk" , "Nicolas . Ferre @ microchip . com" , "alexandre . belloni @ bootlin . com" , "claudiu . beznea @ tuxon . dev" , "Manikandan . M @ microchip . com" , "Dharma . B @ microchip . com" , "arnd @ arndb . de" , "geert+renesas @ glider . be" , "Jason @ zx2c4 . com" , "mpe @ ellerman . id . au" , "gerg @ linux-m68k . org" , "rdunlap @ infradead . org" , "vbabka @ suse . cz" , "dri-devel @ lists . freedesktop . org" , "devicetree @ vger . kernel . org" , "linux-kernel @ vger . kernel . org" , "linux-arm-kernel @ lists . infradead . org" , "Hari . PrasathGE @ microchip . com" , "akpm @ linux-foundation . org" , "deller @ gmx . de" Subject: [PATCH v5 3/4] MAINTAINERS: add SAM9X7 SoC's LVDS controller Date: Fri, 5 Apr 2024 10:05:35 +0530 Message-ID: <20240405043536.274220-4-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240405043536.274220-1-dharma.b@microchip.com> References: <20240405043536.274220-1-dharma.b@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_213722_305446_7EAF35F2 X-CRM114-Status: GOOD ( 10.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dharma Balasubiramani Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add the newly added LVDS controller for the SAM9X7 SoC to the existing MAINTAINERS entry. Signed-off-by: Dharma Balasubiramani Reviewed-by: Neil Armstrong Acked-by: Nicolas Ferre --- Changelog v4 -> v5 v3 -> v4 - No changes. v2 -> v3 - Move the entry before "MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER". v1 -> v2 - No Changes. --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index aa3b947fb080..3dd93dbe9542 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14562,6 +14562,14 @@ S: Supported F: Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml F: drivers/pwm/pwm-atmel.c +MICROCHIP SAM9x7-COMPATIBLE LVDS CONTROLLER +M: Manikandan Muralidharan +M: Dharma Balasubiramani +L: dri-devel@lists.freedesktop.org +S: Supported +F: Documentation/devicetree/bindings/display/bridge/microchip,sam9x7-lvds.yaml +F: drivers/gpu/drm/bridge/microchip-lvds.c + MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER M: Eugen Hristev L: linux-iio@vger.kernel.org From patchwork Fri Apr 5 04:35:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dharma Balasubiramani X-Patchwork-Id: 13618451 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 57BBDCD1297 for ; Fri, 5 Apr 2024 04:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K/gWQz31xmWZ3zfXzT/9EhFw0UuArW/cSq/OjljUw7o=; b=ylyYG5os/smYxr B+B1zZGNkHxwNBb1yS7FSwFOEuUCHwiWwicB48YaSiok1AUAx9EjKxJBo8H0NsE9Ukp2ACXv+VVwZ Dp+AF5JQ6HN/iMD84qGgbNAKYL8wm0WrbtsR4HsacMdXjMplnBy3pjigHbnGeK2TFi52lFlNG4Jvl DXGHJqSvX0JDguCeB3rN+9jBq7Djunv5rtb6J5k1//co40OnhJkAZkHbvkeRL0obCTZrjt97GFp9Z oSGaKC6TYF8csP8wtCr7bTIIxGpH3/uCwASNirGiV/mrvLOWII2KaegsLN3xbaTCvIy3pLUHAOEzU Nj/aqgkRwPvb8gbeEpiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKT-00000005A4D-1V9w; Fri, 05 Apr 2024 04:37:29 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsbKN-000000059z3-3Ilh for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2024 04:37:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1712291843; x=1743827843; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=po9zb6Qn/5fT2i3jnTl0DLe9EyYWr9PtZv3ZiG+LgXk=; b=I+6Mzi3tCEKTZbcKugFXBtIz2sFJW6sM9bYlCaO7YcS92jVU7g7msMjp I0qyJR0UxXEXNI792xHhlIBYGRNE3MYLGe2sQG4qg15jH+T+Bz+Z0+Pfu R2FSY69vOMJ7HzVh6jsUxAsTkwihJpyBvthtXo9eTTpkarPuHPrI6uHiO YVZkqTDwqlbmfBPPtY2TgAE+l3U5TBepox0L6Idpi3ZeyLshYGoG5m66H ufgKCHHaqi+cbAcInFCYGHymyedlh0WHShOkNKkBn07RYCiOZ5Jq6Xikk R9ZACsLlF/BlCs9m6xlOQb3tU5/T/gqYSIhZlRtJr3uyb6UfhMJYPCHyW w==; X-CSE-ConnectionGUID: pa7nRkquTYe1ezaz9E3PHg== X-CSE-MsgGUID: 7CFef4+2SuuC2PUB3XjO2g== X-IronPort-AV: E=Sophos;i="6.07,180,1708412400"; d="scan'208";a="186866936" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 04 Apr 2024 21:37:21 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 4 Apr 2024 21:37:14 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 4 Apr 2024 21:37:02 -0700 From: Dharma Balasubiramani To: "andrzej . hajda @ intel . com" , "neil . armstrong @ linaro . org" , "rfoss @ kernel . org" , "Laurent . pinchart @ ideasonboard . com" , "jonas @ kwiboo . se" , "jernej . skrabec @ gmail . com" , "maarten . lankhorst @ linux . intel . com" , "mripard @ kernel . org" , "tzimmermann @ suse . de" , "airlied @ gmail . com" , "daniel @ ffwll . ch" , "robh+dt @ kernel . org" , "krzysztof . kozlowski+dt @ linaro . org" , "conor+dt @ kernel . org" , "linux @ armlinux . org . uk" , "Nicolas . Ferre @ microchip . com" , "alexandre . belloni @ bootlin . com" , "claudiu . beznea @ tuxon . dev" , "Manikandan . M @ microchip . com" , "Dharma . B @ microchip . com" , "arnd @ arndb . de" , "geert+renesas @ glider . be" , "Jason @ zx2c4 . com" , "mpe @ ellerman . id . au" , "gerg @ linux-m68k . org" , "rdunlap @ infradead . org" , "vbabka @ suse . cz" , "dri-devel @ lists . freedesktop . org" , "devicetree @ vger . kernel . org" , "linux-kernel @ vger . kernel . org" , "linux-arm-kernel @ lists . infradead . org" , "Hari . PrasathGE @ microchip . com" , "akpm @ linux-foundation . org" , "deller @ gmx . de" Subject: [PATCH v5 4/4] ARM: configs: at91: Enable LVDS serializer support Date: Fri, 5 Apr 2024 10:05:36 +0530 Message-ID: <20240405043536.274220-5-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240405043536.274220-1-dharma.b@microchip.com> References: <20240405043536.274220-1-dharma.b@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_213723_905589_336DFF9F X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Hari Prasath Gujulan Elango , Dharma Balasubiramani Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Enable LVDS serializer support for display pipeline. Signed-off-by: Dharma Balasubiramani Acked-by: Hari Prasath Gujulan Elango Acked-by: Nicolas Ferre --- Changelog v4 -> v5 v3 -> v4 v2 -> v3 - No Changes. --- arch/arm/configs/at91_dt_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig index 1d53aec4c836..6eabe2313c9a 100644 --- a/arch/arm/configs/at91_dt_defconfig +++ b/arch/arm/configs/at91_dt_defconfig @@ -143,6 +143,7 @@ CONFIG_VIDEO_OV2640=m CONFIG_VIDEO_OV7740=m CONFIG_DRM=y CONFIG_DRM_ATMEL_HLCDC=y +CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER=y CONFIG_DRM_PANEL_SIMPLE=y CONFIG_DRM_PANEL_EDP=y CONFIG_FB_ATMEL=y