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