From patchwork Thu Nov 9 21:50:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Morgan X-Patchwork-Id: 13451775 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 DCD0DC4167B for ; Thu, 9 Nov 2023 21:50:28 +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=y5ScuvXj5cP1iMLeGGkwggC5CnMBJNVnydeL+xH/y2w=; b=GkcXBP8aIAIA0L bi7NCDXggHdwsywsiCwGtbHZjFLvqLleE6TZxwsljUqRwCzOTS665srOFOb5pF/eIjAB29Q6R7ESN rw24xpcnTbIv7l3TqYgJU1wcGOvUXQzoby+xUBx95/Xtp95x/tCxa1oziW4hAZeuVVqWbaymid24+ D6GeOBRhRzLNsXDzR48T7ThpMxnBUSE2/P/dx+LGk4FQva/Q9b98Ea61S8nFi1pwCbHlD3piHkds/ AEPsXost3vAkNnZwHR5ejxFrCpEB37iATJA/bMU45FSm8s/H+rocijcCBKgF4H3UkcepT5yEqjvZf D8GrjNB6j6adu1ESOrpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1Cus-007I3d-2Q; Thu, 09 Nov 2023 21:50:22 +0000 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1Cuo-007I1X-0X for linux-rockchip@lists.infradead.org; Thu, 09 Nov 2023 21:50:20 +0000 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-581e5a9413bso727174eaf.1 for ; Thu, 09 Nov 2023 13:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699566616; x=1700171416; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JZXYYoZ9YXR8OaFb0rqU8J6WjFq3wVUlkQ9dvWsztWg=; b=eAM0As/cEDcDgmg7mpvqS9ZyjJvkyDwKtqkQioe2l5RD6nGJIUrWE3YzFcvtClP+cD nuC+T5DrzOll3WxzWk4mH7RoatM/mPzuU+rBei1vnnO6dl0d+H4ABAL5kKTGccPGT7L1 s41vH6VH5n4HpwCnDwYUPbLpwVQeVe2NIf6BtoojVbn/GcbhMIT0jZLb97wiaTfF46Wz szM++os49oUbGITLhz2u/ZXjJzPFyOrdooa5iWG2jSL3mKAvoTKSWNohlZrskcABlNGW AcrdYhbL0rphGy4Q8WofX9pJPHQSI69AL8IjdhbzKNYjXi/ijv/CECgyQWAu2nBbezLC jK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699566616; x=1700171416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JZXYYoZ9YXR8OaFb0rqU8J6WjFq3wVUlkQ9dvWsztWg=; b=B5/MF2hxlV1LSj+1ADu0FknTbhelF/vFsw0gY533z317X9VuwwZdhXB115txDol1CK 0bwd53O4fr+2DM61xD+eL5xpXZ4RZBWZvn05OhMbuyneob5pVphYr7HGzsmE6ij4FTCp ae29BveTJ3GhSd5bxj8NeCQFaG4VyQmn0YMc0XRgUChuIt1zCG1ganSQG3pfFIkX5wOJ 5zp+6zrHCNTQGJayFHbNcYnyP5qoczqKlVE2hgr3Brbg77HZGy50GP2x3Qhk+nV1gLHN u3suPQatQhRbp2Ez+ElCD6A0f5ZjsWGCOuzRANcuEjNMiQpsC70aGB4odbTrqHBz/jZG 37Zg== X-Gm-Message-State: AOJu0YwAyVEoYhtTepEtD9fIW9s9qIfXJLpwQhYt0UaYzb23Ny4HAUPO jCuPg48lyTHKXk+CoTIXzNtVsIFLmyo= X-Google-Smtp-Source: AGHT+IEtAOh2Ri8u8l/d3qukxgFDNHa7aYcFKcebfV58wRHC8Ih0NADj5oYrY2SJCPHCMy77yPkxmQ== X-Received: by 2002:a05:6870:9193:b0:1ea:4338:209d with SMTP id b19-20020a056870919300b001ea4338209dmr6168405oaf.31.1699566616026; Thu, 09 Nov 2023 13:50:16 -0800 (PST) Received: from localhost.localdomain ([75.28.21.198]) by smtp.gmail.com with ESMTPSA id tp22-20020a0568718b9600b001d4d8efa7f9sm864003oab.4.2023.11.09.13.50.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 13:50:15 -0800 (PST) From: Chris Morgan To: linux-rockchip@lists.infradead.org Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, sebastian.reichel@collabora.com, daniel@ffwll.ch, airlied@gmail.com, sam@ravnborg.org, neil.armstrong@linaro.org, heiko@sntech.de, conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, Chris Morgan Subject: [PATCH V2 2/4] nv3051d: Add Powkiddy RK2023 Panel Support Date: Thu, 9 Nov 2023 15:50:05 -0600 Message-Id: <20231109215007.66826-3-macroalpha82@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231109215007.66826-1-macroalpha82@gmail.com> References: <20231109215007.66826-1-macroalpha82@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231109_135018_199329_E1564D35 X-CRM114-Status: GOOD ( 16.35 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org From: Chris Morgan Refactor the driver to add support for the powkiddy,rk2023-panel panel. This panel is extremely similar to the rg353p-panel but requires a smaller vertical back porch and isn't as tolerant of higher speeds. Note that while all of these panels are identical in size (70x57) it is possible future panels may not be. Tested on my RG351V, RG353P, RG353V, and RK2023. Signed-off-by: Chris Morgan --- .../gpu/drm/panel/panel-newvision-nv3051d.c | 57 +++++++++++++++---- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c index 79de6c886292..94d89ffd596b 100644 --- a/drivers/gpu/drm/panel/panel-newvision-nv3051d.c +++ b/drivers/gpu/drm/panel/panel-newvision-nv3051d.c @@ -28,6 +28,7 @@ struct nv3051d_panel_info { unsigned int num_modes; u16 width_mm, height_mm; u32 bus_flags; + u32 mode_flags; }; struct panel_nv3051d { @@ -261,6 +262,8 @@ static int panel_nv3051d_unprepare(struct drm_panel *panel) usleep_range(10000, 15000); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + regulator_disable(ctx->vdd); return 0; @@ -385,15 +388,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi) dsi->lanes = 4; dsi->format = MIPI_DSI_FMT_RGB888; - dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; - - /* - * The panel in the RG351V is identical to the 353P, except it - * requires MIPI_DSI_CLOCK_NON_CONTINUOUS to operate correctly. - */ - if (of_device_is_compatible(dev->of_node, "anbernic,rg351v-panel")) - dsi->mode_flags |= MIPI_DSI_CLOCK_NON_CONTINUOUS; + dsi->mode_flags = ctx->panel_info->mode_flags; drm_panel_init(&ctx->panel, &dsi->dev, &panel_nv3051d_funcs, DRM_MODE_CONNECTOR_DSI); @@ -481,16 +476,56 @@ static const struct drm_display_mode nv3051d_rgxx3_modes[] = { }, }; -static const struct nv3051d_panel_info nv3051d_rgxx3_info = { +static const struct drm_display_mode nv3051d_rk2023_modes[] = { + { + .hdisplay = 640, + .hsync_start = 640 + 40, + .hsync_end = 640 + 40 + 2, + .htotal = 640 + 40 + 2 + 80, + .vdisplay = 480, + .vsync_start = 480 + 18, + .vsync_end = 480 + 18 + 2, + .vtotal = 480 + 18 + 2 + 4, + .clock = 24150, + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, + }, +}; + +static const struct nv3051d_panel_info nv3051d_rg351v_info = { .display_modes = nv3051d_rgxx3_modes, .num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes), .width_mm = 70, .height_mm = 57, .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE, + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET | + MIPI_DSI_CLOCK_NON_CONTINUOUS, +}; + +static const struct nv3051d_panel_info nv3051d_rg353p_info = { + .display_modes = nv3051d_rgxx3_modes, + .num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes), + .width_mm = 70, + .height_mm = 57, + .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE, + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET, +}; + +static const struct nv3051d_panel_info nv3051d_rk2023_info = { + .display_modes = nv3051d_rk2023_modes, + .num_modes = ARRAY_SIZE(nv3051d_rk2023_modes), + .width_mm = 70, + .height_mm = 57, + .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE, + .mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET, }; static const struct of_device_id newvision_nv3051d_of_match[] = { - { .compatible = "newvision,nv3051d", .data = &nv3051d_rgxx3_info }, + { .compatible = "anbernic,rg351v-panel", .data = &nv3051d_rg351v_info }, + { .compatible = "anbernic,rg353p-panel", .data = &nv3051d_rg353p_info }, + { .compatible = "powkiddy,rk2023-panel", .data = &nv3051d_rk2023_info }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, newvision_nv3051d_of_match);