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