From patchwork Wed Oct 21 22:50:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 318887 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp2566343ilg; Wed, 21 Oct 2020 15:51:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIU8XosPVEIYf1ysfBDZmy+BlXibPUeDd39EGMUMkKbFthEh4ZnVhwPVHkmP+pwyx1XXzJ X-Received: by 2002:a17:906:3399:: with SMTP id v25mr5544299eja.51.1603320672511; Wed, 21 Oct 2020 15:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603320672; cv=none; d=google.com; s=arc-20160816; b=Fmto8B6MC9hYHnuhFO99xhSKb7+jAAacPgLs2YtKQWujfYNOzl7IRB1ATlRanjw1zT Qlq+y9T0MVREBoDF0Vj5zJFTNI8ArUFwgnZE52OH48Byx5s53YWs4Foupq789dAFZT7N BVp29Cj6UhBE0jxY0DwRp2KTrTKhJdIAW7fQAqAdR3kPhNVndUF+HPu3IytkLii+RcPp rtkOeGSdBsaO3uOtwI+p6avGplCM0UWM62krvaj+yHgPHnUkp03/aonQ5Kh0roZaWp65 T1z9udjouBit9CfYdx0JwsNIYHdMYRFRrgL0YBDprtt/gp7AXuaH3WnNUWHxYmVWOd+N GHKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zpjsljtV36eW22jKsBjcgvjXKE5SZZrozCSm2JOo928=; b=Xh8eBlXpMxnVi72R25ncU/3AV/VuVUQC55EPpWBiF7DIv0Uho8AkJNdZFIzXNrMcnB oIuishi/4p+Zn6ovAcSmFNt39884tU0+Jyh1HfmCvBjhSz6wu2sSQtxZ26cFuNcQMSnS HV1dpDiH4pyxeSBmHhGw5U+NrSO3hKgReE2El0XcCCteLKDcpqSTGLWaACK+s2X+e6Fh Sz9c9Q6CVVho77CVuA7zWVR627lT+G2cjGeVhsNGNy34OUqNag0IflkO4LS69f6bz0tY IN/t2ywe3+lbSEFd2iQMi2K0sFwPaj1SGIA06XEwRo/6pQQKchqLPu9iHbt4ZnPqBh9F 7Giw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=psxdaokV; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k18si2348706edr.149.2020.10.21.15.51.12; Wed, 21 Oct 2020 15:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=psxdaokV; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2506930AbgJUWvL (ORCPT + 6 others); Wed, 21 Oct 2020 18:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2506927AbgJUWvL (ORCPT ); Wed, 21 Oct 2020 18:51:11 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6196FC0613CF for ; Wed, 21 Oct 2020 15:51:10 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id l28so5132646lfp.10 for ; Wed, 21 Oct 2020 15:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zpjsljtV36eW22jKsBjcgvjXKE5SZZrozCSm2JOo928=; b=psxdaokVACpNVNAhX4v+t51isYuTHK2+yjs70ohMFGLi0A/J6RuG4aQrBN2JEjUfuQ jUccs4hXrG/Cf17Pl8QaoJVKTz9hK4i2D9sTWVQo4+QvwwCZULhCZyHFLXA/OaCZc6L/ SifjOGkRULm6oCCcKkGQZt6onbxz4ylRNgr1AiTcPGP5D36sKgS0JOUTA+vwWfV7x4sC cuDFE6E1/+wETEoZQl1PvOPfHy8NfCkAtfb6QCWNiuE/OsdLDYt9uXKpwjIsOEeRSLZ8 V0HelwOprCGlE52v3Rv/cMBCBdpo+Du+ripzg+33RlAk7q/qFQV+AjeGE76F6vozJGVK HW6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zpjsljtV36eW22jKsBjcgvjXKE5SZZrozCSm2JOo928=; b=YlK/sgXOJGu9khEJegXw5UXcAOSMNFSupBqyKq883Y51FvhxK0SNQvDC02+HLOorEc EBGpIKxW2TsmsCK63EM/X9liH4/iFCL/2jmnptU7wzb0LTlcj/ChRzuUEy824saDCUuC Tes7tPMatqocJRonubyrPKpIup21FaRK0PKn/Nh0/TZpsSDIHYM4nABMTg6mvJGYpC19 0tVi6qgYuvUYCNmW/jq7VKYfrrcO2f8yPAdv8CQCSGxa8Jc1Cx+v0Ee1W0WCSPvUuMic +bzj/zvDQVoYozVoXadWUS0JBora5LuKmI4GAuYpo+nVCUtzd1UABtEjb56EqZhIVmY0 s1IA== X-Gm-Message-State: AOAM531izeRQHe//8wecU0OPjvcTPqb0PbbmZPNmUrgbKtO9AElr7wK6 TaMWfRO0Q5Ea3TOrJPP5tZIKJA== X-Received: by 2002:a19:ee14:: with SMTP id g20mr2189420lfb.378.1603320668861; Wed, 21 Oct 2020 15:51:08 -0700 (PDT) Received: from eriador.lan ([188.162.64.195]) by smtp.gmail.com with ESMTPSA id h11sm652062ljc.21.2020.10.21.15.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:51:08 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Pavel Machek , Dan Murphy Cc: Rob Herring , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Date: Thu, 22 Oct 2020 01:50:57 +0300 Message-Id: <20201021225100.162795-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021225100.162795-1-dmitry.baryshkov@linaro.org> References: <20201021225100.162795-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add support for the LPG/PWM block found on newer PMICs: PM8150B and PM8150A/L. Signed-off-by: Dmitry Baryshkov --- drivers/leds/leds-qcom-lpg.c | 68 ++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 7 deletions(-) -- 2.28.0 diff --git a/drivers/leds/leds-qcom-lpg.c b/drivers/leds/leds-qcom-lpg.c index 86131a65d2c5..4d24e0c973d6 100644 --- a/drivers/leds/leds-qcom-lpg.c +++ b/drivers/leds/leds-qcom-lpg.c @@ -48,6 +48,8 @@ struct lpg_data; * @lut_bitmap: allocation bitmap for LUT entries * @triled_base: base address of the TRILED block (optional) * @triled_src: power-source for the TRILED + * @triled_no_atc_ctl: true if there is no TRI_LED_ATC_CTL register + * @triled_no_src_sel: true if there is no TRI_LED_SRC_SEL register * @channels: list of PWM channels * @num_channels: number of @channels */ @@ -65,6 +67,8 @@ struct lpg { u32 triled_base; u32 triled_src; + bool triled_no_atc_ctl; + bool triled_no_src_sel; struct lpg_channel *channels; unsigned int num_channels; @@ -165,6 +169,8 @@ struct lpg_channel_data { * @lut_base: base address of LUT block * @lut_size: number of entries in LUT * @triled_base: base address of TRILED + * @triled_no_atc_ctl: true if there is no TRI_LED_ATC_CTL register + * @triled_no_src_sel: true if there is no TRI_LED_SRC_SEL register * @pwm_9bit_mask: bitmask for switching from 6bit to 9bit pwm * @num_channels: number of channels in LPG * @channels: list of channel initialization data @@ -173,6 +179,8 @@ struct lpg_data { unsigned int lut_base; unsigned int lut_size; unsigned int triled_base; + bool triled_no_atc_ctl; + bool triled_no_src_sel; unsigned int pwm_9bit_mask; int num_channels; struct lpg_channel_data *channels; @@ -986,18 +994,24 @@ static int lpg_init_triled(struct lpg *lpg) return 0; lpg->triled_base = lpg->data->triled_base; - - ret = of_property_read_u32(np, "qcom,power-source", &lpg->triled_src); - if (ret || lpg->triled_src == 2 || lpg->triled_src > 3) { - dev_err(lpg->dev, "invalid power source\n"); - return -EINVAL; + lpg->triled_no_atc_ctl = lpg->data->triled_no_atc_ctl; + lpg->triled_no_src_sel = lpg->data->triled_no_src_sel; + + if (!lpg->triled_no_src_sel) { + ret = of_property_read_u32(np, "qcom,power-source", &lpg->triled_src); + if (ret || lpg->triled_src == 2 || lpg->triled_src > 3) { + dev_err(lpg->dev, "invalid power source\n"); + return -EINVAL; + } } /* Disable automatic trickle charge LED */ - regmap_write(lpg->map, lpg->triled_base + TRI_LED_ATC_CTL, 0); + if (!lpg->triled_no_atc_ctl) + regmap_write(lpg->map, lpg->triled_base + TRI_LED_ATC_CTL, 0); /* Configure power source */ - regmap_write(lpg->map, lpg->triled_base + TRI_LED_SRC_SEL, lpg->triled_src); + if (!lpg->triled_no_src_sel) + regmap_write(lpg->map, lpg->triled_base + TRI_LED_SRC_SEL, lpg->triled_src); /* Default all outputs to off */ regmap_write(lpg->map, lpg->triled_base + TRI_LED_EN_CTL, 0); @@ -1166,12 +1180,52 @@ static const struct lpg_data pmi8998_lpg_data = { }, }; +static const struct lpg_data pm8150b_lpg_data = { + .lut_base = 0xb000, + .lut_size = 49, + + .triled_base = 0xd000, + .triled_no_atc_ctl = true, + .triled_no_src_sel = true, + + .pwm_9bit_mask = BIT(4), + + .num_channels = 2, + .channels = (struct lpg_channel_data[]) { + { .base = 0xb100, .triled_mask = BIT(7) }, + { .base = 0xb200, .triled_mask = BIT(6) }, + }, +}; + +static const struct lpg_data pm8150l_lpg_data = { + .lut_base = 0xb000, + .lut_size = 49, + + .triled_base = 0xd000, + .triled_no_atc_ctl = true, + .triled_no_src_sel = true, + + .pwm_9bit_mask = BIT(4), + + .num_channels = 5, + .channels = (struct lpg_channel_data[]) { + { .base = 0xb100, .triled_mask = BIT(7) }, + { .base = 0xb200, .triled_mask = BIT(6) }, + { .base = 0xb300, .triled_mask = BIT(5) }, + { .base = 0xbc00 }, + { .base = 0xbd00 }, + + }, +}; + static const struct of_device_id lpg_of_table[] = { { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data }, { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data }, { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data }, { .compatible = "qcom,pmi8994-lpg", .data = &pmi8994_lpg_data }, { .compatible = "qcom,pmi8998-lpg", .data = &pmi8998_lpg_data }, + { .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data }, + { .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data }, {} }; MODULE_DEVICE_TABLE(of, lpg_of_table); From patchwork Wed Oct 21 22:50:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 318889 Delivered-To: patch@linaro.org Received: by 2002:a92:d1d1:0:0:0:0:0 with SMTP id u17csp2566411ilg; Wed, 21 Oct 2020 15:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIgQGYNKleUlWN2Ji9d/8sCxd9RMZhSF4V7q6xCTwZB1FJT09lFOs+Ynqv4iWIpHquaaY9 X-Received: by 2002:a05:6402:31b3:: with SMTP id dj19mr5331368edb.210.1603320678179; Wed, 21 Oct 2020 15:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603320678; cv=none; d=google.com; s=arc-20160816; b=rCz8ypcFOUNYsa7auLU6DV0cySSeC5bMsOoJx8eWK5R/a0rA1Vi+jriKmuAse9rssy FAWHuRGj0/zg8NaMvupqJdyBC1RWWww/y2I/w7Oj0/upqw76eey84gIx7TJrIBNPDKNC B/hfEpyQR4nCsizKocYVb0vYhG+eksMYLIoytbWPtkLdmMb0QEiZhE2V8Nr1/QNyYJX7 i91v5hOGvtdzIO5ywOiTVU8LTBXE8FCHU7U6dfKMaOSoZIrOGqvHcMOQGcM6Mv6U0FQ3 WPHXyXPQyt78HNUlPvMyTspDK4pn4IxRV8mbdkfwGW/RKVjKi5VuoTA8KHnOcf2VCY0q kKZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y68c1c7Z13VLVISWQSjGtMfYfdgX0kCBgReV2FtuTdM=; b=cEwwMgA5276hBXD5dnU2oZkU5WojALxeXJXQxi3XngHkgC4qpRjgP9Ejn+0vDhUzBR XdvGwH31eEjOaxDT1vfNKhp++SEdBwJuKkJ5Ssv3yp1LasaJwj7Cp8eg30dkG1SJvJox rJ2B4KwN1vHV19b2N6AZ/wh159nmmtJ6mnOlSA61t7MqwhS+MmiQkJIa+By83S8WIZSx uz7aZVpths69NQGCE2XvhdNlzv4cV22UpM5dEpLh2oEZ4BhApqOQfygy1BrUHkdqIKJr g67UCfFqANzyRidoUIvPd++7atRl9Ap5ktf2ccRWJbJNv4yo+EwfykLeq5RtqZflP0Ny zIDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mMYojLC4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si1055346edr.505.2020.10.21.15.51.18; Wed, 21 Oct 2020 15:51:18 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mMYojLC4; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2506932AbgJUWvO (ORCPT + 6 others); Wed, 21 Oct 2020 18:51:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2506931AbgJUWvO (ORCPT ); Wed, 21 Oct 2020 18:51:14 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F6C0C0613D2 for ; Wed, 21 Oct 2020 15:51:13 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id h6so5209232lfj.3 for ; Wed, 21 Oct 2020 15:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y68c1c7Z13VLVISWQSjGtMfYfdgX0kCBgReV2FtuTdM=; b=mMYojLC4y7LhWFZ4HHoDPGU7gF894ny2E2sByf3XJyfbQ8dXJ5y50Py2imnmaBNCEl 2eHj/pu/bMM8PHskEfAJL/y6Q5T3LUqAyJh5FGnNsmT1gohNN+uLPByBNe7QLNcDWQgv KHFBNupcplqe6jduKdvG408ANXfIaU8aVe9hpvWpBRdXgCw123z1YP/b4d+fsY/SJHoF gCO3n/RonRvdNuUE7SLivYTwdtZfBPJagk8cH4PB6mZDVNW1RTSpxxxGOab0UvseG/ve t3PnoLVJHYoURRMrrRqfIzyDtSnV3crQtJckg9OpMU/wVvisE49a3wabkUgGohOrCzoq fXDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y68c1c7Z13VLVISWQSjGtMfYfdgX0kCBgReV2FtuTdM=; b=sgfL+xFV8FQ1+XElsLbgEeHmhKTPtB3PZgV7NW//otTuhbq0X1cp5zl8gZYamhqE3v tCOW6s42t6FpJIz1wclWZs6qNGtaymymyP0eD59d/9O7o6FPxHEY1rC3aJSJhqljt4BR TMywpyD1dBo/fSSnViBeKLhSUipk7f/DYXamHCW31gk0c2vKuSFN7icKAv1PowmYN37Y PdHhrHTg8saOk3UzZlAeiXwzF2gi/7luyU+6QS/S6CpDEkczKwEApgwz6WEJ7Toxjs7p pFlT1OXiS8wOr8mS46MGTgQFt6LC+CKm0m844xvKsTQfYoBBFAPCisQZ1lvdCNyILpX2 j1Kg== X-Gm-Message-State: AOAM532s/mRB1RPhH6dI98Ixref4D/aOyLXu3PGKOJZtl5i6dHQvPZyZ p8A3GeRUjnKS+ET+g3pc1N7AJQ== X-Received: by 2002:a19:c3cf:: with SMTP id t198mr1831682lff.461.1603320672111; Wed, 21 Oct 2020 15:51:12 -0700 (PDT) Received: from eriador.lan ([188.162.64.195]) by smtp.gmail.com with ESMTPSA id h11sm652062ljc.21.2020.10.21.15.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 15:51:11 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Pavel Machek , Dan Murphy Cc: Rob Herring , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 4/5] arm64: dts: pm8150l: add Light Pulse Generator device node Date: Thu, 22 Oct 2020 01:50:59 +0300 Message-Id: <20201021225100.162795-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201021225100.162795-1-dmitry.baryshkov@linaro.org> References: <20201021225100.162795-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add device node defining LPG/PWM block on PM8150L PMIC chip. Signed-off-by: Dmitry Baryshkov --- arch/arm64/boot/dts/qcom/pm8150l.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.28.0 diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi index 9f214ceec2b7..e8926d6c32cb 100644 --- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi @@ -114,5 +114,15 @@ pmic@5 { reg = <0x5 SPMI_USID>; #address-cells = <1>; #size-cells = <0>; + + pm8150l_lpg: lpg { + compatible = "qcom,pm8150l-lpg"; + + #address-cells = <1>; + #size-cells = <0>; + + status = "disabled"; + }; + }; };