Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp692092rwb; Thu, 15 Dec 2022 00:50:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tA3Q9Xi50emNW7RPLm1w2Vv9NWU5UZtE5KJp8DIjRo1ft6NuTsLD3fQJZCcPnRdtbIUVo X-Received: by 2002:a05:6402:2947:b0:461:f4f9:eb3f with SMTP id ed7-20020a056402294700b00461f4f9eb3fmr22256139edb.19.1671094213691; Thu, 15 Dec 2022 00:50:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671094213; cv=none; d=google.com; s=arc-20160816; b=q/1WGZQfbINvn/A4kk9hAImi0B0TD5IdYVuFwy3Ifw5xjF8QzP6Fl+x2cfevqZNcxr H0+JnI+mY9yfV+uA1mkXiOyvVLgPMKp4i7UhpDjvki9t3RooSDagdS8S4+KlwUA3xJPc ERaHf63euRWjvv8/3GDGgp2RQCsWopK+QF8tQ4NQFOK5uo/wi0OvClFGhnryuYdwn/J1 +BiAAo4c7znBtBgYEfmkgsNlL9/53BGObXKifLqNV6GgnL9YU770dX/uRK8COtGgdzXQ YQr+REwvyrAyOPXO2GWqTrX2dBCFY0Oel5niqkGe8jbylw69k3g8faBC9h3CDc/3hizf NzUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HXhudpMG5ipoBTmDLzbqLq8C65gsSAGF3azolDiFn1I=; b=p2LMhJyBjjbcifMhn4PixQGVzBfR1GmgI0aGyd6hYOur56J6P29nCQMABSFfaJyP8+ j8F8OOnzS+2/og8SWZod4oNqYnJ7VTXw8cwM5ZFRiL3h/VRWbknavM+KZt+Qo6icnEM2 po19y/Xets4ojix3KT8CY2eu2OALB1snaRqgPEVaCpcNB/lSOGnSE8Q1qTp/lNjJ45gD ELYMLqb0Pb0TNr+7Go45yU0Kz2QDjZTYGfx2n7OPdqmh2XwrYSQoFakCpjQ6ERCItRGo 2gD56q7ahJPjVfT07ZDpA4LLX1NyIAV7/0DV0+yz4qOJ3qXobOosVO2Ciyz9wbeQG7HJ u9Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oS7MvThU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v26-20020a50d09a000000b0045938ab7129si14038061edd.330.2022.12.15.00.49.56; Thu, 15 Dec 2022 00:50:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oS7MvThU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229623AbiLOImH (ORCPT + 70 others); Thu, 15 Dec 2022 03:42:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbiLOImB (ORCPT ); Thu, 15 Dec 2022 03:42:01 -0500 Received: from mail-yb1-xb30.google.com (mail-yb1-xb30.google.com [IPv6:2607:f8b0:4864:20::b30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 833A32A700 for ; Thu, 15 Dec 2022 00:42:00 -0800 (PST) Received: by mail-yb1-xb30.google.com with SMTP id 192so2673248ybt.6 for ; Thu, 15 Dec 2022 00:42:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=HXhudpMG5ipoBTmDLzbqLq8C65gsSAGF3azolDiFn1I=; b=oS7MvThUFU/JGOGYBihO3JXdurEUA6AetFLg9F1AnzodZpwdxJ17GYUjSqGNCzoTGp CRuFzoKrac00hc011hygTaS6JwiED8YasNIiSyZOwO7Rr2BVjvDSPNZ2jW+55SXgL37h zS6tDMdtBWFqggnFJiu/bgOLD6DBI6onfSgpbJOitHJdVcPWTCDFAYwazw/7H8ZBL9Ud AFOFTA2S1zpGlxZ8fdoJeDXulzQWRXncyFQDnM4Af34bO2NwHMXQoF1R1nNbw0+pdP5o 2yTopVMiLG76IUn8j6mKOuDmJj2ULCmX8EJyryF4gVzwlQtyLCBOMWPY0wZlTC8TJ9p8 GxWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=HXhudpMG5ipoBTmDLzbqLq8C65gsSAGF3azolDiFn1I=; b=586mFIgwVgrezz+lS8ONYDf2O06e2+N23JhWsG7aJU9V2dfV62TS2l+Q4KyY+ByC0D RZHOwlL+w4FjUaRANIwuOphQ5fEhTJjLcXZxOnb8b04Z+m3WJmbWQA9r6q0HGbecFKE0 PaLP3uD/m8tANCxvsiQtjWqzMQ8Wjc6P9ld1FoCdjtY6teeYCDuM/Eev6LGqWo65XXlI nlOGPxPmzcOFuaKObyjdR192hy3x/NHXV+71RcpRPiiIwpIZL1s8UqHS1kfzmgsIiqfu S2m5E/OrmOErWe5sGDfEgeLJe0589g+Dl8C173K4xDiykC/CQkAv3H9JPxrGPDXYTO7t 26Dw== X-Gm-Message-State: ANoB5plpxG+dpzkEPtJh/W9ppvYARzFSbBKZ4drnX13UMz2NJEPkr7OP eKB/6JgNmshmqGwNQ/kiFmpaoN+3QRTL64TRgoRiTA== X-Received: by 2002:a25:7648:0:b0:6fe:54d5:2524 with SMTP id r69-20020a257648000000b006fe54d52524mr24020034ybc.522.1671093719699; Thu, 15 Dec 2022 00:41:59 -0800 (PST) MIME-Version: 1.0 References: <20221214110037.149387-1-cbranchereau@gmail.com> <20221214110037.149387-2-cbranchereau@gmail.com> In-Reply-To: <20221214110037.149387-2-cbranchereau@gmail.com> From: Linus Walleij Date: Thu, 15 Dec 2022 09:41:48 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] drm/panel: add the orisetech ota5601a To: Christophe Branchereau Cc: thierry.reding@gmail.com, sam@ravnborg.org, airlied@gmail.com, daniel@ffwll.ch, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christophe, thanks for your patch! On Wed, Dec 14, 2022 at 12:01 PM Christophe Branchereau wrote: > Add the orisetech ota5601a ic driver > > For now it only supports the focaltech gpt3 3" 640x480 ips panel > found in the ylm rg300x handheld. > > Signed-off-by: Christophe Branchereau (...) > +config DRM_PANEL_ORISETECH_OTA5601A > + tristate "Orise Technology ota5601a RGB/SPI panel" > + depends on OF && SPI > + depends on BACKLIGHT_CLASS_DEVICE > + select REGMAP_SPI Nice use of regmap in this driver. > +static const struct reg_sequence ota5601a_panel_regs[] = { > + { 0xfd, 0x00 }, > + { 0x02, 0x00 }, > + > + { 0x18, 0x00 }, > + { 0x34, 0x20 }, > + > + { 0x0c, 0x01 }, > + { 0x0d, 0x48 }, > + { 0x0e, 0x48 }, > + { 0x0f, 0x48 }, > + { 0x07, 0x40 }, > + { 0x08, 0x33 }, > + { 0x09, 0x3a }, > + > + { 0x16, 0x01 }, > + { 0x19, 0x8d }, > + { 0x1a, 0x28 }, > + { 0x1c, 0x00 }, > + > + { 0xfd, 0xc5 }, > + { 0x82, 0x0c }, > + { 0xa2, 0xb4 }, > + > + { 0xfd, 0xc4 }, > + { 0x82, 0x45 }, > + > + { 0xfd, 0xc1 }, > + { 0x91, 0x02 }, > + > + { 0xfd, 0xc0 }, > + { 0xa1, 0x01 }, > + { 0xa2, 0x1f }, > + { 0xa3, 0x0b }, > + { 0xa4, 0x38 }, > + { 0xa5, 0x00 }, > + { 0xa6, 0x0a }, > + { 0xa7, 0x38 }, > + { 0xa8, 0x00 }, > + { 0xa9, 0x0a }, > + { 0xaa, 0x37 }, > + > + { 0xfd, 0xce }, > + { 0x81, 0x18 }, > + { 0x82, 0x43 }, > + { 0x83, 0x43 }, > + { 0x91, 0x06 }, > + { 0x93, 0x38 }, > + { 0x94, 0x02 }, > + { 0x95, 0x06 }, > + { 0x97, 0x38 }, > + { 0x98, 0x02 }, > + { 0x99, 0x06 }, > + { 0x9b, 0x38 }, > + { 0x9c, 0x02 }, > + > + { 0xfd, 0x00 }, > +}; If these are registers, why is register 0xfd written 7 times with different values? This is rather a jam table or intializations sequence, so it should be names something like that and a comment about undocumented registers added probably as well. > +static int ota5601a_enable(struct drm_panel *drm_panel) > +{ > + struct ota5601a *panel = to_ota5601a(drm_panel); > + int err; > + > + err = regmap_write(panel->map, 0x01, 0x01); Since you know what this register does, what about: #include #define OTA5601A_CTL 0x01 #define OTA5601A_CTL_OFF 0x00 #define OTA5601A_CTL_ON BIT(0) > +static int ota5601a_get_modes(struct drm_panel *drm_panel, > + struct drm_connector *connector) > +{ > + struct ota5601a *panel = to_ota5601a(drm_panel); > + const struct ota5601a_panel_info *panel_info = panel->panel_info; > + struct drm_display_mode *mode; > + unsigned int i; > + > + for (i = 0; i < panel_info->num_modes; i++) { > + mode = drm_mode_duplicate(connector->dev, > + &panel_info->display_modes[i]); > + if (!mode) > + return -ENOMEM; > + > + drm_mode_set_name(mode); > + > + mode->type = DRM_MODE_TYPE_DRIVER; > + if (panel_info->num_modes == 1) But ... you have just added an array that contains 2 elements, you KNOW it will not be 1. > + mode->type |= DRM_MODE_TYPE_PREFERRED; I think you should probably set this on the preferred resolution anyways, take the one you actually use. > +static const struct of_device_id ota5601a_of_match[] = { > + { .compatible = "focaltech,gpt3", .data = &gpt3_info }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, ota5601a_of_match); Does this mean the display controller is ota5601a and the display manufacturer and product is focaltech gpt3? Then it's fine. Overall the driver looks very good, just the above little details. Yours, Linus Walleij