soc: starfive: Remove pmic driver
authormason.huo <mason.huo@starfivetech.com>
Tue, 7 Jun 2022 03:51:34 +0000 (11:51 +0800)
committermason.huo <mason.huo@starfivetech.com>
Tue, 7 Jun 2022 10:33:10 +0000 (18:33 +0800)
The pmic driver should employ regulator framework,
rather than a driver in soc.

Signed-off-by: mason.huo <mason.huo@starfivetech.com>
arch/riscv/boot/dts/starfive/jh7110-common.dtsi
drivers/gpu/drm/verisilicon/inno_hdmi.c
drivers/media/platform/starfive/v4l2_driver/stf_csi_hw_ops.c
drivers/soc/starfive/Kconfig
drivers/soc/starfive/Makefile
drivers/soc/starfive/jh7110_pmic.c [deleted file]
include/soc/starfive/jh7110_pmic.h [deleted file]

index 1cafa59..67c7b98 100755 (executable)
        pinctrl-names = "default";
        pinctrl-0 = <&i2c5_pins>;
        status = "okay";
-
-       pmic@50 {
-               compatible = "starfive,pmic";
-               reg = <0x50>;
-       };
 };
 
 &i2c6 {
index 2ab105d..69acf2b 100644 (file)
@@ -22,7 +22,6 @@
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
-#include <soc/starfive/jh7110_pmic.h>//20220520 pmic support
 #include "vs_clock.h"
 
 #include "vs_drv.h"
@@ -1108,9 +1107,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
                return PTR_ERR(hdmi->regs);
 
        //pmic turn on
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD18_HDMI, 1);
        udelay(100);
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD09_HDMI, 1);
        udelay(100);
 
 //20220531 clk rst interface support
@@ -1197,9 +1194,7 @@ static void inno_hdmi_unbind(struct device *dev, struct device *master,
 
        //pmic turn off
        #if 1
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD18_HDMI, 0);
        udelay(100);
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD09_HDMI, 0);
        #endif
        //pmic turn off
 
index 2b9ea12..f49528a 100755 (executable)
@@ -7,7 +7,6 @@
  */
 #include "stfcamss.h"
 #include <linux/regmap.h>
-#include <soc/starfive/jh7110_pmic.h>
 
 #define CSI2RX_DEVICE_CFG_REG                  0x000
 
@@ -41,9 +40,6 @@ static int stf_csi_power_on(struct stf_csi_dev *csi_dev, u8 on)
 {
        void __iomem *aon_syscon;
 
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD18_MIPIRX, on);
-       pmic_set_domain(POWER_SW_0_REG, POWER_SW_0_VDD09_MIPIRX, on);
-
        aon_syscon = ioremap(0x17010000, 0x4);
        reg_write(aon_syscon, 0x00, 0x80000000);
 
index b76a9ac..d4b0454 100644 (file)
@@ -7,9 +7,3 @@ config STARFIVE_PMU
        help
          Support PMU for StarFive Soc.
 
