Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp502987pxb; Wed, 18 Nov 2020 09:47:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQBN1epZZ6+HgpM74hA+Fsx8hB8vJ0OK9D5K9iOEgCFRzcmCwKgTK22pa/RX/lCj1YtOGE X-Received: by 2002:a17:906:9448:: with SMTP id z8mr2493697ejx.105.1605721637123; Wed, 18 Nov 2020 09:47:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605721637; cv=none; d=google.com; s=arc-20160816; b=ywwnFh/XOK8dkXbkCXSLzbzfkQn+tyQNLfXQiYESYbPvrvE745xlL35shy4va8+/nO nWrOF2WqPS0/WFUbARf9Mla8Vs9ReqHJrhZQzwjvamXbS+mRI6h+Wo8X24JihpqWHbxR tu+ab8Ar08o+lwrdIfcZCslIPt9gyTw6VSXdg65JhpVTGTTUuhN6PwykNMifEow8lnPm tQcNY66nxtg729E0WV/49v8tBWoI3Z/TrKjFOIQqgqLVYooi+8kgdXQY06OgRQqCeccf zvikdhctozEpM7RHL/7JT545W+JcWZFc1aJCZeSACLzjHsMVXYBO0bP2JvqZ/wWZ3L63 M0fQ== 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=H9OwDD0L8d1vX7kjVmEBiiZc8e6+OxHVW4PFdXs3lM0=; b=fy7BYOfrnyGOVS79i4L00MMo8tO3sZ9v9XPjRyNshTXbSqKKWgRSRsDEZazxnKaZOj b9anV+r/7YUAR+PwE/eVP1gBV9S7d15Z5ycKCJNmGcyHDWWzID1vFmMGhS/KADNuosSc 6G/nrwVeA8X/3mq77ApTLRBsZpOlojRezn2U5DT26awudzIc/ShCNAx3NdLZoMGzEZNq Z0OIdw83pVVos6agjZSf96h38ez5NxczwovD1tr3P8HPwPnNZD65Iz1beOp9OQi/5VZS jzvIV4BdhaEQo0hdZPe3fV10vFt12j1iUuZ9M45miYHwdhojGfwYs6iME3uj/lWsFD1L 8V3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pqgruber.com header.s=mail header.b=qtYx8D6D; 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 f13si16343810edv.212.2020.11.18.09.46.50; Wed, 18 Nov 2020 09:47:17 -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=qtYx8D6D; 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 S1727706AbgKRRpE (ORCPT + 99 others); Wed, 18 Nov 2020 12:45:04 -0500 Received: from mail.pqgruber.com ([52.59.78.55]:53834 "EHLO mail.pqgruber.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726505AbgKRRpE (ORCPT ); Wed, 18 Nov 2020 12:45:04 -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 D36D3C7D0F7; Wed, 18 Nov 2020 18:45:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqgruber.com; s=mail; t=1605721502; bh=H9OwDD0L8d1vX7kjVmEBiiZc8e6+OxHVW4PFdXs3lM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qtYx8D6DEh7xcKUzhD44wFJskmYKuNZ4n8cywu6nxHFenBKVCxmzvvjdrK0gPzEs9 G6A/xlIfPhxZorBwt7yEWKfgwmXoUgu5f5W+GJr9HqhuYcedPpwvCn5wgqEiYN9Unu 2HLQBkbuQzBfE2sSeIhJrEn9KuXwfpfKV6SBlzCU= 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 2/3] pwm: pca9685: Set full OFF bits in probe Date: Wed, 18 Nov 2020 18:44:16 +0100 Message-Id: <20201118174417.278011-2-clemens.gruber@pqgruber.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201118174417.278011-1-clemens.gruber@pqgruber.com> References: <20201118174417.278011-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 --- 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 20f1314e6754..88028222335f 100644 --- a/drivers/pwm/pwm-pca9685.c +++ b/drivers/pwm/pwm-pca9685.c @@ -499,9 +499,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