From patchwork Sat Aug 10 05:28:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 11088305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C04B1399 for ; Sat, 10 Aug 2019 05:31:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38E97212DB for ; Sat, 10 Aug 2019 05:31:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A16922A68; Sat, 10 Aug 2019 05:31:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF3F2212DB for ; Sat, 10 Aug 2019 05:31:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=gxTtaCVE0A18N53jY3hZcy+c0MZsnLXgXTtJqk+3uuc=; b=S+neb0U9tq1Q86eaciiRy09I6r Sh9He+sitA57qmC4w4zqHiNBP6zmAe1AAoy9FHVlYKeL4CheI1SAKUB2uFxDSUFYp9/8EuTxWBFQU 2IJTIPUU7HVtphSTaMS4iUZg0OWf51rKwolbdecMfuMXet1s1OBikkAFscw5mFzVoibw13duXm3LN 0ZMqnDei4RONtdbjK0iYkrxuDTehPGAv9/eHMoXVFexqdnc9whWSitWMEFkboJ/qctEeYcDSYL9DW Gp+/9An/ILq2qhkcmgeRrQL9U+U4V3IUDDlHYyuEbX4dv3+CtNcas1RWO2V0rg3CsgNIpSPaJCmAc 2vO0yvqg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hwJye-00043O-7k; Sat, 10 Aug 2019 05:31:40 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hwJwo-0001Au-Bv for linux-arm-kernel@lists.infradead.org; Sat, 10 Aug 2019 05:29:47 +0000 Received: by mail-pg1-x541.google.com with SMTP id i18so46855979pgl.11 for ; Fri, 09 Aug 2019 22:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SZBPS8zX1lZ/DonV5C3komhokQ/V7ug4it4W/EoGy10=; b=Z1VAV24vg4CQO/RAn7VbwJQFpjru/ocEIBsBk0qmfgVAcVSZPT/FcVCmkdU9IlZ1Ka Oc/1YloYmzzKO0Db83AB6D5gnVGah40VCwhk3qBijk6A7R2FFZdcxyNCgJNjVgFjSQ89 gS9dqvB8OILKpmhDVKj95toNNPOYSwf4tGM9xEg6ae5IO3c06X+1FQXXNjccX6LDIEfp GIp1nvLiSooojE5mPj406ljHLub9v1/y5aIPEYVf8JIgpacJPn06cLCj9AqNFapdofGP 9qN97TZ6HHo2VHwCIvaiEQIpCE8+hvg+SrXi969f020vIZ+IFlMtD/cEBAMmi9hX9uei 9g8w== 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; bh=SZBPS8zX1lZ/DonV5C3komhokQ/V7ug4it4W/EoGy10=; b=gkJ9TM0skvwr1451lFkBgGnZ2JpiQhUO9G44cGsRZIJRu5jrFfI6MTkJtB4OSwp0ch Aexuc7R0EXZ5jvHd2g9iKVjqhM3OiWEf7wT458BGoVlzXcj7HRmtMI0fzI0FZlCiCEO3 8/HsN9resxnuDeo2lzi/yUX031yXBszbPxYe0HWWtsZvSukGNWl76d2vZzxqWdPtrd47 7FceR2JwdTelwowaIrKloovZr740uzRKNLfbegx4P5bLvjvlocmIUXRm9bgkHi/F7RND B84224C6C21dTURQ3nWA3IAHcdD4MinCIuF6omRcI8TesReCOLRwYn6Z3qGiea7FZ1Qh W2RA== X-Gm-Message-State: APjAAAWQkuPJlQHrhedn+nMVL/X3x/giUHXYYs1fooG6i+xR6tR3+qxH uESRK4JUZB+p93Wo0CUb4/c= X-Google-Smtp-Source: APXvYqxslAn91+Gj9uqWPdAgQd4zH50Cp4kKggNShpSaPtsQosYJo1BWGkVX8KozpR9h/90K+ktYjA== X-Received: by 2002:a62:1d8f:: with SMTP id d137mr25970077pfd.207.1565414985703; Fri, 09 Aug 2019 22:29:45 -0700 (PDT) Received: from localhost ([202.182.106.211]) by smtp.gmail.com with ESMTPSA id j20sm95375157pfr.113.2019.08.09.22.29.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Aug 2019 22:29:45 -0700 (PDT) From: Yangtao Li To: rui.zhang@intel.com, edubezval@gmail.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, maxime.ripard@bootlin.com, wens@csie.org, mchehab+samsung@kernel.org, davem@davemloft.net, gregkh@linuxfoundation.org, Jonathan.Cameron@huawei.com, nicolas.ferre@microchip.com Subject: [PATCH v5 08/18] thermal: sun8i: support mod clocks Date: Sat, 10 Aug 2019 05:28:19 +0000 Message-Id: <20190810052829.6032-9-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190810052829.6032-1-tiny.windzz@gmail.com> References: <20190810052829.6032-1-tiny.windzz@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190809_222946_508947_50FD540E X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yangtao Li , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP H3 has extra clock, so introduce something in ths_thermal_chip/ths_device and adds the process of the clock. This is pre-work for supprt it. Signed-off-by: Yangtao Li --- drivers/thermal/sun8i_thermal.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c index b934bc81eba7..6f4294c2aba7 100644 --- a/drivers/thermal/sun8i_thermal.c +++ b/drivers/thermal/sun8i_thermal.c @@ -54,6 +54,7 @@ struct tsensor { }; struct ths_thermal_chip { + bool has_mod_clk; int sensor_num; int offset; int scale; @@ -69,6 +70,7 @@ struct ths_device { struct regmap *regmap; struct reset_control *reset; struct clk *bus_clk; + struct clk *mod_clk; struct tsensor sensor[MAX_SENSOR_NUM]; }; @@ -274,6 +276,12 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) if (IS_ERR(tmdev->bus_clk)) return PTR_ERR(tmdev->bus_clk); + if (tmdev->chip->has_mod_clk) { + tmdev->mod_clk = devm_clk_get(&pdev->dev, "mod"); + if (IS_ERR(tmdev->mod_clk)) + return PTR_ERR(tmdev->mod_clk); + } + ret = reset_control_deassert(tmdev->reset); if (ret) return ret; @@ -282,12 +290,18 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) if (ret) goto assert_reset; - ret = sun50i_ths_calibrate(tmdev); + ret = clk_prepare_enable(tmdev->mod_clk); if (ret) goto bus_disable; + ret = sun50i_ths_calibrate(tmdev); + if (ret) + goto mod_disable; + return 0; +mod_disable: + clk_disable_unprepare(tmdev->mod_clk); bus_disable: clk_disable_unprepare(tmdev->bus_clk); assert_reset: @@ -395,6 +409,7 @@ static int sun8i_ths_remove(struct platform_device *pdev) { struct ths_device *tmdev = platform_get_drvdata(pdev); + clk_disable_unprepare(tmdev->mod_clk); clk_disable_unprepare(tmdev->bus_clk); reset_control_assert(tmdev->reset);