From patchwork Thu Mar 28 11:11:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 783685 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC490374F9 for ; Thu, 28 Mar 2024 11:12:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624342; cv=none; b=g+AurKcE527NXTttyOFnAua5BdFT16tYcgMG4hXWOVh4ld7KjHOohHN/Ei3zzbdEnWB11VI6Z+jsbHMF6qvfmsbhwYQnU4U2DDCgcEXiwXVFcebqz/hsORnewLW9q0jlCkmLL9XEZmxFWQSsA0SmyM0iyjsNHDuH+2WiD0OJUPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624342; c=relaxed/simple; bh=7/POMsW6HjsVJWUdcNvVgHUqdBXzb5wMKW+ROAa4zKc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DLO6ElgzpnL94V23xowsr16QZwdKrHWzi51g7vxS5bd9tfF15c+nWg+JBohjhSbdgI5pgrCESviOj78ECC77sm8QS8XlMQAzZAwKgVNmeiMkX2Sks0XrjkFBcAwtRDER1PsJjROe5fwbSgOFAS5pqAixigqKBmCadjwELcxKYIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=fnHb/NhA; arc=none smtp.client-ip=209.85.210.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fnHb/NhA" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e6b3dc3564so727080b3a.2 for ; Thu, 28 Mar 2024 04:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711624340; x=1712229140; darn=vger.kernel.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=tLELEYK3dmk1bj+WVnvKaUvN2XnDOjot5qdxPMzZado=; b=fnHb/NhAqzj/wMVKNFjKP00vlNPqxllTSFKgEQVX/PIUbGr/uDpuz0ElTAcMUgpl9C oTsawRJaIdLjbiordBnTppMhSdS7A731Iuw/A52ogeIGsE149ZaAHMmtoHBBcNyuteV3 Djs/sWB0vYpQPBTWYb5ML1Q6PVGlg1kNPKCtM9RohhVOZ3erKbaeU4FoajlkH2PJUn3U STOldHxM6ojBlkeFOla11U1uswq56LVxAfeZY/oUCb5Il9RjBkPubmesEqxjiDH8oUWA 0d+7tFQw4u5ibis7A+VKe52hUUJzp752B50Nb5N1qg02zammu1btMQ9VERJ24Wcw0qk4 COAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711624340; x=1712229140; 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=tLELEYK3dmk1bj+WVnvKaUvN2XnDOjot5qdxPMzZado=; b=NKDk5J7oQNEy2I9fjB3Y8IXahi2de0HdF9Z7QjNDmmNV+LYNdx3CAszGSg2xK8dyQM k07a15pidqJfOnKxCH9VvAQpSJAjOLevnDHrT3Qa6S5puz49EGCNRKQgO9C0Byn/TTqW Z10pZD3ApliEZjYBaTtnqj4Xjlaxa3/QF80AT+PaLh8o5HLrh7kVg+DlaGfaQQCW1gtd sYzkvyIA+HSACXS9yUCvx4KTRCfDAIYAOG9/DLR6hdXWok49R+WUzJlCrkvXWpyNL2IE V5vWPh3EylCCCy9sGNUzsQOg3GHmdkRoGjPxTg7qtPK7RxzvUqpWVCXEDeNh/ZWLX428 jOyg== X-Forwarded-Encrypted: i=1; AJvYcCUSHb25NTkehJmbBJsd870PriWtGdYNCDfKb3KKaA3zt8pPcAVvgTf7fvy8A2MhLaQwu4WFUFMAblboW7roi0mHzXQyAOhmWDgzcZVjuA== X-Gm-Message-State: AOJu0Yw7nATZbj9FftRhSB9Ldbr2hn7WGX2gUvVDw4UT2tS/DYFhd+85 mRRGTeqH0oS/WuxkaB7NpD82N5ewtsHSN4ryrj4qe4rvVwB0NjqLCg7Av7foKaA= X-Google-Smtp-Source: AGHT+IFLXKC5s6Z3XmJzfcHVzUC7h1Aa6EP8dyjaeT/CBWRnkZMa+UqmlnyIhHgHNoCLgPYqi6OHpg== X-Received: by 2002:a05:6a00:18a2:b0:6ea:baed:a15c with SMTP id x34-20020a056a0018a200b006eabaeda15cmr3091585pfh.4.1711624339083; Thu, 28 Mar 2024 04:12:19 -0700 (PDT) Received: from niej-think.bbrouter ([112.65.12.82]) by smtp.gmail.com with ESMTPSA id k7-20020aa792c7000000b006eab9ef5d4esm1114607pfa.50.2024.03.28.04.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 04:12:18 -0700 (PDT) From: Jun Nie To: neil.armstrong@linaro.org, dmitry.baryshkov@linaro.org Cc: sam@ravnborg.org, airlied@gmail.com, daniel@ffwll.ch, quic_parellan@quicinc.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, robdclark@gmail.com, seanpaul@chromium.org, swboyd@chromium.org, quic_abhinavk@quicinc.com, quic_jesszhan@quicinc.com, marijn.suijten@somainline.org, sean@poorly.run, Jun Nie Subject: [PATCH 2/3] dt-bindings: display: panel: visionox, vtdr6130: Add mode property Date: Thu, 28 Mar 2024 19:11:57 +0800 Message-Id: <20240328111158.2074351-2-jun.nie@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328111158.2074351-1-jun.nie@linaro.org> References: <20240328111158.2074351-1-jun.nie@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add DSI mode property and compression mode property Signed-off-by: Jun Nie --- .../bindings/display/panel/visionox,vtdr6130.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml b/Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml index d5a8295106c1..36ae94fa96ec 100644 --- a/Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml +++ b/Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml @@ -26,6 +26,14 @@ properties: port: true reset-gpios: true + enforce-cmd-mode: + type: boolean + description: Set DSI as command mode. Video mode by default. + + enable-dsc: + type: boolean + description: Enable display stream compression + additionalProperties: false required: From patchwork Thu Mar 28 11:11:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 783684 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6047A1BDD0 for ; Thu, 28 Mar 2024 11:12:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624349; cv=none; b=CPh3Ymfpxam40vLYQuRLKiqLiJ1+Z2HvmvQ+m53sD4zh0GY6yn1Kov3rvj+mt5hxDB7g1xCM7UQFNIGqhzJAa9WFyKoPVkTIpo/AVHymPq58WIl8rwvPB/NUm9Avpd6jLhj2pIU58WYNU5DuNYg4ALqOLDfNXWFiGqA5dn1fGpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711624349; c=relaxed/simple; bh=Foxahl5f8+Bo0XN8goV9gcZye/Kq+XV2dNBhQOQagxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bMENrfiCYcSz+Dfq4icmiIjb4BnWs+bbNoO923opJPxUdV5ZzuA4aESb0uv1z2yeH2xrXCusq6z0njOGJ992JhaBNao/4+htNzGG0Zh//UBHT4BBsvPgB07tqDbwK4chBSfzCZ80UcH4ygH3Ympl05OgL+uBPAjmgvMsqyQhkEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ej+5Y1H4; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ej+5Y1H4" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ea9a605ca7so638012b3a.0 for ; Thu, 28 Mar 2024 04:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711624347; x=1712229147; darn=vger.kernel.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=H+TeuuSkQj7XTS45LutYmiDgAgbcEY5Odyx7kr6Nww4=; b=ej+5Y1H4BZr0BfATed24JUojTCk0dgppbf5VBpXQxFnpVlQvSX++9tFMs8t7XpldBl rh9FdUAj0e4PbZiTUjQl3s/k/dEADylrCpVMPVC1VXxIxRYrmdWg87DsnIg61gmEUJNs Pk66X17EE6S7EbBRNio95DvOLObxtIGdFblZKfK9BevBmGnEFQNCCC75nP2LwjDmnke+ OBnm9qyQs8Dj5Kvu2S+GBKkSgwpuGJNXTirAyytZ407TCQnXhcKWdCp/b+XnA9LWw9RH eoCsEcjDUTP+Ur6tbtVAYyhLwkGkpZ2+GQutEPJVu+qaTQ5P1kOXEc+jr3dMy4mOkUvQ rrHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711624347; x=1712229147; 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=H+TeuuSkQj7XTS45LutYmiDgAgbcEY5Odyx7kr6Nww4=; b=ZObEWOTkVPc3e64zHfTW1MmEiE5jRqV/hX3A+hyPuVPicitnPLvXxPndHUBfXItABL YGzWtGsBlBU/tQyS1RXtpAergkxFrEqST8b19RPZuXWerCElhYr/Fg2llpTZrtOjP2Nn Ib2buayEmfdIjLXUoVTF5H00HbKZdn+HTtqBHM2ZmdRnr3DUyijYOb38HmL4x3ZfCOC9 jdCA1IyW/Gkhv7xxPOONVLUu2U4UMH5CbZVf+7Xt+DrxxCOQUz1aqNR591s7C11nNtq2 +zmaolN9m4XKR1fibt3B4EHKV5z0EAmaOaVRxwEekBPRuY0IXZZ1IUGCJv9CISlnIYkC JQpw== X-Forwarded-Encrypted: i=1; AJvYcCVZBH1fX+ZxdhJKD7cf8gFmjaDBvAeLDkHuNiYJMLNdpR6eJu6TVUXlsIG39c2a0MycoGeMkAcsXcE+/u99BkdfNUqhyvLSJOjYlNUOrw== X-Gm-Message-State: AOJu0YxAGxqNwqc1zZ2a9nBfhLrV6kCAsRjyOi/3X4W3VyS6jpOCoGQ8 UnLoPIjqWwVDj1Ux4YDhBtmixmnXQ4T6x4bNOik8Uv9i/6ez8lreUDGqa7bkokA= X-Google-Smtp-Source: AGHT+IFtZtWGN0gpIdln/salcEy9PVgCOB6uagldfXRPfnddW1BVC0WLkiU9IKKaikRLoMnyPVkDoA== X-Received: by 2002:a05:6a00:4f86:b0:6ea:74d4:a00d with SMTP id ld6-20020a056a004f8600b006ea74d4a00dmr3250046pfb.5.1711624346654; Thu, 28 Mar 2024 04:12:26 -0700 (PDT) Received: from niej-think.bbrouter ([112.65.12.82]) by smtp.gmail.com with ESMTPSA id k7-20020aa792c7000000b006eab9ef5d4esm1114607pfa.50.2024.03.28.04.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 04:12:26 -0700 (PDT) From: Jun Nie To: neil.armstrong@linaro.org, dmitry.baryshkov@linaro.org Cc: sam@ravnborg.org, airlied@gmail.com, daniel@ffwll.ch, quic_parellan@quicinc.com, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, robdclark@gmail.com, seanpaul@chromium.org, swboyd@chromium.org, quic_abhinavk@quicinc.com, quic_jesszhan@quicinc.com, marijn.suijten@somainline.org, sean@poorly.run, Jun Nie Subject: [PATCH 3/3] drm/panel: Enable DSC for Visionox VTDR6130 panel Date: Thu, 28 Mar 2024 19:11:58 +0800 Message-Id: <20240328111158.2074351-3-jun.nie@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328111158.2074351-1-jun.nie@linaro.org> References: <20240328111158.2074351-1-jun.nie@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Enable display compression (DSC v1.2) for 1080x2400 Visionox VTDR6130 AMOLED DSI panel. DTS property is needed to enable DSC. Default configuration is video mode + non-DSC for any back compatibility. Below modes works on SM8650. While cmd mode does not work yet. - video mode + DSC - video mode - cmd mode + DSC Signed-off-by: Jun Nie --- .../gpu/drm/panel/panel-visionox-vtdr6130.c | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c index 540099253e1b..d6c44816cdd0 100644 --- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -17,9 +18,12 @@ struct visionox_vtdr6130 { struct drm_panel panel; + struct drm_dsc_config dsc; struct mipi_dsi_device *dsi; struct gpio_desc *reset_gpio; struct regulator_bulk_data supplies[3]; + bool cmd_mode; + bool dsc_enable; }; static inline struct visionox_vtdr6130 *to_visionox_vtdr6130(struct drm_panel *panel) @@ -49,12 +53,20 @@ static int visionox_vtdr6130_on(struct visionox_vtdr6130 *ctx) if (ret) return ret; + if (ctx->dsc_enable) + mipi_dsi_dcs_write_seq(dsi, 0x03, 0x01); + mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x20); mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_DISPLAY_BRIGHTNESS, 0x00, 0x00); mipi_dsi_dcs_write_seq(dsi, 0x59, 0x09); mipi_dsi_dcs_write_seq(dsi, 0x6c, 0x01); mipi_dsi_dcs_write_seq(dsi, 0x6d, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0x6f, 0x01); + + if (ctx->cmd_mode) + mipi_dsi_dcs_write_seq(dsi, 0x6f, 0x02); + else + mipi_dsi_dcs_write_seq(dsi, 0x6f, 0x01); + mipi_dsi_dcs_write_seq(dsi, 0x70, 0x12, 0x00, 0x00, 0xab, 0x30, 0x80, 0x09, 0x60, 0x04, 0x38, 0x00, 0x28, 0x02, 0x1c, 0x02, 0x1c, 0x02, 0x00, @@ -205,6 +217,26 @@ static const struct drm_display_mode visionox_vtdr6130_mode = { .height_mm = 157, }; +static int visionox_vtdr6130_enable(struct drm_panel *panel) +{ + struct visionox_vtdr6130 *ctx = to_visionox_vtdr6130(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + struct drm_dsc_picture_parameter_set pps; + int ret; + + if (!dsi->dsc) + return 0; + + drm_dsc_pps_payload_pack(&pps, dsi->dsc); + ret = mipi_dsi_picture_parameter_set(dsi, &pps); + if (ret) { + dev_err(&dsi->dev, "Failed to set PPS\n"); + return ret; + } + + return 0; +} + static int visionox_vtdr6130_get_modes(struct drm_panel *panel, struct drm_connector *connector) { @@ -228,6 +260,7 @@ static const struct drm_panel_funcs visionox_vtdr6130_panel_funcs = { .prepare = visionox_vtdr6130_prepare, .unprepare = visionox_vtdr6130_unprepare, .get_modes = visionox_vtdr6130_get_modes, + .enable = visionox_vtdr6130_enable, }; static int visionox_vtdr6130_bl_update_status(struct backlight_device *bl) @@ -260,12 +293,32 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; struct visionox_vtdr6130 *ctx; + struct drm_dsc_config *dsc; int ret; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) return -ENOMEM; + ctx->cmd_mode = of_property_read_bool(dev->of_node, "enforce-cmd-mode"); + ctx->dsc_enable = of_property_read_bool(dev->of_node, "enable-dsc"); + + /* Set DSC params */ + if (ctx->dsc_enable) { + dsc = &ctx->dsc; + dsc->dsc_version_major = 0x1; + dsc->dsc_version_minor = 0x2; + dsc->slice_height = 40; + dsc->slice_width = 540; + dsc->slice_count = 2; + dsc->slice_per_pkt = 1; + dsc->bits_per_component = 8; + dsc->bits_per_pixel = 8 << 4; + dsc->block_pred_enable = true; + + dsi->dsc = dsc; + } + ctx->supplies[0].supply = "vddio"; ctx->supplies[1].supply = "vci"; ctx->supplies[2].supply = "vdd"; @@ -306,6 +359,9 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) return ret; } + dev_err(&dsi->dev, "discovered with %s mode %s\n", + ctx->cmd_mode ? "cmd" : "video", + ctx->dsc_enable ? "and DSC enabled" : ""); return 0; }