Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1882538ybb; Thu, 9 Apr 2020 10:46:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLkd4mw5GxBSJQiTfvH7pWKCuRPVUoe7x9YwRXQGzP03c39fvnEyHjFI9OIOBpKpZiiePOs X-Received: by 2002:a37:5a43:: with SMTP id o64mr1036729qkb.29.1586454374697; Thu, 09 Apr 2020 10:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586454374; cv=none; d=google.com; s=arc-20160816; b=vhOuWaXFPkCTHVHXWj7A0mi2vCZGrIboEFJQsWxSP0UN5mnat/U47KlgVZmihEWGlU k4HuSTgkarHCB8RYSM6Vh6hgKYti/kE8WtmnegwZxn01uj1H072EzgifQxyY3y3mfdPD J7+fvL/ArUGE8zJYPBI3p2gJtRMc0ScxwP8jH2MBFFwoDLIMd1iPf05zp8GHNwlmJM+W We3Nq6SUcDkSWtAAR/HkJP9Qhkufk5LUz3opHX4mpKMeWENNUn+04+mBO6+KnmniJJwn JpWfdxqC+8nIeY96lX9pTcfEhs5EFDF6M00PlW0+jt9HbjREGu7TlUiqIHiqHvTeSsZU OxZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b+KIwr8FsoUEl5I61MG+GNUlmWOmQgoJsz4NKGh8sQE=; b=to2vIiyx7ZKyiancRjraAieS33sHwA1/y46ImxHQc5oH4DB6jCehrkeqeNahwWD9Sz 62SgVOTPpV/WiLOgcH6peJlThbiZXI1750iNq/omhx7WLV9dkap0XH2TRbsNVF/gZA6v sYWnCR2bYQtgD5ZA7brzqMeNyEkKyzHq4WzKM0AFRZykWTCd5dfUzCtMsDLg6xvX1QNk wU6KWwkXQejOhEi1ijcIjDzUixfpX/RaNbxMrqT6MkuVV0xYfKrPypP8ttv3Cnjz6Uw/ GckFITDCt2X2wfZfZUhiymwKedZ3po+UKZQz1mO70Jqs1RakHCIrp5YmBo6ZlgyOBWfO srJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EM/IsWR2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si6579676qtn.345.2020.04.09.10.45.59; Thu, 09 Apr 2020 10:46:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="EM/IsWR2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgDIRpO (ORCPT + 99 others); Thu, 9 Apr 2020 13:45:14 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46424 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgDIRpN (ORCPT ); Thu, 9 Apr 2020 13:45:13 -0400 Received: by mail-pg1-f194.google.com with SMTP id k191so5276635pgc.13 for ; Thu, 09 Apr 2020 10:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=b+KIwr8FsoUEl5I61MG+GNUlmWOmQgoJsz4NKGh8sQE=; b=EM/IsWR2Q4BGmlK6wbm+C7xuN2DSW8OQJW1orjgIBlgjy0CCTWo8wTZ6MClTNKQqLp tVaDV8+7xResGkEmZtYgBgxI3CFN6b/lj3gI2CoS+tXf453fTunv3/JymQBHTVptNcCR TAV/5tE6KonpppwiPpyriF0/79D39SGsi2PG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=b+KIwr8FsoUEl5I61MG+GNUlmWOmQgoJsz4NKGh8sQE=; b=i7BqIlrKaxFrujlZNTOm5oXCvjIj5cET5uq3BczcFReEcSKVnEPMBUTm0xUh4t1TpM qKyQn99/IVjQZJwU+CjaDPm/w86kTL2Y4WUl6e5nAZXx/+F/XI1l63Delj8hyGslkP+u sO3DKgKKqDcIDyzPUE6gLjKx2WsL40dnsxGz30fpkI0PJ7Gz+y+vCZoAKVWxR/au18Ze LW20a7Af7G38maEropthvp7bD/UaPBlv22HgjjZrMZ33W4hIOhYv9+4cuVrpWv04VDLJ 7CS3xYFedfBGBdnmAJA5YYlUJFou3Yzx46lTRD2SIShOuk7QKvJRN+fXt7iZO+2nxI5R yaJQ== X-Gm-Message-State: AGi0PuauR+0sz6Mgwty4xspmg3CtHRYLzxG7lPtmCOWRxM3kkpYTXUbg 0OCX6H6rIXDCDvc+oP3dO4XVOQ== X-Received: by 2002:a62:2684:: with SMTP id m126mr650534pfm.153.1586454313469; Thu, 09 Apr 2020 10:45:13 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id k12sm6010790pgj.33.2020.04.09.10.45.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 10:45:12 -0700 (PDT) Date: Thu, 9 Apr 2020 10:45:11 -0700 From: Matthias Kaehlcke To: Rajendra Nayak Cc: viresh.kumar@linaro.org, sboyd@kernel.org, bjorn.andersson@linaro.org, agross@kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Akash Asthana , linux-serial@vger.kernel.org Subject: Re: [PATCH 02/21] tty: serial: qcom_geni_serial: Use OPP API to set clk/perf state Message-ID: <20200409174511.GS199755@google.com> References: <1586353607-32222-1-git-send-email-rnayak@codeaurora.org> <1586353607-32222-3-git-send-email-rnayak@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1586353607-32222-3-git-send-email-rnayak@codeaurora.org> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rajendra, On Wed, Apr 08, 2020 at 07:16:28PM +0530, Rajendra Nayak wrote: > geni serial needs to express a perforamnce state requirement on CX > depending on the frequency of the clock rates. Use OPP table from > DT to register with OPP framework and use dev_pm_opp_set_rate() to > set the clk/perf state. > > Signed-off-by: Rajendra Nayak > Cc: Akash Asthana > Cc: linux-serial@vger.kernel.org > --- > drivers/tty/serial/qcom_geni_serial.c | 20 +++++++++++++++----- > include/linux/qcom-geni-se.h | 2 ++ > 2 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c > index 6119090..754eaf6 100644 > --- a/drivers/tty/serial/qcom_geni_serial.c > +++ b/drivers/tty/serial/qcom_geni_serial.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -961,7 +962,7 @@ static void qcom_geni_serial_set_termios(struct uart_port *uport, > goto out_restart_rx; > > uport->uartclk = clk_rate; > - clk_set_rate(port->se.clk, clk_rate); > + dev_pm_opp_set_rate(uport->dev, clk_rate); > ser_clk_cfg = SER_CLK_EN; > ser_clk_cfg |= clk_div << CLK_DIV_SHFT; > > @@ -1198,8 +1199,10 @@ static void qcom_geni_serial_pm(struct uart_port *uport, > if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) > geni_se_resources_on(&port->se); > else if (new_state == UART_PM_STATE_OFF && > - old_state == UART_PM_STATE_ON) > + old_state == UART_PM_STATE_ON) { > + dev_pm_opp_set_rate(uport->dev, 0); > geni_se_resources_off(&port->se); > + } > } > > static const struct uart_ops qcom_geni_console_pops = { > @@ -1318,13 +1321,16 @@ static int qcom_geni_serial_probe(struct platform_device *pdev) > if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap")) > port->cts_rts_swap = true; > > + port->se.opp = dev_pm_opp_set_clkname(&pdev->dev, "se"); dev_pm_opp_set_clkname() can fail for multiple reasons, it seems an error check would be warranted. Is it actually necessary to save the OPP table in 'struct geni_se'? Both the serial and the SPI driver save the table, but don't use it later (nor does the SE driver).