Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp221967rdb; Mon, 18 Sep 2023 13:00:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9F/2U6N2D7yKv5r5jUleo6s2Z/wCVr0HWIe4pfDVYAWoAu4Of5py+C473q3x13iubzuhM X-Received: by 2002:a05:6a00:2491:b0:68f:efc2:ba3d with SMTP id c17-20020a056a00249100b0068fefc2ba3dmr10024359pfv.33.1695067236663; Mon, 18 Sep 2023 13:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695067236; cv=none; d=google.com; s=arc-20160816; b=DVBxoM5SwnZ+sV4d3tJZDh6JhudDQpwTkpdMVqRp7FCHg/DKweHMP64UIhQbTQXWJt O61ycWgTVoXbOd7OKWV444NN9xM+lbiViEMC5+tO+ZHGDyVYsz4i08dnkUxg5SHneBhB nRaSq8tEqZ5rMZVlXpT/cx9MV9NGi6OJRWYxrcinMIunr3/hcuw26jlbFQ1WzvZH4LHt UgT3qGPcNpA0nW3y7YCO+xdPmpVx0BvgJf84qDDHrqGmNVsz4XjGb7D+WKKbxyrwAH80 MkkpGQ7XvmZHh2er/HBSrETFK+w8ELpIzZAwnoa4SghEaNG9he8oNtevnghhg7Pb2DOz NQdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+7Cu5zsIXzEyX7qBnjvxJyKtykP7Ho/OOvNX/Tdar6g=; fh=5op+vZ8ZrQJmWba1Le7ulO5lcdsd3PPtOBYLc/nCXxw=; b=lLa7sTs+oS3m1esUxnTZyX6lLc5ZWaxo+MYpdfBZDxpOrVPFBnbWcYCj1eWfWhvDKN wArPQM9S450cDirwHMd9rinixK95fK4KlffKemu2ph2ycB1kU2hofpG/7x+KrBPeSuuM v53K/FjVSbOF5uHVWepS/jrigEP7MO1ZxSwvYHJEI4Ri7O6WXny+KBdNaGhhl+azJWNd dLw/sbZDdw+yIvj+R8+zpsYGsKNWI7Fqg28bBnmb4Yv8scp7qAZGlZtNn29C58pEeUY4 bNxt79pw7dmPWnOC0z3PLJ9nFCMjuUOYviY8VACyMp1CXxV4jxhb+ce9XMJdOSGJbarW NGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=L9Rr4IxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id d7-20020a056a0024c700b00690bc199287si510203pfv.393.2023.09.18.13.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 13:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@jookia.org header.s=key1 header.b=L9Rr4IxO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=jookia.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AD6A68053CD5; Mon, 18 Sep 2023 06:01:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242016AbjIRNB1 (ORCPT + 99 others); Mon, 18 Sep 2023 09:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242053AbjIRNAx (ORCPT ); Mon, 18 Sep 2023 09:00:53 -0400 Received: from out-229.mta1.migadu.com (out-229.mta1.migadu.com [IPv6:2001:41d0:203:375::e5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC8DCEB for ; Mon, 18 Sep 2023 05:59:57 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jookia.org; s=key1; t=1695041995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+7Cu5zsIXzEyX7qBnjvxJyKtykP7Ho/OOvNX/Tdar6g=; b=L9Rr4IxOeDB6UuRUMyJiI3VRDOJGlLIKG6aTPh0dCE0yar6RGntR3YL0VzVp8ymfVkj52x t+9EeNUfSFi1SM+ZWTPjGRiAo0AQQ7m3aekJNWPH6BtZdwIJaDkdCqfg3jmhmNQTOiLQlH PCAWb4wXx9PoXGHO9hzqjk8RveUBlGaad2SW5vkf4t3RX5cfjXYq0Xjtjh5tt5nozUhfKg udBwANsXVOd7tLf5TJqg7Vc6B4IfubRB+yjtuUX7bNPXyBW2OYFtfzMMAx/Uu6v6/zZe9W R2nR0nE9h8SV4RLqajiPuFpWXg7OUEVj/bpE6XVN/cEewx5hLhhI7AdyG2i4Ug== From: John Watts To: dri-devel@lists.freedesktop.org Cc: Neil Armstrong , Jessica Zhang , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Heiko Stuebner , Chris Morgan , Jagan Teki , John Watts , Paul Cercueil , Christophe Branchereau , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 5/9] drm/panel: nv3052c: Allow specifying registers per panel Date: Mon, 18 Sep 2023 22:58:49 +1000 Message-ID: <20230918125853.2249187-6-contact@jookia.org> In-Reply-To: <20230918125853.2249187-1-contact@jookia.org> References: <20230918125853.2249187-1-contact@jookia.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 18 Sep 2023 06:01:53 -0700 (PDT) Panel initialization registers are per-display and not tied to the controller itself. Different panels will specify their own registers. Attach the sequences to the panel info struct so future panels can specify their own sequences. Signed-off-by: John Watts Reviewed-by: Jessica Zhang --- .../gpu/drm/panel/panel-newvision-nv3052c.c | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c index 307335d0f1fc..2b24c684a8ac 100644 --- a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c +++ b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c @@ -20,11 +20,18 @@ #include #include +struct nv3052c_reg { + u8 cmd; + u8 val; +}; + struct nv3052c_panel_info { const struct drm_display_mode *display_modes; unsigned int num_modes; u16 width_mm, height_mm; u32 bus_format, bus_flags; + const struct nv3052c_reg *panel_regs; + int panel_regs_len; }; struct nv3052c { @@ -36,12 +43,7 @@ struct nv3052c { struct gpio_desc *reset_gpio; }; -struct nv3052c_reg { - u8 cmd; - u8 val; -}; - -static const struct nv3052c_reg nv3052c_panel_regs[] = { +static const struct nv3052c_reg ltk035c5444t_panel_regs[] = { // EXTC Command set enable, select page 1 { 0xff, 0x30 }, { 0xff, 0x52 }, { 0xff, 0x01 }, // Mostly unknown registers @@ -244,6 +246,8 @@ static inline struct nv3052c *to_nv3052c(struct drm_panel *panel) static int nv3052c_prepare(struct drm_panel *panel) { struct nv3052c *priv = to_nv3052c(panel); + const struct nv3052c_reg *panel_regs = priv->panel_info->panel_regs; + int panel_regs_len = priv->panel_info->panel_regs_len; struct mipi_dbi *dbi = &priv->dbi; unsigned int i; int err; @@ -260,9 +264,9 @@ static int nv3052c_prepare(struct drm_panel *panel) gpiod_set_value_cansleep(priv->reset_gpio, 0); msleep(150); - for (i = 0; i < ARRAY_SIZE(nv3052c_panel_regs); i++) { - err = mipi_dbi_command(dbi, nv3052c_panel_regs[i].cmd, - nv3052c_panel_regs[i].val); + for (i = 0; i < panel_regs_len; i++) { + err = mipi_dbi_command(dbi, panel_regs[i].cmd, + panel_regs[i].val); if (err) { dev_err(priv->dev, "Unable to set register: %d\n", err); @@ -466,6 +470,8 @@ static const struct nv3052c_panel_info ltk035c5444t_panel_info = { .height_mm = 64, .bus_format = MEDIA_BUS_FMT_RGB888_1X24, .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE, + .panel_regs = ltk035c5444t_panel_regs, + .panel_regs_len = ARRAY_SIZE(ltk035c5444t_panel_regs), }; static const struct spi_device_id nv3052c_ids[] = { -- 2.42.0