From nobody Wed Feb 11 01:09:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAF9AC76188 for ; Wed, 5 Apr 2023 17:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232951AbjDERPP (ORCPT ); Wed, 5 Apr 2023 13:15:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231280AbjDERPH (ORCPT ); Wed, 5 Apr 2023 13:15:07 -0400 Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A27CB2; Wed, 5 Apr 2023 10:15:04 -0700 (PDT) Received: by mail-qv1-xf2f.google.com with SMTP id cu4so26661954qvb.3; Wed, 05 Apr 2023 10:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680714903; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=NmWjp1WFSH1Z18O7dKkAHmW0FKJldpCbVGltErgPl7A=; b=qzalmI/Wjgc4RNBYA61mVjJMwDCC7p4gfR9VNjpBi1F2hL7u9H3f0wPrSPJZezJreJ MzTzNZ3rpEEG80XyaIH3AjYouDMK9dv3uspX/tMLVdvKjBFCYgFqJ2AgoIFnu/hfLzas lrETsmS5Yopdn+XuxbvfcFyU+HdUpOa6ztn/pg+JOVDI65Cih7BbK33/IOTTtcNLbztO ky3EM6ddJruP4wLuL4fNz3p8PPIgTguuW76DgLJwNSAWuJC1Yw6bmUVVJAuGjNjZyRO/ DDKs6UHgot2mlYYNzeOluFNtEWvEzpxHD7p6T1bckhS7SVCy7e1IjbWRdSzTJjp2LI1A th6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680714903; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NmWjp1WFSH1Z18O7dKkAHmW0FKJldpCbVGltErgPl7A=; b=Iqxb+N4i8g4YLvD4Oj/A0nMETbNO1qmgfEudg3yAaigap5BumR6A7xywp4wcgOSf88 dxFIs05UiAjDcWAVAF7bNG8aHLY3ntK4hOd1/NpwPyGUYAywwWC9N/+MLVuiQAD80lJr 1mYuxjbjsgFuMEI1RyN0MBm5ZsYwKKkClkWwBXy/naAOshXs5ubMMJXqhFLWIVD+LOC6 dNmFAmhKY5v3m1lSM2S/ui0Clh2xdKTkN2muy2Jq+ao9NUrKnvZZvQ/5505QKRPfdT5g Xla0PcAz9ZBXo2lQLWuTa2wmXC6fKVfNvm97SNrLf5INzS3LytISwUtcUv79PagvE1Qv SQCA== X-Gm-Message-State: AAQBX9fswSDcs1HHCpCS7GQwTbA/W1fjWteTWZqPXRnos49+NduWzYPw iB+hWpw8WDpNK4E8ckAowUk= X-Google-Smtp-Source: AKy350a54+2SsGhkwHs5I0YLIayUj5seTSMdskIpd+YAtzIN3tHnWjMxrgVfUS43ekUHZgpnp67pLg== X-Received: by 2002:a05:6214:29e8:b0:5bf:370e:f446 with SMTP id jv8-20020a05621429e800b005bf370ef446mr9763539qvb.17.1680714903611; Wed, 05 Apr 2023 10:15:03 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id ct9-20020a056214178900b005dd8b934571sm4403209qvb.9.2023.04.05.10.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 10:15:03 -0700 (PDT) From: Benjamin Bara Date: Wed, 05 Apr 2023 19:14:34 +0200 Subject: [PATCH v3 1/3] regulator: da9063: add voltage monitoring registers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230403-da9063-disable-unused-v3-1-cc4dc698864c@skidata.com> References: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> In-Reply-To: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> To: Support Opensource , Liam Girdwood , Mark Brown , Lee Jones , Rob Herring , Krzysztof Kozlowski , Steve Twiss Cc: DLG-Adam.Thomson.Opensource@dm.renesas.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Matti Vaittinen , Benjamin Bara , Matti Vaittinen X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Bara Add the definitions for the registers responsible for voltage monitoring. Add a voltage monitor enable bitfield per regulator. Reviewed-by: Matti Vaittinen Signed-off-by: Benjamin Bara --- drivers/regulator/da9063-regulator.c | 29 +++++++++++++++++++++++++++++ include/linux/mfd/da9063/registers.h | 23 +++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da906= 3-regulator.c index 82f52a2a031a..1c720fc595b3 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -83,6 +83,9 @@ struct da9063_regulator_info { =20 /* DA9063 event detection bit */ struct reg_field oc_event; + + /* DA9063 voltage monitor bit */ + struct reg_field vmon; }; =20 /* Macros for LDO */ @@ -148,6 +151,7 @@ struct da9063_regulator { struct regmap_field *suspend; struct regmap_field *sleep; struct regmap_field *suspend_sleep; + struct regmap_field *vmon; }; =20 /* Encapsulates all information for the regulators driver */ @@ -581,36 +585,42 @@ static const struct da9063_regulator_info da9063_regu= lator_info[] =3D { da9063_buck_a_limits, DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BCORE1), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN), }, { DA9063_BUCK(DA9063, BCORE2, 300, 10, 1570, da9063_buck_a_limits, DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BCORE2), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE2_MON_EN), }, { DA9063_BUCK(DA9063, BPRO, 530, 10, 1800, da9063_buck_a_limits, DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BPRO), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPRO_MON_EN), }, { DA9063_BUCK(DA9063, BMEM, 800, 20, 3340, da9063_buck_b_limits, DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BMEM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN), }, { DA9063_BUCK(DA9063, BIO, 800, 20, 3340, da9063_buck_b_limits, DA9063_REG_BUCK_ILIM_A, DA9063_BIO_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BIO), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BIO_MON_EN), }, { DA9063_BUCK(DA9063, BPERI, 800, 20, 3340, da9063_buck_b_limits, DA9063_REG_BUCK_ILIM_B, DA9063_BPERI_ILIM_MASK), DA9063_BUCK_COMMON_FIELDS(BPERI), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPERI_MON_EN), }, { DA9063_BUCK(DA9063, BCORES_MERGED, 300, 10, 1570, @@ -618,6 +628,7 @@ static const struct da9063_regulator_info da9063_regula= tor_info[] =3D { DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK), /* BCORES_MERGED uses the same register fields as BCORE1 */ DA9063_BUCK_COMMON_FIELDS(BCORE1), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN), }, { DA9063_BUCK(DA9063, BMEM_BIO_MERGED, 800, 20, 3340, @@ -625,47 +636,59 @@ static const struct da9063_regulator_info da9063_regu= lator_info[] =3D { DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK), /* BMEM_BIO_MERGED uses the same register fields as BMEM */ DA9063_BUCK_COMMON_FIELDS(BMEM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN), }, { DA9063_LDO(DA9063, LDO3, 900, 20, 3440), .oc_event =3D BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO3_MON_EN), }, { DA9063_LDO(DA9063, LDO7, 900, 50, 3600), .oc_event =3D BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO7_MON_EN), }, { DA9063_LDO(DA9063, LDO8, 900, 50, 3600), .oc_event =3D BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO8_MON_EN), }, { DA9063_LDO(DA9063, LDO9, 950, 50, 3600), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO9_MON_EN), }, { DA9063_LDO(DA9063, LDO11, 900, 50, 3600), .oc_event =3D BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO11_MON_EN), }, =20 /* The following LDOs are present only on DA9063, not on DA9063L */ { DA9063_LDO(DA9063, LDO1, 600, 20, 1860), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO1_MON_EN), }, { DA9063_LDO(DA9063, LDO2, 600, 20, 1860), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO2_MON_EN), }, { DA9063_LDO(DA9063, LDO4, 900, 20, 3440), .oc_event =3D BFIELD(DA9063_REG_STATUS_D, DA9063_LDO4_LIM), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO4_MON_EN), }, { DA9063_LDO(DA9063, LDO5, 900, 50, 3600), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO5_MON_EN), }, { DA9063_LDO(DA9063, LDO6, 900, 50, 3600), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO6_MON_EN), }, =20 { DA9063_LDO(DA9063, LDO10, 900, 50, 3600), + .vmon =3D BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO10_MON_EN), }, }; =20 @@ -932,6 +955,12 @@ static int da9063_regulator_probe(struct platform_devi= ce *pdev) if (IS_ERR(regl->suspend_sleep)) return PTR_ERR(regl->suspend_sleep); } + if (regl->info->vmon.reg) { + regl->vmon =3D devm_regmap_field_alloc(&pdev->dev, + da9063->regmap, regl->info->vmon); + if (IS_ERR(regl->vmon)) + return PTR_ERR(regl->vmon); + } =20 /* Register regulator */ memset(&config, 0, sizeof(config)); diff --git a/include/linux/mfd/da9063/registers.h b/include/linux/mfd/da906= 3/registers.h index 6e0f66a2e727..7b8364bd08a0 100644 --- a/include/linux/mfd/da9063/registers.h +++ b/include/linux/mfd/da9063/registers.h @@ -1040,6 +1040,29 @@ /* DA9063_REG_CONFIG_J (addr=3D0x10F) */ #define DA9063_TWOWIRE_TO 0x40 =20 +/* DA9063_REG_MON_REG_2 (addr=3D0x115) */ +#define DA9063_LDO1_MON_EN 0x01 +#define DA9063_LDO2_MON_EN 0x02 +#define DA9063_LDO3_MON_EN 0x04 +#define DA9063_LDO4_MON_EN 0x08 +#define DA9063_LDO5_MON_EN 0x10 +#define DA9063_LDO6_MON_EN 0x20 +#define DA9063_LDO7_MON_EN 0x40 +#define DA9063_LDO8_MON_EN 0x80 + +/* DA9063_REG_MON_REG_3 (addr=3D0x116) */ +#define DA9063_LDO9_MON_EN 0x01 +#define DA9063_LDO10_MON_EN 0x02 +#define DA9063_LDO11_MON_EN 0x04 + +/* DA9063_REG_MON_REG_4 (addr=3D0x117) */ +#define DA9063_BCORE1_MON_EN 0x04 +#define DA9063_BCORE2_MON_EN 0x08 +#define DA9063_BPRO_MON_EN 0x10 +#define DA9063_BIO_MON_EN 0x20 +#define DA9063_BMEM_MON_EN 0x40 +#define DA9063_BPERI_MON_EN 0x80 + /* DA9063_REG_MON_REG_5 (addr=3D0x116) */ #define DA9063_MON_A8_IDX_MASK 0x07 #define DA9063_MON_A8_IDX_NONE 0x00 --=20 2.34.1 From nobody Wed Feb 11 01:09:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34D33C76188 for ; Wed, 5 Apr 2023 17:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbjDERPS (ORCPT ); Wed, 5 Apr 2023 13:15:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbjDERPI (ORCPT ); Wed, 5 Apr 2023 13:15:08 -0400 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2BED5B81; Wed, 5 Apr 2023 10:15:06 -0700 (PDT) Received: by mail-qv1-xf31.google.com with SMTP id ev7so7622773qvb.5; Wed, 05 Apr 2023 10:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680714906; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=t1MNaffuvyVWLXyLQ6lRNzfTJfcAUGjlFHNhQFdXp8E=; b=necvQ0RUkjIYKGcUKjnlMsbAs/R7KTYbS1sbZjsMBWTmc3Cdfs9FdRAJJSpnS0SR1Q uXlN/daZrSLE77aAF9x4bRtegwHo7n0Gs5fzxuXzk6Gs7cn8SNLI4z6HLXXaGGgCXL+S n8gyLeyOqitneWHgm7Qlk7GnGcEJnL2JpcJAHqkHu0kbrM6D/mGGgnfF3Zj89t0BWw0S KCs172JHRuSg5zv68dt9Yo1a8ZqK4SdLH3HAy6wGej64TIzWZw9JeV5KH+rJ92QbKLWB E+1ixS8JWRtJpIPK+tJ1TdJECMXpq6UYYmKIidPzD4yNWM56UFwuB6LLRLreWAgdlh7r EW4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680714906; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t1MNaffuvyVWLXyLQ6lRNzfTJfcAUGjlFHNhQFdXp8E=; b=OmvncK3lbHAycK1xQyi169byNWie7zXa4sH2iA2PQFPLuh2ZZ04rksqiVmqEtdFSvL A8Cfg4MuNCOCsYbmwsfXuF2WhRJuKXDYOwzxp2uw2AIpuC4r18bp0vJKPn/rjBbqT4S4 gqcQBw78J4J0bznt2bwuBKQAHzH373CB0XWEGSS6EZYo7ePI5c5RPUQm2cqBYwZ0pXGP yEZEKxaOZ0s74S+vTmljNm8Vq8aIBnnpr3UA+UhzrirxRW7Rgs+YlapspTaE9szhqCOO s6okKm3+U/nLcZgFk/hoNLcmile+Ua4qYBtCp+Vd0Pj/q16xzOuCuqOUvV4Lci83EsCm zwjw== X-Gm-Message-State: AAQBX9fwgt0tTWfbOj1J1LhuuRjf2I2hcOok737fSMQmTylfZZYVv4Jz J/xB0ahvhzPWXlmYzqGF0WQ= X-Google-Smtp-Source: AKy350YlHpc02j134uiYYqVZUGxmMtILdAdYv/lYdSIAkwIo9ggXiUZm2l2czpnCD8hN/0JpkZd/rA== X-Received: by 2002:a05:6214:2401:b0:5db:4e49:b2bd with SMTP id fv1-20020a056214240100b005db4e49b2bdmr6544289qvb.18.1680714905746; Wed, 05 Apr 2023 10:15:05 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id ct9-20020a056214178900b005dd8b934571sm4403209qvb.9.2023.04.05.10.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 10:15:05 -0700 (PDT) From: Benjamin Bara Date: Wed, 05 Apr 2023 19:14:35 +0200 Subject: [PATCH v3 2/3] regulator: da9063: implement setter for voltage monitoring MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230403-da9063-disable-unused-v3-2-cc4dc698864c@skidata.com> References: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> In-Reply-To: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> To: Support Opensource , Liam Girdwood , Mark Brown , Lee Jones , Rob Herring , Krzysztof Kozlowski , Steve Twiss Cc: DLG-Adam.Thomson.Opensource@dm.renesas.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Matti Vaittinen , Benjamin Bara X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Bara Allow to en- and disable voltage monitoring from the device tree. Consider that the da9063 only monitors under- *and* over-voltage together, so both must be set to the same severity and value. Signed-off-by: Benjamin Bara --- drivers/regulator/da9063-regulator.c | 118 ++++++++++++++++++++++++++-----= ---- 1 file changed, 90 insertions(+), 28 deletions(-) diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da906= 3-regulator.c index 1c720fc595b3..6f1d77e486fc 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c @@ -207,6 +207,24 @@ static const unsigned int da9063_bmem_bio_merged_limit= s[] =3D { 4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000 }; =20 +static int da9063_set_xvp(struct regulator_dev *rdev, int lim_uV, int seve= rity, bool enable) +{ + struct da9063_regulator *regl =3D rdev_get_drvdata(rdev); + struct device *dev =3D regl->hw->dev; + + dev_dbg(dev, "%s: lim: %d, sev: %d, en: %d\n", regl->desc.name, lim_uV, s= everity, enable); + + /* + * only support enable and disable. + * the da9063 offers a GPIO (GP_FB2) which is unasserted if an XV happens. + * therefore ignore severity here, as there might be handlers in hardware. + */ + if (lim_uV) + return -EINVAL; + + return regmap_field_write(regl->vmon, enable ? 1 : 0); +} + static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned int m= ode) { struct da9063_regulator *regl =3D rdev_get_drvdata(rdev); @@ -545,37 +563,41 @@ static int da9063_buck_get_current_limit(struct regul= ator_dev *rdev) } =20 static const struct regulator_ops da9063_buck_ops =3D { - .enable =3D regulator_enable_regmap, - .disable =3D regulator_disable_regmap, - .is_enabled =3D regulator_is_enabled_regmap, - .get_voltage_sel =3D regulator_get_voltage_sel_regmap, - .set_voltage_sel =3D regulator_set_voltage_sel_regmap, - .list_voltage =3D regulator_list_voltage_linear, - .set_current_limit =3D da9063_buck_set_current_limit, - .get_current_limit =3D da9063_buck_get_current_limit, - .set_mode =3D da9063_buck_set_mode, - .get_mode =3D da9063_buck_get_mode, - .get_status =3D da9063_buck_get_status, - .set_suspend_voltage =3D da9063_set_suspend_voltage, - .set_suspend_enable =3D da9063_suspend_enable, - .set_suspend_disable =3D da9063_suspend_disable, - .set_suspend_mode =3D da9063_buck_set_suspend_mode, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .list_voltage =3D regulator_list_voltage_linear, + .set_current_limit =3D da9063_buck_set_current_limit, + .get_current_limit =3D da9063_buck_get_current_limit, + .set_mode =3D da9063_buck_set_mode, + .get_mode =3D da9063_buck_get_mode, + .get_status =3D da9063_buck_get_status, + .set_suspend_voltage =3D da9063_set_suspend_voltage, + .set_suspend_enable =3D da9063_suspend_enable, + .set_suspend_disable =3D da9063_suspend_disable, + .set_suspend_mode =3D da9063_buck_set_suspend_mode, + .set_over_voltage_protection =3D da9063_set_xvp, + .set_under_voltage_protection =3D da9063_set_xvp, }; =20 static const struct regulator_ops da9063_ldo_ops =3D { - .enable =3D regulator_enable_regmap, - .disable =3D regulator_disable_regmap, - .is_enabled =3D regulator_is_enabled_regmap, - .get_voltage_sel =3D regulator_get_voltage_sel_regmap, - .set_voltage_sel =3D regulator_set_voltage_sel_regmap, - .list_voltage =3D regulator_list_voltage_linear, - .set_mode =3D da9063_ldo_set_mode, - .get_mode =3D da9063_ldo_get_mode, - .get_status =3D da9063_ldo_get_status, - .set_suspend_voltage =3D da9063_set_suspend_voltage, - .set_suspend_enable =3D da9063_suspend_enable, - .set_suspend_disable =3D da9063_suspend_disable, - .set_suspend_mode =3D da9063_ldo_set_suspend_mode, + .enable =3D regulator_enable_regmap, + .disable =3D regulator_disable_regmap, + .is_enabled =3D regulator_is_enabled_regmap, + .get_voltage_sel =3D regulator_get_voltage_sel_regmap, + .set_voltage_sel =3D regulator_set_voltage_sel_regmap, + .list_voltage =3D regulator_list_voltage_linear, + .set_mode =3D da9063_ldo_set_mode, + .get_mode =3D da9063_ldo_get_mode, + .get_status =3D da9063_ldo_get_status, + .set_suspend_voltage =3D da9063_set_suspend_voltage, + .set_suspend_enable =3D da9063_suspend_enable, + .set_suspend_disable =3D da9063_suspend_disable, + .set_suspend_mode =3D da9063_ldo_set_suspend_mode, + .set_over_voltage_protection =3D da9063_set_xvp, + .set_under_voltage_protection =3D da9063_set_xvp, }; =20 /* Info of regulators for DA9063 */ @@ -749,6 +771,41 @@ static const struct regulator_init_data *da9063_get_re= gulator_initdata( return NULL; } =20 +static int da9063_check_xvp_constraints(struct regulator_config *config) +{ + struct da9063_regulator *regl =3D config->driver_data; + const struct regulation_constraints *constr =3D &config->init_data->const= raints; + const struct notification_limit *uv_l =3D &constr->under_voltage_limits; + const struct notification_limit *ov_l =3D &constr->over_voltage_limits; + + /* make sure that only one severity is used to clarify if unchanged, enab= led or disabled */ + if ((!!uv_l->prot + !!uv_l->err + !!uv_l->warn) > 1) { + dev_err(config->dev, "%s: at most one voltage monitoring severity allowe= d!\n", + regl->desc.name); + return -EINVAL; + } + + /* make sure that UV and OV monitoring is set to the same severity and va= lue */ + if (uv_l->prot !=3D ov_l->prot) { + dev_err(config->dev, + "%s: protection-microvolt: value must be equal for uv and ov!\n", + regl->desc.name); + return -EINVAL; + } + if (uv_l->err !=3D ov_l->err) { + dev_err(config->dev, "%s: error-microvolt: value must be equal for uv an= d ov!\n", + regl->desc.name); + return -EINVAL; + } + if (uv_l->warn !=3D ov_l->warn) { + dev_err(config->dev, "%s: warn-microvolt: value must be equal for uv and= ov!\n", + regl->desc.name); + return -EINVAL; + } + + return 0; +} + static struct of_regulator_match da9063_matches[] =3D { [DA9063_ID_BCORE1] =3D { .name =3D "bcore1" }, [DA9063_ID_BCORE2] =3D { .name =3D "bcore2" }, @@ -970,6 +1027,11 @@ static int da9063_regulator_probe(struct platform_dev= ice *pdev) if (da9063_reg_matches) config.of_node =3D da9063_reg_matches[id].of_node; config.regmap =3D da9063->regmap; + + ret =3D da9063_check_xvp_constraints(&config); + if (ret) + return ret; + regl->rdev =3D devm_regulator_register(&pdev->dev, ®l->desc, &config); if (IS_ERR(regl->rdev)) { --=20 2.34.1 From nobody Wed Feb 11 01:09:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D30DDC76188 for ; Wed, 5 Apr 2023 17:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233195AbjDERPV (ORCPT ); Wed, 5 Apr 2023 13:15:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232849AbjDERPK (ORCPT ); Wed, 5 Apr 2023 13:15:10 -0400 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A1D5FEA; Wed, 5 Apr 2023 10:15:08 -0700 (PDT) Received: by mail-qv1-xf2b.google.com with SMTP id oe8so26618464qvb.6; Wed, 05 Apr 2023 10:15:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680714908; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gamUfoyodxPtqgS+QEeMjD5K0L0HZ7BreqQVvBsNAbU=; b=Tgn3bE/RkoAuugsPHfEFEIbp9Xh97c22wBARynaD9+0nsCtchdlZ9ez5matvPzkgt6 fe0iQfR/mnQRE6LE1qeiKIaggzBM1lr5oEyD0SmXXUEe0iXFR9E+W0N/tno//4ievGNz QTQN81oQfxogDQobR8mNfMhTOU4pLoyc2M8fUjDSRM/c3m8HHp69QaGPab5qzQ0TI5Eh oRQDgvYRiBFe4mVokxcaUZUHtCUod3Evk5sgz8V5xe9pxCQq8wbkypIQdA5Hx3Pl6ay0 avtwCviZQ14zMPNl7wGpyojOnD8sfYBlW6sqeV7Ew8bpGpAmuSxY6dn2D3r0G/K88UV4 W7Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680714908; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gamUfoyodxPtqgS+QEeMjD5K0L0HZ7BreqQVvBsNAbU=; b=jpNGZZVWpAfP+e4KuPXDozFJKgtHRTZ4AA7hrb3d3yHcHekjVQ0MGkeRyrVCGk756X 0UewrCl8HwXgFN6bPd8gfiP051/4omOVP9Lono21bfjJBRkS4VIjQ05yYw5ZU+JMZAan boEeqVRfJHNVqW0AxakM3etOM/5vH3W2q+rIxrmb/HPy0gv3SRejCV9xhcaamTQIkvny KEvl3pMuR9yJL9Q1JHBYhdaAb2y4T1Az3pzjBfFbDfFqHz/e2ojqy2XjflOa6frS36oG otsEezw1m/nHgRNkPRo+DvvuGz2YVWzUUCAZqYL0tSdSE+TC1UMbxlbnVV5gnYufuEdX N07w== X-Gm-Message-State: AAQBX9ckqR/Cyyy46IbjBX/2gIVFFlRmSv35bQF32R6HZrgV8KlNaRWI AgTMLUEpwvqBI0wrbtQsK+Y= X-Google-Smtp-Source: AKy350Y+N+2gOHDAcZpIFMRGUeY30FdWItt9poT0Ac3IlRAvy5o1HvuIrCc52f20InyjGC/iF1QHxA== X-Received: by 2002:a05:6214:1315:b0:5aa:6130:7c63 with SMTP id pn21-20020a056214131500b005aa61307c63mr12775504qvb.46.1680714907937; Wed, 05 Apr 2023 10:15:07 -0700 (PDT) Received: from [127.0.1.1] ([91.230.2.244]) by smtp.gmail.com with ESMTPSA id ct9-20020a056214178900b005dd8b934571sm4403209qvb.9.2023.04.05.10.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 10:15:07 -0700 (PDT) From: Benjamin Bara Date: Wed, 05 Apr 2023 19:14:36 +0200 Subject: [PATCH v3 3/3] dt-bindings: mfd: dlg,da9063: document voltage monitoring MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20230403-da9063-disable-unused-v3-3-cc4dc698864c@skidata.com> References: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> In-Reply-To: <20230403-da9063-disable-unused-v3-0-cc4dc698864c@skidata.com> To: Support Opensource , Liam Girdwood , Mark Brown , Lee Jones , Rob Herring , Krzysztof Kozlowski , Steve Twiss Cc: DLG-Adam.Thomson.Opensource@dm.renesas.com, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Matti Vaittinen , Benjamin Bara X-Mailer: b4 0.12.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Bara Document that the da9063 only provides under- *and* over-voltage monitoring in one, and therefore requires both to be configured with the same severity and value. Add an example for clarification. Signed-off-by: Benjamin Bara Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/mfd/dlg,da9063.yaml | 17 +++++++++++++++= -- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mfd/dlg,da9063.yaml b/Docume= ntation/devicetree/bindings/mfd/dlg,da9063.yaml index e8e74e91070c..c5a7e10d7d80 100644 --- a/Documentation/devicetree/bindings/mfd/dlg,da9063.yaml +++ b/Documentation/devicetree/bindings/mfd/dlg,da9063.yaml @@ -12,6 +12,11 @@ maintainers: description: | For device-tree bindings of other sub-modules refer to the binding docum= ents under the respective sub-system directories. + Using regulator-{uv,ov}-{warn,error,protection}-microvolt requires speci= al + handling: First, when GP_FB2 is used, it must be ensured that there is no + moment where all voltage monitors are disabled. Next, as da9063 only sup= ports + UV *and* OV monitoring, both must be set to the same severity and value + (0: disable, 1: enable). =20 properties: compatible: @@ -121,11 +126,19 @@ examples: regulator-max-microamp =3D <2000000>; regulator-boot-on; }; + ldo6 { + /* UNUSED */ + regulator-name =3D "LDO_6"; + regulator-uv-protection-microvolt =3D <0>; + regulator-ov-protection-microvolt =3D <0>; + }; ldo11 { regulator-name =3D "LDO_11"; regulator-min-microvolt =3D <900000>; - regulator-max-microvolt =3D <3600000>; - regulator-boot-on; + regulator-max-microvolt =3D <900000>; + regulator-uv-protection-microvolt =3D <1>; + regulator-ov-protection-microvolt =3D <1>; + regulator-always-on; }; }; }; --=20 2.34.1