From patchwork Wed Jan 9 08:39:46 2019 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: 10753619 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 14FB317E1 for ; Wed, 9 Jan 2019 08:40:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 024F028F7D for ; Wed, 9 Jan 2019 08:40:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D6C28F8D; Wed, 9 Jan 2019 08:40:05 +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 658F828F7D for ; Wed, 9 Jan 2019 08:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbfAIIj4 (ORCPT ); Wed, 9 Jan 2019 03:39:56 -0500 Received: from mail-eopbgr60057.outbound.protection.outlook.com ([40.107.6.57]:32372 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730003AbfAIIjx (ORCPT ); Wed, 9 Jan 2019 03:39:53 -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=kMD+teN8Furmaj5VsAOB9zZN2LQca9KjnbSlRchG1I07CQNoBjTHGimZZ90bnVMSJvZjPmsIselaSbYzZDpEKs9jjKLxjiUsDj4bWnCi2S5LlLzJ5OCcxznAx3rlNOEqra8cU/uyFnouITHFFuiWBV0cuTjgEbc+3+s8UsnKv8U= Received: from AM0PR0402MB3716.eurprd04.prod.outlook.com (52.133.38.156) by AM0PR0402MB3780.eurprd04.prod.outlook.com (52.133.39.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.9; Wed, 9 Jan 2019 08:39:46 +0000 Received: from AM0PR0402MB3716.eurprd04.prod.outlook.com ([fe80::3cc1:26a4:94be:1d72]) by AM0PR0402MB3716.eurprd04.prod.outlook.com ([fe80::3cc1:26a4:94be:1d72%5]) with mapi id 15.20.1495.011; Wed, 9 Jan 2019 08:39:46 +0000 From: =?utf-8?b?Vm9rw6HEjSBNaWNoYWw=?= To: Bartlomiej Zolnierkiewicz CC: Rob Herring , 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: =?utf-8?q?=5BRESEND=C2=A0PATCH_v2_4/4=5D_ARM=3A_mxs=3A_cfa10036=3A_?= =?utf-8?q?Fixup_OLED_display_reset_polarity?= Thread-Topic: =?utf-8?q?=5BRESEND=C2=A0PATCH_v2_4/4=5D_ARM=3A_mxs=3A_cfa1003?= =?utf-8?q?6=3A_Fixup_OLED_display_reset_polarity?= Thread-Index: AQHUp/bge8VKpB9zqEWIZtatzCOaLQ== Date: Wed, 9 Jan 2019 08:39:46 +0000 Message-ID: <1547023165-111798-5-git-send-email-michal.vokac@ysoft.com> References: <1547023165-111798-1-git-send-email-michal.vokac@ysoft.com> In-Reply-To: <1547023165-111798-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: AM5P190CA0022.EURP190.PROD.OUTLOOK.COM (2603:10a6:206:14::35) To AM0PR0402MB3716.eurprd04.prod.outlook.com (2603:10a6:208:d::28) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.1.4 x-originating-ip: [89.24.100.190] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM0PR0402MB3780;6:+1KK/T5IrjA3kSDneTfJMcJ8llg+vNueElubFBgDaRU1hJAxUbyWpkva4eC+FGz24FZ+CUJnr8491ACErWeGdX4GmfXgUGzqhmHHw8oP89qpgMoNpTnEx1mHNev0COzQsK4L0FlGwBvvoaZtP7wGfekcT3HsZ5Su2ueUlsgGx1rnvfOlkNAxo4d11k11Y3zVOONsBB2K7SwBwWW7FHetBcp0Uoir+9icZ4UzlT48Xq2ZGjySZx0YgVtUueWb9WWibJCK38LxN0JzRh4hWfmoU9+w2BMSoFqfQ0VTieYewWn2KB87CwV/P1Iy5oO8ao6U5XssaxrRJJmbQy3I7z2EqF0fixtJV9tDhfCjya6yMHrTJKfP8CZEcPDKvUzCE1jcA2Dskn6h0XysYvH2/8i/wyCIca+7ozPNS55f/ylorCt/h0em92uyWve6SlpJI7DVikmX6W43Py5xp8PRP9p2ow==;5:xy4d20VD/hNnPUs98TsEsMHmXEGShE5KHFoR4Yl6rOpa5rm1VS/l9c/Fvw2XDgmmJyTQQG03teJJ0v1RFi+nRV9d+6beGNCNBy64ufkABOxd8HlJwYIE7uRqqBksvuS9JN5gXmplUayKdqTB2qDDFMi1zYgGKfgW5MfiTz+67z3L+LpsYVA8rKDY56dc8GbLDeW6IypVfu80vuFjjLXRbg==;7:MacNuKv2DwLCg0a7T4SnlALL6vHdYJRFjq5hc2Joocgk6nwUuKmCyxmj1y+De203frnEFAImdnAtu3cn+RprfMAQbcI9w+nJA4BmbfVd7+fF9uFjL6x851EMslvaId2+nLHTn9NfE68mY9Yv/WzbIQ== x-ms-office365-filtering-correlation-id: 4c8c846b-5d90-48e3-45ed-08d6760e026d x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(2017052603328)(7153060)(7193020);SRVR:AM0PR0402MB3780; x-ms-traffictypediagnostic: AM0PR0402MB3780: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(20161123562045)(20161123564045)(201708071742011)(7699051)(76991095);SRVR:AM0PR0402MB3780;BCL:0;PCL:0;RULEID:;SRVR:AM0PR0402MB3780; x-forefront-prvs: 0912297777 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(366004)(376002)(346002)(136003)(39850400004)(199004)(189003)(53936002)(5660300001)(66066001)(8936002)(6512007)(72206003)(6916009)(25786009)(4326008)(14444005)(256004)(36756003)(107886003)(106356001)(6116002)(14454004)(6436002)(105586002)(81156014)(81166006)(97736004)(486006)(6486002)(3846002)(50226002)(2906002)(305945005)(7736002)(86362001)(85182001)(11346002)(478600001)(446003)(476003)(2616005)(68736007)(6346003)(76176011)(102836004)(99286004)(386003)(6506007)(186003)(71190400001)(54906003)(71200400001)(316002)(52116002)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR0402MB3780;H:AM0PR0402MB3716.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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michal.Vokac@ysoft.com; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: YORqYMc6aGiS2xQPxL3MuzBNmhsgO6NIU0lOGad3euMJlbiBpCs6LzbSECj07zP4tNZaNkmHg0lymBNV0OM5us6mOahJE0JUO7l1pM7W2IkwOVariCVGIUzmggqG+VVxpCRMlpE9Pymv25dWQeWeD7o9ZDIfzLJOBLgAB/OrnM2LVpWTL9fYrquLWxumhpinDq4wnD43E/Bmc4ZJnwUjkwdWuhXkBgO69GJ2jGzC77V5tAtE91P4XFONVj4c9KgtV5vvK9/XoS1ombyNf3i8fjz11GqsoLFm/gg0TmBuV3hayB/cYW+OE05jya1/CoNq spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: ysoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c8c846b-5d90-48e3-45ed-08d6760e026d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2019 08:39:45.7620 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b5839965-430f-4be2-b282-d7a3149f2b37 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3780 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)