Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp516772pxk; Sun, 30 Aug 2020 12:13:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7mGnPO0gFkFGLL4uV4vN7h1sESgwTH8qdvs+ktYP0z+ocXNPZDdWLbqwhP0KVU9VALumj X-Received: by 2002:a17:906:f0cc:: with SMTP id dk12mr247036ejb.546.1598814791895; Sun, 30 Aug 2020 12:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598814791; cv=none; d=google.com; s=arc-20160816; b=Gqd0sx5ANPTJvrgYBNk4Vx1mBKygheZLG3Rn1VDWsRno4d5JBHmYKE+p1AyihN2McX 53KJCV7Q4nhCIqU/9IpPMgDx158C7Xw/68GgO4HXXVwLiiGCqSTKMDjm8ud712kG8SvO IadmAZSsGiug+7uRV4VukaXEN1ADkAeq4zDipm3HC+nWfjBsIEaXW+8gBk0Lixs7P2gn ThXD6EYWjUdlcQuMOmSH2gCndCGzIzdO5w+gUQSWyfl5ExbG5O2/O4RjaUn8YtGkeBOK Wvd2FOjodtjSBQUPrXRruvvD/kQk5J8UaNrI8X62GHrHSOjf5eenV0NU42HpbT6rx3FL yN9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=erjVEXCyYTMOHGXHWdbaycBiug7Ytt6RWTId+Ij4C04=; b=i2zNqW7YuHK4cpmP9QpnNQcUiKNh2/rKPekmk6XwnxQIUgG+Wdl0dA8VYWiaU0lqts mM76G6BR8hsWRoz02CYlmPnAiCJOEFDDK350shU2ir6abE5uSL1U5YoLaAM2a4QvlyTv J2+lAtzmvhKv4mWrblK5bJu6XemL3yRs+p+VpDceEKCFfhtmaW0DYOZFqIPbguK0yD3C FxIU5gklIdTANHypwmE6+4ROL55ZcreiYCEypRJyLauA/BHH8J817n7/yjGsjTpg/uDj r38tVtLT9rk2a46QWliZUmScy9CvsLhGvapr3XDgIF+VzBlVWn5rPYW9SqmbSzjqItki kT0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nNDmHo8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e24si3720365eds.212.2020.08.30.12.12.48; Sun, 30 Aug 2020 12:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=nNDmHo8N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgH3TL5 (ORCPT + 99 others); Sun, 30 Aug 2020 15:11:57 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:54128 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726178AbgH3TL5 (ORCPT ); Sun, 30 Aug 2020 15:11:57 -0400 Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6A0CE258; Sun, 30 Aug 2020 21:11:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1598814713; bh=fel0reShl8gyxHac+/RDk7fZq+macGvIPWGmYF2KvpI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nNDmHo8Njma2Cg5b6MZJDWkkayMD+7XR2NTBLh8vbW6FREhHNg44gWKvRWkwOCDx8 vwCNZg7U9sTxsRIbAbb/q21RWvS+0oJFMADArVTp2dd8EGL4b29Y8W6pXN7oXrvR5V BHPfAl6SAy/bnHwTZkkDjW1sDO4mfG5IlaWufAyY= Date: Sun, 30 Aug 2020 22:11:33 +0300 From: Laurent Pinchart To: Paul Cercueil Cc: =?utf-8?B?5L2V5bCP6b6Z?= , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Noralf Tronnes , Linus Walleij , devicetree@vger.kernel.org, od@zcrc.me, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: =?utf-8?B?562U5aSNOiBbUEFUQw==?= =?utf-8?Q?H?= v2 6/6] drm/panel: Add Ilitek ILI9341 DBI panel driver Message-ID: <20200830191133.GB6043@pendragon.ideasonboard.com> References: <20200822163250.63664-1-paul@crapouillou.net> <20200822163250.63664-7-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Paul, On Sun, Aug 30, 2020 at 06:48:12PM +0200, Paul Cercueil wrote: > Le dim. 30 août 2020 à 16:36, 何小龙 (Leon He) a écrit : > >> +struct ili9341 { > >> + struct drm_panel panel; > >> + struct mipi_dsi_device *dsi; > >> + const struct ili9341_pdata *pdata; > >> + > >> + struct gpio_desc *reset_gpiod; > >> + u32 rotation; > >> +}; > >> + > > > > Hi Paul, you put the mipi_dsi_device inside the struct. I think it > > maybe not > > a good idea. That means the panel has a MIPI-DSI interface but it > > doesn't > > have actually. > > > >> +static int ili9341_probe(struct mipi_dsi_device *dsi) > >> +{ > >> + struct device *dev = &dsi->dev; > >> + struct ili9341 *priv; > >> + int ret; > >> + > >> + /* See comment for mipi_dbi_spi_init() */ > >> + if (!dev->coherent_dma_mask) { > >> + ret = dma_coerce_mask_and_coherent(dev, > >> DMA_BIT_MASK(32)); > >> + if (ret) { > >> + dev_warn(dev, "Failed to set dma mask > >> %d\n", ret); > >> + return ret; > >> + } > >> + } > >> + > >> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > >> + if (!priv) > >> + return -ENOMEM; > >> + > >> + mipi_dsi_set_drvdata(dsi, priv); > >> + priv->dsi = dsi; > >> + > >> + device_property_read_u32(dev, "rotation", &priv->rotation); > >> + > >> + priv->pdata = device_get_match_data(dev); > >> + if (!priv->pdata) > >> + return -EINVAL; > >> + > >> + drm_panel_init(&priv->panel, dev, &ili9341_funcs, > >> + DRM_MODE_CONNECTOR_DPI); > >> + > >> + priv->reset_gpiod = devm_gpiod_get(dev, "reset", > >> GPIOD_OUT_HIGH); > >> + if (IS_ERR(priv->reset_gpiod)) { > >> + dev_err(dev, "Couldn't get our reset GPIO\n"); > >> + return PTR_ERR(priv->reset_gpiod); > >> + } > >> + > >> + ret = drm_panel_of_backlight(&priv->panel); > >> + if (ret < 0) { > >> + if (ret != -EPROBE_DEFER) > >> + dev_err(dev, "Failed to get backlight > >> handle\n"); > >> + return ret; > >> + } > >> + > >> + drm_panel_add(&priv->panel); > >> + > >> + dsi->bus_type = priv->pdata->bus_type; > >> + dsi->lanes = priv->pdata->lanes; > >> + dsi->format = MIPI_DSI_FMT_RGB565; > >> + > >> + ret = mipi_dsi_attach(dsi); > >> + if (ret) { > >> + dev_err(dev, "Failed to attach DSI panel\n"); > >> + goto err_panel_remove; > >> + } > >> + > >> + ret = mipi_dsi_maybe_register_tiny_driver(dsi); > >> + if (ret) { > >> + dev_err(dev, "Failed to init TinyDRM driver\n"); > >> + goto err_mipi_dsi_detach; > >> + } > >> + > >> + return 0; > >> + > >> +err_mipi_dsi_detach: > >> + mipi_dsi_detach(dsi); > >> +err_panel_remove: > >> + drm_panel_remove(&priv->panel); > >> + return ret; > >> +} > >> + > >> +static int ili9341_remove(struct mipi_dsi_device *dsi) > >> +{ > >> + struct ili9341 *priv = mipi_dsi_get_drvdata(dsi); > >> + > >> + mipi_dsi_detach(dsi); > >> + drm_panel_remove(&priv->panel); > >> + > >> + drm_panel_disable(&priv->panel); > >> + drm_panel_unprepare(&priv->panel); > >> + > >> + return 0; > >> +} > >> + > >> +static const struct ili9341_pdata yx240qv29_pdata = { > >> + .mode = { DRM_SIMPLE_MODE(240, 320, 37, 49) }, > >> + .width_mm = 0, // TODO > >> + .height_mm = 0, // TODO > >> + .bus_type = MIPI_DCS_BUS_TYPE_DBI_SPI_C3, > >> + .lanes = 1, > >> +}; > >> + > >> +static const struct of_device_id ili9341_of_match[] = { > >> + { .compatible = "adafruit,yx240qv29", .data = > >> &yx240qv29_pdata }, > >> + { } > >> +}; > >> +MODULE_DEVICE_TABLE(of, ili9341_of_match); > >> + > >> +static struct mipi_dsi_driver ili9341_dsi_driver = { > >> + .probe = ili9341_probe, > >> + .remove = ili9341_remove, > >> + .driver = { > >> + .name = "ili9341-dsi", > >> + .of_match_table = ili9341_of_match, > >> + }, > >> +}; > >> +module_mipi_dsi_driver(ili9341_dsi_driver); > > > > Again, you treat this driver as a mipi dsi driver but for a MIPI-DBI > > (I8080/SPI) > > panel device. That will make developers confused. > > > > Is it possible to just add a mipi_dbi_driver for I8080/SPI interface > > panel? > > Thanks! > > Please read the cover letter, it explains why it's done this way. The > whole point of this patchset is to merge DSI and DBI frameworks in a > way that can be maintained. I think this proves the point that the proposed naming is confusing. At least a rename would be required. -- Regards, Laurent Pinchart