Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4898494pxv; Tue, 29 Jun 2021 19:30:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLI3D/ebjAW90OcF0cNRiGWgRQeY3pHOuuUcBi1FUUVx3NjxdB6FhR2w3mlcjOCqI5N+O4 X-Received: by 2002:a92:6902:: with SMTP id e2mr16332645ilc.275.1625020229578; Tue, 29 Jun 2021 19:30:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625020229; cv=none; d=google.com; s=arc-20160816; b=Zn33Olbtcue9R1MJaEHqNeputDvN7an0xx+Zjnmy5vfRt+UHrHtzt18s7zI5aAi8VS q2WeMf/pacbru3E+HFhogRenUWX0yvgQw6crAnrVqgLu7Ko1kd4Szw/a477ldKO6qj7P 9htJ/Pszpoug1iJtZGZE8qezV49vNfTzqzQG6DrSTm6lpzk9NcAP72eB7b/QatP7k6ef 5da/vb0euc8MW6k3xtaIsd7B8je4EA2JOaHvfLxSOdIbyPCmX6CJCIP2QJD3fK/tgPi/ TUSud0JvoF0zDCKZf2So1VHE16O9xd1g1lSDKqN94aAdvEsVyLbwlakR/sEoynDRP7Dt rwEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=tLMSH/BMB3uEymS7rzii/Xh6++aPv9O2DmjWt+eI77Q=; b=W13cPqZgVves1r2WoQOciGi0WDw+WzO3xu39F59rorHXTStHXa+28vcZpI5l3aqjQv PaodxNruMahRymXSHpahlq9YrVt0MM4lRX+lYSocASnPHv5h4YUWuHOgfiH5y9h6Y7zw ZKxVIlgjTmZfEdZboYA7sJSW+Ob31r1i3zK9ugmID8FnURaQ9RUKLc6D2KQGLIuElrOb ySR4RZdQR67rMZmVhxzW21tDy6ASEI1kwwnj7oUCxielZmQ1oGUdIqCP7xTZDHqP/RI3 xmWIc7gRYbJR6k6XAq7TuOB3jHYboz2aT27i7RWiylhH1Ga6rgdXS8THa+V23Obg50T6 osIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKXjfX0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 h19si22646639jaj.37.2021.06.29.19.30.17; Tue, 29 Jun 2021 19:30:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=KKXjfX0z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S232459AbhF3C3p (ORCPT + 99 others); Tue, 29 Jun 2021 22:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbhF3C3p (ORCPT ); Tue, 29 Jun 2021 22:29:45 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05897C061760 for ; Tue, 29 Jun 2021 19:27:14 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id p7so335418qvn.5 for ; Tue, 29 Jun 2021 19:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=tLMSH/BMB3uEymS7rzii/Xh6++aPv9O2DmjWt+eI77Q=; b=KKXjfX0zS+iZy8XOsNmPc2qONgDAEiLTLfA8c67gfaRXHxQr3aFCEcqUV3Iroa2tZu TCjA+HqRkgJy3daRNGTYdXJWQliVQYh7co/IyGPs0U2na35YoS8hGKmFZwBFqZcveoGL BjTvAg8VloasqDEwEhayNZBi3aZnO95wLkAAWItzAta+KlJEQLaikw9BJ9awnBNMQUYm 1zX6rKLbGls5aCKBMeUI5/BUpV0MgLi1Xt0NkJcdR4RB+QhiTIFuGPUX5PkPl5dpbURJ 9eZ6y7So/3JRn0Eib4mMtdmqDdOXqgf0LEBx7JO4X7EAcd4XgYSxVmCekmsQ4ND6YlCX 50jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tLMSH/BMB3uEymS7rzii/Xh6++aPv9O2DmjWt+eI77Q=; b=JPMa/S4dwZxmvQU5pmrBR5PHaDaQ9eN7WW80otcaSuWNZKM6MQyiKIdvaAia83QKh8 88wb8skI3MxV2IghTHmQqQUTCh/fb7kv11WT1Dtv9/L5GLjPovA7P6sQac69pZw/FjoX VG774O1Cqd65tZbALRi17I7c35fGfVofGCbrqdMLXKTlW2ZHef1hTaadr5zmv/bnEpWa 7dn90EWdYmV9Y1enUqneQkM6Gw3GwV91keC7bQKjFwbXGYZ4emmK4nnME8kzucAkwfbn cH/tJWJPkWCdfZA5JdKShpT8mC/lof92G9cTtKfc1pVIBUOHQuB/qtlzPmiH7XvcZuPk C7LQ== X-Gm-Message-State: AOAM530uhZFJUMT9qzTKIyh+Pd+sWBn/S58mjKNBZvlS3ngTJR4Hb6dy QrfmhFrjlYeEpz4AmQqKzCpmwA== X-Received: by 2002:ad4:4245:: with SMTP id l5mr31231802qvq.45.1625020033191; Tue, 29 Jun 2021 19:27:13 -0700 (PDT) Received: from [192.168.1.93] (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.gmail.com with ESMTPSA id k138sm2548006qke.71.2021.06.29.19.27.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Jun 2021 19:27:12 -0700 (PDT) Subject: Re: [Patch v2 3/5] cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support To: Taniya Das , agross@kernel.org, bjorn.andersson@linaro.org, rui.zhang@intel.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, rjw@rjwysocki.net, robh+dt@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20210624115813.3613290-1-thara.gopinath@linaro.org> <20210624115813.3613290-4-thara.gopinath@linaro.org> <34542481-09b0-ae3b-25f1-77565bf47755@codeaurora.org> From: Thara Gopinath Message-ID: Date: Tue, 29 Jun 2021 22:27:11 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <34542481-09b0-ae3b-25f1-77565bf47755@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/28/21 10:50 PM, Taniya Das wrote: > > > On 6/24/2021 5:28 PM, Thara Gopinath wrote: >> Add interrupt support to notify the kernel of h/w initiated frequency >> throttling by LMh. Convey this to scheduler via thermal presssure >> interface. >> >> Signed-off-by: Thara Gopinath >> --- >> >> v1->v2: >>     - Introduced qcom_cpufreq_hw_lmh_init to consolidate LMh related >> initializations >>       as per Viresh's review comment. >>     - Moved the piece of code restarting polling/re-enabling LMh >> interrupt to >>       qcom_lmh_dcvs_notify therby simplifying isr and timer callback >> as per Viresh's >>       suggestion. >>     - Droped cpus from qcom_cpufreq_data and instead using cpus from >> cpufreq_policy in >>       qcom_lmh_dcvs_notify as per Viresh's review comment. >>     - Dropped dt property qcom,support-lmh as per Bjorn's suggestion. >>     - Other minor/cosmetic fixes >> >>   drivers/cpufreq/qcom-cpufreq-hw.c | 103 ++++++++++++++++++++++++++++++ >>   1 file changed, 103 insertions(+) >> >> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c >> b/drivers/cpufreq/qcom-cpufreq-hw.c >> index f86859bf76f1..241f6f2b441f 100644 >> --- a/drivers/cpufreq/qcom-cpufreq-hw.c >> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c [snip] >>   static const struct qcom_cpufreq_soc_data qcom_soc_data = { >>       .reg_enable = 0x0, >>       .reg_freq_lut = 0x110, >>       .reg_volt_lut = 0x114, >> +    .reg_current_vote = 0x704, >>       .reg_perf_state = 0x920, >>       .lut_row_size = 32, >>   }; >> @@ -274,6 +350,23 @@ static const struct of_device_id >> qcom_cpufreq_hw_match[] = { >>   }; >>   MODULE_DEVICE_TABLE(of, qcom_cpufreq_hw_match); >> +static void qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy) >> +{ >> +    struct qcom_cpufreq_data *data = policy->driver_data; >> +    struct platform_device *pdev = cpufreq_get_driver_data(); >> +    struct device *dev = &pdev->dev; >> +    int ret; >> + >> +    ret = devm_request_irq(dev, data->lmh_dcvs_irq, >> qcom_lmh_dcvs_handle_irq, >> +                   0, "dcvsh-irq", data); > > > It is better if you tag the CPU id while registering the IRQ. > "dcvsh-irq-x" (0/4/7) Sure. Will fix it. > >> +    if (ret) { >> +        dev_err(dev, "Error %d registering irq %x\n", ret, >> data->lmh_dcvs_irq); >> +        return; >> +    } >> +    data->policy = policy; >> +    INIT_DEFERRABLE_WORK(&data->lmh_dcvs_poll_work, qcom_lmh_dcvs_poll); >> +} >> + >>   static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) >>   { >>       struct platform_device *pdev = cpufreq_get_driver_data(); >> @@ -370,6 +463,16 @@ static int qcom_cpufreq_hw_cpu_init(struct >> cpufreq_policy *policy) >>               dev_warn(cpu_dev, "failed to enable boost: %d\n", ret); >>       } >> +    /* Look for LMh interrupt. If no interrupt line is specified / >> +     * if there is an error, allow cpufreq to be enabled as usual. >> +     */ >> +    data->lmh_dcvs_irq = platform_get_irq(pdev, index); >> +    if (data->lmh_dcvs_irq > 0) { >> +        qcom_cpufreq_hw_lmh_init(policy); >> +    } else if (data->lmh_dcvs_irq != -ENXIO) { >> +        ret = data->lmh_dcvs_irq; >> +        goto error; >> +    } >>       return 0; >>   error: >>       kfree(data); >> > -- Warm Regards Thara (She/Her/Hers)