From patchwork Wed Oct 16 15:59:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 176510 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7572873ill; Wed, 16 Oct 2019 09:01:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHDFyqa+bKW9tT04v19adNxquj41L1sED9/fb6JlWk+8HHgvp63xMqwNyCIx01l53+kP/V X-Received: by 2002:a05:6402:327:: with SMTP id q7mr33747566edw.30.1571241680830; Wed, 16 Oct 2019 09:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571241680; cv=none; d=google.com; s=arc-20160816; b=kDLI4ku7J/MZPxgg4UCu+AM4bmyt6drVczmK3HR+Hz0tm0UYlofm72eIBSmGa14Y8d p5dhvFTgDNajOs4/qFs5hXsbYJiwptVEvsDDn/xaSV5A0tZpit7N618fIVHY2qWOT8ZE caCwJDt5t6wNcHoIwV0YVMdwFM9+etrY3w+hwboCBrkn/lCjLToueIFWJEXpW33hZwfd jL2TZywBwRAsjdpXIIkzymY3u1gZShzjiWGSRCGeztHox3Bon1hYvULie+2rHtxDK2Hv 4bD1TMZQGbhYE07AQzPUSS2l+rJTv4NBcMQQImgo9sIMIvoTGWrl3kG0SvK+FWc1DAcM S4Uw== 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=rjrKmRCxtLcAljHlXeRYkYtQjW+gz+DNteKwJQGVkFw=; b=RchDQnBT2b6fZo2Y8CRu3pemwXyLQB8bV3u0ni/cxIQrmubnYsTs1jrmcLKkBO5bvZ wCwn5g+Yw4TgEnumxjxOs5mYnKDLyww+K1NDBTEzQ5iBKV69Rj+FTdT4gRENwCe3ppyt WolOeuzLZ7xyIk2/KMPC+u0XxmdKY4bRXtbC/TIdU5hYoijbX3PWDzDd4WPPzbiJp+h7 h7O+2vNrLPOBQdlunAg5NWuA6s/Va3/CPwcLrWxHjpUQc3fbIUazBWDFS4nJHr8FoEZk lqkVdpUUdk8rCceYkoyuU8JtQCR8id0vGD4M5fNNSca4vNNmCnXppWyuRqBH6KJgX6C1 OQzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=byTgUkKG; 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 d48si17259693eda.383.2019.10.16.09.01.20; Wed, 16 Oct 2019 09:01:20 -0700 (PDT) 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=byTgUkKG; 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 S2393130AbfJPQBS (ORCPT + 1 other); Wed, 16 Oct 2019 12:01:18 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:55614 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393088AbfJPQAe (ORCPT ); Wed, 16 Oct 2019 12:00:34 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9GG0VBR039218; Wed, 16 Oct 2019 11:00:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571241632; bh=rjrKmRCxtLcAljHlXeRYkYtQjW+gz+DNteKwJQGVkFw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=byTgUkKG+8ZgBzVvzfMDI8wyiB+MLhRMfWglkoZMQM9LOSY4y7UdCi4CT5SCMB/JL N3kakNOd6FK5VULIrQHG+9/EqGu2b2rPUIEEXWdHgUeZUCEXFnWlWddwVXSTr2vPAl kxvPBi5BafAqTf+GPzRxB+M4mhC9QIePyc2T7YZM= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9GG0VZJ083027; Wed, 16 Oct 2019 11:00:31 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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; Wed, 16 Oct 2019 11:00:24 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DFLE107.ent.ti.com (10.64.6.28) 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; Wed, 16 Oct 2019 11:00:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9GG0VxL113275; Wed, 16 Oct 2019 11:00:31 -0500 From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH v13 14/18] leds: lp5523: Update the lp5523 code to add multicolor brightness function Date: Wed, 16 Oct 2019 10:59:50 -0500 Message-ID: <20191016155954.29044-15-dmurphy@ti.com> X-Mailer: git-send-email 2.22.0.214.g8dca754b1e In-Reply-To: <20191016155954.29044-1-dmurphy@ti.com> References: <20191016155954.29044-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 call back allows setting brightness on grouped channels in a single function. Signed-off-by: Dan Murphy --- drivers/leds/leds-lp5523.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.22.0.214.g8dca754b1e diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index d0b931a136b9..b5beed5bbd85 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -791,6 +791,25 @@ static ssize_t store_master_fader_leds(struct device *dev, return ret; } +static int lp5523_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, + LP5523_REG_LED_PWM_BASE + + led->color_component[i].output_num, + led->color_component[i].brightness); + if (ret) + break; + } + mutex_unlock(&chip->lock); + return ret; +} + static int lp5523_led_brightness(struct lp55xx_led *led) { struct lp55xx_chip *chip = led->chip; @@ -857,6 +876,7 @@ static struct lp55xx_device_config lp5523_cfg = { .max_channel = LP5523_MAX_LEDS, .post_init_device = lp5523_post_init_device, .brightness_fn = lp5523_led_brightness, + .multicolor_brightness_fn = lp5523_multicolor_brightness, .set_led_current = lp5523_set_led_current, .firmware_cb = lp5523_firmware_loaded, .run_engine = lp5523_run_engine,