From patchwork Wed Feb 15 20:11:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13142156 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 66A8DC636CC for ; Wed, 15 Feb 2023 20:14:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229523AbjBOUOK (ORCPT ); Wed, 15 Feb 2023 15:14:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjBOUOJ (ORCPT ); Wed, 15 Feb 2023 15:14:09 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854682597E for ; Wed, 15 Feb 2023 12:14:08 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id k8-20020a05600c1c8800b003dc57ea0dfeso2560498wms.0 for ; Wed, 15 Feb 2023 12:14:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=siyoi7tU1TEBf7AYDT4w7kUxYaQu0QMTjP5CxbvyWqE=; b=CJLkviqFRgeoVuDuTiLnXH5xRKQExPdNkt1xBaPfByUFpxZRlY/kgN5E5C4jxKqNvV lR3p+tiLM1ho7YRWjiJ52LhoQOCLj54zw4HpOO3J7mDxFZJb1xzZHm00guMMvP9VOVfl Id452drWf/XPhv7mgc5PfK8o3SzlvCYhBfqe3lKLT+Xgak44UQSMQ7si8FQqJ4M05R9U DYSHYQzd/cPHxHGc4tPEOCrjtJM0Nw0iFw7MgYmnpzZa6DFg9vmFL1Pz+iGDpQz+dX3T Heev7X/Dkv90/yv/uN6aZec+4dFyfUQJ8X48EM9gmTjUyifUb6O175rOP9pFKOhI0wdJ 4pSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=siyoi7tU1TEBf7AYDT4w7kUxYaQu0QMTjP5CxbvyWqE=; b=hAX80FkeW1cs980tLVRhy9VCJIpvhxxAsz1BCW7rY8FgA/Jcg+52mi7RVxtrmwhYCM w60H/tbEu7Txumw4/kRE5lxtat9ZGAplU8TPhdJHWL5ynzzRb1lCgthDNpNdkbS8PWZb WFNZJ/n3ITtwUnlLIvdsfaT7VBjUT8ddMXla6wNTPlYJLDCe9tEn/OjFQ9TVNt/n0uA7 vHPprA02nmDHWP39iQTvReNigjLfnYzJNtlbEDrhnC3EHYDDAUdhFwby/xHyUOjOcCiF idUt2TLhkEBqQTnFvIHJ6fLj6qPHGoP6iJLBimaMpNignHQyGo6f+oyH/6qOCYbHNDpW t1gQ== X-Gm-Message-State: AO0yUKVrOZUt8SiQnqqZhqQHbOim1QZTWMwXhkStnyhWyM4PeTZ2KJFz flBo/HAxqVHVxjkZRb3uKGo= X-Google-Smtp-Source: AK7set+UKuZeKxGuRmLzI8d3TbmzZ3f4l+W8PzPkj5Fd8UVTrvg/F7EoydLauGzXbji1xI30KPbGvg== X-Received: by 2002:a05:600c:44c4:b0:3dc:eaef:c1bb with SMTP id f4-20020a05600c44c400b003dceaefc1bbmr3077358wmo.35.1676492046934; Wed, 15 Feb 2023 12:14:06 -0800 (PST) Received: from ?IPV6:2a01:c23:b9d5:9700:ccee:9a0d:2992:c73? (dynamic-2a01-0c23-b9d5-9700-ccee-9a0d-2992-0c73.c23.pool.telefonica.de. [2a01:c23:b9d5:9700:ccee:9a0d:2992:c73]) by smtp.googlemail.com with ESMTPSA id ay1-20020a05600c1e0100b003e1fee8baacsm2994527wmb.25.2023.02.15.12.14.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 12:14:06 -0800 (PST) Message-ID: <2553f3bc-b1e6-4af2-fb6c-def486dd99a3@gmail.com> Date: Wed, 15 Feb 2023 21:11:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: [PATCH 1/2] mmc: core: add helpers mmc_regulator_set_ocr_vmmc_up/off Content-Language: en-US From: Heiner Kallweit To: Ulf Hansson , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , "linux-mmc@vger.kernel.org" References: <02b46550-e0b5-4251-8156-56eb0f690d89@gmail.com> In-Reply-To: <02b46550-e0b5-4251-8156-56eb0f690d89@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org A lot of drivers use this code, therefore let's factor it out to helpers. Signed-off-by: Heiner Kallweit --- include/linux/mmc/host.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 812e6b583..f93fb8c7d 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -597,6 +597,23 @@ static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc, } #endif +static inline int mmc_regulator_set_ocr_vmmc_up(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + if (IS_ERR(mmc->supply.vmmc)) + return 0; + + return mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); +} + +static inline int mmc_regulator_set_ocr_vmmc_off(struct mmc_host *mmc) +{ + if (IS_ERR(mmc->supply.vmmc)) + return 0; + + return mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); +} + int mmc_regulator_get_supply(struct mmc_host *mmc); static inline int mmc_card_is_removable(struct mmc_host *host) From patchwork Wed Feb 15 20:13:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 13142157 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 B17BCC636D7 for ; Wed, 15 Feb 2023 20:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjBOUOL (ORCPT ); Wed, 15 Feb 2023 15:14:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbjBOUOL (ORCPT ); Wed, 15 Feb 2023 15:14:11 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 286732597E for ; Wed, 15 Feb 2023 12:14:10 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id k3so12743476wrv.5 for ; Wed, 15 Feb 2023 12:14:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=odieurvf10mcga9adT6YskNMFIVGrQrZFzWT8sMLM8Q=; b=gXdI45qWNupQUBNzpcj6HxFh5+saTgX+qIGVfCUiuvmwf06SywKEb7UhUw75y2AU1+ xeWlliz7Hz32F/q19VUJm16oviUJoCy0xjfN1rzjttKvR+PjUbvDG/YkSeiAwdP6VUFN MxbSwRn5BdIzZLTHFy2exEs93NJRDX5R7XyWllSiPr5izHelmGkSpnFsr1HebHxZc0FR iGL6PIsZ1So+GgR8UjIOdPggoB4e7Pp4C1zYgnNq+c3CrnvV52EH1YGic7rF2Inssdf4 +OqYJBJpICNUMF0e7uPY2HkTmx4Gk1ukQdgBkavOjQDJNasaGOIcfTXXpbcoMFCQ9tMf oMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=odieurvf10mcga9adT6YskNMFIVGrQrZFzWT8sMLM8Q=; b=L4MXlutfcr1dsPH3oXBLPFjDPvnwOhkWBPuAl33afqbfOuOD/IQNRnK6Jl7BULb6CD N+GPugW98KRG6Vw7ScvtgDOvpr1X5mMYjWaVEFgksODn3zTqcU5zYDpXg8hqsyEt7H8X WBYaDHM3ZXNt7v7mZjhOcnYLeA9haGvqyllShf4T1reMXY6d4HlTCV8ziIlRrWcUQIKp ZKfn3mOLqhzUmfiSg9LbwaFEcJfXaM9m86O1Wklrxb5uROkimVVGVEW/0LwmE0U1gcde FKWh2aWs0sJ9vcx8H/2VcWXNmAZO2MhBMyoR0UnkT+KfStEDLSbgpRC9vY5GCVtVgEnB 5u/g== X-Gm-Message-State: AO0yUKUY/1U2iHUt0j/NFzTPcyQn+/F/vYg9lVtvjf1duE1RTTpzpbNu 9QqksjgNLveFasf0NgTni9zYO+wFPM0= X-Google-Smtp-Source: AK7set8dQBdSzKt2yrFiXjGeTL210Xgi5w+tHPueRFWmSyOG7plYKPAt7DqVSI4GYCGJidNrhi2Ixw== X-Received: by 2002:a05:6000:1e1d:b0:2c3:be89:7c1e with SMTP id bj29-20020a0560001e1d00b002c3be897c1emr397247wrb.1.1676492048522; Wed, 15 Feb 2023 12:14:08 -0800 (PST) Received: from ?IPV6:2a01:c23:b9d5:9700:ccee:9a0d:2992:c73? (dynamic-2a01-0c23-b9d5-9700-ccee-9a0d-2992-0c73.c23.pool.telefonica.de. [2a01:c23:b9d5:9700:ccee:9a0d:2992:c73]) by smtp.googlemail.com with ESMTPSA id k6-20020adfe8c6000000b002c55551e6e9sm9448525wrn.108.2023.02.15.12.14.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Feb 2023 12:14:08 -0800 (PST) Message-ID: Date: Wed, 15 Feb 2023 21:13:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: [PATCH 2/2] mmc: meson-gx: use new helpers mmc_regulator_set_ocr_vmmc_off/up Content-Language: en-US From: Heiner Kallweit To: Ulf Hansson , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: "linux-arm-kernel@lists.infradead.org" , "open list:ARM/Amlogic Meson..." , "linux-mmc@vger.kernel.org" References: <02b46550-e0b5-4251-8156-56eb0f690d89@gmail.com> In-Reply-To: <02b46550-e0b5-4251-8156-56eb0f690d89@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Make use of the new helpers to simplify the code. Signed-off-by: Heiner Kallweit --- drivers/mmc/host/meson-gx-mmc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 641ea4292..740973d35 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -604,8 +604,7 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) */ switch (ios->power_mode) { case MMC_POWER_OFF: - if (!IS_ERR(mmc->supply.vmmc)) - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); + mmc_regulator_set_ocr_vmmc_off(mmc); if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) { regulator_disable(mmc->supply.vqmmc); @@ -615,8 +614,7 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) break; case MMC_POWER_UP: - if (!IS_ERR(mmc->supply.vmmc)) - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); + mmc_regulator_set_ocr_vmmc_up(mmc, ios); break;