Received: by 10.223.176.46 with SMTP id f43csp274747wra; Tue, 23 Jan 2018 20:50:06 -0800 (PST) X-Google-Smtp-Source: AH8x226ODmdsOtvaX1cs+qLHIjZKaGabXBtd8oAJmJCsp1J0wJ45PaOdtFueEvTd6utfcf0qsF3M X-Received: by 10.99.176.76 with SMTP id z12mr9462901pgo.405.1516769406486; Tue, 23 Jan 2018 20:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516769406; cv=none; d=google.com; s=arc-20160816; b=DySpTPcWV3ZHpo1t64cdqmtqBNOxCFmkDPQT98C0SbGrDQZCp2wiUeyCYMWaUiFxLJ 8SXB92kHIP2I2IzksAEEkj/UO69frUUGvhXH49HYROaZ7PYSAQLipNz00kg8Mr/invlK GwHfNsz5F4HQDJMGquvl7jKK1RU0agfIA18z+gtMF9Qem8xM5uzAXVAzRhLx6Wkcdx6f tPKZIjrQ/p1KJKMvxhu0A98fi6/6sV8aX5lc9z1la/tIGneL8Ox+XmWGU6zHc1JlprnO TXsfVEoL0zldwK2la/gmuduuvC9u4Nh6XupuI4Z/Tx6KB3Da+5rzpX7yhcvZm9oJTe0N Zd0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MQB24auupw5IQvv9veyMB2S4tBrvhGqofaI90WKdJfo=; b=JTKZAV6TJ4298Gy71cq27ogPJ52FpCRdk2jeUIKEISxEDdIYguZAfF5+BrdYOua+lY I1zoTXhx3ICNZRVI3vhY2R3QQK9PwYwpzaGT0qfy/UiIZCULyqWMkMYp08P4lZLigJX6 19NNM3gfPVSdUhpt1clKGul/o4vMclchG2GMneSylu9sExma6nzTOgDbt0BbL7DAUrZC rnHnOJ7fFRsZIpGvWoJS4pI3IdCrFOxo+vswnPfTqqtfz7r899E6+M1oPMznJlVszps2 LWnePoT4D9BJykpDKeDzl+6g5h6YTAKihRRdx0vxDsnlLFouCmKiBRZs7XEUfV84bvi7 6tew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=BVxNMIHz; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g29si15659989pgn.132.2018.01.23.20.49.53; Tue, 23 Jan 2018 20:50:06 -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=@microsoft.com header.s=selector1 header.b=BVxNMIHz; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932716AbeAXEsb (ORCPT + 99 others); Tue, 23 Jan 2018 23:48:31 -0500 Received: from mail-by2nam03on0132.outbound.protection.outlook.com ([104.47.42.132]:45413 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932520AbeAXEQI (ORCPT ); Tue, 23 Jan 2018 23:16:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MQB24auupw5IQvv9veyMB2S4tBrvhGqofaI90WKdJfo=; b=BVxNMIHzlJUL4jxRqIJ+E5ff1K7tOA6MwMXY22c5VIZ0VIc3/FU1vCoVsq6knr8nMi8S7TDCljailozSGSvn2HiTaJW8B4ql7MK0yPooVilFLafDSKIqHdWvzE+NqSVuenzvsz6phXI8xvpKWPJCyEkwoCyf9oPjxnUU4rfzLKE= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1078.namprd21.prod.outlook.com (52.132.130.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.464.1; Wed, 24 Jan 2018 04:16:03 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::6485:b98:d15e:9da7%2]) with mapi id 15.20.0464.000; Wed, 24 Jan 2018 04:16:03 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Andrey Gusakov , Andrzej Hajda , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 083/100] drm/bridge: tc358767: fix timing calculations Thread-Topic: [PATCH AUTOSEL for 4.14 083/100] drm/bridge: tc358767: fix timing calculations Thread-Index: AQHTlMnrBwpTDNDNiEmKiIY1P6uRyw== Date: Wed, 24 Jan 2018 04:15:08 +0000 Message-ID: <20180124041414.32065-83-alexander.levin@microsoft.com> References: <20180124041414.32065-1-alexander.levin@microsoft.com> In-Reply-To: <20180124041414.32065-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1078;7:uCR6acKKQfO1laF1ZIgqRVq4BT7ZqjXwjleiSrHoWz28QyLUHczbouNrlIScK0J4gYhMefA3Wi5rKYzQtYeNY9NAWMtMGc77yeNvoAAS8ovpcHDQafQ8y2ovXpfoUPBvBlSK2Yqnvf/lKT3lJIbKQJjOQo2Hj4sEzpTbLwm0TxqoG02OuqreXMQ171Vdp5+KNakiDJZL/gjZhCjZ009wwNNUGsh61QpDPf2kNDCfGTAIoi20kXz+s5cfQPrhLaSy x-ms-office365-filtering-correlation-id: 798f2dfa-97d9-4895-6fdf-08d562e12e98 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603307)(7193020);SRVR:DM5PR2101MB1078; x-ms-traffictypediagnostic: DM5PR2101MB1078: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(7411616537696); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231046)(2400081)(944501161)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1078;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1078; x-forefront-prvs: 056297E276 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(376002)(346002)(39860400002)(366004)(396003)(39380400002)(199004)(189003)(86612001)(22452003)(6436002)(106356001)(107886003)(102836004)(105586002)(305945005)(5250100002)(2501003)(14454004)(3280700002)(4326008)(7736002)(97736004)(59450400001)(6306002)(6512007)(36756003)(8936002)(2950100002)(3846002)(6116002)(6506007)(86362001)(54906003)(76176011)(110136005)(966005)(2906002)(53936002)(66066001)(72206003)(6346003)(5660300001)(8676002)(478600001)(10290500003)(68736007)(81156014)(10090500001)(1076002)(3660700001)(25786009)(316002)(2900100001)(99286004)(26005)(6486002)(81166006)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1078;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: bWp7Kz3gGxk/Wmjvl0i73JxnKtWqjXscT1aHZU3Jfv5W/05leH45PdWcUXj0SAn+vdYEStC+inyf3HFSoJthNw== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 798f2dfa-97d9-4895-6fdf-08d562e12e98 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 04:15:08.2289 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1078 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Gusakov [ Upstream commit 66d1c3b94d5d59e4325e61a78d520f92c043d645 ] Fields in HTIM01 and HTIM02 regs should be even. Recomended thresh_dly value is max_tu_symbol. Remove set of VPCTRL0.VSDELAY as it is related to DSI input interface. Currently driver supports only DPI. Acked-by: Philipp Zabel Signed-off-by: Andrey Gusakov Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/1510073785-16108-5-git-= send-email-andrey.gusakov@cogentembedded.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/tc358767.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index 7334cb2121a3..b916346b933a 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -659,6 +659,14 @@ static int tc_set_video_mode(struct tc_data *tc, struc= t drm_display_mode *mode) int lower_margin =3D mode->vsync_start - mode->vdisplay; int vsync_len =3D mode->vsync_end - mode->vsync_start; =20 + /* + * Recommended maximum number of symbols transferred in a transfer unit: + * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, + * (output active video bandwidth in bytes)) + * Must be less than tu_size. + */ + max_tu_symbol =3D TU_SIZE_RECOMMENDED - 1; + dev_dbg(tc->dev, "set mode %dx%d\n", mode->hdisplay, mode->vdisplay); dev_dbg(tc->dev, "H margin %d,%d sync %d\n", @@ -668,13 +676,18 @@ static int tc_set_video_mode(struct tc_data *tc, stru= ct drm_display_mode *mode) dev_dbg(tc->dev, "total: %dx%d\n", mode->htotal, mode->vtotal); =20 =20 - /* LCD Ctl Frame Size */ - tc_write(VPCTRL0, (0x40 << 20) /* VSDELAY */ | + /* + * LCD Ctl Frame Size + * datasheet is not clear of vsdelay in case of DPI + * assume we do not need any delay when DPI is a source of + * sync signals + */ + tc_write(VPCTRL0, (0 << 20) /* VSDELAY */ | OPXLFMT_RGB888 | FRMSYNC_DISABLED | MSF_DISABLED); - tc_write(HTIM01, (left_margin << 16) | /* H back porch */ - (hsync_len << 0)); /* Hsync */ - tc_write(HTIM02, (right_margin << 16) | /* H front porch */ - (mode->hdisplay << 0)); /* width */ + tc_write(HTIM01, (ALIGN(left_margin, 2) << 16) | /* H back porch */ + (ALIGN(hsync_len, 2) << 0)); /* Hsync */ + tc_write(HTIM02, (ALIGN(right_margin, 2) << 16) | /* H front porch */ + (ALIGN(mode->hdisplay, 2) << 0)); /* width */ tc_write(VTIM01, (upper_margin << 16) | /* V back porch */ (vsync_len << 0)); /* Vsync */ tc_write(VTIM02, (lower_margin << 16) | /* V front porch */ @@ -693,7 +706,7 @@ static int tc_set_video_mode(struct tc_data *tc, struct= drm_display_mode *mode) /* DP Main Stream Attributes */ vid_sync_dly =3D hsync_len + left_margin + mode->hdisplay; tc_write(DP0_VIDSYNCDELAY, - (0x003e << 16) | /* thresh_dly */ + (max_tu_symbol << 16) | /* thresh_dly */ (vid_sync_dly << 0)); =20 tc_write(DP0_TOTALVAL, (mode->vtotal << 16) | (mode->htotal)); @@ -709,13 +722,6 @@ static int tc_set_video_mode(struct tc_data *tc, struc= t drm_display_mode *mode) tc_write(DPIPXLFMT, VS_POL_ACTIVE_LOW | HS_POL_ACTIVE_LOW | DE_POL_ACTIVE_HIGH | SUB_CFG_TYPE_CONFIG1 | DPI_BPP_RGB888); =20 - /* - * Recommended maximum number of symbols transferred in a transfer unit: - * DIV_ROUND_UP((input active video bandwidth in bytes) * tu_size, - * (output active video bandwidth in bytes)) - * Must be less than tu_size. - */ - max_tu_symbol =3D TU_SIZE_RECOMMENDED - 1; tc_write(DP0_MISC, (max_tu_symbol << 23) | (TU_SIZE_RECOMMENDED << 16) | BPC_8); =20 --=20 2.11.0