-config STARFIVE_PMIC
-       bool "Support PMIC for StarFive Soc"
-       depends on SOC_STARFIVE || COMPILE_TEST
-       default SOC_STARFIVE_JH7110
-       help
-         Support PMIC for StarFive Soc.
\ No newline at end of file
index acc48b7..296eb75 100644 (file)
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_STARFIVE_PMU)     += jh7110_pmu.o
-obj-$(CONFIG_STARFIVE_PMIC)    += jh7110_pmic.o
diff --git a/drivers/soc/starfive/jh7110_pmic.c b/drivers/soc/starfive/jh7110_pmic.c
deleted file mode 100644 (file)
index 126a487..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * PMIC driver for the StarFive JH7110 SoC
- *
- * Copyright (C) 2022 changhuang <changhuang.liang@starfivetech.com>
- */
-
-#include <linux/i2c.h>
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/device.h>
-#include <soc/starfive/jh7110_pmic.h>
-
-static struct pmic_dev *pmic_dev;
-
-static int pmic_read_reg(struct pmic_dev *pmic_dev, u8 reg)
-{
-       struct i2c_client *client = pmic_dev->i2c_client;
-       int ret = i2c_smbus_read_byte_data(client, reg);
-
-       if (ret < 0)
-               dev_err(&client->dev, "Read Error\n");
-
-       return ret;
-}
-
-static int pmic_write_reg(struct pmic_dev *pmic_dev, u8 reg, u8 val)
-{
-       struct i2c_client *client = pmic_dev->i2c_client;
-       int ret = i2c_smbus_write_byte_data(client, reg, val);
-
-       if (ret < 0)
-               dev_err(&client->dev, "Write Error\n");
-
-       return ret;
-}
-
-static void pmic_set_bit(struct pmic_dev *pmic_dev, u8 reg, u8 mask, u8 val)
-{
-       u8 value;
-
-       value = pmic_read_reg(pmic_dev, reg) & ~mask;
-       val &= mask;
-       val |= value;
-       pmic_write_reg(pmic_dev, reg, val);
-}
-
-void pmic_set_domain(u8 reg, u8 domain, u8 on)
-{
-       pmic_set_bit(pmic_dev, reg, BIT(domain), on<<domain);
-}
-EXPORT_SYMBOL(pmic_set_domain);
-
-static int pmic_probe(struct i2c_client *client)
-{
-       struct device *dev = &client->dev;
-
-       pmic_dev = devm_kzalloc(dev, sizeof(*pmic_dev), GFP_KERNEL);
-       if (!pmic_dev)
-               return -ENOMEM;
-
-       pmic_dev->i2c_client = client;
-
-       dev_info(dev, "pmic init success!");
-
-       return 0;
-}
-
-static int pmic_remove(struct i2c_client *client)
-{
-       return 0;
-}
-
-static const struct i2c_device_id pmic_id[] = {
-       {"pmic", 0},
-       {},
-};
-MODULE_DEVICE_TABLE(i2c, pmic_id);
-
-static const struct of_device_id pmic_dt_ids[] = {
-       { .compatible = "starfive,pmic" },
-       { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, pmic_dt_ids);
-
-static struct i2c_driver pmic_i2c_driver = {
-       .driver = {
-               .name  = "pmic",
-               .of_match_table = pmic_dt_ids,
-       },
-       .id_table = pmic_id,
-       .probe_new = pmic_probe,
-       .remove   = pmic_remove,
-};
-
-static __init int pmic_init(void)
-{
-       return i2c_add_driver(&pmic_i2c_driver);
-}
-
-static __exit void pmic_exit(void)
-{
-       i2c_del_driver(&pmic_i2c_driver);
-}
-
-fs_initcall(pmic_init);
-module_exit(pmic_exit);
-
-MODULE_AUTHOR("changhuang <changhuang.liang@starfivetech.com>");
-MODULE_DESCRIPTION("StarFive JH7110 PMIC Device Driver");
-MODULE_LICENSE("GPL v2");
diff --git a/include/soc/starfive/jh7110_pmic.h b/include/soc/starfive/jh7110_pmic.h
deleted file mode 100644 (file)
index 304927e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * PMIC driver for the StarFive JH7110 SoC
- *
- * Copyright (C) 2022 changhuang <changhuang.liang@starfivetech.com>
- */
-
-#ifndef __SOC_STARFIVE_JH7110_PMIC_H__
-#define __SOC_STARFIVE_JH7110_PMIC_H__
-
-#include <linux/bits.h>
-#include <linux/types.h>
-
-#define PMIC_REG_BASE          0x80
-
-enum pmic_reg {
-       POWER_SW_0_REG = PMIC_REG_BASE+0x00,
-       POWER_SW_1_REG = PMIC_REG_BASE+0x01,
-};
-
-enum pmic_power_domian {
-       POWER_SW_0_VDD18_HDMI = 0,
-       POWER_SW_0_VDD18_MIPITX,
-       POWER_SW_0_VDD18_MIPIRX,
-       POWER_SW_0_VDD09_HDMI,
-       POWER_SW_0_VDD09_MIPITX,
-       POWER_SW_0_VDD09_MIPIRX,
-};
-
-struct pmic_dev {
-       struct i2c_client *i2c_client;
-};
-
-/**
- * @reg: see enum pmic_reg.
- * @domian: see enum pmic_power_domian.
- * @on: power swtich, 1 or 0.
- */
-void pmic_set_domain(u8 reg, u8 domain, u8 on);
-
-#endif