From nobody Thu Mar 13 08:49:13 2025 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 456171DFF0 for ; Wed, 22 Jan 2025 03:11:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737515482; cv=none; b=C9aa3yhJJSFfVps9NUP3vM3v2yzP/NTBUNbPgE7+mvpBK/b74weeSP3H+rU7Jid77nzYE6ZMXfMteL+lBvwzJu6HjKOPss1QUxs269fJGYsKQqyV1MgyK0jj7DKMAfYEBpaAlIZ64cec75qlNTUhjzsfXH8q+5YN8sEmLZdyOFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737515482; c=relaxed/simple; bh=MQkwWdL+6ylwFUGlj/G6jvVEoguitjlubUZD+/s2ejI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=T3zmBR1xVsCRqksVtKs57pxxsXrUZN27IC+wjsl9puJ8wnAjspoVz7k2zQTHgS6GTqId2NBUMP/RO1mSvNV5Rs9T1aHg1ARmtA7KdiZrsY0vmr8SWT5duuuvzyBVdu5MQbKUp/dcUr4yEUbRF3yUSWG1468Ckhvs41OiCXoO7Ek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WMnS/UTu; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WMnS/UTu" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2ef748105deso8276772a91.1 for ; Tue, 21 Jan 2025 19:11:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737515480; x=1738120280; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ux115BZ6yMp4mGDHcgSg3b/SgxdnLXCDKrOt/YcxPPI=; b=WMnS/UTuZVvN/dmuSadePT5CrJ/UjqWbiKYaqrWtJ4McubFviH+xioK/wXwXhr4B/p 2JLuNMOAfCy85khxfxzRamVN5avk8+Gt472V7DctXEXdYdzC0ZKFkD8S5/RSMcFL7xqn fm4daJgamAY1p8uBdBvOxcH/qsC1P7Fe4NVlpOQhY8tLzCdn11OrYNXBjulhhfrqKq+I up5e1P2spYxrVw1FqIxJPesHCU1SEgWhifwB29r6AtWD7Vtm5i3CEAP1YQ+Jro3A0uIZ oxXMkwlJGKOvNcFFAFRGb6KpSkfga+Wd46fu5V/3rU8VJLxHzYL4pNu5XvU0HyfUMU0H +Yqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737515480; x=1738120280; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ux115BZ6yMp4mGDHcgSg3b/SgxdnLXCDKrOt/YcxPPI=; b=JnPPbEs06Uf+A1uqdL/6Ju12JfO/W5gv4ZOCLtrQp3ORASysWUhJk5izPJoTgRCeEq mwTrSubqpS+nBSJvQCg/2Wx7ZGVN8eUZvlwoUZwT8hPIinBaJQIoTrL31Rtzr3Z5890v W/hbn3GWVFbzIcMRf+TqQCKkdrRUconFE47WKjx/achSV9vHdEFFkckBTmfqAJYHL6lq pAuaXPODNdX8XuOnywCIy2U5DJcGWJjlPpzpkIKC4YhB8wtf++PLv/TIHbmUvvq+3py8 ltkJPXK6C3w7GeYF393YYkP6mTYZH7agr7dmib1RVD0Vwwa9vUSStReM5qqjLh9hqdb3 ME6A== X-Forwarded-Encrypted: i=1; AJvYcCUIHljWaSF90SwNA3rLFXQwY6YZmOSCCauxtIcuceIYiIaIm2jxDHhYG50pPTpJuOHmFvluw5j3trAEd/o=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0WUN9WUHmTa8pi3JtcDjKkm1eXMjfQko4mOdHjCnJGpN22inL UjjzZ6BC8OfdSTXL5AOx1XYz2uHmx7ZL0JMO3on7608ih94KC95m X-Gm-Gg: ASbGncsB8aAOl19li60UvU16TeIo524kA/vMzARbq6wG+BI0VIDt4jBRVhUBy+x6PJ6 JnGml5CmUQzqv9qOeqBxBb2VL+LYPluGbaIxAii9v5N0BTJisB8iC2xTtcjgdY2bVgZgGGlL4cV VhymE5aZ16D3d/MJL7vmCbuSGcksy/PY65+RkpgPmVy3bHWsb9Afd+QElf2TL4uDUW/AI+ROY08 hg60TlXGdxkXfPYAsoESLSH3gInPbasXA65OLyJ2VVwfoAfndHookI9ClgUQsGINNPALT4Ld+rZ FR+nvhKAcsfo X-Google-Smtp-Source: AGHT+IFNfCmWcYFe6+zV6ILkzqGYAgdGnHc7yVUtAkDwTfWhNG3crD05nOKk4p+hHJMDbHAVGXnzOg== X-Received: by 2002:a17:90a:e18f:b0:2ee:acb4:fecd with SMTP id 98e67ed59e1d1-2f782c70244mr28919903a91.9.1737515480477; Tue, 21 Jan 2025 19:11:20 -0800 (PST) Received: from distilledx.SRMIST.EDU.IN ([59.152.80.69]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f7e6af0104sm303914a91.49.2025.01.21.19.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 19:11:20 -0800 (PST) From: Tejas Vipin To: neil.armstrong@linaro.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch Cc: quic_jesszhan@quicinc.com, dianders@chromium.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tejas Vipin Subject: [PATCH v2] drm/panel: samsung-s6e88a0-ams452ef01: transition to mipi_dsi wrapped functions Date: Wed, 22 Jan 2025 08:41:10 +0530 Message-ID: <20250122031110.286079-1-tejasvipin76@gmail.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Changes the samsung-s6e88a0-ams452ef01 panel to use multi style functions for improved error handling. Reviewed-by: Douglas Anderson Signed-off-by: Tejas Vipin --- Changes in v2: - changed s6e88a0_ams452ef01_off to return void Link to v1: https://lore.kernel.org/all/20250121134819.251718-1-tejasvipin7= 6@gmail.com/ --- .../panel/panel-samsung-s6e88a0-ams452ef01.c | 91 +++++++------------ 1 file changed, 31 insertions(+), 60 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c b/dri= vers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c index d2df227abbea..57b1a899bbdc 100644 --- a/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +++ b/drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c @@ -39,91 +39,66 @@ static void s6e88a0_ams452ef01_reset(struct s6e88a0_ams= 452ef01 *ctx) static int s6e88a0_ams452ef01_on(struct s6e88a0_ams452ef01 *ctx) { struct mipi_dsi_device *dsi =3D ctx->dsi; - struct device *dev =3D &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx =3D { .dsi =3D dsi }; =20 dsi->mode_flags |=3D MIPI_DSI_MODE_LPM; =20 - mipi_dsi_dcs_write_seq(dsi, 0xf0, 0x5a, 0x5a); // enable LEVEL2 commands - mipi_dsi_dcs_write_seq(dsi, 0xcc, 0x4c); // set Pixel Clock Divider polar= ity + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); // enable LEVEL= 2 commands + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xcc, 0x4c); // set Pixel Clock Di= vider polarity =20 - ret =3D mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to exit sleep mode: %d\n", ret); - return ret; - } - msleep(120); + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); =20 // set default brightness/gama - mipi_dsi_dcs_write_seq(dsi, 0xca, - 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, // V255 RR,GG,BB - 0x80, 0x80, 0x80, // V203 R,G,B - 0x80, 0x80, 0x80, // V151 R,G,B - 0x80, 0x80, 0x80, // V87 R,G,B - 0x80, 0x80, 0x80, // V51 R,G,B - 0x80, 0x80, 0x80, // V35 R,G,B - 0x80, 0x80, 0x80, // V23 R,G,B - 0x80, 0x80, 0x80, // V11 R,G,B - 0x6b, 0x68, 0x71, // V3 R,G,B - 0x00, 0x00, 0x00); // V1 R,G,B + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xca, + 0x01, 0x00, 0x01, 0x00, 0x01, 0x00,// V255 RR,GG,BB + 0x80, 0x80, 0x80, // V203 R,G,B + 0x80, 0x80, 0x80, // V151 R,G,B + 0x80, 0x80, 0x80, // V87 R,G,B + 0x80, 0x80, 0x80, // V51 R,G,B + 0x80, 0x80, 0x80, // V35 R,G,B + 0x80, 0x80, 0x80, // V23 R,G,B + 0x80, 0x80, 0x80, // V11 R,G,B + 0x6b, 0x68, 0x71, // V3 R,G,B + 0x00, 0x00, 0x00); // V1 R,G,B // set default Amoled Off Ratio - mipi_dsi_dcs_write_seq(dsi, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a); - mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x2c, 0x0b); // set default elvss volta= ge - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_POWER_SAVE, 0x00); - mipi_dsi_dcs_write_seq(dsi, 0xf7, 0x03); // gamma/aor update - mipi_dsi_dcs_write_seq(dsi, 0xf0, 0xa5, 0xa5); // disable LEVEL2 commands + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb2, 0x40, 0x0a, 0x17, 0x00, 0x0a= ); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xb6, 0x2c, 0x0b); // set default = elvss voltage + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf7, 0x03); // gamma/aor update + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); // disable LEVE= L2 commands =20 - ret =3D mipi_dsi_dcs_set_display_on(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display on: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); =20 - return 0; + return dsi_ctx.accum_err; } =20 -static int s6e88a0_ams452ef01_off(struct s6e88a0_ams452ef01 *ctx) +static void s6e88a0_ams452ef01_off(struct s6e88a0_ams452ef01 *ctx) { struct mipi_dsi_device *dsi =3D ctx->dsi; - struct device *dev =3D &dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx =3D { .dsi =3D dsi}; =20 dsi->mode_flags &=3D ~MIPI_DSI_MODE_LPM; =20 - ret =3D mipi_dsi_dcs_set_display_off(dsi); - if (ret < 0) { - dev_err(dev, "Failed to set display off: %d\n", ret); - return ret; - } - msleep(35); - - ret =3D mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "Failed to enter sleep mode: %d\n", ret); - return ret; - } - msleep(120); - - return 0; + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 35); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); } =20 static int s6e88a0_ams452ef01_prepare(struct drm_panel *panel) { struct s6e88a0_ams452ef01 *ctx =3D to_s6e88a0_ams452ef01(panel); - struct device *dev =3D &ctx->dsi->dev; int ret; =20 ret =3D regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); - if (ret < 0) { - dev_err(dev, "Failed to enable regulators: %d\n", ret); + if (ret < 0) return ret; - } =20 s6e88a0_ams452ef01_reset(ctx); =20 ret =3D s6e88a0_ams452ef01_on(ctx); if (ret < 0) { - dev_err(dev, "Failed to initialize panel: %d\n", ret); gpiod_set_value_cansleep(ctx->reset_gpio, 0); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); @@ -136,12 +111,8 @@ static int s6e88a0_ams452ef01_prepare(struct drm_panel= *panel) static int s6e88a0_ams452ef01_unprepare(struct drm_panel *panel) { struct s6e88a0_ams452ef01 *ctx =3D to_s6e88a0_ams452ef01(panel); - struct device *dev =3D &ctx->dsi->dev; - int ret; =20 - ret =3D s6e88a0_ams452ef01_off(ctx); - if (ret < 0) - dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + s6e88a0_ams452ef01_off(ctx); =20 gpiod_set_value_cansleep(ctx->reset_gpio, 0); regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); --=20 2.48.1