Received: by 10.223.176.46 with SMTP id f43csp4679768wra; Tue, 23 Jan 2018 12:50:34 -0800 (PST) X-Google-Smtp-Source: AH8x2267+kZM0WJ3qUchTZRWiJAgbJY5oHCW06igChz72+v/HrKmyme8bzNYUX26phCF1PVrsAcp X-Received: by 10.36.135.5 with SMTP id f5mr5762153ite.80.1516740634459; Tue, 23 Jan 2018 12:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516740634; cv=none; d=google.com; s=arc-20160816; b=SE3bx0ayN646dtQFq5LJHapqRTNwgVmgxoXKjV5EGyTSTqTzUdPfnJaumhiWUcV3T5 AG8uS3iPXj2yv49XGz47hNWm4JCxxsJGOdl0jgZze8RbIgvbnmMTNxSMqDverRybTH6r r3Vwvd62MN/Bq+cF7LwviAgTbnFqrhyOPL8UPK9+RqNei6Kl47Ai5tkIYXEdjA0ctBvA WBLsk7Kg9Bsn6XfTRHLZXKIwyzbAwOUIl85jkaA6bRvuccGQ+DmT/xe7Tn0YdLprKULX cpDDyn/u0OiCzIf4OxpLh2Be9ZblF1HNGsJT6LqySDg1qDsLkizCN+a9+19p66VptDHR ab1w== 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:dkim-signature:arc-authentication-results; bh=I63gBXDzIcXqPHrXGbGPDT7pGXIpe4PE5kTvY28GtTg=; b=ZWUBE1QIFS/GWF87ECifgS7Y38gEJ42uscT1R+XvL39DVLl4qfkB3bK6HJ/bwY/Be6 Pbd4X2SawwOukjLnmI3p8aCxpj+GJHKu/MRgryQ20uPzREaqpNsB66z/3UWsMV0EbhCF IZyJm53pQRKe9yjTH82P8qfQ5FLysAFEwTQ6IlV4B5eJxihW34d7Ps2NhCJxOvNnwHRN moao9O33xmThsJefGc7wMAhaIwiZZDESewVaMb9cH0lYk6XMOF60RzLw7sPdKXKJ7ZKg aEZcbBNB/pu8ouYWBRBHXrYDAJQSXv0Hf0bRTlbt96orGhuId3Ofjmz6iumJw092X9MW cSUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=M2SJ/Wtr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si9304575ith.29.2018.01.23.12.50.21; Tue, 23 Jan 2018 12:50:34 -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; dkim=pass header.i=@chromium.org header.s=google header.b=M2SJ/Wtr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932190AbeAWUtp (ORCPT + 99 others); Tue, 23 Jan 2018 15:49:45 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:42714 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752615AbeAWUtn (ORCPT ); Tue, 23 Jan 2018 15:49:43 -0500 Received: by mail-pg0-f66.google.com with SMTP id q67so1107014pga.9 for ; Tue, 23 Jan 2018 12:49:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=I63gBXDzIcXqPHrXGbGPDT7pGXIpe4PE5kTvY28GtTg=; b=M2SJ/Wtr7ucru5/81+GtKg25fNOWqTagZQ0HKmLcu67LVti4KWWkO8Q9/dfidZKGOX NtNodDLUWjaqO0It/mSHXQ+6glYlldPRA38X/mXZSGLCDUgdyV+vr7z21MbtmmzmWeq/ AuAte7qo20DL3atD86nzjz+/3Hc3dgSw5SugA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=I63gBXDzIcXqPHrXGbGPDT7pGXIpe4PE5kTvY28GtTg=; b=dasjC5UvkGGSFMfw/fa2rO60dv0FCNwXS/uhywvfIgWpdjRYbVT1MgNajM1yD/C/zd Mf8Uqx/TRIAiMKgEaFNuYtGXxpEA4e/tN8Rht3Ri6iqAv1VuP1l8CGqqQ6/4Xcb4GnkR yxJxp9tMFNlRx8wC5b+FXfzZESUNZXU0uD1A6FJAW5gVgZGAOJHoUnpCRO3TAcyfATCe TUOzHAzZny8y0oFU8YpEkd5sVIKfvh+TyOC/qHKBZPqXxmcypm5tQ5nebq8XOMAkBY5L JVfUXnMZUfSaexoFui5DvcMX782H75MG0J/PkVmupbY/vVknSGb4buwdWsiCif+Uz2Kl LiAg== X-Gm-Message-State: AKwxytdxKMUSMalMDDeaRaJLmPH8iH7mHqfL66M4ycuKHpw4kA/8V9j2 XqA/3g4hnzCm3kTqzKwDTsEr5A== X-Received: by 2002:a17:902:6ec5:: with SMTP id l5-v6mr6377160pln.443.1516740583231; Tue, 23 Jan 2018 12:49:43 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.113.17]) by smtp.gmail.com with ESMTPSA id t6sm9580670pfl.174.2018.01.23.12.49.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2018 12:49:42 -0800 (PST) Date: Tue, 23 Jan 2018 12:49:40 -0800 From: Brian Norris To: Philippe Cornu Cc: Archit Taneja , Andrzej Hajda , Laurent Pinchart , David Airlie , Benjamin Gaignard , Bhumika Goyal , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sandy Huang , Heiko Stubner , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Yannick Fertre , Vincent Abriou , Alexandre Torgue , Maxime Coquelin , Ludovic Barre , Mickael Reulier , hl@rock-chips.com, Chris Zhong , nickey.yang@rock-chips.com Subject: Re: [PATCH v3] drm/bridge/synopsys: dsi: add optional pixel clock Message-ID: <20180123204939.qirvr34mlwgiwmqz@ban.mtv.corp.google.com> References: <20180123170806.5282-1-philippe.cornu@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180123170806.5282-1-philippe.cornu@st.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Philippe asked me to review the last version. I'm not sure I have a lot to contribute. Maybe Rockchip folks who wrote this stuff in the first place might. I've CC'd some. On Tue, Jan 23, 2018 at 06:08:06PM +0100, Philippe Cornu wrote: > The pixel clock is optional. When available, it offers a better > preciseness for timing computations and allows to reduce the extra dsi > bandwidth in burst mode (from ~20% to ~10-12%, hw platform dependant). > > Reviewed-by: Andrzej Hajda > Signed-off-by: Philippe Cornu > --- > Changes in v3: Simplify px_clk probing thanks to Andrzej Hajda comments > > Changes in v2: Improve px_clk probing in case of ENOENT dt returned value > (thanks to Philipp Zabel & Andrzej Hajda comments) > > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 25 +++++++++++++++++++------ > 1 file changed, 19 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index ed8af32f8e52..9fb35385c348 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -217,6 +217,7 @@ struct dw_mipi_dsi { > void __iomem *base; > > struct clk *pclk; > + struct clk *px_clk; > > unsigned int lane_mbps; /* per lane */ > u32 channel; > @@ -703,24 +704,28 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, > struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); > const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; > void *priv_data = dsi->plat_data->priv_data; > + struct drm_display_mode px_clk_mode = *mode; > int ret; > > clk_prepare_enable(dsi->pclk); > > - ret = phy_ops->get_lane_mbps(priv_data, mode, dsi->mode_flags, > + if (dsi->px_clk) > + px_clk_mode.clock = clk_get_rate(dsi->px_clk) / 1000; > + > + ret = phy_ops->get_lane_mbps(priv_data, &px_clk_mode, dsi->mode_flags, > dsi->lanes, dsi->format, &dsi->lane_mbps); > if (ret) > DRM_DEBUG_DRIVER("Phy get_lane_mbps() failed\n"); > > pm_runtime_get_sync(dsi->dev); > dw_mipi_dsi_init(dsi); > - dw_mipi_dsi_dpi_config(dsi, mode); > + dw_mipi_dsi_dpi_config(dsi, &px_clk_mode); > dw_mipi_dsi_packet_handler_config(dsi); > dw_mipi_dsi_video_mode_config(dsi); > - dw_mipi_dsi_video_packet_config(dsi, mode); > + dw_mipi_dsi_video_packet_config(dsi, &px_clk_mode); > dw_mipi_dsi_command_mode_config(dsi); > - dw_mipi_dsi_line_timer_config(dsi, mode); > - dw_mipi_dsi_vertical_timing_config(dsi, mode); > + dw_mipi_dsi_line_timer_config(dsi, &px_clk_mode); > + dw_mipi_dsi_vertical_timing_config(dsi, &px_clk_mode); > > dw_mipi_dsi_dphy_init(dsi); > dw_mipi_dsi_dphy_timing_config(dsi); > @@ -734,7 +739,7 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, > > dw_mipi_dsi_dphy_enable(dsi); > > - dw_mipi_dsi_wait_for_two_frames(mode); > + dw_mipi_dsi_wait_for_two_frames(&px_clk_mode); > > /* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ > dw_mipi_dsi_set_mode(dsi, 0); > @@ -828,6 +833,14 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, > return ERR_PTR(ret); > } > > + dsi->px_clk = devm_clk_get(dev, "px_clk"); Did you write a device tree binding document update for this anywhere? Brian > + if (IS_ERR(dsi->px_clk)) { > + ret = PTR_ERR(dsi->px_clk); > + if (ret != ENOENT) > + dev_err(dev, "Unable to get opt. px_clk: %d\n", ret); > + dsi->px_clk = NULL; > + } > + > /* > * Note that the reset was not defined in the initial device tree, so > * we have to be prepared for it not being found. > -- > 2.15.1 >