From patchwork Mon Apr 26 22:14:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 427553 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4087233jao; Mon, 26 Apr 2021 15:13:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmBdAHUwHY0deuxFo+IZCqpVt4lIXK5RFeRHUImjazNOI/b4E6QzyXgbwjP6mM2N2lMIMk X-Received: by 2002:a63:540b:: with SMTP id i11mr1994239pgb.44.1619475198987; Mon, 26 Apr 2021 15:13:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619475198; cv=none; d=google.com; s=arc-20160816; b=plJ/5WwUnhqUqI40IF79R3QbldCExrCS6sp3yVn8n5RWTfZAuCsauSG41uRvDzw21t ht5RSJcCNrCe5maDyrH9XXjnVzbTLBXkSapWfPznqpdnQDRFKi4rm68S8ldCuScgoB8m 0ImJ41cukqv9IAcKf/vKLhE3zcQAP37HfQUEohhY0qu0AwH/1R747iMvsJc5dxAukvRT 7fvA5dzNegE+Ff0gINSIh+++SGcK7M0Alm8ibZ7uGF3gf2AHK3W9NJ9lIyHt3s3WKhZO RU15JPZx+gJJGjl0szggJCn9jGnn44pFzmkeN4IKWciWWwIzYvu0bdNqMtqpzJ1zIdL6 +Pqg== 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=byleSoR3uVivo8lWUxItN76uGnD6h4WkxkvPblf1pgs=; b=riyFj37Ou82toNAsQrpGTU+mV8Wz21eOiEY8hh55K2aUyxnrmg9d07esiv39jnZCCr EcNgPYil6UKVI8xJ7ScSGGIdUmZTd4/oHrzK5PSnVgsZ9RQDDV9G1nN8OyeaybcpHNEm igGWuWjJ1JM2JlQIuWc1GUNPdoOvsAjRBZ+/wppvqOxzD6uyr7LDOlDXDxPpHVKypPe7 WdgmLn2yJY63On/+MfAO3mt2O10aLnSKqBHru+AxkPPJWiJwESjO35eZmTYSGmSn/f4U yzEHSwICocebS2K0rMXYji7tkICwM0UumoNPptc2CgdSoqMwAXZcX/fvnDGmtFnCk04r XFzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QNdRK6x1; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 o7si526100plg.251.2021.04.26.15.13.18; Mon, 26 Apr 2021 15:13:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=QNdRK6x1; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S232235AbhDZWNy (ORCPT + 17 others); Mon, 26 Apr 2021 18:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbhDZWNy (ORCPT ); Mon, 26 Apr 2021 18:13:54 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05952C061760 for ; Mon, 26 Apr 2021 15:13:12 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id n4-20020a05600c4f84b029013151278decso5785051wmq.4 for ; Mon, 26 Apr 2021 15:13:11 -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=byleSoR3uVivo8lWUxItN76uGnD6h4WkxkvPblf1pgs=; b=QNdRK6x1Vu5iyxHDPdpYUwhnDmIWWvcN9VR7TZg7xM1ZDisCReZJj3YfopGtBN1/cs rowkW+8SpGTpEyeWWWUQAa1NYKNDvOKPhO2p7YJVVSL9TEfJIAXapqYJLvYKhiQ+H5uq 9x0TVH3ZsS30HWO81USMPJkuwuugeb1neFJc7d61h+CdjP/+yFBMewzUOL1BS7oYZW8G oBY8SZanKfMd10bDU2zIu0KOGTVMcXb/MnwcyTlTUUFFeuxXVfB7KoUxzcCP5BcQgdpc u2X7O00rV1j0YfVSE0AUYuQcreIiLqkZDsdJJQDc7hsl+4qywcDlkaseby/S9nll6xCj qEfw== 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=byleSoR3uVivo8lWUxItN76uGnD6h4WkxkvPblf1pgs=; b=UKgujUlc0SJS7k0e9cHaVpWB5vEbVM62QIrZgrHVRntFX4Y6wldkvMjFyYCftVaNhM qmbLbHcWN8Xn/bQHZ0z58Yz/uhfeZ3Jx4vFI/7Rob88uus6R6710GwbsfUM5jDkAPxiJ PU9Ynye5Ll5iTf9tY2IFMWWwqalCU6PlyvqbcXMGaa1Y5dQulh7z+C/2qnZH6/yZbORG uHpdoE4XwfXfIgkhEJFImJ6OnGMo3ep6c/WMmBOehDn56EDpVR21Zfv8BNi6Osx2YARP T1djMKkuhsvYXmof+UI2Wo74WZK7R7yimM1vNSb/V5QOBC/TKYEnOGm1hh+MZxkTLyZ0 nBwg== X-Gm-Message-State: AOAM533cpwF6704QcB+C2y1vCitraYgg2cO4ugVwB8ImdibtXzhx0GOe V/KrJXQEAAmd+c0qKJWEOWwEeg== X-Received: by 2002:a1c:740c:: with SMTP id p12mr3198068wmc.112.1619475190749; Mon, 26 Apr 2021 15:13:10 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id x9sm1756042wrt.13.2021.04.26.15.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 15:13:10 -0700 (PDT) From: Bryan O'Donoghue To: agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh@kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, linux-arm-msm@vger.kernel.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v2 1/2] regulator: Add a routine to set the current limit for QCOM PMIC VBUS Date: Mon, 26 Apr 2021 23:14:45 +0100 Message-Id: <20210426221446.1852572-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210426221446.1852572-1-bryan.odonoghue@linaro.org> References: <20210426221446.1852572-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add hooks to regulator_get_current_limit_regmap() and regulator_set_current_limit_regmap() with an accompanying map of amperages. This lets us use the existing helper functions to map requested current settings to register bit-map/indicies. This change is required to elevate the default 2 Amps set by the bootloader to 3 Amps or indeed to constrain the value lower as the system design may dictate. The valid range is 500 mA to 3 A in increments of 500 mA. Cc: Mark Brown Signed-off-by: Bryan O'Donoghue --- drivers/regulator/qcom_usb_vbus-regulator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 2.30.1 diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c index 457788b505720..2e627c2b6c512 100644 --- a/drivers/regulator/qcom_usb_vbus-regulator.c +++ b/drivers/regulator/qcom_usb_vbus-regulator.c @@ -16,13 +16,21 @@ #define CMD_OTG 0x40 #define OTG_EN BIT(0) +#define OTG_CURRENT_LIMIT_CFG 0x52 +#define OTG_CURRENT_LIMIT_MASK GENMASK(2, 0) #define OTG_CFG 0x53 #define OTG_EN_SRC_CFG BIT(1) +static const unsigned int curr_table[] = { + 500000, 1000000, 1500000, 2000000, 2500000, 3000000, +}; + static const struct regulator_ops qcom_usb_vbus_reg_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, .is_enabled = regulator_is_enabled_regmap, + .get_current_limit = regulator_get_current_limit_regmap, + .set_current_limit = regulator_set_current_limit_regmap, }; static struct regulator_desc qcom_usb_vbus_rdesc = { @@ -30,6 +38,8 @@ static struct regulator_desc qcom_usb_vbus_rdesc = { .ops = &qcom_usb_vbus_reg_ops, .owner = THIS_MODULE, .type = REGULATOR_VOLTAGE, + .curr_table = curr_table, + .n_current_limits = ARRAY_SIZE(curr_table), }; static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev) @@ -61,6 +71,8 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev) qcom_usb_vbus_rdesc.enable_reg = base + CMD_OTG; qcom_usb_vbus_rdesc.enable_mask = OTG_EN; + qcom_usb_vbus_rdesc.csel_reg = base + OTG_CURRENT_LIMIT_CFG; + qcom_usb_vbus_rdesc.csel_mask = OTG_CURRENT_LIMIT_MASK; config.dev = dev; config.init_data = init_data; config.of_node = dev->of_node; From patchwork Mon Apr 26 22:14:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 427555 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp4087263jao; Mon, 26 Apr 2021 15:13:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRl3OhxguvBXU6m0gSiHaY8q9PboG/JybeC660nRzIRm7E7qNntW0IEC3piKGj5JheDIBa X-Received: by 2002:a63:9e02:: with SMTP id s2mr19465806pgd.134.1619475200845; Mon, 26 Apr 2021 15:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619475200; cv=none; d=google.com; s=arc-20160816; b=aqpk4MSC34yDodL3hc+ZvlOnaati2Y6j84Qa/FGGc/mtq17L11BGZGooeeDyv0Z5tO 5FkVMJ+MZzyHijCInHUIwYMH9AgAxj/gIacxjHb/5CRUmL9F12JbMQ3jmVYMP7OhkR8u Htb5NofibX4FSL2lEQn0O6HK+I/GJH/bzgY/I7IooMbLyDszdLumpU9gH74O3zdfS+XJ 4ycGV9LJsmonBr/0Zat2LfRc2dajG9XmRdmc+wz/t+Y4BlCtUey4bMyW2lqqrp9eA92h in7MiW45DLJll80xn6Onk+wwN5iL3OIt6EEJz3TpM825i6zKvdf1JKpSnOZfAYQL2ICD 782A== 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=jlTbSEdZXfT6MxSN+IUIhlV19k9uBh2kVBWE92p9qiQ=; b=l6iOk9hVq/KQGpO2/4WG6RFClZ6w3+Ck04KztkipR6Iw3cJZo99NDgS4Q2a+C9AJ4S QMz+p87nQW3QkXzwPxu0/33+Z2mebVBgoRq5sAVC9vgxYrfH5POy1OaqMkCZO+qbMwcC IjT+ihQfsejBsfcpT5wKglBDvKIKMKKBP180DACzM5SO0XV+2wlN4gHeUU5AfdrEIwb+ /quNiyrw1bs9ZCqb55nL3P3jUQpX/lIlXsGM7cMNe+xUFSEJMVBT2po58Uk6mskpQO9j uuLnuV/iBS3mIhMXjNEmkqWgDpArrF3t2GYCJQ3WmUMr5Wgfkcp9DkFEnWYb/VwdNj4d jgXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t+9SLn2W; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 o7si526100plg.251.2021.04.26.15.13.20; Mon, 26 Apr 2021 15:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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=t+9SLn2W; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S233257AbhDZWN5 (ORCPT + 17 others); Mon, 26 Apr 2021 18:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232116AbhDZWN4 (ORCPT ); Mon, 26 Apr 2021 18:13:56 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E21C061761 for ; Mon, 26 Apr 2021 15:13:12 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id f15-20020a05600c4e8fb029013f5599b8a9so3893144wmq.1 for ; Mon, 26 Apr 2021 15:13:12 -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=jlTbSEdZXfT6MxSN+IUIhlV19k9uBh2kVBWE92p9qiQ=; b=t+9SLn2WTexSIDQ+Eivw4b3WL8F4mZxTT0TfsTpSb91Aq7ats0DQ2QAvUAyweRQJws e5SpVVHUScBDAk8os26R6WgtDMXvJrE4FrNc/NYV4CNik07A9PSgJFtpmgsewP80Es02 2nBGGvOYayhbByzXYos4h4OO957bL2PgaOHgdu1Njid4RpNKX7ql7ChW2gDR8qfdqoZH cMgs1bWHwEE2zGAFc0uDoEGiO+lM4JKBmhy4RGxPzc3e7OosajH8TpzsSIEWd101hXCb bYmHYiZ1twYpXvCtRJP2fZBy+/0KC7XFuVhhqQlqBPn7ULuWarGyJYPJF7Xph1PrSTMw e36A== 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=jlTbSEdZXfT6MxSN+IUIhlV19k9uBh2kVBWE92p9qiQ=; b=ere3oHyWknZQoXjEqUAxp6M/Gnhltjd0MGjFW5d5L/FnldjJvQLeD5lfC+z25V4OzZ Tf2EkzzKpo5K/0k4TqPezYyUeCJE2KRfrFfOMGDibdeLm5oVs7ekhcBHY7Q5CGsNUsuo Mjt2kkhmxBQKG8oKiPCo21jUnBVHBdM7wNhJVfwcN98GcjFS+WuM5MWrwjU3XoR/phk5 +RXPaaIXjU3uh4G168rLMrpTQfE16jAuA0a3913lj4nNcui3HZVlwDRUX3T4mjHzrHF5 msBFwfOt3iQbXalKCDjoMbLPfyZI6CkeSFLpragN/tK6Lxc0xk7yt/mjx/vr0nVCAiWa YWgQ== X-Gm-Message-State: AOAM531xjX5l9Oy0SjOrlfwkWAb/X+fHoKH3L55kW7oNTcKmbz1ckiMn 1uciZ+vJDLS6eQpm1gjlYrx82A== X-Received: by 2002:a05:600c:35cf:: with SMTP id r15mr1014943wmq.183.1619475191681; Mon, 26 Apr 2021 15:13:11 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id x9sm1756042wrt.13.2021.04.26.15.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 15:13:11 -0700 (PDT) From: Bryan O'Donoghue To: agross@kernel.org, bjorn.andersson@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, robh@kernel.org, devicetree@vger.kernel.org Cc: wcheng@codeaurora.org, linux-arm-msm@vger.kernel.org, dmitry.baryshkov@linaro.org, bryan.odonoghue@linaro.org Subject: [PATCH v2 2/2] arm64: boot: dts: qcom: pm8150b: Add DTS node for PMIC VBUS booster Date: Mon, 26 Apr 2021 23:14:46 +0100 Message-Id: <20210426221446.1852572-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210426221446.1852572-1-bryan.odonoghue@linaro.org> References: <20210426221446.1852572-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Wesley Cheng Add the required DTS node for the USB VBUS output regulator, which is available on PM8150B. This will provide the VBUS source to connected peripherals. bod: Add minimum and maximum amperage values for the VBUS current provided by the pm8150b. Cc: Rob Herring Signed-off-by: Wesley Cheng Signed-off-by: Bryan O'Donoghue --- arch/arm64/boot/dts/qcom/pm8150b.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.30.1 diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi index b21e56a46145b..2a90d773810ad 100644 --- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi +++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi @@ -53,6 +53,14 @@ power-on@800 { status = "disabled"; }; + pm8150b_vbus: dcdc@1100 { + compatible = "qcom,pm8150b-vbus-reg"; + regulator-min-microamp = <500000>; + regulator-max-microamp = <3000000>; + status = "disabled"; + reg = <0x1100>; + }; + pm8150b_temp: temp-alarm@2400 { compatible = "qcom,spmi-temp-alarm"; reg = <0x2400>;