From patchwork Tue Dec 4 15:03:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= X-Patchwork-Id: 1007698 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=ysoft.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ysoft.com header.i=@ysoft.com header.b="KtPt1LVh"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 438Q9x61Jbz9s9h for ; Wed, 5 Dec 2018 02:04:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbeLDPD7 (ORCPT ); Tue, 4 Dec 2018 10:03:59 -0500 Received: from mail-eopbgr30059.outbound.protection.outlook.com ([40.107.3.59]:2400 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726151AbeLDPD6 (ORCPT ); Tue, 4 Dec 2018 10:03:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gW0TL8oViga6LgLmrj/1ZxAhqVTiZdgv5iUCUDPMEXo=; b=KtPt1LVhRDjpss53fpldlZeHl1FmwSFrM9ltNzE3RiAP+OWD+OjJCX5LluSiLmR3d/aYzvAI9y8S9u+U+5aYte//Fc89aKP7ILhMf1nA1mo4UO3D14jBCr2DZhQfYWV6YzDjdEgRrhJT3D5Dc7YIfdhLhXehgMpGxf4izK5OBZw= Received: from DB7PR04MB4667.eurprd04.prod.outlook.com (52.135.139.13) by DB7PR04MB5963.eurprd04.prod.outlook.com (20.178.107.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1382.22; Tue, 4 Dec 2018 15:03:40 +0000 Received: from DB7PR04MB4667.eurprd04.prod.outlook.com ([fe80::2561:ec02:4e5e:f490]) by DB7PR04MB4667.eurprd04.prod.outlook.com ([fe80::2561:ec02:4e5e:f490%2]) with mapi id 15.20.1404.016; Tue, 4 Dec 2018 15:03:40 +0000 From: =?utf-8?b?Vm9rw6HEjSBNaWNoYWw=?= To: Rob Herring , Bartlomiej Zolnierkiewicz CC: Shawn Guo , Fabio Estevam , Alexandre Belloni , Maxime Ripard , "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , =?utf-8?b?Vm9rw6HEjSBNaWNoYWw=?= Subject: =?utf-8?q?=5BPATCH_4/4=5D_ARM=3A_mxs=3A_cfa10036=3A_Fixup_OLED?= =?utf-8?q?=C2=A0display_reset_polarity?= Thread-Topic: =?utf-8?q?=5BPATCH_4/4=5D_ARM=3A_mxs=3A_cfa10036=3A_Fixup_O?= =?utf-8?q?LED=C2=A0display_reset_polarity?= Thread-Index: AQHUi+KKthGpJEQVZU6UA2M3No4/WA== Date: Tue, 4 Dec 2018 15:03:40 +0000 Message-ID: <1543935806-94880-5-git-send-email-michal.vokac@ysoft.com> References: <1543935806-94880-1-git-send-email-michal.vokac@ysoft.com> In-Reply-To: <1543935806-94880-1-git-send-email-michal.vokac@ysoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM5PR0402CA0011.eurprd04.prod.outlook.com (2603:10a6:203:90::21) To DB7PR04MB4667.eurprd04.prod.outlook.com (2603:10a6:5:37::13) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michal.Vokac@ysoft.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [89.24.100.190] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB7PR04MB5963; 6:8Jf4LwWMkTeYdKmvFEEhEN4ikRMT2Rrjjz6f/N0dBkb0Wymmh/8IcsUcgAT/n90aM7RviEtamXrn36LfbgdZZ3SMShdI4eJUCk0AdfxxarT8BhANO8scLcmGj6d8RKRtIWXx4V1GkoN/+Tm2mtuxKcwbLQjarqzQT0zGehXsRKphBZ3zcIsPSHTXt3lLagmeNdgk/QbyYQdEnvdaKOjYUkWViqljhmqTLEO/22c6Fup+bGSoB0tRlUvZ5qrtpM/0vof27kGSzahX0siJUoj8dZVHFj3Bk2bgnfHtmuwq5budcAHAJEmway6it+82vwTHXJ+YW5ThH1DAfH0F5TVzl7Wp/PXXoJd+snT1v0ttRbxWdndAHXt1lq83gcorQBhPvtduTT8kBB+fw9UHvnvOGl6wnnUJ8nmifF5pQD5ucE0JXZ7rqbY2n4UOnZ3/eUh9yjV9/xJIIgLEdhBCV1b+8w==; 5:uIzqHWrMz8JvPwyCOEVlnaUuQF1ieSzudFx8UFb5J1HHa9PtbkMBAFCZIh/0nNn/W7Vb3nnfkV9aWQyJ0zfl8L5ZfHAUnb+HY7XMow3aGJOoOtY699onBi2E9so+7eaI/7vrNkpGP/wZoeukTZ0Goed90UoeirwvT+yKYuELWkg=; 7:sIs6dERQhNa0ZwEcFtb+R0VrTr8MjAC4uqFvyHPhYc98+8GJO6vmItXd9m/0yegpExNJzodH6b0iNjC57m9iE0yjOSQQu/sPPXGBgkKfAZxnWlw/k+3sygAuX5tMWM4Tw070wQrWezf+v3NHEWFHUw== x-ms-office365-filtering-correlation-id: ea8ba808-b6f6-4722-50e8-08d659f9ace9 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:DB7PR04MB5963; x-ms-traffictypediagnostic: DB7PR04MB5963: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231455)(999002)(944501493)(52105112)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DB7PR04MB5963; BCL:0; PCL:0; RULEID:; SRVR:DB7PR04MB5963; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39850400004)(136003)(396003)(346002)(376002)(199004)(189003)(72206003)(53936002)(478600001)(76176011)(6512007)(26005)(386003)(305945005)(186003)(4326008)(107886003)(7736002)(256004)(81156014)(14444005)(66066001)(8936002)(71200400001)(14454004)(71190400001)(6506007)(81166006)(6486002)(5660300001)(11346002)(25786009)(99286004)(36756003)(2616005)(6436002)(446003)(316002)(68736007)(102836004)(105586002)(2906002)(110136005)(106356001)(54906003)(486006)(52116002)(6116002)(86362001)(3846002)(476003)(85182001)(97736004); DIR:OUT; SFP:1101; SCL:1; SRVR:DB7PR04MB5963; H:DB7PR04MB4667.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: ysoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: oXc0pktuujK0Dy7zuTSZdNU0IdmxWiZWsHZysuJ6N+DREI1sDOlWGDIanc8+fK89vnbkbDQVViMIpgAFw7NcBGsHUH7gDKxj0gWVSJ7SgtugXADjAE4by2vZ+bn5QOJcqpcbibGj4BSdKNTDzO0JkDb5EELDNAacLEVPqeHZ4hGRBvAVGXHBWPFKRNK+H3hNU03tKRXKBMRnBA7MBxc6QUXWahKYxmEH10Rwij1nRS60VnfFwms6c1UBeMCqhkrB8XmIOz3udyIiaQ+9pOUlff3jUsfThehiYy65oqJrj6xEvjX0XrP0AhTueA8Cm6ENc14lT1MbiqUjEWbf6WbwPmjqc8EOIuGWNpdn2ka2yuo= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <738447F86299104B827666F04D0CB600@eurprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: ysoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea8ba808-b6f6-4722-50e8-08d659f9ace9 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 15:03:40.5329 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b5839965-430f-4be2-b282-d7a3149f2b37 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB5963 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org There was a bug in reset signal generation in ssd1307fb OLED driver. The display needs an active-low reset signal but the driver produced the correct sequence only if the GPIO used for reset was specified as GPIO_ACTIVE_HIGH. Now as the OLED driver is fixed it is also necessarry to implement a fixup for all current users of the old DT ABI. There is only one in-tree user and that is the Crystalfontz CFA-10036 board. In case this board is booting and GPIO_ACTIVE_HIGH is used for reset we override it to GPIO_ACTIVE_LOW. Signed-off-by: Michal Vokáč Reviewed-by: Rob Herring --- arch/arm/mach-mxs/mach-mxs.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 1c6062d..23c260c 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -268,9 +269,53 @@ static void __init apx4devkit_init(void) apx4devkit_phy_fixup); } +#define OLED_RESET_GPIO_LEN 3 +#define OLED_RESET_GPIO_SIZE (OLED_RESET_GPIO_LEN * sizeof(u32)) + +static void __init crystalfontz_oled_reset_fixup(void) +{ + struct property *newgpio; + struct device_node *np; + u32 *gpiospec; + int i, ret; + + np = of_find_compatible_node(NULL, NULL, "solomon,ssd1306fb-i2c"); + if (!np) + return; + + newgpio = kzalloc(sizeof(*newgpio) + OLED_RESET_GPIO_SIZE, GFP_KERNEL); + if (!newgpio) + return; + + newgpio->value = newgpio + 1; + newgpio->length = OLED_RESET_GPIO_SIZE; + newgpio->name = kstrdup("reset-gpios", GFP_KERNEL); + if (!newgpio->name) { + kfree(newgpio); + return; + } + + gpiospec = newgpio->value; + for (i = 0; i < OLED_RESET_GPIO_LEN; i++) { + ret = of_property_read_u32_index(np, "reset-gpios", i, + &gpiospec[i]); + if (ret) { + kfree(newgpio); + return; + } + } + + if (!(gpiospec[2] & OF_GPIO_ACTIVE_LOW)) { + gpiospec[2] |= OF_GPIO_ACTIVE_LOW; + cpu_to_be32_array(gpiospec, gpiospec, OLED_RESET_GPIO_LEN); + of_update_property(np, newgpio); + } +} + static void __init crystalfontz_init(void) { update_fec_mac_prop(OUI_CRYSTALFONTZ); + crystalfontz_oled_reset_fixup(); } static void __init duckbill_init(void)