From patchwork Thu Dec 20 12:13:57 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: 10738795 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2C2666C2 for ; Thu, 20 Dec 2018 12:14:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BD60287D4 for ; Thu, 20 Dec 2018 12:14:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EF90287DB; Thu, 20 Dec 2018 12:14:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FROM_EXCESS_BASE64,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9607C287D4 for ; Thu, 20 Dec 2018 12:14:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730229AbeLTMOK (ORCPT ); Thu, 20 Dec 2018 07:14:10 -0500 Received: from mail-eopbgr80072.outbound.protection.outlook.com ([40.107.8.72]:28546 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731706AbeLTMOI (ORCPT ); Thu, 20 Dec 2018 07:14:08 -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=yZ213LF2TEZgcy9lw1delmrhUGR8P3/CHyIBa1ZYhP0=; b=MX0BxjfGAUJu3mPMKe8ov8ZU2Pck+5GGUFbVIJyugk6gSAnc7rLzLRJ82w0ye/Kbkj6VcK34GbOUIpR1/1ocwY1LzPvxIYbTl1wCt154HtjxXtSOCd5ZdXn65Bk/AlEPxC0+YQ4vYjNUMCTrFpfdYKOfzr9mwkjvWej+OAuEODk= Received: from DB7PR04MB4667.eurprd04.prod.outlook.com (52.135.139.13) by DB7PR04MB4555.eurprd04.prod.outlook.com (52.135.138.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.19; Thu, 20 Dec 2018 12:13:59 +0000 Received: from DB7PR04MB4667.eurprd04.prod.outlook.com ([fe80::2561:ec02:4e5e:f490]) by DB7PR04MB4667.eurprd04.prod.outlook.com ([fe80::2561:ec02:4e5e:f490%3]) with mapi id 15.20.1446.020; Thu, 20 Dec 2018 12:13:59 +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?Vm9r?= =?utf-8?b?w6HEjSBNaWNoYWw=?= Subject: [PATCH v2 4/4] ARM: mxs: cfa10036: Fixup OLED display reset polarity Thread-Topic: [PATCH v2 4/4] ARM: mxs: cfa10036: Fixup OLED display reset polarity Thread-Index: AQHUmF17VaGP6W4V9EimfGBpapxsgQ== Date: Thu, 20 Dec 2018 12:13:57 +0000 Message-ID: <1545308005-51559-5-git-send-email-michal.vokac@ysoft.com> References: <1545308005-51559-1-git-send-email-michal.vokac@ysoft.com> In-Reply-To: <1545308005-51559-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: AM5PR0701CA0015.eurprd07.prod.outlook.com (2603:10a6:203:51::25) 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;DB7PR04MB4555;6:D2VuRcyYvcFpgjLG8tH1SuACPWQrAVifPmWzncERM/lpgyBe6z7ux9PC7J58bqLjMqk9Ob7JGolxq3U2xXm0vGXnvarQH7Xcoyzv0QyK+ccUD1C9Q0QE1nYiMCgFvRw7TJjRamuIExn3wCfwlS6sZJN6PNkOrJunroRj/9HL59NZayLmlyqnEzlbRHWfX6WmlvmHXWN5YbLOpVG6Ex2h6sds7EAOw8A+U9qYPjPH5fFEeg5h+qEfO/h83JIe/CIf6b9leWr1e00fdU4uVkxEOJETxw12fITDn6brmZzYLwa39GHinH4xam4Ulhqfg1IrH9IM54zTnYLEZRgnWBC5LS1VkkXIS5tOe1IxRLDRmjcq7CxbUmfipcU1byolSKvL6foKzAgMT/PvKSL1CjRLJ0TJ6Cb5w0HQCnbG/zckdRrHxqfx2PqTS5dF3BI0T5dibbRv62HSrdeg4kqdgIo5sQ==;5:Qv1lE7G5pGxHvIG9u7RXdx2RKttTz2D1KWM3EtatEf5/7qwgU/18yFiL1UbiyKx3k+1GTQkp157PCI2IPetm+TXHO+qf+u+sBobtnWvUXdrABrFqabKggvxo8675NTY8Rg7d4HpoTjPAeS4+BZajRlc1btI1e77K8Q8Bj9/3lYQ=;7:pMTabk3mNlXQuRNzJIpeoig/RM3PCxARpJKr2WVZnIJTtMrkXsAqbZuxi04Uw5K9mXEWWm/pSHI84cnPn3NSNBDbopAGiFQpDfFhsXbKoHWO1Y5NlAJPdlHeVJ61MXojH3zzO1hNg0vzmbcBgPDiAw== x-ms-office365-filtering-correlation-id: 4addf853-3716-44fd-3644-08d666749dc5 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(4534185)(4627221)(201703031133081)(201702281549075)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB7PR04MB4555; x-ms-traffictypediagnostic: DB7PR04MB4555: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230021)(999002)(5005026)(6040522)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(10201501046)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051)(76991095);SRVR:DB7PR04MB4555;BCL:0;PCL:0;RULEID:;SRVR:DB7PR04MB4555; x-forefront-prvs: 0892FA9A88 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(346002)(39850400004)(376002)(366004)(396003)(199004)(189003)(99286004)(305945005)(7736002)(102836004)(14454004)(66066001)(110136005)(72206003)(478600001)(8676002)(81166006)(6486002)(8936002)(71200400001)(71190400001)(81156014)(76176011)(446003)(6436002)(476003)(386003)(6506007)(2616005)(486006)(11346002)(86362001)(68736007)(54906003)(5660300001)(85182001)(53936002)(36756003)(107886003)(6116002)(3846002)(256004)(14444005)(106356001)(52116002)(105586002)(25786009)(26005)(2906002)(316002)(6512007)(4326008)(186003)(97736004);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4555;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: wiAIWtcz8Fj9G4n1NnE7N1acB32MU2WaE0z74rsVApbbTe3iQny3CpzjQ18bbeYHZrtVrmQbw7/EyAlpsR3z5u+meX1m5n9VBb7hIxHVa+bPRutJlqMyH2IoojAThBSCuJB2iARCSUvpWZarYQgAEVOpFm7/qBhjV/1hh44oaZGUos6kw4Jq17CowwDYw3hH63i3dV0PYDBDkwJUyEZeh4pUQkh77txUfszQ/IFPnY6GTs9ffl7PUb7C0F72KFpYzRCQf4eH2gh7L5imbwntuxBkX169R/iKqg58xcO98InY6zm5SrY5ZTZiHwuQMq0i spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: ysoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4addf853-3716-44fd-3644-08d666749dc5 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2018 12:13:57.2733 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b5839965-430f-4be2-b282-d7a3149f2b37 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4555 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Reviewed-by: Rob Herring Signed-off-by: Michal Vokáč --- Changes from v1: - Add R-by from Rob - Use of_property_read_variable_u32_array to read the GPIO specifier array instead of reading it manualy in for cycle. (Rob) arch/arm/mach-mxs/mach-mxs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 1c6062d..50038d6 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,52 @@ 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 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; + ret = of_property_read_variable_u32_array(np, "reset-gpios", gpiospec, + OLED_RESET_GPIO_LEN, 0); + + if (ret < 0) { + 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)