Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp589989ybl; Thu, 22 Aug 2019 01:39:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpA3KFabW2TBUmJJAUTHZhDhmIWbY0ixeHcjgtmeytNnpyanKt3x1nGEINsrRIY+7DZIKg X-Received: by 2002:a63:6f41:: with SMTP id k62mr32834343pgc.32.1566463191266; Thu, 22 Aug 2019 01:39:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566463191; cv=none; d=google.com; s=arc-20160816; b=Rvdw3n2tRSjNLa37C+mds2yapCjzfiWbh2xFuZzEXkcn16aYhqvbYdcylkLJ2QR+mc DdQkWlRcDgUO0h+Ho8dfpB4nKQ+/eiVdTKF8kVWxSL10P0R53NZiM5HnQp4Q2bNB/TpZ AFyPWx4ywqN7ovodPR6D7sLoGb3gwsSB6DoJC5D8CwqApZ7ZgQz5UCeEsXTeVfwFWi2i QjvhmQAzl3s1s2HKY083MdO/JpMSFnqbUKwRtPHtHVebTN3jDcQBS1jeQQM9j0okBJS+ Xyle6vDeWVHBF74ecHjWDGvU1osqRYstfwXrAAefMOXfCcM6/T+wgq8vtQVM2xjFx6av wkgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=VOjoQj+l1y9ifF8l/7pTt1m4q45D/eYGAPnTzSY0Hu8=; b=Tm+3FtcsJ4Av3yHyUoKFahNc0x2Bkx4MjxtgvQMline+tmXA0KPSnAf01h3lYBW1qS V5SKDpsd/H0asBQbJLp5EKji0JjVq18IxdLmL4JAQOv67seB4g7f2k61/WSWmrt90RaY /ko6l2tNpz5rismIQuLijMN6xJBq6aPy/rtbR+apTWGKbvzrYeSoKYcCdNmD3kKpzNJ/ bWu6NJ9uCeRbD2aBwNBrft29fRPntzSPmgZs27NuNa3u3PZsKO1eD+621xfjuRjyRvfc nKNfrHCuWKYTQNLNJ8MxAA+w0JDogBqiB1uxj8LDpX2aC+Hyfn7QY8kVapHz9qlX9yJy quQw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f37si16230807pgm.145.2019.08.22.01.39.36; Thu, 22 Aug 2019 01:39:51 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732054AbfHVHCq (ORCPT + 99 others); Thu, 22 Aug 2019 03:02:46 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:21167 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730048AbfHVHCo (ORCPT ); Thu, 22 Aug 2019 03:02:44 -0400 X-UUID: 8b5b994b19934c8fb6ec44cf27186598-20190822 X-UUID: 8b5b994b19934c8fb6ec44cf27186598-20190822 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0707 with TLS) with ESMTP id 1661304108; Thu, 22 Aug 2019 15:02:40 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 22 Aug 2019 15:02:39 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 22 Aug 2019 15:02:35 +0800 From: Sam Shih To: Rob Herring , Mark Rutland , Matthias Brugger , Thierry Reding CC: Ryder Lee , John Crispin , , , , , Sam Shih Subject: [PATCH v5 12/13] pwm: mediatek: remove a property "has-clock" Date: Thu, 22 Aug 2019 14:58:42 +0800 Message-ID: <1566457123-20791-13-git-send-email-sam.shih@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1566457123-20791-1-git-send-email-sam.shih@mediatek.com> References: <1566457123-20791-1-git-send-email-sam.shih@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Due to we added clock-frequency property to fix mt7628 pwm during configure from userspace. We can alos use this property to determine whether the complex clock tree exists in the SoC or not. So we can safety remove has-clock property in the driver specific data. Signed-off-by: Sam Shih --- drivers/pwm/pwm-mediatek.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c index 290536a92a80..96f592595063 100644 --- a/drivers/pwm/pwm-mediatek.c +++ b/drivers/pwm/pwm-mediatek.c @@ -35,7 +35,6 @@ struct pwm_mediatek_of_data { unsigned int fallback_npwms; bool pwm45_fixup; - bool has_clks; }; /** @@ -73,7 +72,7 @@ static int pwm_mediatek_clk_enable(struct pwm_chip *chip, struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); int ret; - if (!pc->soc->has_clks) + if (pc->clk_freq) return 0; ret = clk_prepare_enable(pc->clk_top); @@ -103,7 +102,7 @@ static void pwm_mediatek_clk_disable(struct pwm_chip *chip, { struct pwm_mediatek_chip *pc = to_pwm_mediatek_chip(chip); - if (!pc->soc->has_clks) + if (pc->clk_freq) return; clk_disable_unprepare(pc->clk_pwms[pwm->hwpwm]); @@ -134,10 +133,10 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm, u64 resolution; int ret; - if (pc->soc->has_clks) - clk_freq = clk_get_rate(pc->clk_pwms[pwm->hwpwm]); - else + if (pc->clk_freq) clk_freq = pc->clk_freq; + else + clk_freq = clk_get_rate(pc->clk_pwms[pwm->hwpwm]); ret = pwm_mediatek_clk_enable(chip, pwm); if (ret < 0) @@ -222,6 +221,7 @@ static int pwm_mediatek_probe(struct platform_device *pdev) struct pwm_mediatek_chip *pc; struct resource *res; unsigned int npwms; + unsigned int clk_freq; int ret; pc = devm_kzalloc(&pdev->dev, sizeof(*pc), GFP_KERNEL); @@ -247,7 +247,8 @@ static int pwm_mediatek_probe(struct platform_device *pdev) } } - if (pc->soc->has_clks) { + ret = of_property_read_u32(np, "clock-frequency", &clk_freq); + if (ret < 0) { int i; pc->clk_pwms = devm_kcalloc(&pdev->dev, npwms, @@ -280,13 +281,6 @@ static int pwm_mediatek_probe(struct platform_device *pdev) } } } else { - unsigned int clk_freq; - - ret = of_property_read_u32(np, "clock-frequency", &clk_freq); - if (ret < 0) { - dev_err(&pdev->dev, "failed to get clock_frequency\n"); - return ret; - } pc->clk_freq = clk_freq; } @@ -316,25 +310,21 @@ static int pwm_mediatek_remove(struct platform_device *pdev) static const struct pwm_mediatek_of_data mt2712_pwm_data = { .fallback_npwms = 8, .pwm45_fixup = false, - .has_clks = true, }; static const struct pwm_mediatek_of_data mt7622_pwm_data = { .fallback_npwms = 6, .pwm45_fixup = false, - .has_clks = true, }; static const struct pwm_mediatek_of_data mt7623_pwm_data = { .fallback_npwms = 5, .pwm45_fixup = true, - .has_clks = true, }; static const struct pwm_mediatek_of_data mt7628_pwm_data = { .fallback_npwms = 4, .pwm45_fixup = true, - .has_clks = false, }; static const struct of_device_id pwm_mediatek_of_match[] = { -- 2.17.1