Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2048119pxu; Tue, 24 Nov 2020 15:49:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/G8+VmR7FlVaBHFx+ZtsnBBqIfzX5QB8h0ZSD6gcBYvo8lVAU6Vg7JdpQ/9bf0tpY/IrI X-Received: by 2002:a17:906:e214:: with SMTP id gf20mr58760ejb.314.1606261780927; Tue, 24 Nov 2020 15:49:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606261780; cv=none; d=google.com; s=arc-20160816; b=kyY3SL0sExGY7GXkGpVvHWoIXWBL1W6mx+P+5+JRd4J8KOOvG7XMXVzm+eotr7exqx Lik3Cln84vm/wuhE+rRfumve+4v/8FbdDOcL+26z7o6wshJN/XBC+QX3nEbRoO8SfkNh eKPzSwuTuzby2nSWEZ1NpO9fzL+OA5nHHhjeuwXtXwu9c+MVoIKLBTrwdOiVOzmtOS6n mbJizAiJXO5i5IpqEi5PpGnwOYgRF61eqLLCVT0bFCA+RRn/YeFF9R6hMKWL2uQ99x7s uKOydeZIp6OZJ+rqQY0K5OomHcmqz4P+SYXFcs1+TA3vDHUMDdBviCY5EpFGG3kd1ZHL TapQ== 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=1ef2WxML02Qxif+zyLTRqJ0smQsMIJLV4ESdnMUHFKQ=; b=VqULLyqvS/Ml/xVbBmtoauj5Vxy+POGP8W8nahJPP3neSlHe75lCWoyD1CJcTgWwwX +BamzMCzGWg32raLzlgK4KWtwMsmfwOA+jQuftUxu/2LG8D3LvRlNRkSodCEoAA2Wy+l Y43NVelYG2A918e4Oa5fJeno92ddaqexxd0eLWX+HatvGKMV/bpUIPLxO9O8L65DdXE1 IFDlCsgnlSr7SSV+HRfGSNRMPJGsN/6mCIxbKvxFIqlDCqkpAtV/G1VGKHy33bPciz3t YZ4HTOZcxL0qKIJZGKxnvMeTgWlMZlO+HPIZAaWc0orjcSskDQwl23hfDja97283qxvw CjDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=xTEkkqte; 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=QUARANTINE 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 63si168908edn.339.2020.11.24.15.49.17; Tue, 24 Nov 2020 15:49:40 -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=xTEkkqte; 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=QUARANTINE sp=NONE dis=NONE) header.from=pqgruber.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404329AbgKXSKp (ORCPT + 99 others); Tue, 24 Nov 2020 13:10:45 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:53772 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404173AbgKXSKp (ORCPT ); Tue, 24 Nov 2020 13:10:45 -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 24446C81EED; Tue, 24 Nov 2020 19:10:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1606241443; bh=1ef2WxML02Qxif+zyLTRqJ0smQsMIJLV4ESdnMUHFKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTEkkqtenqTCtFwcc8PeuolcG78BqeCqJkot/6UYy8AYZpYe+KieY4Htlh5Cuooh5 gMab6MXEoUeejc8JYVJo3GuYhb1ilcwXScGpjeZfOKJnBM14Shz7sGg+iT8ml/jDLW q1CG7q08zcdw7DtXLD/2gaACOCnRJcGbHk5onkiw= 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 v3 2/4] pwm: pca9685: Set full OFF bits in probe Date: Tue, 24 Nov 2020 19:10:12 +0100 Message-Id: <20201124181013.162176-2-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201124181013.162176-1-clemens.gruber@pqgruber.com> References: <20201124181013.162176-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 4cfbf1467f15..2b82b35ff0de 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -475,9 +475,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