From patchwork Tue Mar 8 16:39:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Reichel X-Patchwork-Id: 8536241 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7967E9F372 for ; Tue, 8 Mar 2016 16:57:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A1FBB201EF for ; Tue, 8 Mar 2016 16:57:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C77212011D for ; Tue, 8 Mar 2016 16:57:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933271AbcCHQxk (ORCPT ); Tue, 8 Mar 2016 11:53:40 -0500 Received: from ring0.de ([5.45.101.7]:33630 "EHLO ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933095AbcCHQuI (ORCPT ); Tue, 8 Mar 2016 11:50:08 -0500 Received: by ring0.de (Postfix, from userid 110) id 83BDAA4A86C; Tue, 8 Mar 2016 17:41:17 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from sre.ring0.de (host-091-097-051-039.ewe-ip-backbone.de [91.97.51.39]) by ring0.de (Postfix) with ESMTPSA id 92E06A4A830; Tue, 8 Mar 2016 17:40:28 +0100 (CET) From: Sebastian Reichel To: Sebastian Reichel , Tony Lindgren , Aaro Koskinen , Tomi Valkeinen Cc: Laurent Pinchart , David Airlie , linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 23/23] drm: omapdrm: panel-dsi-cm: provide timings methods for omapdrm Date: Tue, 8 Mar 2016 17:39:55 +0100 Message-Id: <1457455195-1938-24-git-send-email-sre@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457455195-1938-1-git-send-email-sre@kernel.org> References: <1457455195-1938-1-git-send-email-sre@kernel.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Provide omapdrm with methods to acquire timings and check them later, so that it can properly initialize the display. Signed-off-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 38 +++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 196fe8d18ff4..edd1298b3a71 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -1163,6 +1163,41 @@ static void dsicm_ulps_work(struct work_struct *work) mutex_unlock(&ddata->lock); } +static void dsicm_get_timings(struct omap_dss_device *dssdev, + struct omap_video_timings *timings) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + *timings = ddata->timings; +} + +static int dsicm_check_timings(struct omap_dss_device *dssdev, + struct omap_video_timings *timings) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + int ret = 0; + + if (timings->x_res != ddata->timings.x_res) + ret = -EINVAL; + else if (timings->y_res != ddata->timings.y_res) + ret = -EINVAL; + + /* pixelclock is modified by dsi, so not easily checkable */ + + /* vfp, vbp, hfp, hbp are (re-)configured automatically by dsi */ + + if (ret) { + dev_warn(dssdev->dev, "wrong resolution: %d x %d", + timings->x_res, timings->y_res); + dev_warn(dssdev->dev, "panel resolution: %d x %d", + ddata->timings.x_res, ddata->timings.y_res); + } else { + dev_dbg(dssdev->dev, "mode check: ok"); + } + + return ret; +} + static struct omap_dss_driver dsicm_ops = { .connect = dsicm_connect, .disconnect = dsicm_disconnect, @@ -1180,6 +1215,9 @@ static struct omap_dss_driver dsicm_ops = { .get_te = dsicm_get_te, .memory_read = dsicm_memory_read, + + .get_timings = dsicm_get_timings, + .check_timings = dsicm_check_timings, }; static int dsicm_probe_pdata(struct platform_device *pdev)