From patchwork Wed May 12 09:48:50 2021 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: 12253377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3DFAC433B4 for ; Wed, 12 May 2021 12:12:31 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6CBC56109E for ; Wed, 12 May 2021 12:12:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CBC56109E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ysoft.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0BCC6EB8A; Wed, 12 May 2021 12:12:29 +0000 (UTC) X-Greylist: delayed 429 seconds by postgrey-1.36 at gabe; Wed, 12 May 2021 09:56:07 UTC Received: from uho.ysoft.cz (uho.ysoft.cz [81.19.3.130]) by gabe.freedesktop.org (Postfix) with ESMTPS id 070886EB4C for ; Wed, 12 May 2021 09:56:07 +0000 (UTC) Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id 61FCCA02C2; Wed, 12 May 2021 11:48:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1620812935; bh=2985J8QEH7ypkIWT9eXgR8S1j/LwdOsTbCDZrn2V8iY=; h=From:To:Cc:Subject:Date:From; b=R9RP4TAfFQKyc869XKMykTIB2y/DaUteIxfcu/WAqiD5OkWu+IWclRRZIHUNl7SDZ LipOKwxTcu1P6R7giYF9eLI03p4yzyt1h1hlwTZEdFxy44Eww1bI3rUTDrsg8bqDqJ 94EdkamI3qf6053FEfpVbln1Tb4esF2gOaAMhWmo= From: =?utf-8?b?TWljaGFsIFZva8OhxI0=?= To: Bartlomiej Zolnierkiewicz Subject: [PATCH RESEND] video: ssd1307fb: Enable charge pump only on displays that actually have it Date: Wed, 12 May 2021 11:48:50 +0200 Message-Id: <1620812930-30356-1-git-send-email-michal.vokac@ysoft.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 12 May 2021 12:12:25 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, =?utf-8?b?TWljaGFsIFZva8OhxI0=?= , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" A note in the datasheet says: "Patterns other than those given in the Command Table are prohibited to enter the chip as a command; as unexpected results can occur." So do not send the charge pump command to displays that do not support it. Signed-off-by: Michal Vokáč --- drivers/video/fbdev/ssd1307fb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c index 1b0b2a096afa..54903ea2e3ac 100644 --- a/drivers/video/fbdev/ssd1307fb.c +++ b/drivers/video/fbdev/ssd1307fb.c @@ -497,14 +497,16 @@ static int ssd1307fb_init_regs(struct ssd1307fb_par *par) return ret; /* Turn on the DC-DC Charge Pump */ - ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP); - if (ret < 0) - return ret; + if (par->device_info->need_chargepump) { + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_CHARGE_PUMP); + if (ret < 0) + return ret; - ret = ssd1307fb_write_cmd(par->client, - BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0)); - if (ret < 0) - return ret; + ret = ssd1307fb_write_cmd(par->client, + BIT(4) | (par->device_info->need_chargepump ? BIT(2) : 0)); + if (ret < 0) + return ret; + } /* Set lookup table */ if (par->lookup_table_set) {