Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6986969ybl; Wed, 15 Jan 2020 13:31:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyj3eQT+HEUZQoGSZa6DnovnLZhNrtxQy9X/sFGijQ/Q38lZL3kXRVjmlcskJs/GRcay8fr X-Received: by 2002:aca:554d:: with SMTP id j74mr1634930oib.92.1579123903287; Wed, 15 Jan 2020 13:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579123903; cv=none; d=google.com; s=arc-20160816; b=hEa9zDgI+WlOSopyz2rsExu/oNePIvCehkw6RgyFtvRbE7jcyVjXn1XmDfaHqKzOMh 1lrp7YF7y2AoG0ecFQ4ZNDy1ZhlQljoFeMs+ESjulNVvVTbcXobfaF6q68JefoBmdGT9 JWtqdm9fAEFPVyk10pb8CzkOLoqX3zLOmq825ED1neJo24Jsv9c6fHpsHOPIIpReS76v UYYiOcJ3FfDWb7auIVAX81c4Q753YIk+8NIDFozXbIVe/18DdgqAc0RDPfo6llluzcqP e4lyu2+1BC11EcKOf0t0NzIfaPUBu+iCADT/A2Y9jr5d/rla9JX0IPbv8PHGTG0ERS1R dzEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fBv2x9aB36b8Iir5IbvzEAo4j0udmQBWHRpjXLvankY=; b=ZxhWf6MwJTPRCQhrl0Yve9nWgrD3JPLsOXFMhh0YWcyPxLYRdBOv8XMGpWrkHvbnwa aXpA3yPC1C8iAvWfIO1xKOHtFl/wlz5NvzhG6zSG1YmKiYVLBhpSRwPC3uSg9sYvZuzE AyupNgqcykG4E3Mir/M72kmmsxCtAogWm+R+cwRXwY/CSFlGv5+mC8irb6+sdPfn4/xl Sco0CY4b29fuWwRqbniYkgVB5YD6rtIIwYyFihccALfkz4dU+InDRJb8J+309xxZq3yU wXlzGHwVsASx8yoQg3zuiSQpBqpTNKaKOWwNKeXr6JnVM8T9IyJXgl9ysi0w97vDL63D QimA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si12273136oth.181.2020.01.15.13.31.30; Wed, 15 Jan 2020 13:31:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729801AbgAOVOM (ORCPT + 99 others); Wed, 15 Jan 2020 16:14:12 -0500 Received: from asavdk4.altibox.net ([109.247.116.15]:44108 "EHLO asavdk4.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729406AbgAOVOM (ORCPT ); Wed, 15 Jan 2020 16:14:12 -0500 Received: from ravnborg.org (unknown [158.248.194.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk4.altibox.net (Postfix) with ESMTPS id 1D865804E5; Wed, 15 Jan 2020 22:14:05 +0100 (CET) Date: Wed, 15 Jan 2020 22:14:04 +0100 From: Sam Ravnborg To: Jitao Shi Cc: Thierry Reding , David Airlie , Daniel Vetter , Matthias Brugger , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, yingjoe.chen@mediatek.com, eddie.huang@mediatek.com, cawa.cheng@mediatek.com, bibby.hsieh@mediatek.com, ck.hu@mediatek.com, stonea168@163.com Subject: Re: [PATCH v8 2/8] drm/panel: support for BOE tv101wum-nl6 wuxga dsi video mode panel Message-ID: <20200115211404.GC28904@ravnborg.org> References: <20200115135958.126303-1-jitao.shi@mediatek.com> <20200115135958.126303-3-jitao.shi@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200115135958.126303-3-jitao.shi@mediatek.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=VcLZwmh9 c=1 sm=1 tr=0 a=UWs3HLbX/2nnQ3s7vZ42gw==:117 a=UWs3HLbX/2nnQ3s7vZ42gw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=mpaa-ttXAAAA:8 a=qFe5Z7MAUKcRMEBcnwwA:9 a=CjuIK1q_8ugA:10 a=6heAxKwa5pAsJatQ0mat:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jitao. > + > +static int boe_panel_add(struct boe_panel *boe) > +{ > + struct device *dev = &boe->dsi->dev; > + int err; > + > + boe->avdd = devm_regulator_get(dev, "avdd"); > + if (IS_ERR(boe->avdd)) > + return PTR_ERR(boe->avdd); > + > + boe->avee = devm_regulator_get(dev, "avee"); > + if (IS_ERR(boe->avee)) > + return PTR_ERR(boe->avee); > + > + boe->pp1800 = devm_regulator_get(dev, "pp1800"); > + if (IS_ERR(boe->pp1800)) > + return PTR_ERR(boe->pp1800); > + > + boe->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); > + if (IS_ERR(boe->enable_gpio)) { > + dev_err(dev, "cannot get reset-gpios %ld\n", > + PTR_ERR(boe->enable_gpio)); > + return PTR_ERR(boe->enable_gpio); > + } > + > + gpiod_set_value(boe->enable_gpio, 0); > + > + err = drm_panel_of_backlight(&boe->base); > + if (err) > + return err; From the descrition of drm_panel_of_backlight(): "" drm_panel_of_backlight() must be called after the call to drm_panel_init(). "" Please do as documented. Sam > + > + drm_panel_init(&boe->base, dev, &boe_panel_funcs, > + DRM_MODE_CONNECTOR_DSI); > + > + boe->base.funcs = &boe_panel_funcs; > + boe->base.dev = &boe->dsi->dev; > + > + return drm_panel_add(&boe->base); > +} > + > +static int boe_panel_probe(struct mipi_dsi_device *dsi) > +{ > + struct boe_panel *boe; > + int ret; > + const struct panel_desc *desc; > + > + boe = devm_kzalloc(&dsi->dev, sizeof(*boe), GFP_KERNEL); > + if (!boe) > + return -ENOMEM; > + > + desc = of_device_get_match_data(&dsi->dev); > + dsi->lanes = desc->lanes; > + dsi->format = desc->format; > + dsi->mode_flags = desc->mode_flags; > + boe->desc = desc; > + boe->dsi = dsi; > + ret = boe_panel_add(boe); > + if (ret < 0) > + return ret; > + > + mipi_dsi_set_drvdata(dsi, boe); > + > + ret = mipi_dsi_attach(dsi); > + if (ret) > + drm_panel_remove(&boe->base); > + > + return ret; > +} > + > +static void boe_panel_shutdown(struct mipi_dsi_device *dsi) > +{ > + struct boe_panel *boe = mipi_dsi_get_drvdata(dsi); > + > + drm_panel_disable(&boe->base); > + drm_panel_unprepare(&boe->base); > +} > + > +static int boe_panel_remove(struct mipi_dsi_device *dsi) > +{ > + struct boe_panel *boe = mipi_dsi_get_drvdata(dsi); > + int ret; > + > + boe_panel_shutdown(dsi); > + > + ret = mipi_dsi_detach(dsi); > + if (ret < 0) > + dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); > + > + if (boe->base.dev) > + drm_panel_remove(&boe->base); > + > + return 0; > +} > + > +static const struct of_device_id boe_of_match[] = { > + { .compatible = "boe,tv101wum-nl6", > + .data = &boe_tv101wum_nl6_desc > + }, > + { /* sentinel */ } > +}; > +MODULE_DEVICE_TABLE(of, boe_of_match); > + > +static struct mipi_dsi_driver boe_panel_driver = { > + .driver = { > + .name = "panel-boe-tv101wum-nl6", > + .of_match_table = boe_of_match, > + }, > + .probe = boe_panel_probe, > + .remove = boe_panel_remove, > + .shutdown = boe_panel_shutdown, > +}; > +module_mipi_dsi_driver(boe_panel_driver); > + > +MODULE_AUTHOR("Jitao Shi "); > +MODULE_DESCRIPTION("BOE tv101wum-nl6 1200x1920 video mode panel driver"); > +MODULE_LICENSE("GPL v2"); > -- > 2.21.0