mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
ARM: SoC driver updates for v4.15
This branch contains platform-related driver updates for ARM and ARM64,
these are the areas that bring the changes:
New drivers:
- Driver support for Renesas R-Car V3M (R8A77970)
- Power management support for Amlogic GX
- A new driver for the Tegra BPMP thermal sensor
- A new bus driver for Technologic Systems NBUS
Changes for subsystems that prefer to merge through arm-soc:
- The usual updates for reset controller drivers from Philipp Zabel,
with five added drivers for SoCs in the arc, meson, socfpa, uniphier
and mediatek families.
- Updates to the ARM SCPI and PSCI frameworks, from Sudeep Holla,
Heiner Kallweit and Lorenzo Pieralisi.
Changes specific to some ARM-based SoC
- The Freescale/NXP DPAA QBMan drivers from PowerPC can now work
on ARM as well.
- Several changes for power management on Broadcom SoCs
- Various improvements on Qualcomm, Broadcom, Amlogic, Atmel, Mediatek
- Minor Cleanups for Samsung, TI OMAP SoCs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJaDggbAAoJEGCrR//JCVInIeQQAN1MDyO1UaWiFYnbkVOgzFcj
dqbFOc41DBE/90JoBWE8kR/rjyF83OqztiaYpx9viu2qMMBZVcOwxhCUthWK59c/
IujYdw4zGevLscF+jdrLbXgk97nfaWebsHyTAF307WAdZVJxiVGGzQEcgm71d6Zp
CXjLiUii4winHUMK9FLRY2st0HKAevXhuvZJVV432+sTg3p7fGVilYeGOL5G62WO
zQfCisqzC5q677kGGyUlPRGlHWMPkllsTTnfXcmV/FUiGyVa3lUWY5sEu+wCl96O
U1ffPENeNj/A/4fa1dbErtbiNnC2z/+jf+Dg7Cn8w/dPk4Suf0ppjP8RqIGyxmDl
Wm/UxbwDClxaeF4GSaYh2yKgGRJMH5N87bJnZRINE5ccGiol8Ww/34bFG0xNnfyh
jSAFAc318AFG62WD4lvqWc7LSpzOYxp/MNqIFXKN692St/MJLkx8/q0nTwY1qPY0
3SELz9II3hz+3MfDRqtRi7hZpkgHgQ+UG7S5+Xhmqrl309GOEldCjPVJhhXxWoxK
ZPtZOuyYvGhIC+YAnHaN6lUjADIdNJZHwbuXFImx85oKHVofoxHbcni5vk8Uu7z1
sQNYOtdDGaPG/2u9RJdJlPg/jIgLKxxt/Xm9TYVawpZ5hFANhBTtIq5ExCRAil68
j9sMOrpZ1DzCQyR7zN2v
=qDhq
-----END PGP SIGNATURE-----
Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC driver updates from Arnd Bergmann:
"This branch contains platform-related driver updates for ARM and
ARM64, these are the areas that bring the changes:
New drivers:
- driver support for Renesas R-Car V3M (R8A77970)
- power management support for Amlogic GX
- a new driver for the Tegra BPMP thermal sensor
- a new bus driver for Technologic Systems NBUS
Changes for subsystems that prefer to merge through arm-soc:
- the usual updates for reset controller drivers from Philipp Zabel,
with five added drivers for SoCs in the arc, meson, socfpa,
uniphier and mediatek families
- updates to the ARM SCPI and PSCI frameworks, from Sudeep Holla,
Heiner Kallweit and Lorenzo Pieralisi
Changes specific to some ARM-based SoC
- the Freescale/NXP DPAA QBMan drivers from PowerPC can now work on
ARM as well
- several changes for power management on Broadcom SoCs
- various improvements on Qualcomm, Broadcom, Amlogic, Atmel,
Mediatek
- minor Cleanups for Samsung, TI OMAP SoCs"
[ NOTE! This doesn't work without the previous ARM SoC device-tree pull,
because the R8A77970 driver is missing a header file that came from
that pull.
The fact that this got merged afterwards only fixes it at this point,
and bisection of that driver will fail if/when you walk into the
history of that driver. - Linus ]
* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (96 commits)
soc: amlogic: meson-gx-pwrc-vpu: fix power-off when powered by bootloader
bus: add driver for the Technologic Systems NBUS
memory: omap-gpmc: Remove deprecated gpmc_update_nand_reg()
soc: qcom: remove unused label
soc: amlogic: gx pm domain: add PM and OF dependencies
drivers/firmware: psci_checker: Add missing destroy_timer_on_stack()
dt-bindings: power: add amlogic meson power domain bindings
soc: amlogic: add Meson GX VPU Domains driver
soc: qcom: Remote filesystem memory driver
dt-binding: soc: qcom: Add binding for rmtfs memory
of: reserved_mem: Accessor for acquiring reserved_mem
of/platform: Generalize /reserved-memory handling
soc: mediatek: pwrap: fix fatal compiler error
soc: mediatek: pwrap: fix compiler errors
arm64: mediatek: cleanup message for platform selection
soc: Allow test-building of MediaTek drivers
soc: mediatek: place Kconfig for all SoC drivers under menu
soc: mediatek: pwrap: add support for MT7622 SoC
soc: mediatek: pwrap: add common way for setup CS timing extenstion
soc: mediatek: pwrap: add MediaTek MT6380 as one slave of pwrap
..
This commit is contained in:
commit
cf9b0772f2
110 changed files with 6933 additions and 996 deletions
|
|
@ -55,7 +55,7 @@ obj-$(CONFIG_INTEL_BXT_PMIC_THERMAL) += intel_bxt_pmic_thermal.o
|
|||
obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o
|
||||
obj-$(CONFIG_ST_THERMAL) += st/
|
||||
obj-$(CONFIG_QCOM_TSENS) += qcom/
|
||||
obj-$(CONFIG_TEGRA_SOCTHERM) += tegra/
|
||||
obj-y += tegra/
|
||||
obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
|
||||
obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
|
||||
obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
|
||||
|
|
|
|||
|
|
@ -10,4 +10,11 @@ config TEGRA_SOCTHERM
|
|||
zones to manage temperatures. This option is also required for the
|
||||
emergency thermal reset (thermtrip) feature to function.
|
||||
|
||||
config TEGRA_BPMP_THERMAL
|
||||
tristate "Tegra BPMP thermal sensing"
|
||||
depends on TEGRA_BPMP || COMPILE_TEST
|
||||
help
|
||||
Enable this option for support for sensing system temperature of NVIDIA
|
||||
Tegra systems-on-chip with the BPMP coprocessor (Tegra186).
|
||||
|
||||
endmenu
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
obj-$(CONFIG_TEGRA_SOCTHERM) += tegra-soctherm.o
|
||||
obj-$(CONFIG_TEGRA_SOCTHERM) += tegra-soctherm.o
|
||||
obj-$(CONFIG_TEGRA_BPMP_THERMAL) += tegra-bpmp-thermal.o
|
||||
|
||||
tegra-soctherm-y := soctherm.o soctherm-fuse.o
|
||||
tegra-soctherm-$(CONFIG_ARCH_TEGRA_124_SOC) += tegra124-soctherm.o
|
||||
|
|
|
|||
263
drivers/thermal/tegra/tegra-bpmp-thermal.c
Normal file
263
drivers/thermal/tegra/tegra-bpmp-thermal.c
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Author:
|
||||
* Mikko Perttunen <mperttunen@nvidia.com>
|
||||
* Aapo Vienamo <avienamo@nvidia.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/thermal.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <soc/tegra/bpmp.h>
|
||||
#include <soc/tegra/bpmp-abi.h>
|
||||
|
||||
struct tegra_bpmp_thermal_zone {
|
||||
struct tegra_bpmp_thermal *tegra;
|
||||
struct thermal_zone_device *tzd;
|
||||
struct work_struct tz_device_update_work;
|
||||
unsigned int idx;
|
||||
};
|
||||
|
||||
struct tegra_bpmp_thermal {
|
||||
struct device *dev;
|
||||
struct tegra_bpmp *bpmp;
|
||||
unsigned int num_zones;
|
||||
struct tegra_bpmp_thermal_zone **zones;
|
||||
};
|
||||
|
||||
static int tegra_bpmp_thermal_get_temp(void *data, int *out_temp)
|
||||
{
|
||||
struct tegra_bpmp_thermal_zone *zone = data;
|
||||
struct mrq_thermal_host_to_bpmp_request req;
|
||||
union mrq_thermal_bpmp_to_host_response reply;
|
||||
struct tegra_bpmp_message msg;
|
||||
int err;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.type = CMD_THERMAL_GET_TEMP;
|
||||
req.get_temp.zone = zone->idx;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.mrq = MRQ_THERMAL;
|
||||
msg.tx.data = &req;
|
||||
msg.tx.size = sizeof(req);
|
||||
msg.rx.data = &reply;
|
||||
msg.rx.size = sizeof(reply);
|
||||
|
||||
err = tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*out_temp = reply.get_temp.temp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra_bpmp_thermal_set_trips(void *data, int low, int high)
|
||||
{
|
||||
struct tegra_bpmp_thermal_zone *zone = data;
|
||||
struct mrq_thermal_host_to_bpmp_request req;
|
||||
struct tegra_bpmp_message msg;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.type = CMD_THERMAL_SET_TRIP;
|
||||
req.set_trip.zone = zone->idx;
|
||||
req.set_trip.enabled = true;
|
||||
req.set_trip.low = low;
|
||||
req.set_trip.high = high;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.mrq = MRQ_THERMAL;
|
||||
msg.tx.data = &req;
|
||||
msg.tx.size = sizeof(req);
|
||||
|
||||
return tegra_bpmp_transfer(zone->tegra->bpmp, &msg);
|
||||
}
|
||||
|
||||
static void tz_device_update_work_fn(struct work_struct *work)
|
||||
{
|
||||
struct tegra_bpmp_thermal_zone *zone;
|
||||
|
||||
zone = container_of(work, struct tegra_bpmp_thermal_zone,
|
||||
tz_device_update_work);
|
||||
|
||||
thermal_zone_device_update(zone->tzd, THERMAL_TRIP_VIOLATED);
|
||||
}
|
||||
|
||||
static void bpmp_mrq_thermal(unsigned int mrq, struct tegra_bpmp_channel *ch,
|
||||
void *data)
|
||||
{
|
||||
struct mrq_thermal_bpmp_to_host_request *req;
|
||||
struct tegra_bpmp_thermal *tegra = data;
|
||||
int i;
|
||||
|
||||
req = (struct mrq_thermal_bpmp_to_host_request *)ch->ib->data;
|
||||
|
||||
if (req->type != CMD_THERMAL_HOST_TRIP_REACHED) {
|
||||
dev_err(tegra->dev, "%s: invalid request type: %d\n",
|
||||
__func__, req->type);
|
||||
tegra_bpmp_mrq_return(ch, -EINVAL, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < tegra->num_zones; ++i) {
|
||||
if (tegra->zones[i]->idx != req->host_trip_reached.zone)
|
||||
continue;
|
||||
|
||||
schedule_work(&tegra->zones[i]->tz_device_update_work);
|
||||
tegra_bpmp_mrq_return(ch, 0, NULL, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
dev_err(tegra->dev, "%s: invalid thermal zone: %d\n", __func__,
|
||||
req->host_trip_reached.zone);
|
||||
tegra_bpmp_mrq_return(ch, -EINVAL, NULL, 0);
|
||||
}
|
||||
|
||||
static int tegra_bpmp_thermal_get_num_zones(struct tegra_bpmp *bpmp,
|
||||
int *num_zones)
|
||||
{
|
||||
struct mrq_thermal_host_to_bpmp_request req;
|
||||
union mrq_thermal_bpmp_to_host_response reply;
|
||||
struct tegra_bpmp_message msg;
|
||||
int err;
|
||||
|
||||
memset(&req, 0, sizeof(req));
|
||||
req.type = CMD_THERMAL_GET_NUM_ZONES;
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.mrq = MRQ_THERMAL;
|
||||
msg.tx.data = &req;
|
||||
msg.tx.size = sizeof(req);
|
||||
msg.rx.data = &reply;
|
||||
msg.rx.size = sizeof(reply);
|
||||
|
||||
err = tegra_bpmp_transfer(bpmp, &msg);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*num_zones = reply.get_num_zones.num;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct thermal_zone_of_device_ops tegra_bpmp_of_thermal_ops = {
|
||||
.get_temp = tegra_bpmp_thermal_get_temp,
|
||||
.set_trips = tegra_bpmp_thermal_set_trips,
|
||||
};
|
||||
|
||||
static int tegra_bpmp_thermal_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra_bpmp *bpmp = dev_get_drvdata(pdev->dev.parent);
|
||||
struct tegra_bpmp_thermal *tegra;
|
||||
struct thermal_zone_device *tzd;
|
||||
unsigned int i, max_num_zones;
|
||||
int err;
|
||||
|
||||
tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
|
||||
if (!tegra)
|
||||
return -ENOMEM;
|
||||
|
||||
tegra->dev = &pdev->dev;
|
||||
tegra->bpmp = bpmp;
|
||||
|
||||
err = tegra_bpmp_thermal_get_num_zones(bpmp, &max_num_zones);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to get the number of zones: %d\n",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
|
||||
tegra->zones = devm_kcalloc(&pdev->dev, max_num_zones,
|
||||
sizeof(*tegra->zones), GFP_KERNEL);
|
||||
if (!tegra->zones)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < max_num_zones; ++i) {
|
||||
struct tegra_bpmp_thermal_zone *zone;
|
||||
int temp;
|
||||
|
||||
zone = devm_kzalloc(&pdev->dev, sizeof(*zone), GFP_KERNEL);
|
||||
if (!zone)
|
||||
return -ENOMEM;
|
||||
|
||||
zone->idx = i;
|
||||
zone->tegra = tegra;
|
||||
|
||||
err = tegra_bpmp_thermal_get_temp(zone, &temp);
|
||||
if (err < 0) {
|
||||
devm_kfree(&pdev->dev, zone);
|
||||
continue;
|
||||
}
|
||||
|
||||
tzd = devm_thermal_zone_of_sensor_register(
|
||||
&pdev->dev, i, zone, &tegra_bpmp_of_thermal_ops);
|
||||
if (IS_ERR(tzd)) {
|
||||
if (PTR_ERR(tzd) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
devm_kfree(&pdev->dev, zone);
|
||||
continue;
|
||||
}
|
||||
|
||||
zone->tzd = tzd;
|
||||
INIT_WORK(&zone->tz_device_update_work,
|
||||
tz_device_update_work_fn);
|
||||
|
||||
tegra->zones[tegra->num_zones++] = zone;
|
||||
}
|
||||
|
||||
err = tegra_bpmp_request_mrq(bpmp, MRQ_THERMAL, bpmp_mrq_thermal,
|
||||
tegra);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "failed to register mrq handler: %d\n",
|
||||
err);
|
||||
return err;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, tegra);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra_bpmp_thermal_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct tegra_bpmp_thermal *tegra = platform_get_drvdata(pdev);
|
||||
|
||||
tegra_bpmp_free_mrq(tegra->bpmp, MRQ_THERMAL, tegra);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id tegra_bpmp_thermal_of_match[] = {
|
||||
{ .compatible = "nvidia,tegra186-bpmp-thermal" },
|
||||
{ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, tegra_bpmp_thermal_of_match);
|
||||
|
||||
static struct platform_driver tegra_bpmp_thermal_driver = {
|
||||
.probe = tegra_bpmp_thermal_probe,
|
||||
.remove = tegra_bpmp_thermal_remove,
|
||||
.driver = {
|
||||
.name = "tegra-bpmp-thermal",
|
||||
.of_match_table = tegra_bpmp_thermal_of_match,
|
||||
},
|
||||
};
|
||||
module_platform_driver(tegra_bpmp_thermal_driver);
|
||||
|
||||
MODULE_AUTHOR("Mikko Perttunen <[email protected]>");
|
||||
MODULE_DESCRIPTION("NVIDIA Tegra BPMP thermal sensor driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
Loading…
Reference in a new issue