From nobody Fri May 17 23:31:02 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EFCF158A12; Thu, 18 Apr 2024 08:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430737; cv=none; b=pJD2mKdnl1eyObcdjj60ypcML8VYid1MOgHr7xKhRDQja4D0yoN/eOJbaVHQ8zD641ROi8tp4Qze7/JExPT+1+2ltpo35nE6nUuyC7o09DcUi71hBXOuqoeY8ooVnWSlZkp7zitsijmK8Fs+nN5OXeo0bxIqrPsShyqosjqO6Eo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430737; c=relaxed/simple; bh=zmwWDI8GjPkIeLctZgAAryEmVPFq+vlYqthKzJRehGU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pk2zMo/HVoQ0I7jhkViKjCYVLENeoEZ5se53VIhNmThaDz8XhjRBY+mg53zeVKGYWUOj5QC9dWH46zhoOkQVKJHFE+LHAQ7MZdpZQh0SDBs2I4Vjj74TqZOihJB0VD0dYMD5LgHUYlVO63SkhvucowKNiPe1xii6tJ0Zlr3gu6M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=yc3I3OTc; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="yc3I3OTc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713430735; x=1744966735; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zmwWDI8GjPkIeLctZgAAryEmVPFq+vlYqthKzJRehGU=; b=yc3I3OTclGiiQgrI4W6h9Anlv5/JQcBfcQCyUY8y7UCxB2VXY9Ch+NpS /nVBckW3GLUdQ63aEvIZZZ4xgXyIHzhbh04u2w6kgJChk7n/VCrt6o6sw h3hquToC+UxsStxU3DxdLyBC8oRNvUTgIaAiRz3MZKhzBiRidkUN1Lzri Kh6MKlNR5nqa3lD4shqWuz/Lp8OsWNVADq0cQPHoRDiO1iRPrt6s8Z6u/ h1hGYBJriZKV6eLzlAv6G4IgmIRmnTTVRKePP1+7ffWcInusG6R9CBLy7 S9jJ+znO8CnJ2xY5GyLy+DifePkUPLsFRTCFwxPS2eeiLqOoZBCTl/B74 Q==; X-CSE-ConnectionGUID: nOC82dQIQv+hluLRGLoAdw== X-CSE-MsgGUID: SLaAB+ssRIKI6+x2ITGmhg== X-IronPort-AV: E=Sophos;i="6.07,211,1708412400"; d="scan'208";a="252380679" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Apr 2024 01:58:54 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 18 Apr 2024 01:58:21 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 18 Apr 2024 01:58:09 -0700 From: Dharma Balasubiramani To: "dmitry . baryshkov @ linaro . org" , "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" , "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" , "oe-kbuild-all @ lists . linux . dev" , "Hari . PrasathGE @ microchip . com" CC: Dharma Balasubiramani , Rob Herring Subject: [PATCH v7 1/4] dt-bindings: display: bridge: add sam9x75-lvds binding Date: Thu, 18 Apr 2024 14:27:22 +0530 Message-ID: <20240418085725.373797-2-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240418085725.373797-1-dharma.b@microchip.com> References: <20240418085725.373797-1-dharma.b@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 v6 -> v7 - No Changes. v5 -> v6 - No Changes. 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 se= ries. - 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/microc= hip,sam9x75-lvds.yaml diff --git a/Documentation/devicetree/bindings/display/bridge/microchip,sam= 9x75-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-lv= ds.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.y= aml# +$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 =3D "microchip,sam9x75-lvds"; + reg =3D <0xf8060000 0x100>; + interrupts =3D <56 IRQ_TYPE_LEVEL_HIGH 0>; + clocks =3D <&pmc PMC_TYPE_PERIPHERAL 56>; + clock-names =3D "pclk"; + }; --=20 2.25.1 From nobody Fri May 17 23:31:02 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91707158A12; Thu, 18 Apr 2024 08:58:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430729; cv=none; b=DWfDFHA4Df94RkzIlnDC7IExSGQio7vCW+oajWUEQf1QKpgBoxX9FMhOfaJzpey5q1QGRun+LjEkuXEOdWr4+28xlJsa38GHDzmFXFcvKpj6ZN3sruCCljf151q7uIqRvRtTiSVupN6JHw3ZNgQAc5gkdFcKquYnEH/PEHjrU4M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430729; c=relaxed/simple; bh=2jlRNOXggWGS+80SIZCeSvACFd9ff6EoKfaMoBRQFJg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YJLJFd3AI9gaQ4TAUOJN5AQgi6AYWORihLshMOALnWxe5mUtdnEso0H22ZS5x8JooScWzJP8RnuFsrpOBuUeb6KqFEjVbmJ58jEqatRORYxNhrLz35ScAS5TDWTe9nrboQ0065Fx8vCGIeA6MjSxh5+MjHSWdfIChr6VuEPd3ug= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=zq1qnT6I; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="zq1qnT6I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713430726; x=1744966726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2jlRNOXggWGS+80SIZCeSvACFd9ff6EoKfaMoBRQFJg=; b=zq1qnT6INDQ2zRxghgE0Jh45OTufK5Smxgb+EBQtwpm9iqTqqDHfzjl5 bJu1UuA4KjTe2dBl0oQgnz51D0Bo0pj+dvHVJ8GiBv41pVDV8DeWGm0ty KCWMbqq4NmZsZ9CbjoEsvCfffRRpzXTRvFahXrPSsTdJzw7rn2QOMdgxf doKGqMyxhX5GpN+1zWERCt15kroxgEhJM17P1H/rWjvJt7lFYLsQQ7lxw o2n4SsmYWiP1XvMfJD7mQ2OiPwndoNclkvixI8XhSlTXatFdcu7ZEVJiJ 9b5y6kX/rC+8JK5zLvVBJy404zf6aomN/Ygus3g5WM6xIJAkh1oblgp5p g==; X-CSE-ConnectionGUID: laatkwQ1Ty++ty3yTjSAXA== X-CSE-MsgGUID: 436fqXSYSxOFMSIgDb0M4Q== X-IronPort-AV: E=Sophos;i="6.07,211,1708412400"; d="scan'208";a="23593212" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Apr 2024 01:58:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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, 18 Apr 2024 01:58:33 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 18 Apr 2024 01:58:21 -0700 From: Dharma Balasubiramani To: "dmitry . baryshkov @ linaro . org" , "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" , "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" , "oe-kbuild-all @ lists . linux . dev" , "Hari . PrasathGE @ microchip . com" CC: Dharma Balasubiramani , Manikandan Muralidharan , Hari Prasath Gujulan Elango Subject: [PATCH v7 2/4] drm/bridge: add lvds controller support for sam9x7 Date: Thu, 18 Apr 2024 14:27:23 +0530 Message-ID: <20240418085725.373797-3-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240418085725.373797-1-dharma.b@microchip.com> References: <20240418085725.373797-1-dharma.b@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 v6 -> v7 - Remove setting encoder type from bridge driver. - Drop clk_disable() from pm_runtime_get_sync() error handling. - Use devm_clk_get() instead of prepared version. - Hence use clk_prepare_enable() and clk_disable_unprepare(). - Use devm_drm_of_get_bridge() instead of devm_drm_panel_bridge_add(). - Add error check for devm_pm_runtime_enable(). - Use dev_err() instead of DRM_DEV_ERROR() as it is deprecated. - Add missing Acked-by tag. v5 -> v6 - No Changes. 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 | 229 ++++++++++++++++++++++++ 3 files changed, 237 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. =20 +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/Makef= ile 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) +=3D lontium-lt9611.o obj-$(CONFIG_DRM_LONTIUM_LT9611UXC) +=3D lontium-lt9611uxc.o obj-$(CONFIG_DRM_LVDS_CODEC) +=3D lvds-codec.o obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) +=3D megachips-stdpxxxx-= ge-b850v3-fw.o +obj-$(CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER) +=3D microchip-lvds.o obj-$(CONFIG_DRM_NXP_PTN3460) +=3D nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) +=3D parade-ps8622.o obj-$(CONFIG_DRM_PARADE_PS8640) +=3D parade-ps8640.o diff --git a/drivers/gpu/drm/bridge/microchip-lvds.c b/drivers/gpu/drm/brid= ge/microchip-lvds.c new file mode 100644 index 000000000000..17a93c3c72d4 --- /dev/null +++ b/drivers/gpu/drm/bridge/microchip-lvds.c @@ -0,0 +1,229 @@ +// 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 =3D 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)) { + dev_err(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 =3D bridge_to_lvds(bridge); + + return drm_bridge_attach(bridge->encoder, lvds->panel_bridge, + bridge, flags); +} + +static void mchp_lvds_enable(struct drm_bridge *bridge) +{ + struct mchp_lvds *lvds =3D bridge_to_lvds(bridge); + int ret; + + ret =3D clk_prepare_enable(lvds->pclk); + if (ret < 0) { + dev_err(lvds->dev, "failed to enable lvds pclk %d\n", ret); + return; + } + + ret =3D pm_runtime_get_sync(lvds->dev); + if (ret < 0) { + dev_err(lvds->dev, "failed to get pm runtime: %d\n", ret); + return; + } + + lvds_serialiser_on(lvds); +} + +static void mchp_lvds_disable(struct drm_bridge *bridge) +{ + struct mchp_lvds *lvds =3D bridge_to_lvds(bridge); + + pm_runtime_put(lvds->dev); + clk_disable_unprepare(lvds->pclk); +} + +static const struct drm_bridge_funcs mchp_lvds_bridge_funcs =3D { + .attach =3D mchp_lvds_attach, + .enable =3D mchp_lvds_enable, + .disable =3D mchp_lvds_disable, +}; + +static int mchp_lvds_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct mchp_lvds *lvds; + struct device_node *port; + int ret; + + if (!dev->of_node) + return -ENODEV; + + lvds =3D devm_kzalloc(&pdev->dev, sizeof(*lvds), GFP_KERNEL); + if (!lvds) + return -ENOMEM; + + lvds->dev =3D dev; + + lvds->regs =3D devm_ioremap_resource(lvds->dev, + platform_get_resource(pdev, IORESOURCE_MEM, 0)); + if (IS_ERR(lvds->regs)) + return PTR_ERR(lvds->regs); + + lvds->pclk =3D devm_clk_get(lvds->dev, "pclk"); + if (IS_ERR(lvds->pclk)) + return dev_err_probe(lvds->dev, PTR_ERR(lvds->pclk), + "could not get pclk_lvds\n"); + + port =3D of_graph_get_remote_node(dev->of_node, 1, 0); + if (!port) { + dev_err(dev, + "can't find port point, please init lvds panel port!\n"); + return -ENODEV; + } + + lvds->panel =3D of_drm_find_panel(port); + of_node_put(port); + + if (IS_ERR(lvds->panel)) + return -EPROBE_DEFER; + + lvds->panel_bridge =3D devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); + + if (IS_ERR(lvds->panel_bridge)) + return PTR_ERR(lvds->panel_bridge); + + lvds->bridge.of_node =3D dev->of_node; + lvds->bridge.type =3D DRM_MODE_CONNECTOR_LVDS; + lvds->bridge.funcs =3D &mchp_lvds_bridge_funcs; + + dev_set_drvdata(dev, lvds); + devm_pm_runtime_enable(dev); + if (ret < 0) { + dev_err(lvds->dev, "failed to enable pm runtime: %d\n", ret); + return ret; + } + + drm_bridge_add(&lvds->bridge); + + return 0; +} + +static const struct of_device_id mchp_lvds_dt_ids[] =3D { + { + .compatible =3D "microchip,sam9x75-lvds", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, mchp_lvds_dt_ids); + +static struct platform_driver mchp_lvds_driver =3D { + .probe =3D mchp_lvds_probe, + .driver =3D { + .name =3D "microchip-lvds", + .of_match_table =3D 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"); --=20 2.25.1 From nobody Fri May 17 23:31:02 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5164136991; Thu, 18 Apr 2024 08:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.153.233 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430739; cv=none; b=Z+axqfqG6zKaUgpyXGOwGB9VuLWcuF6OvhMdPLu82byH6vhHYsQbZWsP1cIJ+K2b3rySky42JZbjdtBPkD9PuvcaS3xXy+Z3cwDXSdeHNk2YI9SwnGP8LRola1TURDZQyYPWzTkUxxaWJt9kppwFZ3UecXQ8fqaKOmcL6CwkaqE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430739; c=relaxed/simple; bh=xvoAVCZn7y6cWhAIyRiSa8G/ubMxvgzRvPGzUq0Y6Ak=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pjZMuUMMmSWSCdogj3IaY0DVcAcneRogPqHBEmRGCnx5iOUiojHX/X58dHa6f/JxVwRKG+Z8j+178i2BOIbCgLvgiKXe/chsbwdUqRORskvfvrPcpdE8Iiu9m0DvJCl0/4EJWxN7D3tuYmIYWUrtFk1QMotzDydJPzKCGVybrbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=BD2mIXzj; arc=none smtp.client-ip=68.232.153.233 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="BD2mIXzj" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713430737; x=1744966737; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xvoAVCZn7y6cWhAIyRiSa8G/ubMxvgzRvPGzUq0Y6Ak=; b=BD2mIXzjpuLP3p9zjTAbW4pFoic5nB3kw0A0GJw5NLoitO2Y6xjPIjW0 rGHxAPpZmqlNgIO/y2Dw8o0KnaKaYgdJp3wJrq7xb4Kiavr4xWBGORKwM qAhR9ZvLbvz7qjlKk/HW2g55pRcTxGnxFBluCzDKD64Zdr0xA80vsMBWp s14XYYzp25j3tISPX7h4k7vtHWMIv1l6ew6IJ5VVg+8v5CiFUQe3Zq57s Kvuc/q9rUwsYKMIAJu7z+UUEdhoa+8QHHDImLKtcE+QGJFP4iCSM4T5+o QmYCjUFP7JONMrpAO9PFhBFmayAh0ZSyG+N/EvMApmaQK4hFtouG3FAxx g==; X-CSE-ConnectionGUID: nOC82dQIQv+hluLRGLoAdw== X-CSE-MsgGUID: KzPS7JK7REyXkQpf/18qng== X-IronPort-AV: E=Sophos;i="6.07,211,1708412400"; d="scan'208";a="252380686" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 18 Apr 2024 01:58:55 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 18 Apr 2024 01:58:45 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 18 Apr 2024 01:58:34 -0700 From: Dharma Balasubiramani To: "dmitry . baryshkov @ linaro . org" , "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" , "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" , "oe-kbuild-all @ lists . linux . dev" , "Hari . PrasathGE @ microchip . com" CC: Dharma Balasubiramani , Nicolas Ferre Subject: [PATCH v7 3/4] MAINTAINERS: add SAM9X7 SoC's LVDS controller Date: Thu, 18 Apr 2024 14:27:24 +0530 Message-ID: <20240418085725.373797-4-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240418085725.373797-1-dharma.b@microchip.com> References: <20240418085725.373797-1-dharma.b@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 v6 -> v7 - No changes. v5 -> v6 - Correct the file name sam9x7-lvds.yaml -> sam9x75-lvds.yaml. 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 c23fda1aa1f0..e49347eac596 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14563,6 +14563,14 @@ S: Supported F: Documentation/devicetree/bindings/pwm/atmel,at91sam-pwm.yaml F: drivers/pwm/pwm-atmel.c =20 +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,sam9x75-lvds= .yaml +F: drivers/gpu/drm/bridge/microchip-lvds.c + MICROCHIP SAMA5D2-COMPATIBLE ADC DRIVER M: Eugen Hristev L: linux-iio@vger.kernel.org --=20 2.25.1 From nobody Fri May 17 23:31:02 2024 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B05315AACA; Thu, 18 Apr 2024 08:59:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.154.123 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430760; cv=none; b=OCvQfiykKQKSaNtu6FTwK+4N9urRJMFF7gDmnIQyojNhCUYIbqgCIio87xOZ8vZrsBRvGGFDm5uOLve2k1PQIT35bK9hNB4opGn82TsBP+DcGFjdqUkfjlqQts6CWkGHVHXAJRTpYimh2CMMRF8R5FxMoyzaYYDr3Uqf6toRBqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713430760; c=relaxed/simple; bh=0CpQwN2sY7E8w9r+RH403hk74qO8mXZSxBiz6OoTlT8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TR2Pl0sMaD2djWF1CeREQauPofDWlXODP+ao5oBFbiTkgjXTvbVgF5a8XyjoLUlllc3F/z8o8NBvz1bq3OHWXrx2NT7xCOA7vwhLQneLapmxn94PZIL31GLu8NGbjNuZxGpyTSvPMBjJbqwqR/0ziMDlj4mYigc6mVJnrhT7KBM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b=usvMwDNr; arc=none smtp.client-ip=68.232.154.123 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="usvMwDNr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1713430758; x=1744966758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0CpQwN2sY7E8w9r+RH403hk74qO8mXZSxBiz6OoTlT8=; b=usvMwDNrOOHV1aZm15tDshDISJCglxYqPaH+KrED4C6evXwpNF1JSACD t4kLZeYCD0hdHNwlEZHiNyzD3urciijCKe5uwDsHT5fx4gsijSglM9C3K xpHLAurbwkDguUlsSAYjgsn86EKpswug7XA/i0Tnr+Cd4fL5SpWMBL4iM n3q0+T2VgU8x9WtjfxCPveaIvWK+8EclhFSi9IywtXAN47yfT0Sx6Vz0Y Nh+QbGrv5+iO+KZO7dXTDD1B1ToG2IUp6HWEQj3n8v6UvEytd9ZmZbdyG GyUFWe2hV/HY2PIa9pU3sX2n2wgnOHQ6QoP/HtBSEegG/tmF8Um/R/j8W Q==; X-CSE-ConnectionGUID: R+PXq/rzTeCdCQmY8Xy7jA== X-CSE-MsgGUID: hF1xpleMR0K5xu0Z7/mHaw== X-IronPort-AV: E=Sophos;i="6.07,211,1708412400"; d="scan'208";a="188866875" 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; 18 Apr 2024 01:59:17 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 18 Apr 2024 01:58:57 -0700 Received: from che-lt-i70843lx.microchip.com (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Thu, 18 Apr 2024 01:58:45 -0700 From: Dharma Balasubiramani To: "dmitry . baryshkov @ linaro . org" , "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" , "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" , "oe-kbuild-all @ lists . linux . dev" , "Hari . PrasathGE @ microchip . com" CC: Dharma Balasubiramani , "Hari Prasath Gujulan Elango" , Nicolas Ferre Subject: [PATCH v7 4/4] ARM: configs: at91: Enable LVDS serializer support Date: Thu, 18 Apr 2024 14:27:25 +0530 Message-ID: <20240418085725.373797-5-dharma.b@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240418085725.373797-1-dharma.b@microchip.com> References: <20240418085725.373797-1-dharma.b@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Enable LVDS serializer support for display pipeline. Signed-off-by: Dharma Balasubiramani Acked-by: Hari Prasath Gujulan Elango Acked-by: Nicolas Ferre --- Changelog v6 -> v7 v5 -> v6 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=3Dm CONFIG_VIDEO_OV7740=3Dm CONFIG_DRM=3Dy CONFIG_DRM_ATMEL_HLCDC=3Dy +CONFIG_DRM_MICROCHIP_LVDS_SERIALIZER=3Dy CONFIG_DRM_PANEL_SIMPLE=3Dy CONFIG_DRM_PANEL_EDP=3Dy CONFIG_FB_ATMEL=3Dy --=20 2.25.1