xref: /linux/drivers/acpi/pmic/intel_pmic_chtcrc.c (revision e172e650eda3274964df3a74cf12d210eae9a044)
1cefe6aacSHans de Goede // SPDX-License-Identifier: GPL-2.0
2cefe6aacSHans de Goede /*
3cefe6aacSHans de Goede  * Intel Cherry Trail Crystal Cove PMIC operation region driver
4cefe6aacSHans de Goede  *
5cefe6aacSHans de Goede  * Copyright (C) 2019 Hans de Goede <hdegoede@redhat.com>
6cefe6aacSHans de Goede  */
7cefe6aacSHans de Goede 
8cefe6aacSHans de Goede #include <linux/acpi.h>
9cefe6aacSHans de Goede #include <linux/init.h>
10cefe6aacSHans de Goede #include <linux/mfd/intel_soc_pmic.h>
11cefe6aacSHans de Goede #include <linux/platform_device.h>
12cefe6aacSHans de Goede #include <linux/regmap.h>
13cefe6aacSHans de Goede #include "intel_pmic.h"
14cefe6aacSHans de Goede 
15cefe6aacSHans de Goede /*
16cefe6aacSHans de Goede  * We have no docs for the CHT Crystal Cove PMIC. The Asus Zenfone-2 kernel
17cefe6aacSHans de Goede  * code has 2 Crystal Cove regulator drivers, one calls the PMIC a "Crystal
18935ab850STom Saeger  * Cove Plus" PMIC and talks about Cherry Trail, so presumably that one
19cefe6aacSHans de Goede  * could be used to get register info for the regulators if we need to
20cefe6aacSHans de Goede  * implement regulator support in the future.
21cefe6aacSHans de Goede  *
22cefe6aacSHans de Goede  * For now the sole purpose of this driver is to make
23cefe6aacSHans de Goede  * intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a
24cefe6aacSHans de Goede  * CHT Crystal Cove PMIC.
25cefe6aacSHans de Goede  */
26*e172e650SHans de Goede static const struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = {
27cefe6aacSHans de Goede 	.pmic_i2c_address = 0x6e,
28cefe6aacSHans de Goede };
29cefe6aacSHans de Goede 
30cefe6aacSHans de Goede static int intel_chtcrc_pmic_opregion_probe(struct platform_device *pdev)
31cefe6aacSHans de Goede {
32cefe6aacSHans de Goede 	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
33cefe6aacSHans de Goede 	return intel_pmic_install_opregion_handler(&pdev->dev,
34cefe6aacSHans de Goede 			ACPI_HANDLE(pdev->dev.parent), pmic->regmap,
35cefe6aacSHans de Goede 			&intel_chtcrc_pmic_opregion_data);
36cefe6aacSHans de Goede }
37cefe6aacSHans de Goede 
38cefe6aacSHans de Goede static struct platform_driver intel_chtcrc_pmic_opregion_driver = {
39cefe6aacSHans de Goede 	.probe = intel_chtcrc_pmic_opregion_probe,
40cefe6aacSHans de Goede 	.driver = {
41cefe6aacSHans de Goede 		.name = "cht_crystal_cove_pmic",
42cefe6aacSHans de Goede 	},
43cefe6aacSHans de Goede };
44cefe6aacSHans de Goede builtin_platform_driver(intel_chtcrc_pmic_opregion_driver);
45