Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp735441lqd; Wed, 24 Apr 2024 15:43:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfwRp8pelvPng62gj+XPU076DSFdIdJK6dQl1an2asyGjkkJkh3tkF8P3gNGKeYzhDqnuY0gycxAr7XqYFtA/WcJJQYGs5CtysTVbf7Q== X-Google-Smtp-Source: AGHT+IHjClfzWsnDvoybYec6rwP7WaOE7Cf8bz2rjjvIRkt9Xmc1mlBNUBkflYRmOl4HPHSNQAzg X-Received: by 2002:a25:ac57:0:b0:dcd:6722:c728 with SMTP id r23-20020a25ac57000000b00dcd6722c728mr4734180ybd.14.1713998618743; Wed, 24 Apr 2024 15:43:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713998618; cv=pass; d=google.com; s=arc-20160816; b=TTNuK7kmtiJcNzSGa6Xm2EZKQ9W5x9q7P245IHsdVAA13a6Pw47sVUT80ytiBqBSmI TR1yUJJFy4aL/v7gOj8Wl3njDQPHkJ9E8L+eYcM5u1By5c7cfvlKBciJNoC4q7MSZXtv SWbSIgALLrpLtJLn26iYNEeC2SHAyR/22dP8Jq+wRZIZcH923swxm/rF+fBwRX/iY6Ho ZxNtdMNe5R44tQtLzkxSLvjPfrQE2g4tCuKuYykJluMIEOEEZFFasGA3x4ZyXg21MQ/9 X383MaeEc01YRBrI4GdkyrNYPiEUS8XfyCvNeCEYNdc4Mi2yPOHY5uiMdQPlZhdsCNnp xd/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=nMrRFrfAkMBHNdCwNPCMk+6Pc/CQ0PrT4pRXz9no6XU=; fh=9KKk8LXReVwdQHoPTrcvpC9hl2louoc2Zl6L2N0tr/0=; b=pWQK44qXQJy4JcYJrjCRUfDbdnZXJCqEsMGRwH3EeGlKF2oOERpYltkDi6Sot1WmbP yx3joZeS6QnEVfsoSq2PcBjYI6b26j6iYl9GroddkrVsbMnjHJBBAKXybJmI3tD8hL/h ANL6KW17Xo8XuXybJj41qE6nZ5wOmABXRuWJJUhVckUblUwnnU8LFrpBFIhG0leUKQOR 1EnDzxzhCfOzWNKIm9jJ8g0Gx0/KIWOC1UMkz7qFbd/r9uyXK/QEvOowuJF38R/SfcKH o+Zf8NOIx1d230vqHVg4SD37Vi/cRoXs7dJoK6nWSLkHn11ECsIZz/xAmWfqhA1TDM4D 4daw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LtNK1GaJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-157797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fn11-20020ad45d6b000000b00698725f3baesi15941880qvb.153.2024.04.24.15.43.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 15:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-157797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LtNK1GaJ; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-157797-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-157797-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 67B3B1C237AE for ; Wed, 24 Apr 2024 22:43:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10FC716E87C; Wed, 24 Apr 2024 22:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LtNK1GaJ" Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (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 8C08E16DEDE for ; Wed, 24 Apr 2024 22:43:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713998613; cv=none; b=OdYgPl0ooze7tfaYpDD2KVX2Q0r1MzovKkaAJRKMUCwdmyW8+nM0RH4uZoLcp5v38ELTqFigXEfMVa41feTb2XzZg79B61Ei+fmll5R9N84PjdaWbbpdDYjelbvYeFR8G6UggykcDie+aqBsvvGyKtIBj15StBe4kSSDZ5J8m5E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713998613; c=relaxed/simple; bh=MEKcpxKvyFyt6gXvf1rl3IVTfewAZXKh6RKdA7b7/Vw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jVvrv63QCS0opF3709grQvENmWVQ97Fc3LbK2UGKThYbmZ7eAlEzqeZp4kVDoU6wyB2U6Jk0Zj0FpcbQRsAZEcvx2kvS+8OvJYAeHHWYQdvBXpr3Ki17YVBM1Ho/CLdPTdBmVKVJ/ncYRZdfJ1cNfpP07kVa2IChw5RvE8BCE08= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=LtNK1GaJ; arc=none smtp.client-ip=209.85.219.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-dc23bf7e5aaso519020276.0 for ; Wed, 24 Apr 2024 15:43:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1713998608; x=1714603408; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nMrRFrfAkMBHNdCwNPCMk+6Pc/CQ0PrT4pRXz9no6XU=; b=LtNK1GaJMpytif9kIdreY1U0fIgCYUvTUrNGo3ebrCdBVeRcmBRJpXgk6fIF8FB19h 6cl6ZwzlFSPi89U0ipfssd48M2lKVtlVg94iRUuzcSfQ+UT12lhqaI8m4Lt8qhP7XLLX nVj4Kcmpjjn2/CNNI8vZTQ+tW77KDq3bW+uH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713998608; x=1714603408; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nMrRFrfAkMBHNdCwNPCMk+6Pc/CQ0PrT4pRXz9no6XU=; b=SAHQaOxMUIggWEqpZLSsBjt4TltPQaK6RECt8Y2Kbqqz7ETaIbThCxRM0Np4Q4B9CI wgiQwV0lGIv+PVV2xm84VvFrBATDys/QnILaQf9DR21cDF7vYo1V0DmXo6jsQy9rYitw Ax/d0MHHc+gTs7emHQx3J0Zs3XM/zib8agVSZu9yk+N+MLSnrr71/dcgdSlaDhlaHC6C 26OxhP/TyrmY47XnIim72aez1/JL0ek1tdSsjwaa3WRcLwxJVcP34dPPvfs0YSD1t3lY uJ4wzuwR5h0oZZWH4LT7LuurUat6tzipEbtRJSpal9/mSwBUNds4UFfUfwgFZ4iZqifc 64QA== X-Forwarded-Encrypted: i=1; AJvYcCWcJjTkaC/R2nlrU6tm6Xs/NjKMf7Wdrfao/iWqIEQ7DtSrAFMMpSGVuA2L9gJLNYdkoalAXdr70xAgpbbGX6IuMej+D2fRMDpaJ1cM X-Gm-Message-State: AOJu0Yy1GCyamePIeg0XcRlTU7Wx6SYt9pkYyPLDpRyiKZAciWVv1G8M 8XCkXe3eseNuFv8N8vV20Pl73bC8Qf1kJjMX976YdLwZkkQgp0RnmUp2Kb35cBdhlTGNmBhRVUs = X-Received: by 2002:a25:a2d1:0:b0:dd0:702:577a with SMTP id c17-20020a25a2d1000000b00dd00702577amr4093922ybn.35.1713998607794; Wed, 24 Apr 2024 15:43:27 -0700 (PDT) Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com. [209.85.160.173]) by smtp.gmail.com with ESMTPSA id m14-20020a0c9d0e000000b00698e65cdfefsm6504783qvf.87.2024.04.24.15.43.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Apr 2024 15:43:27 -0700 (PDT) Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-43989e6ca42so121631cf.0 for ; Wed, 24 Apr 2024 15:43:26 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCULt4pYGIYfW26DFiQMMTOxiJJT6y+DN3Ckq3QS1hui+dE21Zkrd1EAen6bqB3v7rU5gWqSOPaZJ1qNYaWlnCQKykdtuS6H8qEvuoh9 X-Received: by 2002:ac8:795a:0:b0:437:b572:6a with SMTP id r26-20020ac8795a000000b00437b572006amr43473qtt.23.1713998605986; Wed, 24 Apr 2024 15:43:25 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240422090310.3311429-1-yangcong5@huaqin.corp-partner.google.com> <20240422090310.3311429-3-yangcong5@huaqin.corp-partner.google.com> In-Reply-To: From: Doug Anderson Date: Wed, 24 Apr 2024 15:43:10 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/7] drm/panel: himax-hx83102: Break out as separate driver To: cong yang Cc: sam@ravnborg.org, neil.armstrong@linaro.org, daniel@ffwll.ch, linus.walleij@linaro.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, conor+dt@kernel.org, airlied@gmail.com, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, xuxinxiong@huaqin.corp-partner.google.com, Dmitry Baryshkov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Tue, Apr 23, 2024 at 7:42=E2=80=AFPM cong yang wrote: > > Hi, > Thanks reply. > > Doug Anderson =E4=BA=8E2024=E5=B9=B44=E6=9C=8824= =E6=97=A5=E5=91=A8=E4=B8=89 00:26=E5=86=99=E9=81=93=EF=BC=9A > > > > Hi, > > > > On Tue, Apr 23, 2024 at 2:37=E2=80=AFAM cong yang > > wrote: > > > > > > > > +static int starry_init_cmd(struct hx83102 *ctx) > > > > > +{ > > > > > + struct mipi_dsi_device *dsi =3D ctx->dsi; > > > > > + > > > > > + mipi_dsi_dcs_write_seq(dsi, HX83102_SETEXTC, 0x83, 0x10, = 0x21, 0x55, 0x00); > > > > > + > > > > > + mipi_dsi_dcs_write_seq(dsi, HX83102_SETPOWER, 0x2C, 0xB5,= 0xB5, 0x31, 0xF1, 0x31, 0xD7, 0x2F, > > > > > + 0x36, 0x36, 0x3= 6, 0x36, 0x1A, 0x8B, 0x11, 0x65, 0x00, 0x88, 0xFA, 0xFF, > > > > > + 0xFF, 0x8F, 0xF= F, 0x08, 0x74, 0x33); > > > > > > > > I know this is a sticking point between Linus W. and me, but I'm > > > > really not a fan of all the hardcoded function calls since it bloat= s > > > > the code so much. I think we need to stick with something more tabl= e > > > > based at least for the majority of the commands. If I understand > > > > correctly, Linus was OK w/ something table based as long as it was = in > > > > common code [1]. I think he also wanted the "delay" out of the tabl= e, > > > > but since those always seem to be at the beginning or the end it se= ems > > > > like we could still have the majority of the code as table based. D= o > > > > you want to make an attempt at that? If not I can try to find some > > > > time to write up a patch in the next week or so. > > > > > > Do you mean not add "delay" in the table? However, the delay > > > required by each panel may be different. How should this be handled? > > > > In the case of the "himax-hx83102" driver, it looks as if all the > > delays are at the beginning or end of the init sequence. That means > > you could just make those extra parameters that are set per-panel and > > you're back to having a simple sequence without delays. > > Do you mean add msleep in hx83102_enable()? > > @@ -612,12 +604,15 @@ static int hx83102_enable(struct drm_panel *panel) > struct device *dev =3D &dsi->dev; > int ret; > > + msleep(60); > ret =3D ctx->desc->init_cmds(ctx); > if (ret) { > dev_err(dev, "Panel init cmds failed: %d\n", ret); > return ret; > } > > + msleep(60); > + > ret =3D mipi_dsi_dcs_exit_sleep_mode(dsi); > > > > > If you had panels that needed delays in a more complicated way, you > > could keep the per-panel functions but just make the bulk of the > > function calls apply a sequence. For instance: > > > > static int my_panel_init_cmd(...) > > { > > ret =3D mipi_dsi_dcs_write_cmd_seq(dsi, my_panel_init_cmd_seq); > > if (ret) > > return ret; > > mdelay(100); > > ret =3D mipi_dsi_dcs_write(dsi, ...); > > if (ret) > > return ret; > > mdelay(50); > > ret =3D mipi_dsi_dcs_write_cmd_seq(dsi, ...); > > if (ret) > > return ret; > > } > > > > The vast majority of the work is still table driven so it doesn't > > bloat the code, but you don't have the "delay" in the command sequence > > since Linus didn't like it. I think something like the above would > > make Linus happy and I'd be OK w/ it as well. Ideally you should still > > make your command sequence as easy to understand as possible, kind of > > like how we did with _INIT_SWITCH_PAGE_CMD() in > > "panel-ilitek-ili9882t.c" > > > > As part of this, you'd have to add a patch to create > > mipi_dsi_dcs_write_cmd_seq(), but hopefully that shouldn't be too > > complicated? > > > > > > > It would be great if you could help provide a patch. Thank you so muc= h. > > > > Sure, I can, though maybe you want to give it a shot with the above des= cription? > > Sorry, I still don't seem to understand. How to encapsulate the parameter= s of > "HX83102_SETDISP, HX83102_SETCYC,....."? Different parameters for each pa= nel. > I have sent my V3 but it does not contain the patch you want. It sounds as if Dmitry has come up with a solution that allows us to keep using the functions like you've been using but avoid the code bloat problems. ...so let's go with that. It sounds as if he's going to send a patch before too long and then it should be pretty easy to convert your patches over to use his new function. [1] https://lore.kernel.org/r/CAA8EJprv3qBd1hfdWHrfhY=3DS0w2O70dZnYb6TVsS6A= GRPxsYdw@mail.gmail.com