Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1311685pxa; Sat, 15 Aug 2020 15:28:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqppiQH954VMg7CK77hBUcpqHjizvPOq5vo67L/XytBGMIwQ8D95weTpa3d2tWiLZgrbY8 X-Received: by 2002:a50:d75e:: with SMTP id i30mr8914139edj.246.1597530532463; Sat, 15 Aug 2020 15:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597530532; cv=none; d=google.com; s=arc-20160816; b=GEkUzRy0fkqGOfI12GXjsd69/dtwsAILyDK6FoBEHsp6m3rE33B2bAL6zoEwWhcfbv i5Ty56ufC4NimWIFnesU80yi6qAc+RL0PBR0E8/kypIVPalGlU5mFlN9rlVax1jnhVpr ZJ7/HtyLpCJB5FdgXvd092mJ47yE82TgyG6zcxuMEi//cHHJivx5IQDcULZGreunQyFT 1guDJmku6wXFJZeTraWhez2Lcebhc1kbV1mDv+VjyR2rZODpCNZxJ3mZCQvSECdahko2 qw7pUULOFpXPMwQ1l9jcfxTNPRYrChqpqgXNsHxPuVvevGMa84EZ8+HcwksNyPYGdx3m SY0g== 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; bh=Bii2Sq2YhzZG0H7YNwKvVJWlazi7ZV0ysw2c+wUqmhg=; b=1KqLBuVNZcas+yoRK6sljMri92ZiQBn13KXJipuxnIFBuv/ZzGyvQVY/gxncCZQl1I C6EYtLmXAm3AVVHJJCHiEcQmk4w+OjoMZ15OfyIp4EMVpfCKbe8crv6pnNdHvU5GNlVM 1U/pd1e+n2RSK2q+u4J+OcVnFiE8UGckWUMXbxiF/rBsNzS+cqJ3tto2DeDREaf9s6/i 6GZxwCSEbAPviem+ObOwCg2egtqxfo1s2Jmr36OomXtQwDfkNhUGjmzvWaAlXXgm+r1R QJQwp8yDwivi8FdBsV+0CElls2bXW9+tgQcYY5dKX/flMWaX7a/m95B0gB7CcOkjqNZY 586Q== ARC-Authentication-Results: i=1; mx.google.com; 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 gv23si8049144ejb.307.2020.08.15.15.28.29; Sat, 15 Aug 2020 15:28:52 -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; 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 S1729014AbgHOW1U (ORCPT + 99 others); Sat, 15 Aug 2020 18:27:20 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:53992 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728091AbgHOW1T (ORCPT ); Sat, 15 Aug 2020 18:27:19 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id F0763FB03; Sat, 15 Aug 2020 12:40:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OX_34ocNZaCv; Sat, 15 Aug 2020 12:40:23 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 60AF4457CC; Sat, 15 Aug 2020 12:40:22 +0200 (CEST) Date: Sat, 15 Aug 2020 12:40:22 +0200 From: Guido =?iso-8859-1?Q?G=FCnther?= To: Sam Ravnborg Cc: Thierry Reding , David Airlie , Daniel Vetter , Rob Herring , Arnd Bergmann , Linus Walleij , Heiko Stuebner , Daniel Palmer , Lubomir Rintel , Mark Brown , Kuninori Morimoto , allen , Mauro Carvalho Chehab , "David S. Miller" , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel Message-ID: <20200815104022.GA5641@bogon.m.sigxcpu.org> References: <0a7539135cc46eec5636ca89f52695f4a1197841.1597412076.git.agx@sigxcpu.org> <20200815100230.GA1002374@ravnborg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200815100230.GA1002374@ravnborg.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sam, On Sat, Aug 15, 2020 at 12:02:30PM +0200, Sam Ravnborg wrote: > Hi Guido. > > > +static int mantix_probe(struct mipi_dsi_device *dsi) > > +{ > > + struct device *dev = &dsi->dev; > > + struct mantix *ctx; > > + int ret; > > + > > + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); > > + if (!ctx) > > + return -ENOMEM; > > + > > + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); > > + if (IS_ERR(ctx->reset_gpio)) { > > + DRM_DEV_ERROR(dev, "cannot get reset gpio\n"); > > + return PTR_ERR(ctx->reset_gpio); > > + } > > + > > + mipi_dsi_set_drvdata(dsi, ctx); > > + ctx->dev = dev; > > + > > + dsi->lanes = 4; > > + dsi->format = MIPI_DSI_FMT_RGB888; > > + dsi->mode_flags = MIPI_DSI_MODE_VIDEO | > > + MIPI_DSI_MODE_VIDEO_BURST | MIPI_DSI_MODE_VIDEO_SYNC_PULSE; > > + > > + ctx->avdd = devm_regulator_get(dev, "avdd"); > > + if (IS_ERR(ctx->avdd)) { > > + ret = PTR_ERR(ctx->avdd); > > + if (ret != -EPROBE_DEFER) > > + DRM_DEV_ERROR(dev, > > + "Failed to request avdd regulator: %d\n", > > + ret); > > + return ret; > > + } > > Consider to use the recently added dev_err_probe() here and below. > Note: Not part of drm-misc-next yet - but hopefully after -rc1 > when a backmerge is done. In fact I did decided against it since i was told that missing dev_* and DRM_* logging shouldn't be done. So is that o.k. nowadays? Cheers, -- Guido > > Sam > > > + ctx->avee = devm_regulator_get(dev, "avee"); > > + if (IS_ERR(ctx->avee)) { > > + ret = PTR_ERR(ctx->avee); > > + if (ret != -EPROBE_DEFER) > > + DRM_DEV_ERROR(dev, > > + "Failed to request avee regulator: %d\n", > > + ret); > > + return ret; > > + } > > + ctx->vddi = devm_regulator_get(dev, "vddi"); > > + if (IS_ERR(ctx->vddi)) { > > + ret = PTR_ERR(ctx->vddi); > > + if (ret != -EPROBE_DEFER) > > + DRM_DEV_ERROR(dev, > > + "Failed to request vddi regulator: %d\n", > > + ret); > > + return ret; > > + } > > + > > + drm_panel_init(&ctx->panel, dev, &mantix_drm_funcs, > > + DRM_MODE_CONNECTOR_DSI); > > + > > + ret = drm_panel_of_backlight(&ctx->panel); > > + if (ret) > > + return ret; > > + drm_panel_add(&ctx->panel); > > + > > + ret = mipi_dsi_attach(dsi); > > + if (ret < 0) { > > + DRM_DEV_ERROR(dev, > > + "mipi_dsi_attach failed (%d). Is host ready?\n", > > + ret); > > + drm_panel_remove(&ctx->panel); > > + return ret; > > + } > > + > > + DRM_DEV_INFO(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", > > + default_mode.hdisplay, default_mode.vdisplay, > > + drm_mode_vrefresh(&default_mode), > > + mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); > > + > > + return 0; > > +} > > + > > +static void mantix_shutdown(struct mipi_dsi_device *dsi) > > +{ > > + struct mantix *ctx = mipi_dsi_get_drvdata(dsi); > > + int ret; > > + > > + ret = drm_panel_unprepare(&ctx->panel); > > + if (ret < 0) > > + DRM_DEV_ERROR(&dsi->dev, "Failed to unprepare panel: %d\n", > > + ret); > > + > > + ret = drm_panel_disable(&ctx->panel); > > + if (ret < 0) > > + DRM_DEV_ERROR(&dsi->dev, "Failed to disable panel: %d\n", > > + ret); > > +} > > + > > +static int mantix_remove(struct mipi_dsi_device *dsi) > > +{ > > + struct mantix *ctx = mipi_dsi_get_drvdata(dsi); > > + int ret; > > + > > + mantix_shutdown(dsi); > > + > > + ret = mipi_dsi_detach(dsi); > > + if (ret < 0) > > + DRM_DEV_ERROR(&dsi->dev, "Failed to detach from DSI host: %d\n", > > + ret); > > + > > + drm_panel_remove(&ctx->panel); > > + > > + return 0; > > +} > > + > > +static const struct of_device_id mantix_of_match[] = { > > + { .compatible = "mantix,mlaf057we51-x" }, > > + { /* sentinel */ } > > +}; > > +MODULE_DEVICE_TABLE(of, mantix_of_match); > > + > > +static struct mipi_dsi_driver mantix_driver = { > > + .probe = mantix_probe, > > + .remove = mantix_remove, > > + .shutdown = mantix_shutdown, > > + .driver = { > > + .name = DRV_NAME, > > + .of_match_table = mantix_of_match, > > + }, > > +}; > > +module_mipi_dsi_driver(mantix_driver); > > + > > +MODULE_AUTHOR("Guido G?nther "); > > +MODULE_DESCRIPTION("DRM driver for Mantix MLAF057WE51-X MIPI DSI panel"); > > +MODULE_LICENSE("GPL v2"); > > -- > > 2.26.2 > > > > _______________________________________________ > > dri-devel mailing list > > dri-devel@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/dri-devel >