Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp676780lqp; Sat, 13 Apr 2024 14:30:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJ0yfy7UsK2LOkw6DFMxh5XB7w1NgLxMD9oeHFU8sDLgib0ADrKaOy3rZ8dqBmyaFLlDQqf5CpGWUlnMFxS37VV37iwfHBrNrDmsj78A== X-Google-Smtp-Source: AGHT+IGnMNiIGi5Pnxzg1wUULwacNuNImrzFGfIh508Ju4f39TwnHhPYnsrWji+HP55o6XjsRLpo X-Received: by 2002:a17:90b:e05:b0:2a2:7494:15df with SMTP id ge5-20020a17090b0e0500b002a2749415dfmr8557751pjb.9.1713043825637; Sat, 13 Apr 2024 14:30:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713043825; cv=pass; d=google.com; s=arc-20160816; b=mr7UNF6vpbGfnLoSB61ePgqxaHup9T3fYtXjx2ZNTMUX7EjifXN5JPXGfJ05fU49NE 4Gt46gVWsfL3vLwJCFQMwbBIKbwKlnj53ITNJdWmcZHJai1yPzY3Kg4IMkH3gyOUIGle cwrjlGqz5z0GIzgUdjreLxNh5Z6O5657AWYMgKSxbECOYMb572LSNesbInEvqdnnBB8/ +JsRQhRreJmWRdQqrzRB78xJiwZfpIme8ZdluiMHV3E/NEySl8BkX7f7RLWobkxpKTOr Tg+iw5OSQE7fXxqZ6PbSVyd56GpFcLMCHSbuwSjK1nEFDSUBVdDZrT33ILcCbJyFh2xC MZHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=gfISAXWGNKygfVcKirSChI48fXmAcNanS9OkNc2RdmM=; fh=02SEi3wshS2L12B/UGZXIM05oTJXTvSL30x6bk1cQo8=; b=uhC1uqcWq59ptRNPi0HMyAJdKikQlkZIf+RzGDagjuywd+K4cutch2ZiNNY4DT1sB5 OTRG3FlHR7WUsxUZTlAhjWdHASh85hkkakpNefh14LMf8xRa9CebkH10UffXjELan8YR u9AOMeAYTCZxFE2MpLPDbdLW1tV+Oxd3jBXe+5zJzRivcn/eWO6zEm/YLQSlwFqtyhBI kacx/+FbQcRkQI6Pm+G+2li8ahEgHQ+6afoj9ZDteJtycwlPDK9nu5lM5BWkib5y+mLO wzbO0XAlKCwm+6HpuAJRAN0WiB6sC2qqJqNNUo9WirgzuA6BldZXUkHGKTwRDp8qlBIm 1iPg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=somainline.org); spf=pass (google.com: domain of linux-kernel+bounces-143884-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143884-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f17-20020a17090ace1100b002a6149fea55si5587814pju.75.2024.04.13.14.30.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 14:30:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143884-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=somainline.org); spf=pass (google.com: domain of linux-kernel+bounces-143884-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143884-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40B14281DAB for ; Sat, 13 Apr 2024 21:30:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D5AE56443; Sat, 13 Apr 2024 21:30:19 +0000 (UTC) Received: from relay03.th.seeweb.it (relay03.th.seeweb.it [5.144.164.164]) (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 4EABB1EB31 for ; Sat, 13 Apr 2024 21:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=5.144.164.164 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713043818; cv=none; b=TEglOwQLmyOpTGEgFAoiACfkGZh0ZmAS8Xm0LlZSAFE4zoFPtSddt6Ib+Qe+wOgQtLubuWsqKZ76ebnBHTMIS+2rj8D55n8mbS1LAEKh/X6KyfdoFpN7Nw6M6iPkxiOe+JBT7P0cTCq/1tRfyCKn9DNKiNFxXWNyzGwwiKleD8k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713043818; c=relaxed/simple; bh=sSRLyOrAPUnlICcYlFjeeGuacJ5dYEn8lr800sZSWnU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ar82pJHP9cKhhwgcRAtZ/Yq9HcavpDme3UlRo3Xz/6OYYSikmfZl9Kx553F6vBAW/8SLa9SfDZM7hxpHDHkjvcC0ouVhgBgWTPwlGk+0iHq1TAy4FBhRDdEAv8AwxdKjuqsCWMdANb3hqz0KuATeCFYwreGkBlYR6AmzQvRu3kU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=somainline.org; spf=pass smtp.mailfrom=somainline.org; arc=none smtp.client-ip=5.144.164.164 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=somainline.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=somainline.org Received: from SoMainline.org (94-211-6-86.cable.dynamic.v4.ziggo.nl [94.211.6.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r1.th.seeweb.it (Postfix) with ESMTPSA id ADFAC205A9; Sat, 13 Apr 2024 23:12:44 +0200 (CEST) Date: Sat, 13 Apr 2024 23:12:43 +0200 From: Marijn Suijten To: Dmitry Baryshkov Cc: 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 , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v5 3/4] drm/mipi-dsi: add mipi_dsi_compression_mode_ext() Message-ID: References: <20240408-lg-sw43408-panel-v5-0-4e092da22991@linaro.org> <20240408-lg-sw43408-panel-v5-3-4e092da22991@linaro.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240408-lg-sw43408-panel-v5-3-4e092da22991@linaro.org> On 2024-04-08 02:53:52, Dmitry Baryshkov wrote: > 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 Reviewed-by: Marijn Suijten Something doesn't stick with me on the _ext() naming, but I don't have something better to propose. - Marijn > --- > 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 mipi_dsi_device *dsi, > EXPORT_SYMBOL(mipi_dsi_set_maximum_return_packet_size); > > /** > - * 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] = { enable << 0, 0 }; > + u8 tx[2] = { }; > struct mipi_dsi_msg msg = { > .channel = dsi->channel, > .type = MIPI_DSI_COMPRESSION_MODE, > .tx_len = sizeof(tx), > .tx_buf = tx, > }; > - int ret = mipi_dsi_device_transfer(dsi, &msg); > + int ret; > + > + if (algo > 3 || pps_selector > 3) > + return -EINVAL; > + > + tx[0] = (enable << 0) | > + (algo << 1) | > + (pps_selector << 4); > + > + ret = mipi_dsi_device_transfer(dsi, &msg); > > 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_DSC, 0); > +} > EXPORT_SYMBOL(mipi_dsi_compression_mode); > > /** > 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 mipi_dsi_pixel_format fmt) > return -EINVAL; > } > > +enum mipi_dsi_compression_algo { > + MIPI_DSI_COMPRESSION_DSC = 0, > + MIPI_DSI_COMPRESSION_VENDOR = 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); > > > -- > 2.39.2 >