From patchwork Tue Aug 20 19:53:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 171833 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp4886896ily; Tue, 20 Aug 2019 12:53:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqynyftsm0rHWyNXJJ7FvcRvhd2Y6BrPw9wfIhueeEGyMMELVobHwbrOiN+Wov58WzyLjU6C X-Received: by 2002:a17:902:f301:: with SMTP id gb1mr29130677plb.249.1566330818847; Tue, 20 Aug 2019 12:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566330818; cv=none; d=google.com; s=arc-20160816; b=XDbfsRUk93ciYCL2V9RTKyUSpd5L4lrNnb0+JqFGpVSJAsG3AOv/jPBjODibwV9X10 YNs/bWDRZBQvqCYodPci9/Cvx1sPGOoVoagXzwNKQoywkKTVnMUmb+BTJTy9lVyiqiDg LKzmXtQDyfG/dxwdPlleJfa4OitR+8nPO3OnBJh4xOXRI5F9fQSJQN5xGxtETY4Ru/7z upxEN4UI7Pf6E+KyIwf1yLOp+CGvSnYR8BvOrQwQrEs4/8Baw7g39bABHME0sXinEfox c/rl2oftc4Tn/VBdejVdjFleTHCKBgC+T6XIdt10MPmexutrMJAv4a0MBihanwuZExln rBeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zTlYVpk4j6J82Whbs9ef9vsWDQXT0h/u+NCcDZR6KRs=; b=FENe68YNong6IChcePCMxL1LEeoFquNKdpZj4In3ZstAsF2qHBj4WXsq4CPJAnGC30 epXMnj1W+LRw2E+ScMFGX2g2tXC6uVmbI3LRwmOf2515yZqrIbrbnXwOlSolTPgZrhfQ PNvkrKCes7uhz3H5F2c5sdJQhWLT5THnXZkomkFiJsvuX8dQ2F7hf5b6cVUpGvayFBZC rhZDCrLVfrgD93/4Fp/uXfZielUhMZHs6ZAgUIK+N1FglQR682zhphdrkWFlH/YY43k4 gN0xd2VYk86dwEKLk35QR6hEVoSDktXYni0Y77r7C7dHKaZhpJQvxmqsU0I6hKejxtLR iizg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=m+kSAUHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si12759359pgd.554.2019.08.20.12.53.38; Tue, 20 Aug 2019 12:53:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=m+kSAUHg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730801AbfHTTxc (ORCPT + 28 others); Tue, 20 Aug 2019 15:53:32 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44752 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728283AbfHTTx2 (ORCPT ); Tue, 20 Aug 2019 15:53:28 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7KJrIHT074727; Tue, 20 Aug 2019 14:53:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1566330798; bh=zTlYVpk4j6J82Whbs9ef9vsWDQXT0h/u+NCcDZR6KRs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=m+kSAUHgqJ3zzDfqE0WPQO2NrV7WR0mZBAbkpcYVhkiOMU4R08I68uo+qF9e4TuGc 8ha6LgAZ/hyRw4zI5mbcNToTVWEdLF4oO0xuu1qjxKyw9ySShAEzDJ1I0rYLC5Mi8L aZq9nuI8FtbA6h0wJ6Q6M0HmS/Ysl1r1DzR0y70c= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7KJrIil057594 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 20 Aug 2019 14:53:18 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 20 Aug 2019 14:53:18 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 20 Aug 2019 14:53:18 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7KJrINT072811; Tue, 20 Aug 2019 14:53:18 -0500 From: Dan Murphy To: , , , , , , CC: , , Dan Murphy Subject: [PATCH v3 3/5] leds: lm3532: Fixes for the driver for stability Date: Tue, 20 Aug 2019 14:53:05 -0500 Message-ID: <20190820195307.27590-3-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20190820195307.27590-1-dmurphy@ti.com> References: <20190820195307.27590-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fixed misspelled words, added error check during probe on the init of the registers, and fixed ALS/I2C control mode. Fixes: e37a7f8d77e1 ("leds: lm3532: Introduce the lm3532 LED driver") Reported-by: Pavel Machek Acked-by: Pavel Machek Signed-off-by: Dan Murphy --- v3 - No changes - https://lore.kernel.org/patchwork/patch/1114541/ drivers/leds/leds-lm3532.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c index 0c3d67671ab2..5e33ae4561f2 100644 --- a/drivers/leds/leds-lm3532.c +++ b/drivers/leds/leds-lm3532.c @@ -43,7 +43,7 @@ #define LM3532_REG_ZONE_TRGT_C 0x7a #define LM3532_REG_MAX 0x7e -/* Contorl Enable */ +/* Control Enable */ #define LM3532_CTRL_A_ENABLE BIT(0) #define LM3532_CTRL_B_ENABLE BIT(1) #define LM3532_CTRL_C_ENABLE BIT(2) @@ -307,7 +307,7 @@ static int lm3532_led_disable(struct lm3532_led *led_data) int ret; ret = regmap_update_bits(led_data->priv->regmap, LM3532_REG_ENABLE, - ctrl_en_val, ~ctrl_en_val); + ctrl_en_val, 0); if (ret) { dev_err(led_data->priv->dev, "Failed to set ctrl:%d\n", ret); return ret; @@ -326,7 +326,7 @@ static int lm3532_brightness_set(struct led_classdev *led_cdev, mutex_lock(&led->priv->lock); - if (led->mode == LM3532_BL_MODE_ALS) { + if (led->mode == LM3532_ALS_CTRL) { if (brt_val > LED_OFF) ret = lm3532_led_enable(led); else @@ -561,11 +561,14 @@ static int lm3532_parse_node(struct lm3532_data *priv) } if (led->mode == LM3532_BL_MODE_ALS) { + led->mode = LM3532_ALS_CTRL; ret = lm3532_parse_als(priv); if (ret) dev_err(&priv->client->dev, "Failed to parse als\n"); else lm3532_als_configure(priv, led); + } else { + led->mode = LM3532_I2C_CTRL; } led->num_leds = fwnode_property_count_u32(child, "led-sources"); @@ -606,7 +609,13 @@ static int lm3532_parse_node(struct lm3532_data *priv) goto child_out; } - lm3532_init_registers(led); + ret = lm3532_init_registers(led); + if (ret) { + dev_err(&priv->client->dev, "register init err: %d\n", + ret); + fwnode_handle_put(child); + goto child_out; + } i++; }