From patchwork Tue Dec 3 17:21:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tommaso Merciai X-Patchwork-Id: 13892734 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 8AFBAE74AC3 for ; Tue, 3 Dec 2024 17:22:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7BD210E47E; Tue, 3 Dec 2024 17:22:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="dpsMnQQl"; dkim-atps=neutral Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2DBD10E47E for ; Tue, 3 Dec 2024 17:22:04 +0000 (UTC) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-434a14d6bf4so52475235e9.1 for ; Tue, 03 Dec 2024 09:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733246523; x=1733851323; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LDrSaH5SCKXFsRBXZmgdwR2EOhLbo3un31COyXQgzFk=; b=dpsMnQQls+XF5eLI8XujoKiydq2nvbJaEvxWzygLunL7umjNeeVIVeitkjI9hSX1iB kvdwzkjWuZGzgzqjq6s3gA4rfSOdcqZrr48z4V0AeL+sfxaVKQ58a915dJ4fIO/cw3YW NRvLivz720IZ4Ug9uDnj9lusB9Opt/Yo33yOq6ySlYONCzZmTGno/DU33ZEllkxFG3Y3 N6lgatHaoxokaX7OiyzxghAnRRmWmFhMgnTVTs37oRmZXmesGdZSnOKGsh6iXmVwrRlA KLILTTHWexRrxvo7KhboHLUnQIh/ce0nfdkylTIStvXko6wZBnB6aIULleHZaUACMEWv zxbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733246523; x=1733851323; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LDrSaH5SCKXFsRBXZmgdwR2EOhLbo3un31COyXQgzFk=; b=WGaVLxwRXiCL4P/HqA6hfz8WAasCDiWAlmJbararLTdHOVII9CXm42ncgjJvhHA3XV JmD3wQ5DSfXoXX2Of+q4Nhq+NBV9EW75EVZ3acBIpWBtyD1Ehxw8iG9OwCSSKCkqMc8T O+Z7Mpzt0gQUPUiIfiWwh+Kwm0azWLmRNKDTJYkwYXLl2SFegtfgaFwLVtVHtd5rvTm+ LMs3kOGAGFOGQd66mmLM3F+v/wOCvUbfyRkLf2yRCeQUuDpZOtRu7fu4PtBvkLuSrg5j OKQ+gOwg64Ijga4AMCrTMI7kgnRG9ujL+gx/LCZuvJNydzLZ7rXscmVvzoR37sIkohnh iIQg== X-Forwarded-Encrypted: i=1; AJvYcCUme6mSlsByNv/7hkX2q1AfG16OMy1la4D7JfBxOCxp2LmgWknNFLHA4/sLXzHY/Rs65CeEy/BFt5I=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yy/kYz2QZRNP1ssKbI7o1mHiIeGmvW5WkKIk5lXzQk98hQ7Z1tz mSMNdMI6wjfhmN10AmRvDNJVKyczl44hM8v3ORGGw5XRhbT0nJn5 X-Gm-Gg: ASbGncsGdTKk2LLw+R09dqTkMo/+JgazSd8KmzFuMLouz25zgt1qZT9AYsRL38QfKXV J0wTJdMDCZ3peUoMkeL9pHiBWP/BS2e5EUYrb/z0yyfP+Q59GHm/DHy0HPVXvONqDyn1UP5P34P HJEFRG7oID4EuimDyqJorso9cnts2jyKDKuhqtSj31O4YJLMtjgESL4IWxMcE6oiUPCLtnwLzt+ yUo0QuhPnl4iUyhodkwQytyhOJDtdJpIUpglIBePzuY1kGD5xIdUlkUMv+gJvBG4bdXjRZAhPEn 8MrZxI+4vZ8dyOY/tHF8UstVtS6E2Z7Nw4Ai4LE2SJYC5Q== X-Google-Smtp-Source: AGHT+IHf2fdYtDx1rwtIPEdB0BycampUt/lo8/MCwVi4A8/NjisEkxdV8VZFFWTSSBwN37r6fxWJqA== X-Received: by 2002:a5d:5f94:0:b0:385:fae7:fe50 with SMTP id ffacd0b85a97d-385fd423b82mr2951236f8f.42.1733246522761; Tue, 03 Dec 2024 09:22:02 -0800 (PST) Received: from tom-desktop.station (net-188-217-53-234.cust.vodafonedsl.it. [188.217.53.234]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-385ee2c7559sm7826658f8f.12.2024.12.03.09.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 09:22:02 -0800 (PST) From: tomm.merciai@gmail.com X-Google-Original-From: tommaso.merciai.xr@bp.renesas.com To: tomm.merciai@gmail.com Cc: linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, biju.das.jz@bp.renesas.com, Tommaso Merciai , Liu Ying , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org Subject: [PATCH] drm/bridge: ite-it6263: Support VESA input format Date: Tue, 3 Dec 2024 18:21:29 +0100 Message-Id: <20241203172129.778123-1-tommaso.merciai.xr@bp.renesas.com> X-Mailer: git-send-email 2.34.1 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tommaso Merciai Introduce it6263_is_input_bus_fmt_valid() and refactor the it6263_bridge_atomic_get_input_bus_fmts() function to support VESA format by selecting the LVDS input format based on the LVDS data mapping and thereby support both JEIDA and VESA input formats. Signed-off-by: Tommaso Merciai Reviewed-by: Dmitry Baryshkov Signed-off-by: Tommaso Merciai Acked-by: Tommaso Merciai --- drivers/gpu/drm/bridge/ite-it6263.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6263.c b/drivers/gpu/drm/bridge/ite-it6263.c index cbabd4e20d3e..83d1db29157a 100644 --- a/drivers/gpu/drm/bridge/ite-it6263.c +++ b/drivers/gpu/drm/bridge/ite-it6263.c @@ -48,6 +48,7 @@ #define REG_COL_DEP GENMASK(1, 0) #define BIT8 FIELD_PREP(REG_COL_DEP, 1) #define OUT_MAP BIT(4) +#define VESA BIT(4) #define JEIDA 0 #define REG_DESSC_ENB BIT(6) #define DMODE BIT(7) @@ -428,12 +429,30 @@ static inline void it6263_lvds_reset(struct it6263 *it) fsleep(10000); } +static bool it6263_is_input_bus_fmt_valid(u32 input_fmt) +{ + switch (input_fmt) { + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA: + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG: + return true; + } + return false; +} + static inline void it6263_lvds_set_interface(struct it6263 *it) { + u8 fmt; + /* color depth */ regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, REG_COL_DEP, BIT8); + + if (it->lvds_data_mapping == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) + fmt = VESA; + else + fmt = JEIDA; + /* output mapping */ - regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, JEIDA); + regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, fmt); if (it->lvds_dual_link) { regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, DMODE, DISO); @@ -714,14 +733,14 @@ it6263_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, *num_input_fmts = 0; - if (it->lvds_data_mapping != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) + if (!it6263_is_input_bus_fmt_valid(it->lvds_data_mapping)) return NULL; input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL); if (!input_fmts) return NULL; - input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA; + input_fmts[0] = it->lvds_data_mapping; *num_input_fmts = 1; return input_fmts;