From nobody Tue Feb 10 02:55:05 2026 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 AA47E405F2 for ; Wed, 3 Apr 2024 03:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712115843; cv=none; b=geJZ2T8+KoOkFyJ6wv/SRs9KiBcd8WcM87B6fd5L2IjeYuKSTikqXhXZQBKJ1fT19AkHgLOYlerDBXFpep9Zq7llVnDi15N5PgLrNVbANZB6hdrRcmRfriTLcKG2gZzHVQ9OOIKIt/8Qs2qly9lglq62YwBeqTRbhzCTUD00hwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712115843; c=relaxed/simple; bh=ir5CM+jVaND4C9bLuSFQauIuwSNRo2ScqG2rMJDBLjA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CoDsOsRv1tAhNvB/vBHgOh1Ipcc57WolYdAxxqfoC6ohPgjv0pqB0Rsgw3iIQighxQ9Mg51dwUpytW2cf6tm9r3+TbT+vfI9ysa77Rn6C7jgBPWh8PMdO1qMCxHxpf4q2dN0WCkfDsoZwXB57HAduk0KZj3O6KAjsw02mugeA74= 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=M3SiSxXt; arc=none smtp.client-ip=209.85.167.42 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="M3SiSxXt" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-516bfcc775bso80217e87.2 for ; Tue, 02 Apr 2024 20:44:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712115840; x=1712720640; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+T+p5YoQyUiQemU/jDWxQz+rt6jIm9aQcddIMzbzpGw=; b=M3SiSxXtXEYtp4arg7jmcDdaOLhur5POmN6Bu0+10vkjPAPkvAeopUhzVOMI+qIUKs EfO+kkC9KxbxWd5DxY69Vz1HIttoT/Gn4uFMgZn/R25EQUYqqBZBJUOBVvdMcIspTIMd 1BN1LUA/qGoZT2DLHWryA+ti8ZjpLaA4I7wqOZg4cOwhrS2huDVyS0mFMXSG03SnJZTm j3dHwdZAozeDB3fyjo4V+pOUuYte+kcFKRbQBc4IjlKnS5pKZ7JmyR0wBiTaiEF5Kpik DSUM1d/wHtt+hwSBZEOrat+DnzWZL15HSMdi0lab8A1YoQoAGBMJl1zO0xF8Ugp236Rb NsrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712115840; x=1712720640; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+T+p5YoQyUiQemU/jDWxQz+rt6jIm9aQcddIMzbzpGw=; b=U2J7pgYZYJNuzLXAPYa/ovwwM1E+vfM41lpoe8tJkjhP100nTAnIutXpTX8bsf3ic/ My3rOANYgfRXJlNvnKyiynzb+NNTM5/7QA7fWrtWpLYSgUD01ICVk0WpSiCBGIe8csBN lL5w5AAuD261bBHoZH9jKkHRGWeo5Dyzy8PTlBA0Uw53TqXEDfbAQCvR773PGLR5Y3nU A5UEU6iZjN6GiJbIyY/GCJS24Dc1Z68vXM4SzqbGkkmifuHHqKuu63iswcyGiBQoPqKA KwzjJYfBTLqRPJuwa3XloxQhVoZi1tih5K4NBrPJqx4sXw+bpT6BXNqjh7IMiAqwmqLt T4Wg== X-Forwarded-Encrypted: i=1; AJvYcCXcAqzkEjpdjJLZ2mQnf9sZ2vZspQZ0SP+D2CWflNMmz4zqeJ04Z8VttwBVnOMruBbypCKAaQZehioJ7i0gUKG0/wBGtIZcj7S7Qtra X-Gm-Message-State: AOJu0YwC2R96kZpzQivO29ALe/1jKZs0K0LWKvHM/pBmjr2I/W6KpeXD qkf9QdXw4AXbF41cxYqtVo5JXEy+nC8r7KAAcG7Q/YxcM/bOswtjJZThoaMyJHE= X-Google-Smtp-Source: AGHT+IGtfzqNsIWXjR3lBrH+KbvcO7vtmJYhpysBjIhPrbalUcOtjnu38HJTgTjYUhOp5Z7WdpkgMw== X-Received: by 2002:ac2:58ea:0:b0:513:d5ea:1d21 with SMTP id v10-20020ac258ea000000b00513d5ea1d21mr10812399lfo.69.1712115839856; Tue, 02 Apr 2024 20:43:59 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id br31-20020a056512401f00b00516a69b1dcbsm940985lfb.78.2024.04.02.20.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 20:43:59 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 03 Apr 2024 06:43:57 +0300 Subject: [PATCH v4 3/4] drm/mipi-dsi: add mipi_dsi_compression_mode_ext() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240403-lg-sw43408-panel-v4-3-a386d5d3b0c6@linaro.org> References: <20240403-lg-sw43408-panel-v4-0-a386d5d3b0c6@linaro.org> In-Reply-To: <20240403-lg-sw43408-panel-v4-0-a386d5d3b0c6@linaro.org> To: Sumit Semwal , Caleb Connolly , Neil Armstrong , Jessica Zhang , Sam Ravnborg , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3976; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ir5CM+jVaND4C9bLuSFQauIuwSNRo2ScqG2rMJDBLjA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmDNB7OkkeRbzXWIfkMtxvOhujgHNt5OQ+MjsZ3 1J6uivUGSKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZgzQewAKCRCLPIo+Aiko 1YIKB/wNIG3h5bvt1QfaxHeh9v8mtUutT8ei6fGtabLxfRYmUsTbx1DBS3yrCx0395eAQxG3BA+ 5h2/OBHLE/i+T8x6voeANwrABTo4CsGpnli0xD1AqvqNIelZ2GN7YmNLKNHAmZNYjPgTjdteAb6 GSZe9YJPlHwh8csbFwlfMJvGzot/d5S4Lwt5b5Glp/1OJiX/nnRGckkzdvH2zsxRel1L2uCxAuL kuMuzxie2mpRApvdxtGQooOGpO53SI3JEohjWo0ROAKTsmB6+82mzeFQ3Zo3Ik4MHe8CTDdAxEX 7g7I8BGc1ERvJQQILmE9zcLy97H8Cq4f6R09AM2EYYYT/p0l X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Add the extended version of mipi_dsi_compression_mode(). It provides a way to specify the algorithm and PPS selector. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_mipi_dsi.c | 41 ++++++++++++++++++++++++++++++++++----= --- include/drm/drm_mipi_dsi.h | 9 +++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index 9874ff6d4718..795001bb7ff1 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -645,29 +645,56 @@ int mipi_dsi_set_maximum_return_packet_size(struct mi= pi_dsi_device *dsi, EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size); =20 /** - * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral + * mipi_dsi_compression_mode_ext() - enable/disable DSC on the peripheral * @dsi: DSI peripheral device * @enable: Whether to enable or disable the DSC + * @algo: Selected compression algorithm + * @pps_selector: Select PPS from the table of pre-stored or uploaded PPS = entries * - * Enable or disable Display Stream Compression on the peripheral using the - * default Picture Parameter Set and VESA DSC 1.1 algorithm. + * Enable or disable Display Stream Compression on the peripheral. * * Return: 0 on success or a negative error code on failure. */ -int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable) +int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, + enum mipi_dsi_compression_algo algo, + unsigned int pps_selector) { - /* Note: Needs updating for non-default PPS or algorithm */ - u8 tx[2] =3D { enable << 0, 0 }; + u8 tx[2] =3D { }; struct mipi_dsi_msg msg =3D { .channel =3D dsi->channel, .type =3D MIPI_DSI_COMPRESSION_MODE, .tx_len =3D sizeof(tx), .tx_buf =3D tx, }; - int ret =3D mipi_dsi_device_transfer(dsi, &msg); + int ret; + + if (algo > 3 || pps_selector > 3) + return -EINVAL; + + tx[0] =3D (enable << 0) | + (algo << 1) | + (pps_selector << 4); + + ret =3D mipi_dsi_device_transfer(dsi, &msg); =20 return (ret < 0) ? ret : 0; } +EXPORT_SYMBOL(mipi_dsi_compression_mode_ext); + +/** + * mipi_dsi_compression_mode() - enable/disable DSC on the peripheral + * @dsi: DSI peripheral device + * @enable: Whether to enable or disable the DSC + * + * Enable or disable Display Stream Compression on the peripheral using the + * default Picture Parameter Set and VESA DSC 1.1 algorithm. + * + * Return: 0 on success or a negative error code on failure. + */ +int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable) +{ + return mipi_dsi_compression_mode_ext(dsi, enable, MIPI_DSI_COMPRESSION_DS= C, 0); +} EXPORT_SYMBOL(mipi_dsi_compression_mode); =20 /** diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 3011d33eccbd..82b1cc434ea3 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -226,6 +226,12 @@ static inline int mipi_dsi_pixel_format_to_bpp(enum mi= pi_dsi_pixel_format fmt) return -EINVAL; } =20 +enum mipi_dsi_compression_algo { + MIPI_DSI_COMPRESSION_DSC =3D 0, + MIPI_DSI_COMPRESSION_VENDOR =3D 3, + /* other two values are reserved, DSI 1.3 */ +}; + struct mipi_dsi_device * mipi_dsi_device_register_full(struct mipi_dsi_host *host, const struct mipi_dsi_device_info *info); @@ -242,6 +248,9 @@ int mipi_dsi_turn_on_peripheral(struct mipi_dsi_device = *dsi); int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, u16 value); int mipi_dsi_compression_mode(struct mipi_dsi_device *dsi, bool enable); +int mipi_dsi_compression_mode_ext(struct mipi_dsi_device *dsi, bool enable, + enum mipi_dsi_compression_algo algo, + unsigned int pps_selector); int mipi_dsi_picture_parameter_set(struct mipi_dsi_device *dsi, const struct drm_dsc_picture_parameter_set *pps); =20 --=20 2.39.2