Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp956336imu; Thu, 20 Dec 2018 07:56:35 -0800 (PST) X-Google-Smtp-Source: AFSGD/WtKne+FPPh85QE+bYxXQS2r+sd2DdrSY3yjjx5roL/2u+yMWH6koOfCNNTMZDSHAQbrzlg X-Received: by 2002:a17:902:2f03:: with SMTP id s3mr23955534plb.277.1545321395536; Thu, 20 Dec 2018 07:56:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545321395; cv=none; d=google.com; s=arc-20160816; b=wlxx1FCIT2CU1FOQwN+bjy7MdPnDGXifEAcAo1LljVHmUCFwbOudCRCWSJOXVnuN/m SHsEPkJ0du7TNmWJQRE+Av3ooA7wZ9sVL2doNzh6/9gAkuymh1V0aGBq7uy9hfvyRVFt MGVipvf61G3yVcPky8/3ZdVQtK62cYyiEBTRt02FxCYWSuQqnE/yriWBsGMmCz7v0/pM cfOHOGH7+JQAT7PHzab9yL51/Xm1i9ALjftRivZfkRctc2piuqxCd3eOKV3qUo+BJoZR VnRVDncnUa3RTDZ8Nyvp0GjY75V/TxB6+Tyns6ZYPp5kKnyxCv8pE0nKSGIJN1Uq17Vb K6IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=DiwUwv3SzpPrdtxPArl5qm75U9qUh3x5ftSy0Att7GA=; b=u4bU7ndZ8coeJ4fPXSc1bgLQLm+9BvgmhUn/ZljXuXTn/ADyRhvDpjGP0DgRmI/k4m NYbBOVRDP6xCD+L26FKlWegsP2QTQK/Z4pHsQrP7b0kcfiMR1BgnJtXPScA3z79HWEy6 QDckvu2Lx719ef3uquvYdUo1vM/kSyO2mOq3VdVh7pT/i8VtaymJT5LQL1IKhoFo1GOj 3i247yWw+68dzXLDqZXd12X2IvR2hiwQh+AhHEx6Tc6fR68BlR/z9i+o2VVayAalRYcx xZ2QAOg+8QoyRjx2PM22E84Ud6KxFR5+hyFS1RVNW2IuAH9Fl1u1wkhuj2N8/EYuFiKk g9Fg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si17997461pgu.5.2018.12.20.07.56.16; Thu, 20 Dec 2018 07:56:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732393AbeLTMfU (ORCPT + 99 others); Thu, 20 Dec 2018 07:35:20 -0500 Received: from mail.bootlin.com ([62.4.15.54]:60681 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730044AbeLTMfU (ORCPT ); Thu, 20 Dec 2018 07:35:20 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id D948320801; Thu, 20 Dec 2018 13:35:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (242.171.71.37.rev.sfr.net [37.71.171.242]) by mail.bootlin.com (Postfix) with ESMTPSA id 7C13A207D4; Thu, 20 Dec 2018 13:35:06 +0100 (CET) Date: Thu, 20 Dec 2018 13:35:05 +0100 From: Alexandre Belloni To: =?utf-8?B?Vm9rw6HEjQ==?= Michal Cc: Rob Herring , Bartlomiej Zolnierkiewicz , Shawn Guo , Fabio Estevam , Maxime Ripard , "linux-fbdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: Re: [PATCH v2 4/4] ARM: mxs: cfa10036: Fixup OLED display reset polarity Message-ID: <20181220123505.GH2188@piout.net> References: <1545308005-51559-1-git-send-email-michal.vokac@ysoft.com> <1545308005-51559-5-git-send-email-michal.vokac@ysoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1545308005-51559-5-git-send-email-michal.vokac@ysoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/2018 12:13:57+0000, Vokáč Michal wrote: > 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. > Honestly, the platform has been discontinued and I don't really think it is worth having that fixup in the tree forever. > 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) > -- > 2.1.4 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com