From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11A41C7EE2F for ; Mon, 29 May 2023 21:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229550AbjE2VL0 (ORCPT ); Mon, 29 May 2023 17:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjE2VLY (ORCPT ); Mon, 29 May 2023 17:11:24 -0400 Received: from relay08.th.seeweb.it (relay08.th.seeweb.it [5.144.164.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F604C7; Mon, 29 May 2023 14:11:23 -0700 (PDT) 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 (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 65D193EBA6; Mon, 29 May 2023 23:11:21 +0200 (CEST) Date: Mon, 29 May 2023 23:11:20 +0200 From: Marijn Suijten To: Dmitry Baryshkov Cc: Neil Armstrong , Sam Ravnborg , David Airlie , Daniel Vetter , Caleb Connolly , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Gross , Bjorn Andersson , ~postmarketos/upstreaming@lists.sr.ht, AngeloGioacchino Del Regno , Konrad Dybcio , Martin Botka , Jami Kettunen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, Abhinav Kumar , Kuogee Hsieh , Jessica Zhang Subject: Re: [PATCH RFC 03/10] drm/panel: Add LGD panel driver for Sony Xperia XZ3 Message-ID: References: <20230521-drm-panels-sony-v1-0-541c341d6bee@somainline.org> <20230521-drm-panels-sony-v1-3-541c341d6bee@somainline.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-05-22 04:16:20, Dmitry Baryshkov wrote: > > + if (ctx->dsi->dsc) { > > dsi->dsc is always set, thus this condition can be dropped. I want to leave room for possibly running the panel without DSC (at a lower resolution/refresh rate, or at higher power consumption if there is enough BW) by not assigning the pointer, if we get access to panel documentation: probably one of the magic commands sent in this driver controls it but we don't know which. > > + drm_dsc_pps_payload_pack(&pps, ctx->dsi->dsc); > > + > > + ret = mipi_dsi_picture_parameter_set(ctx->dsi, &pps); > > + if (ret < 0) { > > + dev_err(panel->dev, "failed to transmit PPS: %d\n", ret); > > + goto fail; > > + } > > + ret = mipi_dsi_compression_mode(ctx->dsi, true); > > + if (ret < 0) { > > + dev_err(dev, "failed to enable compression mode: %d\n", ret); > > + goto fail; > > + } > > + > > + msleep(28); > > + } > > + > > + ctx->prepared = true; > > + return 0; > > + > > +fail: > > + gpiod_set_value_cansleep(ctx->reset_gpio, 0); > > + regulator_disable(ctx->vddio); > > + return ret; > > +} > > + /* This panel only supports DSC; unconditionally enable it */ On that note I should perhaps reword this. > > + dsi->dsc = dsc = devm_kzalloc(&dsi->dev, sizeof(*dsc), GFP_KERNEL); > > I think double assignments are frowned upon. Ack. > > > + if (!dsc) > > + return -ENOMEM; > > + > > + dsc->dsc_version_major = 1; > > + dsc->dsc_version_minor = 1; > > + > > + dsc->slice_height = 32; > > + dsc->slice_count = 2; > > + // TODO: Get hdisplay from the mode > > Would you like to fix the TODO? I can't unless either migrating to drm_bridge (is that doable?) or expand drm_panel. That's a larger task, but I don't think this driver is the right place to track that desire. Should I drop the comment entirely or reword it? > > + WARN_ON(1440 % dsc->slice_count); > > + dsc->slice_width = 1440 / dsc->slice_count; - Marijn