From patchwork Mon Nov 4 12:37:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 178414 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1427599ilf; Mon, 4 Nov 2019 04:39:27 -0800 (PST) X-Google-Smtp-Source: APXvYqySv0mORh1P/fsRxkBYxU239zRDT8fTdgCgziQ3l7sOEUEk2LvpUJjCJ70VjkVoyCgtr5lw X-Received: by 2002:a50:baa9:: with SMTP id x38mr24561222ede.106.1572871167833; Mon, 04 Nov 2019 04:39:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572871167; cv=none; d=google.com; s=arc-20160816; b=f17GF9/QwALuslZelVh3lxEttyjzVM3SzWBro3qIRj0wI8kQI2d+pYXHOfnXEhN7OU WLofHG5KoZZqTeAXPRAQRfQeVvVhu+ZX11dW2x0Qm8rwysiCcOledKIs025xk6cMxkyV Q45QFw78/NCrSSmNjfrxLxguOf53+p4zkTKelH7yNSnbHo5462pnqnnyeqdYxFyWDa3f L47uV4ZgSxqe6jTifYjTOPusZzw2js3PnC3UpzFuLSmQEM8prY4Omv/JSNZ+OnEZzphD 5bYVl1Pd9I6PZmXRdfFjl7f2EYJwOMaEVTqe461IWEANrrlkzBlON88u3ci35Lehfp3j l9rg== 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=5oPRgd9y4fLZAUSx3Us0YBQ1cAUc/cf63XhWxENhBFk=; b=pBANeIVkyawVZjwBdgOFDwt0NZbzwykvaNKhamE6NM71ak8c37/7YVELOZYQ5mWg3q PukfjFhhnoIChUuCOfMVZHf0YAw2sgz/RtNOYtHrDMNwdL5OqeT1bB0beuBL4TIsN0Qg aMvVkfkwygvp7irOHYKJWNyVBFLBuTsyWLuHmWRkhcuhTEAG6diHpl+/eaUGLWIK0G5Z M+5aL4itCWVSIXUG01Y6bweupjyuDImoLxFVPzm+VO7BIdvA36qpg99K+9tFEux7OUqa AwHLlsL+3rSyA6FS3KQ2VvWoNcBe//s/PaIwHkAWwv9jwrfxwz56Dm5qRA5wOaEHnXg6 XxNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tXphMMD1; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 nj2si11045305ejb.233.2019.11.04.04.39.27; Mon, 04 Nov 2019 04:39:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-leds-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=tXphMMD1; spf=pass (google.com: best guess record for domain of linux-leds-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-leds-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 S1729201AbfKDMj1 (ORCPT + 1 other); Mon, 4 Nov 2019 07:39:27 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:47458 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727267AbfKDMj1 (ORCPT ); Mon, 4 Nov 2019 07:39:27 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xA4CdO9V120577; Mon, 4 Nov 2019 06:39:24 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1572871164; bh=5oPRgd9y4fLZAUSx3Us0YBQ1cAUc/cf63XhWxENhBFk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tXphMMD1mIcVyBmA8+JtHSATJ302fHWc9fkNX5Clu7mBp+FgWxVgPUq9Zf6qFMygF Drm9ZJULgPmuEdFuvBjNrhxBHjvFU6bTho9ewjG0/irGS3DnYM5Kr06HIANnCMjIme /jRWqvdCOo0fDKIFij1lcmFPtYCy9hL5eNOu+B90= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xA4CdOui130688 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 4 Nov 2019 06:39:24 -0600 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 4 Nov 2019 06:39:09 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE103.ent.ti.com (10.64.6.24) 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; Mon, 4 Nov 2019 06:39:24 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id xA4CdNvQ055949; Mon, 4 Nov 2019 06:39:23 -0600 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v16 15/19] leds: lp5521: Add multicolor framework multicolor brightness support Date: Mon, 4 Nov 2019 06:37:03 -0600 Message-ID: <20191104123707.31930-16-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191104123707.31930-1-dmurphy@ti.com> References: <20191104123707.31930-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-leds-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add the multicolor brightness call back to support the multicolor framework. This function allows setting the brightness across grouped LED channels in a single call. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5521.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 6ff81d6be789..f8bdd55e8349 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -349,6 +349,25 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf) return 0; } +static int lp5521_multicolor_brightness(struct lp55xx_led *led) +{ + struct lp55xx_chip *chip = led->chip; + int ret; + int i; + + mutex_lock(&chip->lock); + for (i = 0; i < led->mc_cdev.num_leds; i++) { + ret = lp55xx_write(chip, + LP5521_REG_LED_PWM_BASE + + led->color_components[i].output_num, + led->color_components[i].brightness); + if (ret) + break; + } + mutex_unlock(&chip->lock); + return ret; +} + static int lp5521_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -490,6 +509,7 @@ static struct lp55xx_device_config lp5521_cfg = { .max_channel = LP5521_MAX_LEDS, .post_init_device = lp5521_post_init_device, .brightness_fn = lp5521_led_brightness, + .multicolor_brightness_fn = lp5521_multicolor_brightness, .set_led_current = lp5521_set_led_current, .firmware_cb = lp5521_firmware_loaded, .run_engine = lp5521_run_engine,