From patchwork Thu Dec 12 03:39:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 181392 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp371455ile; Wed, 11 Dec 2019 19:40:18 -0800 (PST) X-Google-Smtp-Source: APXvYqw6AYvgzZ9whP1LSxsCpMYzBfZpOSPsfhXrQzfiPMctrgZSoY8iEzjMqPrHwbcWfz2WRh8X X-Received: by 2002:a9d:7393:: with SMTP id j19mr5501944otk.336.1576122018189; Wed, 11 Dec 2019 19:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576122018; cv=none; d=google.com; s=arc-20160816; b=jtBrRIJARSc5bla6dqtOfznjqrnjFkguORtSnvesN5R5kqIrUY2uhUl1OYUZz7PNhB LqsUSgVonulkLg17tqMAJaiJWzs7YE1Sj3PzxJ3ZzNbttoitqUMHgyeENBPkes/odwT+ RwhyQy18C1Pn9W7vjkUImNGudkJNjr5zOvpCtPpBNyYpUmVcOi+ZNVf+dPEmZo/ebU3Y cmQmHyVKwqY1xAvO+3Dx7LiFB8VFUiQQyVzcqWd6eM4LZhIGpZarISGmUvDxwNYZDleU 3mblyYVSrgo85bHKaHYNjRC5J5AWzhuvg5nakJjtp7tJRapX7qA5xaSyvrDl8uQydIr0 NtUQ== 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; bh=aP5K95S21ITCYz0Mbl5YtF5Je5aV6lnsxYMAlCR4OSI=; b=ZhoxBbE+7CB9yBMBTnntd/7TThYXourViVAJWFlfOriM5QhwIoemp8q44+bz0OkAOW o66Rz+0SxzOEOU8NaSj+1akXmUx/r1eHDkqIqzy2Qj0i1wYW++J00JkHdxnbpWPv6i3j LNY69u6IL+mTY0r0U6JffiUxJ9oZaWQLf7drgmXzbqKjenBtoPnXcJtcB18WgXXY7UB2 jk3iAnOPx9zSn+kkOJ3fHEDXPGbeEXnAhQymPpfwAjN/LvJ+ne8G94gx8Q+V4TrpKDmn iEgQo0qwucrallnMpyy3UTMMPTvfDBT+n3SYW4wOlpjcxdcmJ4rorBnlLt1eH2dB/pUw B0iw== ARC-Authentication-Results: i=1; mx.google.com; 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 u18si2420033oia.80.2019.12.11.19.40.17; Wed, 11 Dec 2019 19:40:18 -0800 (PST) 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; 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 S1727893AbfLLDkR (ORCPT + 27 others); Wed, 11 Dec 2019 22:40:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:58556 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727730AbfLLDkG (ORCPT ); Wed, 11 Dec 2019 22:40:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D8415AF63; Thu, 12 Dec 2019 03:40:04 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: linux-realtek-soc@lists.infradead.org, linux-leds@vger.kernel.org Cc: Jacek Anaszewski , Pavel Machek , Dan Murphy , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [RFC 17/25] leds: tm1628: Prepare Fude Microelectronics AiP1618 Date: Thu, 12 Dec 2019 04:39:44 +0100 Message-Id: <20191212033952.5967-18-afaerber@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191212033952.5967-1-afaerber@suse.de> References: <20191212033952.5967-1-afaerber@suse.de> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add definition for AiP1618 chipset. Signed-off-by: Andreas Färber --- drivers/leds/Kconfig | 5 +++-- drivers/leds/leds-tm1628.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) -- 2.16.4 diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a7695d961d9c..3a7e6028ae80 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -842,8 +842,9 @@ config LEDS_TM1628 depends on SPI depends on OF || COMPILE_TEST help - Say Y to enable support for Titan Micro Electronics TM1628 and - Fuda Hisi Microelectronics FD628 LED controllers. + Say Y to enable support for Titan Micro Electronics TM1628, + Fuda Hisi Microelectronics FD628 and Fude Microelectronics AiP1618 + LED controllers. They are 3-wire SPI devices controlling a two-dimensional grid of LEDs. Dimming is applied to all outputs through an internal PWM. diff --git a/drivers/leds/leds-tm1628.c b/drivers/leds/leds-tm1628.c index ef85712a84f2..8a8fd1562853 100644 --- a/drivers/leds/leds-tm1628.c +++ b/drivers/leds/leds-tm1628.c @@ -3,6 +3,7 @@ * Titan Micro Electronics TM1628 LED controller * Also compatible: * Fuda Hisi Microelectronics FD628 + * Fude Microelectronics AiP1618 * * Copyright (c) 2019 Andreas Färber */ @@ -411,9 +412,38 @@ static const struct tm1628_info fd628_info = { .default_pwm = 0, }; +static const struct tm1628_mode aip1618_modes[4] = { + { + .grid_mask = GENMASK(4, 1), + .seg_mask = GENMASK(8, 1), + }, + { + .grid_mask = GENMASK(5, 1), + .seg_mask = GENMASK(7, 1), + }, + { + .grid_mask = GENMASK(6, 1), + .seg_mask = GENMASK(6, 1), + }, + { + .grid_mask = GENMASK(7, 1), + .seg_mask = GENMASK(5, 1), + }, +}; + +static const struct tm1628_info aip1618_info = { + .grid_mask = GENMASK(7, 1), + .seg_mask = GENMASK(14, 12) | GENMASK(5, 1), + .modes = aip1618_modes, + .default_mode = 3, + .pwm_map = tm1628_pwm_map, + .default_pwm = 0, +}; + static const struct of_device_id tm1628_spi_of_matches[] = { { .compatible = "titanmec,tm1628", .data = &tm1628_info }, { .compatible = "fdhisi,fd628", .data = &fd628_info }, + { .compatible = "szfdwdz,aip1618", .data = &aip1618_info }, {} }; MODULE_DEVICE_TABLE(of, tm1628_spi_of_matches);