Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2114307iof; Tue, 7 Jun 2022 20:12:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxygF/2UW7t8+4VdbIFNEsF4+3K15yk1m90iGIgdbHRhnXk1LyfPvkOnD+/kLY1KVXjTtbG X-Received: by 2002:a17:90b:3849:b0:1e8:7f47:5dcd with SMTP id nl9-20020a17090b384900b001e87f475dcdmr15165871pjb.61.1654657973211; Tue, 07 Jun 2022 20:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654657973; cv=none; d=google.com; s=arc-20160816; b=emgcYnFZFCe5eFAo+OkimqHmPEbz/IX/kszrQbtBTu5PUMkfJMo7QRqNK6V0OxNAlv aWW6wSBKF2a939RxJZxWvbdxWZd7g/NQbYGNG5uxYcVObMNZc/hI4wB4+u+OPwor6ELw 89ucM9VcEYCBJYtlBHG9yijZ9Bpmgh6S/2Klb3Stz0rYLfJOtl8QwHqewdSETiPCIr/F 2h0bIm/Kja6DSO5Hblk0YXuxi4DRxCe/BnXf4aOW/Qjw6BTLnpGaXFoAETisFi9oGijJ J1A82pFDwajHtVczb0mycUc/WU1ILeyW9ShetEvuZnKOAX1oFtxWbvzKSp0cQSYbCBWW ookg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0FG/uRJv82hLzvqaOr2ac86wdcUSpC7fMO2LKIjUtOw=; b=Xa/eIof/A9UdpaoeR72l3WrKKRpmRWMayFgKIgfkUekWKLJTDbyBwZk5zGfXdlJP3S 4vKiw6mwR5Xh1ymu1Whsh9yNMbjoGW7ZSinfU1EAd31fJbvOiB9fcS8K9vBCuqvkV6fF QeEbTsLu82POIxxM+4fUqhSEMyIenSO2ybjGiMPVKiknjeCJkuzQiBj7zP4PjAX4m6u3 DloK3Us0dD1UvxJZtkHiGiWMdAXzQHhyWxspWwLdcjJLwDbaVmQo6t/nZa5bBxaiTZfr ikF9trYDFe6p1JHbL9//MKZlfRzKSZEobdiH55fFotlvl5SEO3SxvApqEEo1D04uz4a4 Gx0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vkheCahf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id rj8-20020a17090b3e8800b001e8927db60bsi9336151pjb.73.2022.06.07.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:12:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vkheCahf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0FA6135DB38; Tue, 7 Jun 2022 19:17:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382685AbiFGWaV (ORCPT + 99 others); Tue, 7 Jun 2022 18:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380798AbiFGVQ7 (ORCPT ); Tue, 7 Jun 2022 17:16:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A82BF527D2; Tue, 7 Jun 2022 11:57:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2BFD76159D; Tue, 7 Jun 2022 18:57:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3849CC385A2; Tue, 7 Jun 2022 18:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628248; bh=Iv21szQQ0IsjJwXsnfNc9wifZ6YaVnjO+Lc5Z9nTGic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vkheCahfwoxuZXc4vxF3HAVyh8H63n31pvgKLIXTojg5YzU2WggWT/y1E75DhSYf1 kl9dwuKGICI+H8gFq/LtMeVsQexksdnuT1NMMhcWz0yVjCFaprAIaZ3oiRSyWY1N3+ 24rMjErX8VaWS8BOtiVSLa6fswAR2m26Ot6J2PyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.18 260/879] drm: ssd130x: Always apply segment remap setting Date: Tue, 7 Jun 2022 18:56:18 +0200 Message-Id: <20220607165010.397560644@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai [ Upstream commit a134109c301736ea2ac5054ba3c29c30c87f6ba7 ] Currently the ssd130x driver only sets the segment remap setting when the device tree requests it; it however does not clear the setting if it is not requested. This leads to the setting incorrectly persisting if the hardware is always on and has no reset GPIO wired. This might happen when a developer is trying to find the correct settings for an unknown module, and cause the developer to get confused because the settings from the device tree are not consistently applied. Make the driver apply the segment remap setting consistently, setting the value correctly based on the device tree setting. This also makes this setting's behavior consistent with the other settings, which are always applied. Fixes: a61732e80867 ("drm: Add driver for Solomon SSD130x OLED displays") Signed-off-by: Chen-Yu Tsai Acked-by: Javier Martinez Canillas Signed-off-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220308160758.26060-2-wens@kernel.org Signed-off-by: Sasha Levin --- drivers/gpu/drm/solomon/ssd130x.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c index ccd378135589..d08d86ef07bc 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -48,7 +48,7 @@ #define SSD130X_CONTRAST 0x81 #define SSD130X_SET_LOOKUP_TABLE 0x91 #define SSD130X_CHARGE_PUMP 0x8d -#define SSD130X_SEG_REMAP_ON 0xa1 +#define SSD130X_SET_SEG_REMAP 0xa0 #define SSD130X_DISPLAY_OFF 0xae #define SSD130X_SET_MULTIPLEX_RATIO 0xa8 #define SSD130X_DISPLAY_ON 0xaf @@ -61,6 +61,8 @@ #define SSD130X_SET_COM_PINS_CONFIG 0xda #define SSD130X_SET_VCOMH 0xdb +#define SSD130X_SET_SEG_REMAP_MASK GENMASK(0, 0) +#define SSD130X_SET_SEG_REMAP_SET(val) FIELD_PREP(SSD130X_SET_SEG_REMAP_MASK, (val)) #define SSD130X_SET_COM_SCAN_DIR_MASK GENMASK(3, 3) #define SSD130X_SET_COM_SCAN_DIR_SET(val) FIELD_PREP(SSD130X_SET_COM_SCAN_DIR_MASK, (val)) #define SSD130X_SET_CLOCK_DIV_MASK GENMASK(3, 0) @@ -235,7 +237,7 @@ static void ssd130x_power_off(struct ssd130x_device *ssd130x) static int ssd130x_init(struct ssd130x_device *ssd130x) { - u32 precharge, dclk, com_invdir, compins, chargepump; + u32 precharge, dclk, com_invdir, compins, chargepump, seg_remap; int ret; /* Set initial contrast */ @@ -244,11 +246,11 @@ static int ssd130x_init(struct ssd130x_device *ssd130x) return ret; /* Set segment re-map */ - if (ssd130x->seg_remap) { - ret = ssd130x_write_cmd(ssd130x, 1, SSD130X_SEG_REMAP_ON); - if (ret < 0) - return ret; - } + seg_remap = (SSD130X_SET_SEG_REMAP | + SSD130X_SET_SEG_REMAP_SET(ssd130x->seg_remap)); + ret = ssd130x_write_cmd(ssd130x, 1, seg_remap); + if (ret < 0) + return ret; /* Set COM direction */ com_invdir = (SSD130X_SET_COM_SCAN_DIR | -- 2.35.1