Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2647919pxu; Mon, 7 Dec 2020 11:41:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhAQbsmxp3RTLyo+6IdisFlYDlYGETzS3fAu3oZJ1bN6JZO0LUFxSt2Y559kR/Jj+MmHIW X-Received: by 2002:a05:6402:c95:: with SMTP id cm21mr15757051edb.294.1607370103928; Mon, 07 Dec 2020 11:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607370103; cv=none; d=google.com; s=arc-20160816; b=swhfIAHpd3l5R+mKfcsmXZ5oUj9gvscND+DKAuBWCNSRfvDg6WBjw92xaiU8c969Z6 OodBvepshdSSJC8tbprlF3ROEhPIaxoJ2Yy/nomphZsS0YZ7eWx3bNCQ+NJ5R8KJqgGK m37WbU2Ls2k9MpcvHLQZ3azNtfIwXWAW8l5ajvP+M0E4cVBiS4h9fVsq683LCHjeLril GgFlGoiKXcUL4FlNHHdqrn90ou6qXmtepYOYEvmfqYHm5ZTZFdQ12+ByiSx+Ktoc2ciD 7MD/pTNu/zCU4pPXQulIb3w8kWz+CrNLy6kUmWwNzRq/DG2HrbmteO0nabsUtXMJabm0 MJBw== 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=ShuICKLZBVI5ErEI1/41Y2BY3Y2fl8W0JkwcIOrl/JY=; b=hwWh5q1QmGqoix4tXGbBtJc23axzTyTNYhBIgzlLVMz5Kz10UEGd/1pV7rMwUKbjGe Edd9Hs6YgQJuf/Bs12tBgVanQj8huFRdDkKpPTC8pNdTbr65cSONzjRPDUf90PuCSvGw fejHJFri9b+iiiyiP51rSvrWXi6NZlJu2QRnwRQ2rUyzKY8xJJnOZYYP31p/frw8dpgu QqqRohcVqVNbduG40KMmKsoSEhtJg7pe4++kKQqwEl5qQ2C8laDDydb+bXQ40pGzpTCn Z/H7pizfZCzJGET4BGA4HWPKkETkUzkbAhTpKk25V7+j3MNelp/wqNYfcIUrWMqfZmmQ OtZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=rh71cuWL; 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 c17si6235849eje.256.2020.12.07.11.41.20; Mon, 07 Dec 2020 11:41:43 -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=rh71cuWL; 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 S1726638AbgLGThx (ORCPT + 99 others); Mon, 7 Dec 2020 14:37:53 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:35196 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725799AbgLGThw (ORCPT ); Mon, 7 Dec 2020 14:37:52 -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 921A6C8926C; Mon, 7 Dec 2020 20:37:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1607369830; bh=ShuICKLZBVI5ErEI1/41Y2BY3Y2fl8W0JkwcIOrl/JY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rh71cuWLJ6yoKVtlaSv2+4mPyT///9Jkn48WuhA97VyHaY03Ad0yGYSGBstew26R7 i8QbKNHls2M7hrHEEA264ZBqz6Z3nka/Hsz5Z8qm4EKdyCyl9fC/YiYb/Ypu+Q7lB6 e/c/cVtQ9vhPUNQoS1XQKbSUBpzOoJkT25Ew+Ppo= 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 v4 2/4] pwm: pca9685: Set full OFF bits in probe Date: Mon, 7 Dec 2020 20:36:28 +0100 Message-Id: <20201207193629.493241-2-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201207193629.493241-1-clemens.gruber@pqgruber.com> References: <20201207193629.493241-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 0425e0bcb81e..fdce5fb9f41e 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -486,9 +486,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