From nobody Mon Feb 9 00:01:11 2026 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.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 E0AD11CE092 for ; Fri, 28 Jun 2024 18:25:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719599122; cv=none; b=kidF1LvCw+nus4zKKVzNTbHK/008wxWmZ7AtrK4u/0VTv4LzXeUhPPOnwMEUsU8DaDY1YiK5Bhx3TUTdzm8TcdzAPQJ6YAYJeSZR2gATyDx75sW1gdZW1lLELksnrP7XS/WQH3vbhljjuNdJW4feY+g6dHlUBoZe3snovS3BPsk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719599122; c=relaxed/simple; bh=vuQi+2JeDlGLQM0NgGprIEwEDkk9NbJ1EoRRt5hN9fw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=awuE256t53Yuw/7bWQ2Aac7t89KpFBzh7oIyxDh2iEKsuCGHyK5IUztHv9v0sFuyW0xUMNScFM4S7APttUzcUvplgy2LY47uoSactVQEGc53sh5GlC1F6V8JHnW/nhoHX6h5cilGmR/1v0cM9i5qgMIjORjnrmU9wMmDfJRCktw= 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=jMSbMrg9; arc=none smtp.client-ip=209.85.214.175 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="jMSbMrg9" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1fa07e4f44eso5834215ad.2 for ; Fri, 28 Jun 2024 11:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719599119; x=1720203919; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wfBm8V9NV7G6pqPtIBKn244UHr+yYxygJZ9Qu/8ilKA=; b=jMSbMrg93vlrk0Vs8YKhiliG3XWD3ma+e+VXFwCkpztl+MkIkbXXfmMyFQDYOH8WLA NJhrVRiqJcSKEVDzldPCFfz2wLrtNSe8f9WE4IGT01CyN35I0FvCWl7P804iA2M4BpT6 9gq9N1o1hPZmLZNXn50GdDjg+LuTapeS4MahEXPB9dIjq29Xpp1DvjpSA90IpcJmDxrT TJ8ZD4/Jj7X2pNmrUP2k3i13/xUNeoIsHB58B9iTYZfN8rOt3GPd5hJkz2Nh0u9KU45r 7cfpCCZwMbBzc27b7OxQBpjWzj6srcw5aX2pUB2f7/ij4vyi5GTEVJxrWI6TQ/JNtMDb FacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719599119; x=1720203919; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wfBm8V9NV7G6pqPtIBKn244UHr+yYxygJZ9Qu/8ilKA=; b=VH9N93TQ6blD1F0hS4mJ9oqxojboPKtw67UNWROJxykEF4Qdh4EsymnT+4vYn+NLD2 hf9OMsF2xIz9uJUo85byVuB5M1TOYw0pmCngSFX8dBGrWmM5oZqT/tMn4U3dhvtUgwfM Tpb0WjVEbLEK112dNlsFJOqIfjVVXauG/pdBFJcpLrRm/QHfUNjfHzfAQZni7EmDhl7k v3HBk2JJYjwKtoucZ5XmuB7o0zjjBi3glHZ5t4PJbR+AM1RbfgmhonB9ciGsewKsIJNM EWIunQmgUJQWP/nUEWJoRup3aV9vxfAgiCRgoTIc1Wx/hb/th+UQHs7JMMtygQPW/i6A Wvrg== X-Forwarded-Encrypted: i=1; AJvYcCWGgxbVa1mNVnx2L3Emk5+7d+UhMByx7tJNBhzrGcE6VN4S/m0Xdctq7PItNJiqdjzJfz0Zr8DzeKuDRjaASNP6kG/hm8VVu3N5VvU8 X-Gm-Message-State: AOJu0Yy2FZGTMCEWR7kFNjDtdtCrrccF77AcItw9fL2iwPHIWRHbgemf fL7Xk3wVYSZdaSp+CrO9fpeIIP+clHTvm/CYcWNaLBKBdgAGQ4EE X-Google-Smtp-Source: AGHT+IF2h8mtrMLcscWEwhh6vN6i5Afk/cteeBt9wnk4CW19G9u0jb4V25LgKABMzllKERcphwATgw== X-Received: by 2002:a17:902:c401:b0:1f9:9a24:dc29 with SMTP id d9443c01a7336-1fa23be2439mr193767495ad.24.1719599119217; Fri, 28 Jun 2024 11:25:19 -0700 (PDT) Received: from distilledx.localdomain ([122.172.84.231]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac10e21aesm18557465ad.64.2024.06.28.11.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:25:18 -0700 (PDT) From: Tejas Vipin To: neil.armstrong@linaro.org, quic_jesszhan@quicinc.com Cc: dianders@chromium.org, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tejas Vipin Subject: [PATCH 2/2] drm/panel: startek-kd070fhfid015: transition to mipi_dsi wrapped functions Date: Fri, 28 Jun 2024 23:54:28 +0530 Message-ID: <20240628182428.171031-3-tejasvipin76@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240628182428.171031-1-tejasvipin76@gmail.com> References: <20240628182428.171031-1-tejasvipin76@gmail.com> 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" Use multi style wrapped functions for mipi_dsi in the startek-kd070fhfid015 panel. Signed-off-by: Tejas Vipin --- .../drm/panel/panel-startek-kd070fhfid015.c | 107 ++++++------------ 1 file changed, 35 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c b/drivers/= gpu/drm/panel/panel-startek-kd070fhfid015.c index 0156689f41cd..d58c81c43724 100644 --- a/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c +++ b/drivers/gpu/drm/panel/panel-startek-kd070fhfid015.c @@ -52,92 +52,63 @@ static inline struct stk_panel *to_stk_panel(struct drm= _panel *panel) static int stk_panel_init(struct stk_panel *stk) { struct mipi_dsi_device *dsi =3D stk->dsi; - struct device *dev =3D &stk->dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx =3D {.dsi =3D dsi}; =20 - ret =3D mipi_dsi_dcs_soft_reset(dsi); - if (ret < 0) { - dev_err(dev, "failed to mipi_dsi_dcs_soft_reset: %d\n", ret); - return ret; - } - mdelay(5); + mipi_dsi_dcs_soft_reset_multi(&dsi_ctx); =20 - ret =3D mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - dev_err(dev, "failed to set exit sleep mode: %d\n", ret); - return ret; - } - msleep(120); + if (!dsi_ctx.accum_err) + mdelay(5); + + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); =20 - mipi_dsi_generic_write_seq(dsi, DSI_REG_MCAP, 0x04); + mipi_dsi_msleep(&dsi_ctx, 120); + + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_MCAP, 0x04); =20 /* Interface setting, video mode */ - mipi_dsi_generic_write_seq(dsi, DSI_REG_IS, 0x14, 0x08, 0x00, 0x22, 0x00); - mipi_dsi_generic_write_seq(dsi, DSI_REG_IIS, 0x0C, 0x00); - mipi_dsi_generic_write_seq(dsi, DSI_REG_CTRL, 0x3A, 0xD3); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IS, 0x14, 0x08, 0x00, = 0x22, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_IIS, 0x0C, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, DSI_REG_CTRL, 0x3A, 0xD3); =20 - ret =3D mipi_dsi_dcs_set_display_brightness(dsi, 0x77); - if (ret < 0) { - dev_err(dev, "failed to write display brightness: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, 0x77); =20 - mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, - MIPI_DCS_WRITE_MEMORY_START); + mipi_dsi_dcs_write_seq_multi(&dsi_ctx, MIPI_DCS_WRITE_CONTROL_DISPLAY, + MIPI_DCS_WRITE_MEMORY_START); =20 - ret =3D mipi_dsi_dcs_set_pixel_format(dsi, 0x77); - if (ret < 0) { - dev_err(dev, "failed to set pixel format: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_pixel_format_multi(&dsi_ctx, 0x77); =20 - ret =3D mipi_dsi_dcs_set_column_address(dsi, 0, stk->mode->hdisplay - 1); - if (ret < 0) { - dev_err(dev, "failed to set column address: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_column_address_multi(&dsi_ctx, 0, stk->mode->hdisplay - = 1); =20 - ret =3D mipi_dsi_dcs_set_page_address(dsi, 0, stk->mode->vdisplay - 1); - if (ret < 0) { - dev_err(dev, "failed to set page address: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_page_address_multi(&dsi_ctx, 0, stk->mode->vdisplay - 1); =20 - return 0; + return dsi_ctx.accum_err; } =20 static int stk_panel_on(struct stk_panel *stk) { struct mipi_dsi_device *dsi =3D stk->dsi; - struct device *dev =3D &stk->dsi->dev; - int ret; + struct mipi_dsi_multi_context dsi_ctx =3D {.dsi =3D dsi}; =20 - ret =3D mipi_dsi_dcs_set_display_on(dsi); - if (ret < 0) - dev_err(dev, "failed to set display on: %d\n", ret); + mipi_dsi_dcs_set_display_on_multi(&dsi_ctx); =20 - mdelay(20); + if (!dsi_ctx.accum_err) + mdelay(20); =20 - return ret; + return dsi_ctx.accum_err; } =20 static void stk_panel_off(struct stk_panel *stk) { struct mipi_dsi_device *dsi =3D stk->dsi; - struct device *dev =3D &stk->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); + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); =20 - ret =3D mipi_dsi_dcs_enter_sleep_mode(dsi); - if (ret < 0) - dev_err(dev, "failed to enter sleep mode: %d\n", ret); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); =20 - msleep(100); + mipi_dsi_msleep(&dsi_ctx, 100); } =20 static int stk_panel_unprepare(struct drm_panel *panel) @@ -155,7 +126,6 @@ static int stk_panel_unprepare(struct drm_panel *panel) static int stk_panel_prepare(struct drm_panel *panel) { struct stk_panel *stk =3D to_stk_panel(panel); - struct device *dev =3D &stk->dsi->dev; int ret; =20 gpiod_set_value(stk->reset_gpio, 0); @@ -175,16 +145,12 @@ static int stk_panel_prepare(struct drm_panel *panel) gpiod_set_value(stk->reset_gpio, 1); mdelay(10); ret =3D stk_panel_init(stk); - if (ret < 0) { - dev_err(dev, "failed to init panel: %d\n", ret); + if (ret < 0) goto poweroff; - } =20 ret =3D stk_panel_on(stk); - if (ret < 0) { - dev_err(dev, "failed to set panel on: %d\n", ret); + if (ret < 0) goto poweroff; - } =20 return 0; =20 @@ -250,18 +216,15 @@ static int dsi_dcs_bl_get_brightness(struct backlight= _device *bl) static int dsi_dcs_bl_update_status(struct backlight_device *bl) { struct mipi_dsi_device *dsi =3D bl_get_data(bl); - 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; - ret =3D mipi_dsi_dcs_set_display_brightness(dsi, bl->props.brightness); - if (ret < 0) { - dev_err(dev, "failed to set DSI control: %d\n", ret); - return ret; - } + mipi_dsi_dcs_set_display_brightness_multi(&dsi_ctx, bl->props.brightness); + if (dsi_ctx.accum_err) + return dsi_ctx.accum_err; =20 dsi->mode_flags |=3D MIPI_DSI_MODE_LPM; - return 0; + return dsi_ctx.accum_err; } =20 static const struct backlight_ops dsi_bl_ops =3D { --=20 2.45.2