From patchwork Thu Oct 3 15:52:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 175134 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp558225ill; Thu, 3 Oct 2019 09:30:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZt1cYYAj97xmz5tv91b4RhGyJf7jtQ4rOHkhFViv1pGh0C09WTvFlfPTxLsrE+meZTawA X-Received: by 2002:a17:906:82c1:: with SMTP id a1mr8670237ejy.187.1570120255857; Thu, 03 Oct 2019 09:30:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570120255; cv=none; d=google.com; s=arc-20160816; b=R1eDgG9hbYdcd3F8EhLf2lIUm3pp73a9AHtGgjaNbp2TLpbLT754pLky4rl4v1rfLn Eb0EuJpP2iqtsa4WIL43ajoTzbqgvJ53knm7ZLaZj8IDL+Qo7RJ76/VITcbbXUIjrfsl xqUW8PQ4QW2FWiSx0uOtWjvoGJu+SUl8mmMsBG0RGneoW54wuSzpSzdG2awVYT1dYFKs N/MB+tYe7Gw0IgFzORSA6VJXvP4qhRnKkzyi9VsHgVtU7kchQ+Pbp58tjwmw0BOSPPqb kJlniYaLSaH2zl5+6dmeNB/T9qQS8MJPiLsi4vm4nZCg3qtAMHzPfEPchYhYa0XukNkn A+0Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2E8mRGBWHQ0p2iBQgTkN82G24aoQ+hEFi1cI1hH+PSI=; b=WJ3fXTGHvJXAv7Gzwbl/vsZXY9/SXUm403LH/TCtpumYYM20SsOZ3y+/goorPvODIw kvb2XvKUqeNxK35DzemBl+GigMZ8ePyY05Xjrbs3uvMOMbukTfmfv6hkSQDJUrmgtOt6 oPXluesb+bsQaHM+NfEx9cOGEEEMASaCj1oHXUuVlxJwThymdAp/MGu1eJEu81zQnrt6 8n1Hne1Ej/JEQwm6YlsDWg3Doc/W/RcMD2/+KaSxabLQL4A6KXgUZUYvUB8cNdRBps0u 8WYOKj2TOIsM+tYV3KpTm8/0JfNGldDeu9GwOEemAC+68I6RjyosezzgEVGt9vtui+gp ywXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0I2lh1P7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ci22si1485121ejb.162.2019.10.03.09.30.55; Thu, 03 Oct 2019 09:30:55 -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=@kernel.org header.s=default header.b=0I2lh1P7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391224AbfJCQay (ORCPT + 27 others); Thu, 3 Oct 2019 12:30:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:37198 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388282AbfJCQar (ORCPT ); Thu, 3 Oct 2019 12:30:47 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29C912054F; Thu, 3 Oct 2019 16:30:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570120246; bh=aRnDWCac5Rp2zw7MueiQHhEBPV+CE2W1Bm3OSFT9eFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0I2lh1P7DFBtKcrUy/roZqP0zBLFoz06UsqW4XMdlGmUHuwPcnvG24cPD6BteGIaS zbMQDhHl0J3SsHIib1HIzXc8IoTkf6gGqApFN4wUsEjBrwGQqTjEdmbxKNuaQIzagy bphry6iV9qIgYiQDU7/urd84SUMEZjEejTsvJMyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Dan Murphy , Jacek Anaszewski , Sasha Levin Subject: [PATCH 5.2 150/313] leds: lm3532: Fixes for the driver for stability Date: Thu, 3 Oct 2019 17:52:08 +0200 Message-Id: <20191003154547.709338957@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154533.590915454@linuxfoundation.org> References: <20191003154533.590915454@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Murphy [ Upstream commit 6559ac32998248182572e1ccae79dc2eb40ac7c6 ] Fixed misspelled words, added error check during probe on the init of the registers, and fixed ALS/I2C control mode. Fixes: bc1b8492c764 ("leds: lm3532: Introduce the lm3532 LED driver") Reported-by: Pavel Machek Signed-off-by: Dan Murphy Acked-by: Pavel Machek Signed-off-by: Jacek Anaszewski Signed-off-by: Sasha Levin --- drivers/leds/leds-lm3532.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/leds/leds-lm3532.c b/drivers/leds/leds-lm3532.c index 180895b83b888..e55a64847fe2f 100644 --- a/drivers/leds/leds-lm3532.c +++ b/drivers/leds/leds-lm3532.c @@ -40,7 +40,7 @@ #define LM3532_REG_ZN_3_LO 0x67 #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) @@ -302,7 +302,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; @@ -321,7 +321,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 @@ -542,11 +542,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_read_u32_array(child, @@ -590,7 +593,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++; }