Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp977871pxu; Mon, 23 Nov 2020 08:40:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAPr99z698zrm5El7B+6tSmp2mMsJVMeUmKYTilwGOkJ6nRTpev8iDYSXyUVrIr2N2W6Kp X-Received: by 2002:a50:858a:: with SMTP id a10mr60781edh.190.1606149646055; Mon, 23 Nov 2020 08:40:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606149646; cv=none; d=google.com; s=arc-20160816; b=YjiZaKuXo6PhggSezfUAGKvgtlfLiIy6PqfZQaYCAKJEZ2ZOusiyi2b8raEOD3FlVi gwIqmk6uuT53dI3L+PxspCLsETeZN8SMeUVwv+SgJiNil6kbM9CqDSLupnejM0ewO7xw sEXeRUmZN/A7pgw2Dj0lYVTa8xWs7tNBiFh7bC4rYN5SEvl45jBycJNJigTA3t8L4vXf tnUT15+gHR6O1XOxSs+EQOQbShNQQ4XFr714zv8cuvhmQCFbZA/womoIKnAwM8GajrpR 1RG1uPGaxmosc3Q1jZGhHSteMGBxTWI0T87GLvDV6+L19JGlAMzLwtx1XtuSCfddFv3I IeYA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZmjI6GuWBxpDH1vN+eqMpXexsA9ttqDbpZixuYg88ts=; b=UOLhQjHTIoc1/6c7syNQVIYKQVRHGpcPraaOMeEd4HATJsCNl7aics+D9movynyR8D q94T2ANBbFEyuWc59GZWslVHWWGcbtsLwWbnC4v6LUfidXxWIzcpkHZZlViObG2uXyh2 uwC9mwlNZtrU1AWvhAOitR0lQ4xnTaZYvo40PI90pmeRCGa85/9tKtOIDb9QcyhEVrNK VeViFi0jMYH+LUv9fSj9V8a28ArvQ6De+RBhyZlpRa2nqw3jMJLY4fEA+twxxJWTo3Kj 7c4P7Pz+qUNoeX5NTorOJgzsO09faqlisPDLlT/tJ1cwV+C0YY1QQpJXsRI/xgMIvEwy hp4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=ZI0a4FTo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m64si2967460ede.159.2020.11.23.08.40.22; Mon, 23 Nov 2020 08:40:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=ZI0a4FTo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390055AbgKWQg6 (ORCPT + 99 others); Mon, 23 Nov 2020 11:36:58 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:41308 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732535AbgKWQg5 (ORCPT ); Mon, 23 Nov 2020 11:36:57 -0500 Received: from workstation.tuxnet (213-47-165-233.cable.dynamic.surfer.at [213.47.165.233]) by mail.pqgruber.com (Postfix) with ESMTPSA id 73961C81EEB; Mon, 23 Nov 2020 17:36:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1606149415; bh=ZmjI6GuWBxpDH1vN+eqMpXexsA9ttqDbpZixuYg88ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZI0a4FToaZI+GLoDqW5hsySPoKdnifMNSi+62cpwpZt83Gczas/36kuJJ+tKx3PQu dWicetmtkN9cbR4inYwsCkyR91vukZkn/eIbak+cVpm5WTf0hvYGMhqyCp+vshRuDw NjdDYIdDuI4FLGIXWCPtrTRsNGI4A209uYwh6cuk= From: Clemens Gruber To: linux-pwm@vger.kernel.org Cc: Thierry Reding , u.kleine-koenig@pengutronix.de, Lee Jones , linux-kernel@vger.kernel.org, Sven Van Asbroeck , Mika Westerberg , David Jander , Clemens Gruber Subject: [PATCH v2 2/4] pwm: pca9685: Set full OFF bits in probe Date: Mon, 23 Nov 2020 17:36:21 +0100 Message-Id: <20201123163622.166048-2-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123163622.166048-1-clemens.gruber@pqgruber.com> References: <20201123163622.166048-1-clemens.gruber@pqgruber.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The full OFF bits are set by default in the PCA9685 LEDn_OFF_H registers at POR. LEDn_ON_L/H and LEDn_OFF_L default to 0. The datasheet states that LEDn_OFF and LEDn_ON should never be both set to the same values. This patch removes the clearing of the full OFF bit in the probe function. We still clear the rest of the OFF regs but now we set the full OFF bit to avoid having both OFF and ON registers set to 0 and start up in a safe default state. Signed-off-by: Clemens Gruber --- Changes since v1: - Rebased drivers/pwm/pwm-pca9685.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c index 47a69ee7951f..eaeadfa853cf 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -494,9 +494,9 @@ static int pca9685_pwm_probe(struct i2c_client *client, reg &= ~(MODE1_ALLCALL | MODE1_SUB1 | MODE1_SUB2 | MODE1_SUB3); regmap_write(pca->regmap, PCA9685_MODE1, reg); - /* Clear all "full off" bits */ + /* Reset OFF registers to HW default (only full OFF bit is set) */ regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_L, 0); - regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_H, 0); + regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_H, LED_FULL); pca->chip.ops = &pca9685_pwm_ops; /* Add an extra channel for ALL_LED */ -- 2.29.2