From patchwork Mon Apr 16 10:11:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 10342557 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9AEA9601C2 for ; Mon, 16 Apr 2018 10:16:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B74120121 for ; Mon, 16 Apr 2018 10:16:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E63120246; Mon, 16 Apr 2018 10:16:30 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC4122018E for ; Mon, 16 Apr 2018 10:16:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116AbeDPKOP (ORCPT ); Mon, 16 Apr 2018 06:14:15 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:52095 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753842AbeDPKOL (ORCPT ); Mon, 16 Apr 2018 06:14:11 -0400 Received: from epcas1p4.samsung.com (unknown [182.195.41.48]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20180416101410epoutp028d013cd69de9a5e8a9fc9a062af0d31f~l4wLKKUqQ0411004110epoutp028; Mon, 16 Apr 2018 10:14:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20180416101410epoutp028d013cd69de9a5e8a9fc9a062af0d31f~l4wLKKUqQ0411004110epoutp028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1523873650; bh=wrltF/o+IHVd9JCUcg3ufM969OwYzOXVtIAK6gs09O0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=BfPn1QZTP/YHHvB3B74ZM01z3bsNoVPkcbW6EXDu8eQw62fgq3AkyLqWfmp9aOL32 ZGIf4EMZEPj3lJuLG120rs8nIdASF8e2itQ0jNVsSVQ5196CxMveiAKp6OVbMLdfYn 6z22AR3ViGL/iA4zZWIux7l7W52XlMp+hmgu29oA= Received: from epsmges1p5.samsung.com (unknown [182.195.42.57]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20180416101409epcas1p15735718b59ee336c4cd675f8a996bb50~l4wLB48OL0854408544epcas1p15; Mon, 16 Apr 2018 10:14:09 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 8D.8F.04084.17774DA5; Mon, 16 Apr 2018 19:14:09 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20180416101409epcas1p4f8e0279a94322d1cc423ced6dfce3362~l4wKrcS6G1538915389epcas1p4O; Mon, 16 Apr 2018 10:14:09 +0000 (GMT) X-AuditID: b6c32a39-579ff70000000ff4-84-5ad477711205 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F5.AB.03849.17774DA5; Mon, 16 Apr 2018 19:14:09 +0900 (KST) Received: from AMDC3058.DIGITAL.local ([106.120.53.102]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P79000EEWCHS590@mmp2.samsung.com>; Mon, 16 Apr 2018 19:14:09 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Eduardo Valentin Cc: Zhang Rui , Krzysztof Kozlowski , Kukjin Kim , Daniel Lezcano , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com Subject: [PATCH 08/14] thermal: exynos: remove parsing of samsung,tmu[_min,_max]_efuse_value properties Date: Mon, 16 Apr 2018 12:11:59 +0200 Message-id: <1523873525-23718-9-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrAIsWRmVeSWpSXmKPExsWy7bCmgW5h+ZUog/8tZhYbZ6xntZj3WdZi /pVrrBb9j18zW5w/v4Hd4vKuOWwWn3uPMFrMOL+PyeLJwz42B06PnbPusnss3vOSyWPTqk42 jzvX9rB59G1ZxejxeZNcAFsUl01Kak5mWWqRvl0CV0bnme+sBVvNK7a+OsXcwDhHr4uRk0NC wERixbRr7F2MXBxCAjsYJT733WUHSQgJfGeUWLpJDqZofeMpNoiiDYwSC1a0M0M4vxglLk67 yQpSxSZgJTGxfRUjiC0ioCVx4tJ2JpAiZoEJTBJPX81kA0kIC2RKXFzSwwxiswioSry9+pIF xOYV8JBoWrSAEWKdnMTJY5PBhnIKeEo0rbkGtlpCYAGbxPrO3UBFHECOi8T8M5UQ9cISr45v YYcIS0tcOmoLUd7MKPFtxx5miJoJjBJ71gtB2NYSh49fBJvPLMAn8e5rDytEL69ERxtUiYfE +3N3WCBsR4mnh1YyQkJlDqPE4nVWExilFjAyrGIUSy0ozk1PLTYsMNUrTswtLs1L10vOz93E CI5XLcsdjMfO+RxiFOBgVOLh3XH2cpQQa2JZcWXuIUYJDmYlEd5liUAh3pTEyqrUovz4otKc 1OJDjNIcLErivE99zkQJCa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X-CMS-RootMailID: 20180416101409epcas1p4f8e0279a94322d1cc423ced6dfce3362 X-RootMTR: 20180416101409epcas1p4f8e0279a94322d1cc423ced6dfce3362 References: <1523873525-23718-1-git-send-email-b.zolnierkie@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since pdata efuse values are SoC (not platform) specific just move them from platform data to struct exynos_tmu_data instance. Then remove parsing of samsung,tmu[_,min_,max]_efuse_value properties. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz Reviewed-by: Daniel Lezcano --- drivers/thermal/samsung/exynos_tmu.c | 49 +++++++++++++++++++++++------------- drivers/thermal/samsung/exynos_tmu.h | 7 ------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1fa162d..9a0e961 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -185,6 +185,9 @@ * @clk: pointer to the clock structure. * @clk_sec: pointer to the clock structure for accessing the base_second. * @sclk: pointer to the clock structure for accessing the tmu special clk. + * @efuse_value: SoC defined fuse value + * @min_efuse_value: minimum valid trimming data + * @max_efuse_value: maximum valid trimming data * @temp_error1: fused value of the first point trim. * @temp_error2: fused value of the second point trim. * @regulator: pointer to the TMU regulator structure. @@ -207,6 +210,9 @@ struct exynos_tmu_data { struct work_struct irq_work; struct mutex lock; struct clk *clk, *clk_sec, *sclk; + u32 efuse_value; + u32 min_efuse_value; + u32 max_efuse_value; u16 temp_error1, temp_error2; struct regulator *regulator; struct thermal_zone_device *tzd; @@ -283,20 +289,18 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info) { - struct exynos_tmu_platform_data *pdata = data->pdata; - data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) & EXYNOS_TMU_TEMP_MASK); if (!data->temp_error1 || - (pdata->min_efuse_value > data->temp_error1) || - (data->temp_error1 > pdata->max_efuse_value)) - data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK; + (data->min_efuse_value > data->temp_error1) || + (data->temp_error1 > data->max_efuse_value)) + data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK; if (!data->temp_error2) data->temp_error2 = - (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) & + (data->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) & EXYNOS_TMU_TEMP_MASK; } @@ -655,7 +659,6 @@ static int exynos7_tmu_initialize(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct thermal_zone_device *tz = data->tzd; - struct exynos_tmu_platform_data *pdata = data->pdata; unsigned int status, trim_info; unsigned int rising_threshold = 0, falling_threshold = 0; int ret = 0, threshold_code, i; @@ -672,9 +675,9 @@ static int exynos7_tmu_initialize(struct platform_device *pdev) data->temp_error1 = trim_info & EXYNOS7_TMU_TEMP_MASK; if (!data->temp_error1 || - (pdata->min_efuse_value > data->temp_error1) || - (data->temp_error1 > pdata->max_efuse_value)) - data->temp_error1 = pdata->efuse_value & EXYNOS_TMU_TEMP_MASK; + (data->min_efuse_value > data->temp_error1) || + (data->temp_error1 > data->max_efuse_value)) + data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK; /* Write temperature code for rising and falling threshold */ for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) { @@ -1136,13 +1139,6 @@ static int exynos_of_sensor_conf(struct device_node *np, of_property_read_u32(np, "samsung,tmu_reference_voltage", &value); pdata->reference_voltage = (u8)value; - of_property_read_u32(np, "samsung,tmu_efuse_value", - &pdata->efuse_value); - of_property_read_u32(np, "samsung,tmu_min_efuse_value", - &pdata->min_efuse_value); - of_property_read_u32(np, "samsung,tmu_max_efuse_value", - &pdata->max_efuse_value); - of_property_read_u32(np, "samsung,tmu_cal_type", &pdata->cal_type); of_node_put(np); @@ -1196,6 +1192,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->tmu_read = exynos4210_tmu_read; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; data->ntrip = 4; + data->efuse_value = 55; + data->min_efuse_value = 40; + data->max_efuse_value = 100; break; case SOC_ARCH_EXYNOS3250: case SOC_ARCH_EXYNOS4412: @@ -1209,6 +1208,13 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; data->ntrip = 4; + data->efuse_value = 55; + if (data->soc != SOC_ARCH_EXYNOS5420 && + data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO) + data->min_efuse_value = 40; + else + data->min_efuse_value = 0; + data->max_efuse_value = 100; break; case SOC_ARCH_EXYNOS5433: data->tmu_initialize = exynos5433_tmu_initialize; @@ -1217,6 +1223,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; data->ntrip = 8; + data->efuse_value = 75; + data->min_efuse_value = 40; + data->max_efuse_value = 150; break; case SOC_ARCH_EXYNOS5440: data->tmu_initialize = exynos5440_tmu_initialize; @@ -1225,6 +1234,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->tmu_set_emulation = exynos5440_tmu_set_emulation; data->tmu_clear_irqs = exynos5440_tmu_clear_irqs; data->ntrip = 4; + data->efuse_value = 0x5d2d; + data->min_efuse_value = 16; + data->max_efuse_value = 76; break; case SOC_ARCH_EXYNOS7: data->tmu_initialize = exynos7_tmu_initialize; @@ -1233,6 +1245,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; data->ntrip = 8; + data->efuse_value = 75; + data->min_efuse_value = 15; + data->max_efuse_value = 100; break; default: dev_err(&pdev->dev, "Platform not supported\n"); diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index b111a01..4c49312 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h @@ -45,9 +45,6 @@ enum soc_type { * @reference_voltage: reference voltage of amplifier * in the positive-TC generator block * 0 < reference_voltage <= 31 - * @efuse_value: platform defined fuse value - * @min_efuse_value: minimum valid trimming data - * @max_efuse_value: maximum valid trimming data * @cal_type: calibration type for temperature * * This structure is required for configuration of exynos_tmu driver. @@ -56,10 +53,6 @@ struct exynos_tmu_platform_data { u8 gain; u8 reference_voltage; - u32 efuse_value; - u32 min_efuse_value; - u32 max_efuse_value; - u32 cal_type; };