From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA17FC3A59D for ; Thu, 22 Aug 2019 06:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9238E2082F for ; Thu, 22 Aug 2019 06:16:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dkfEZLhx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbfHVGQK (ORCPT ); Thu, 22 Aug 2019 02:16:10 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:33267 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727476AbfHVGQJ (ORCPT ); Thu, 22 Aug 2019 02:16:09 -0400 Received: by mail-wm1-f67.google.com with SMTP id p77so6317284wme.0 for ; Wed, 21 Aug 2019 23:16:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=v/3dZSfOdl8S6ZuVsDc0xr8vSJO5wrI3ARNo9NhdoHg=; b=dkfEZLhxXG3d1ubAYcYq8AtogXAIdF338g3nRefUV6YxYpPNtII9vo/q6a4qfju9w+ WhqpuyDe3y0oOpFdrZ/9G8u6coQeL45ErcVJmtuNZbiFUQ/yAaIsLOWZkKKr2GmcW+xH 0h39wbwkY4CAzaQooIiLxvpzlXzsL20nVbEKzmVUUpy0tH0KYP3oEkDoURZPSzMzNORO 9WyV2EPR6wNnNuMo7GllUyDscThT1Tb7HZeaQlqdnNPrNCU2Ub6lVMQn041MBcva4P5e ZfM1Lr30xbY3dOYL8C/dnzuVKXbUvBIhaQ71mRJojX0Ffx1uioWaSNNLPoZ4xmGE3jxO Jn7w== 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:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=v/3dZSfOdl8S6ZuVsDc0xr8vSJO5wrI3ARNo9NhdoHg=; b=D16QEDv8wczMWvfY6RoqpcXxYwgE9206oL1lIzqL28RhPVFr4bn7Gj8bc8QE/+KLY8 QA4Q6rMexQxlfxNYTsodICILYiHSKIUYMhem9Xitv4FG5DENStmGf0EtF0/L9IsMIkcz pFk1Q2ZJrHciBbKkDE8Bn5q/mwG9YpI9yXvSM18EcC7IRuaM29cWKoVQ44d4T/uZyEnL AoNhFKfzn/DWjrzoNG87LbKqQGT0flZc1VD2WLOSQz6egLkTDLv1n5Y4daMtW1yA7OPJ ip4Q/dYanEIzs4ByMZwZCTwn3Jdbrp6d+v0iHV8wVO6FOP5uiLR9zsKjrajNzSwqDqOv sHrA== X-Gm-Message-State: APjAAAVAp/RJRXnrowAe+7TlLFoRu5Jt72WwGakzoKUO5c2gZ47JNwHX zIrDbRsHHkFVuR8U8WGtYMuk3w== X-Google-Smtp-Source: APXvYqwxfairnPt8SpfzkQ/D2+XtXx0VQWPZqBg8DRtt4/Gs1XrSDV89wTEK4hLKPPX28GUWHhjf1Q== X-Received: by 2002:a1c:790b:: with SMTP id l11mr4208570wme.3.1566454565427; Wed, 21 Aug 2019 23:16:05 -0700 (PDT) Received: from ?IPv6:2a01:e34:ed2f:f020:7130:374d:99e8:92fa? ([2a01:e34:ed2f:f020:7130:374d:99e8:92fa]) by smtp.googlemail.com with ESMTPSA id c1sm1801267wmc.40.2019.08.21.23.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Aug 2019 23:16:04 -0700 (PDT) Subject: Re: [PATCH 1/2] thermal: db8500: Finalize device tree conversion To: Linus Walleij , Zhang Rui , Eduardo Valentin Cc: linux-pm@vger.kernel.org, Lee Jones References: <20190717063222.5902-1-linus.walleij@linaro.org> From: Daniel Lezcano Openpgp: preference=signencrypt Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= mQINBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud8CAtq+w P9EftUysLtovGpLSpGDO5zQ++4ZGVygdYFr318aGDqCljKAKZ9hYgRimPBToDedho1S1uE6F 6YiBFnI3ry9+/KUnEP6L8Sfezwy7fp2JUNkUr41QF76nz43tl7oersrLxHzj2dYfWUAZWXva wW4IKF5sOPFMMgxoOJovSWqwh1b7hqI+nDlD3mmVMd20VyE9W7AgTIsvDxWUnMPvww5iExlY eIC0Wj9K4Uq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z7nRC8 qePOXubgouxumi5RQs1+crBmCDa/AyJHKdG2mqCt9fx5EPbDpw6Zzx7hgURh4ikHoS7/tLjK iqWjuat8/HWc01yEd8rtkGuUcMqbCi1XhcAmkaOnX8FYscMRoyyMrWClRZEQRokqZIj79+PR adkDXtr4MeL8BaB7Ij2oyRVjXUwhFQNKi5Z5Rve0a3zvGkkqw8Mz20BOksjSWjAF6g9byukl CUVjC03PdMSufNLK06x5hPc/c4tFR4J9cLrV+XxdCX7r0zGos9SzTPGNuIk1LK++S3EJhLFj 4eoWtNhMWc1uiTf9ENza0ntqH9XBWEQ6IA1gubCniGG+Xg== Message-ID: <47cb523f-60ad-750e-4374-6563f8230593@linaro.org> Date: Thu, 22 Aug 2019 08:16:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190717063222.5902-1-linus.walleij@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On 17/07/2019 08:32, Linus Walleij wrote: > At some point there was an attempt to convert the DB8500 > thermal sensor to device tree: a probe path was added > and the device tree was augmented for the Snowball board. > The switchover was never completed: instead the thermal > devices came from from the PRCMU MFD device and the probe > on the Snowball was confused as another set of configuration > appeared from the device tree. > > Move over to a device-tree only approach, as we fixed up > the device trees. > > Cc: Lee Jones > Signed-off-by: Linus Walleij > --- > Lee: it'd be great if you could ACK this, it is a file > with low change rate so we should likely not see any > collisions. > --- > drivers/mfd/db8500-prcmu.c | 53 +------------------- > drivers/thermal/Kconfig | 2 +- > drivers/thermal/db8500_thermal.c | 30 +++++------ > include/linux/platform_data/db8500_thermal.h | 29 ----------- > 4 files changed, 17 insertions(+), 97 deletions(-) > delete mode 100644 include/linux/platform_data/db8500_thermal.h > > diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c > index 3f21e26b8d36..a1e09bf06977 100644 > --- a/drivers/mfd/db8500-prcmu.c > +++ b/drivers/mfd/db8500-prcmu.c > @@ -36,7 +36,6 @@ > #include > #include > #include > -#include > #include "dbx500-prcmu-regs.h" > > /* Index of different voltages to be used when accessing AVSData */ > @@ -2982,53 +2981,6 @@ static struct ux500_wdt_data db8500_wdt_pdata = { > .timeout = 600, /* 10 minutes */ > .has_28_bits_resolution = true, > }; > -/* > - * Thermal Sensor > - */ > - > -static struct resource db8500_thsens_resources[] = { > - { > - .name = "IRQ_HOTMON_LOW", > - .start = IRQ_PRCMU_HOTMON_LOW, > - .end = IRQ_PRCMU_HOTMON_LOW, > - .flags = IORESOURCE_IRQ, > - }, > - { > - .name = "IRQ_HOTMON_HIGH", > - .start = IRQ_PRCMU_HOTMON_HIGH, > - .end = IRQ_PRCMU_HOTMON_HIGH, > - .flags = IORESOURCE_IRQ, > - }, > -}; > - > -static struct db8500_thsens_platform_data db8500_thsens_data = { > - .trip_points[0] = { > - .temp = 70000, > - .type = THERMAL_TRIP_ACTIVE, > - .cdev_name = { > - [0] = "thermal-cpufreq-0", > - }, > - }, > - .trip_points[1] = { > - .temp = 75000, > - .type = THERMAL_TRIP_ACTIVE, > - .cdev_name = { > - [0] = "thermal-cpufreq-0", > - }, > - }, > - .trip_points[2] = { > - .temp = 80000, > - .type = THERMAL_TRIP_ACTIVE, > - .cdev_name = { > - [0] = "thermal-cpufreq-0", > - }, > - }, > - .trip_points[3] = { > - .temp = 85000, > - .type = THERMAL_TRIP_CRITICAL, > - }, > - .num_trips = 4, > -}; I've been through the DT and I don't understand why there is: [ ... ] trip0-temp = <70000>; trip0-type = "active"; trip0-cdev-num = <1>; trip0-cdev-name0 = "thermal-cpufreq-0"; [ ... ] Those bindings already exists for the thermal no? Why not create a thermal-zone node and then add the values above? Another point is there are too many trip points, two should be enough, one for throttling and one for critical, the governor will handle that properly by stepping the opps. And one last point is the trip point should be passive, not active. > static const struct mfd_cell common_prcmu_devs[] = { > { > @@ -3052,10 +3004,7 @@ static const struct mfd_cell db8500_prcmu_devs[] = { > }, > { > .name = "db8500-thermal", > - .num_resources = ARRAY_SIZE(db8500_thsens_resources), > - .resources = db8500_thsens_resources, > - .platform_data = &db8500_thsens_data, > - .pdata_size = sizeof(db8500_thsens_data), > + .of_compatible = "stericsson,db8500-thermal", > }, > }; > > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig > index 9966364a6deb..001a21abcc28 100644 > --- a/drivers/thermal/Kconfig > +++ b/drivers/thermal/Kconfig > @@ -310,7 +310,7 @@ config DOVE_THERMAL > > config DB8500_THERMAL > tristate "DB8500 thermal management" > - depends on MFD_DB8500_PRCMU > + depends on MFD_DB8500_PRCMU && OF > default y > help > Adds DB8500 thermal management implementation according to the thermal > diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c > index b71a999d17d6..d650ae5fdf2a 100644 > --- a/drivers/thermal/db8500_thermal.c > +++ b/drivers/thermal/db8500_thermal.c > @@ -13,13 +13,24 @@ > #include > #include > #include > -#include > #include > #include > #include > > #define PRCMU_DEFAULT_MEASURE_TIME 0xFFF > #define PRCMU_DEFAULT_LOW_TEMP 0 > +#define COOLING_DEV_MAX 8 > + > +struct db8500_trip_point { > + unsigned long temp; > + enum thermal_trip_type type; > + char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH]; > +}; > + > +struct db8500_thsens_platform_data { > + struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS]; > + int num_trips; > +}; > > struct db8500_thermal_zone { > struct thermal_zone_device *therm_dev; > @@ -301,7 +312,6 @@ static void db8500_thermal_work(struct work_struct *work) > dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n"); > } > > -#ifdef CONFIG_OF > static struct db8500_thsens_platform_data* > db8500_thermal_parse_dt(struct platform_device *pdev) > { > @@ -370,13 +380,6 @@ static struct db8500_thsens_platform_data* > dev_err(&pdev->dev, "Parsing device tree data error.\n"); > return NULL; > } > -#else > -static inline struct db8500_thsens_platform_data* > - db8500_thermal_parse_dt(struct platform_device *pdev) > -{ > - return NULL; > -} > -#endif > > static int db8500_thermal_probe(struct platform_device *pdev) > { > @@ -386,11 +389,10 @@ static int db8500_thermal_probe(struct platform_device *pdev) > int low_irq, high_irq, ret = 0; > unsigned long dft_low, dft_high; > > - if (np) > - ptrips = db8500_thermal_parse_dt(pdev); > - else > - ptrips = dev_get_platdata(&pdev->dev); > + if (!np) > + return -EINVAL; > > + ptrips = db8500_thermal_parse_dt(pdev); > if (!ptrips) > return -EINVAL; > > @@ -498,13 +500,11 @@ static int db8500_thermal_resume(struct platform_device *pdev) > return 0; > } > > -#ifdef CONFIG_OF > static const struct of_device_id db8500_thermal_match[] = { > { .compatible = "stericsson,db8500-thermal" }, > {}, > }; > MODULE_DEVICE_TABLE(of, db8500_thermal_match); > -#endif > > static struct platform_driver db8500_thermal_driver = { > .driver = { > diff --git a/include/linux/platform_data/db8500_thermal.h b/include/linux/platform_data/db8500_thermal.h > deleted file mode 100644 > index 55e55750a165..000000000000 > --- a/include/linux/platform_data/db8500_thermal.h > +++ /dev/null > @@ -1,29 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0-or-later */ > -/* > - * db8500_thermal.h - DB8500 Thermal Management Implementation > - * > - * Copyright (C) 2012 ST-Ericsson > - * Copyright (C) 2012 Linaro Ltd. > - * > - * Author: Hongbo Zhang > - */ > - > -#ifndef _DB8500_THERMAL_H_ > -#define _DB8500_THERMAL_H_ > - > -#include > - > -#define COOLING_DEV_MAX 8 > - > -struct db8500_trip_point { > - unsigned long temp; > - enum thermal_trip_type type; > - char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH]; > -}; > - > -struct db8500_thsens_platform_data { > - struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS]; > - int num_trips; > -}; > - > -#endif /* _DB8500_THERMAL_H_ */ > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog