Move Hisilicon 6421v600 SPMI and USB drivers out of staging
Subsystems (10)
Mauro Carvalho Chehab
maintainerv8 cover Move Hisilicon 6421v600 SPMI and USB drivers out of staging
Hi Greg/Mark/Lee/Vinod,
Another rebase , also the top of staging-testing.
This series contain the remaining patches for USB to start working, except for a final DTS patch.
Patches 1 and 2 convert the SPMI and regulator drivers to use regmap and simplifies the logic by using regmap helpers.
Patches 3 to 9 address some issues pointed by Lee at the MFD driver.
I guess the best would be if Greg could apply patches 1 to 9 via the staging tree.
Patches 10 to 13 move the drivers and their corresponding DT documentation bindings out of staging.
Patch 14 contains the DT which describes the regulator, SPMI controller and MFD.
I'll submit the final patch with USB bindings after having everything set (e.g. after 5.12-rc1).
-
v8: contains a fix for REGMAP dependencies and for a build breakage.
Mauro Carvalho Chehab (14):
staging: hikey9xx: spmi driver: convert to regmap
staging: hikey9xx: hi6421v600-regulator: use some regmap helpers
staging: hikey9xx: hi6421-spmi-pmic: rename some vars
staging: hikey9xx: hi6421-spmi-pmic: cleanup probe code
staging: hikey9xx: hi6421-spmi-pmic: cleanup header file
staging: hikey9xx: hi6421-spmi-pmic: fix IRQ handler code
staging: hikey9xx: hi6421-spmi-pmic: cleanup IRQ handling code
staging: hikey9xx: hi6421-spmi-pmic: document registers
staging: hikey9xx: hi6421-spmi-pmic: update copyright notes
phy: phy-hi3670-usb3: move driver from staging into phy
spmi: hisi-spmi-controller: move driver from staging
mfd: hi6421-spmi-pmic: move driver from staging
regulator: hi6421v600-regulator: move it from staging
dts: hisilicon: add support for the PMIC found on Hikey 970
.../mfd}/hisilicon,hi6421-spmi-pmic.yaml | 0
.../bindings/phy/hisilicon,hi3670-usb3.yaml | 0
.../spmi}/hisilicon,hisi-spmi-controller.yaml | 0
MAINTAINERS | 24 +-
.../boot/dts/hisilicon/hi3670-hikey970.dts | 22 +-
.../boot/dts/hisilicon/hikey970-pmic.dtsi | 87 +++++
drivers/mfd/Kconfig | 16 +
drivers/mfd/Makefile | 1 +
drivers/mfd/hi6421-spmi-pmic.c | 297 ++++++++++++++++
drivers/phy/hisilicon/Kconfig | 10 +
drivers/phy/hisilicon/Makefile | 1 +
.../hisilicon}/phy-hi3670-usb3.c | 0
drivers/regulator/Kconfig | 9 +
drivers/regulator/Makefile | 1 +
.../hi6421v600-regulator.c | 63 +---
drivers/spmi/Kconfig | 9 +
drivers/spmi/Makefile | 1 +
.../hikey9xx => spmi}/hisi-spmi-controller.c | 0
drivers/staging/Kconfig | 2 -
drivers/staging/Makefile | 1 -
drivers/staging/hikey9xx/Kconfig | 50 ---
drivers/staging/hikey9xx/Makefile | 7 -
drivers/staging/hikey9xx/TODO | 5 -
drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 326 ------------------
include/linux/mfd/hi6421-spmi-pmic.h | 28 +-
25 files changed, 471 insertions(+), 489 deletions(-)
rename {drivers/staging/hikey9xx => Documentation/devicetree/bindings/mfd}/hisilicon,hi6421-spmi-pmic.yaml (100%)
rename drivers/staging/hikey9xx/phy-hi3670-usb3.yaml => Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml (100%)
rename {drivers/staging/hikey9xx => Documentation/devicetree/bindings/spmi}/hisilicon,hisi-spmi-controller.yaml (100%)
create mode 100644 arch/arm64/boot/dts/hisilicon/hikey970-pmic.dtsi
create mode 100644 drivers/mfd/hi6421-spmi-pmic.c
rename drivers/{staging/hikey9xx => phy/hisilicon}/phy-hi3670-usb3.c (100%)
rename drivers/{staging/hikey9xx => regulator}/hi6421v600-regulator.c (81%)
rename drivers/{staging/hikey9xx => spmi}/hisi-spmi-controller.c (100%)
delete mode 100644 drivers/staging/hikey9xx/Kconfig
delete mode 100644 drivers/staging/hikey9xx/Makefile
delete mode 100644 drivers/staging/hikey9xx/TODO
delete mode 100644 drivers/staging/hikey9xx/hi6421-spmi-pmic.cSignature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 1/14 staging: hikey9xx: spmi driver: convert to regmap
Instead of doing its own SPMI I/O implementation, use the already-existing regmap one.
--- drivers/staging/hikey9xx/Kconfig | 2 + drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 115 ++++++------------ .../staging/hikey9xx/hi6421v600-regulator.c | 26 ++-- include/linux/mfd/hi6421-spmi-pmic.h | 7 +- 4 files changed, 54 insertions(+), 96 deletions(-)
drivers/staging/hikey9xx/Kconfig +2 -0
@@ -29,6 +29,7 @@ config MFD_HI6421_SPMI depends on OF depends on SPMI select MFD_CORE + select REGMAP_SPMI help Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes multi-functions, such as regulators, RTC, codec, Coulomb counter,
@@ -44,6 +45,7 @@ config REGULATOR_HI6421V600 tristate "HiSilicon Hi6421v600 PMIC voltage regulator support" depends on MFD_HI6421_SPMI && OF depends on REGULATOR + select REGMAP help This driver provides support for the voltage regulators on HiSilicon Hi6421v600 PMU / Codec IC.
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +36 -79
178 lines not on this page · raw message
drivers/staging/hikey9xx/hi6421v600-regulator.c +14 -12
@@ -12,6 +12,7 @@#include <linux/mfd/hi6421-spmi-pmic.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <linux/regulator/driver.h> #include <linux/spmi.h>
@@ -100,7 +101,7 @@ static int hi6421_spmi_regulator_is_enabled(struct regulator_dev *rdev)struct hi6421_spmi_pmic *pmic = sreg->pmic;u32 reg_val; - reg_val =hi6421_spmi_pmic_read (pmic, rdev->desc->enable_reg); +regmap_read (pmic->map, rdev->desc->enable_reg, ®_val);return ((reg_val & rdev->desc->enable_mask) !=0 ); }
@@ -114,9 +115,9 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)/* cannot enable more than one regulator at one time */ mutex_lock (&sreg->enable_mutex); - ret =hi6421_spmi_pmic_rmw (pmic, rdev->desc->enable_reg, - rdev->desc->enable_mask, - rdev->desc->enable_mask); + ret =regmap_update_bits (pmic->map, rdev->desc->enable_reg, + rdev->desc->enable_mask, + rdev->desc->enable_mask);/* Avoid powering up multiple devices at the same time */ usleep_range (rdev->desc->off_on_delay, rdev->desc->off_on_delay +60 );
@@ -131,8 +132,8 @@ static int hi6421_spmi_regulator_disable(struct regulator_dev *rdev)struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);struct hi6421_spmi_pmic *pmic = sreg->pmic; -return hi6421_spmi_pmic_rmw (pmic, rdev->desc->enable_reg, - rdev->desc->enable_mask,0 ); +return regmap_update_bits (pmic->map, rdev->desc->enable_reg, + rdev->desc->enable_mask,0 ); }static int hi6421_spmi_regulator_get_voltage_sel (struct regulator_dev *rdev)
@@ -141,7 +142,7 @@ static int hi6421_spmi_regulator_get_voltage_sel(struct regulator_dev *rdev)struct hi6421_spmi_pmic *pmic = sreg->pmic;u32 reg_val; - reg_val =hi6421_spmi_pmic_read (pmic, rdev->desc->vsel_reg); +regmap_read (pmic->map, rdev->desc->vsel_reg, ®_val);return (reg_val & rdev->desc->vsel_mask) >> (ffs (rdev->desc->vsel_mask) -1 ); }
@@ -159,8 +160,8 @@ static int hi6421_spmi_regulator_set_voltage_sel(struct regulator_dev *rdev, reg_val = selector << (ffs (rdev->desc->vsel_mask) -1 );/* set voltage selector */ -return hi6421_spmi_pmic_rmw (pmic, rdev->desc->vsel_reg, - rdev->desc->vsel_mask, reg_val); +return regmap_update_bits (pmic->map, rdev->desc->vsel_reg, + rdev->desc->vsel_mask, reg_val); }static unsigned int hi6421_spmi_regulator_get_mode (struct regulator_dev *rdev)
@@ -169,7 +170,7 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)struct hi6421_spmi_pmic *pmic = sreg->pmic;u32 reg_val; - reg_val =hi6421_spmi_pmic_read (pmic, rdev->desc->enable_reg); +regmap_read (pmic->map, rdev->desc->enable_reg, ®_val);if (reg_val & sreg->eco_mode_mask)return REGULATOR_MODE_IDLE ;
@@ -195,8 +196,8 @@ static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev,return -EINVAL ; } -return hi6421_spmi_pmic_rmw (pmic, rdev->desc->enable_reg, - sreg->eco_mode_mask, val); +return regmap_update_bits (pmic->map, rdev->desc->enable_reg, + sreg->eco_mode_mask, val); } static unsigned int
@@ -304,6 +305,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) config.dev = pdev->dev.parent; config.driver_data = sreg; + config.regmap = pmic->map; rdev =devm_regulator_register (dev, &info->desc, &config);if (IS_ERR (rdev)) {
include/linux/mfd/hi6421-spmi-pmic.h +2 -5
@@ -12,6 +12,7 @@#define __HISI_PMIC_H#include <linux/irqdomain.h> +#include <linux/regmap.h> #define HISI_ECO_MODE_ENABLE (1)#define HISI_ECO_MODE_DISABLE (0)
@@ -25,13 +26,9 @@ struct hi6421_spmi_pmic {int irq;int gpio;unsigned int *irqs; +struct regmap *map; }; -int hi6421_spmi_pmic_read (struct hi6421_spmi_pmic *pmic,int reg); -int hi6421_spmi_pmic_write (struct hi6421_spmi_pmic *pmic,int reg,u32 val); -int hi6421_spmi_pmic_rmw (struct hi6421_spmi_pmic *pmic,int reg, -u32 mask,u32 bits); -enum hi6421_spmi_pmic_irq_list {OTMP =0 ,VBUS_CONNECT ,
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 2/14 staging: hikey9xx: hi6421v600-regulator: use some regmap helpers
In reply to Mauro Carvalho ChehabNow that the driver was ported to use regmap, let's use some help functions in order to simplify the code a little bit.
--- .../staging/hikey9xx/hi6421v600-regulator.c | 45 ++----------------- 1 file changed, 3 insertions(+), 42 deletions(-)
drivers/staging/hikey9xx/hi6421v600-regulator.c +3 -42
@@ -95,17 +95,6 @@ static const unsigned int ldo34_voltages[] = { .eco_uA = ecoamp, \ } -static int hi6421_spmi_regulator_is_enabled (struct regulator_dev *rdev) -{ -struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev); -struct hi6421_spmi_pmic *pmic = sreg->pmic; -u32 reg_val; - -regmap_read (pmic->map, rdev->desc->enable_reg, ®_val); - -return ((reg_val & rdev->desc->enable_mask) !=0 ); -} -static int hi6421_spmi_regulator_enable (struct regulator_dev *rdev) {struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);
@@ -136,34 +125,6 @@ static int hi6421_spmi_regulator_disable(struct regulator_dev *rdev) rdev->desc->enable_mask, 0); } -static int hi6421_spmi_regulator_get_voltage_sel (struct regulator_dev *rdev) -{ -struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev); -struct hi6421_spmi_pmic *pmic = sreg->pmic; -u32 reg_val; - -regmap_read (pmic->map, rdev->desc->vsel_reg, ®_val); - -return (reg_val & rdev->desc->vsel_mask) >> (ffs (rdev->desc->vsel_mask) -1 ); -} - -static int hi6421_spmi_regulator_set_voltage_sel (struct regulator_dev *rdev, -unsigned int selector) -{ -struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev); -struct hi6421_spmi_pmic *pmic = sreg->pmic; -u32 reg_val; - -if (selector >= rdev->desc->n_voltages) -return -EINVAL ; - - reg_val = selector << (ffs (rdev->desc->vsel_mask) -1 ); - -/* set voltage selector */ -return regmap_update_bits (pmic->map, rdev->desc->vsel_reg, - rdev->desc->vsel_mask, reg_val); -} -static unsigned int hi6421_spmi_regulator_get_mode (struct regulator_dev *rdev) {struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);
@@ -214,13 +175,13 @@ hi6421_spmi_regulator_get_optimum_mode(struct regulator_dev *rdev, }static const struct regulator_ops hi6421_spmi_ldo_rops = { - .is_enabled = hi6421_spmi_regulator_is_enabled, + .is_enabled = regulator_is_enabled_regmap, .enable = hi6421_spmi_regulator_enable, .disable = hi6421_spmi_regulator_disable, .list_voltage = regulator_list_voltage_table, .map_voltage = regulator_map_voltage_iterate, - .get_voltage_sel = hi6421_spmi_regulator_get_voltage_sel, - .set_voltage_sel = hi6421_spmi_regulator_set_voltage_sel, + .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_mode = hi6421_spmi_regulator_get_mode, .set_mode = hi6421_spmi_regulator_set_mode, .get_optimum_mode = hi6421_spmi_regulator_get_optimum_mode,
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 3/14 staging: hikey9xx: hi6421-spmi-pmic: rename some vars
In reply to Mauro Carvalho Chehab- When referring to regmap, rename map to regmap
- inside hi6421-spmi-pmic, call private data struct as ddata.
No functional changes.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 104 +++++++++--------- .../staging/hikey9xx/hi6421v600-regulator.c | 10 +- include/linux/mfd/hi6421-spmi-pmic.h | 2 +- 3 files changed, 58 insertions(+), 58 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +52 -52
@@ -43,17 +43,17 @@ static const struct mfd_cell hi6421v600_devs[] = {static irqreturn_t hi6421_spmi_irq_handler (int irq,void *priv) { -struct hi6421_spmi_pmic *pmic = (struct hi6421_spmi_pmic *)priv; +struct hi6421_spmi_pmic *ddata = (struct hi6421_spmi_pmic *)priv;unsigned long pending;unsigned int data;int i, offset;for (i =0 ; i <HISI_IRQ_ARRAY ; i++) { -regmap_read (pmic->map, offset, &data); +regmap_read (ddata->regmap, offset, &data); data &=HISI_MASK_FIELD ;if (data !=0 )pr_debug ("data[%d]=0x%d\n\r" , i, data); -regmap_write (pmic->map, i +SOC_PMIC_IRQ0_ADDR , data); +regmap_write (ddata->regmap, i +SOC_PMIC_IRQ0_ADDR , data);/* for_each_set_bit() macro requires unsigned long */ pending = data;
@@ -61,14 +61,14 @@ static irqreturn_t hi6421_spmi_irq_handler(int irq, void *priv)/* solve powerkey order */ if ((i ==HISI_IRQ_KEY_NUM ) && ((pending &HISI_IRQ_KEY_VALUE ) ==HISI_IRQ_KEY_VALUE )) { -generic_handle_irq (pmic->irqs[HISI_IRQ_KEY_DOWN ]); -generic_handle_irq (pmic->irqs[HISI_IRQ_KEY_UP ]); +generic_handle_irq (ddata->irqs[HISI_IRQ_KEY_DOWN ]); +generic_handle_irq (ddata->irqs[HISI_IRQ_KEY_UP ]); pending &= (~HISI_IRQ_KEY_VALUE ); }if (pending) {for_each_set_bit (offset, &pending,HISI_BITS ) -generic_handle_irq (pmic->irqs[offset + i *HISI_BITS ]); +generic_handle_irq (ddata->irqs[offset + i *HISI_BITS ]); } }
@@ -77,7 +77,7 @@ static irqreturn_t hi6421_spmi_irq_handler(int irq, void *priv)static void hi6421_spmi_irq_mask (struct irq_data *d) { -struct hi6421_spmi_pmic *pmic =irq_data_get_irq_chip_data (d); +struct hi6421_spmi_pmic *ddata =irq_data_get_irq_chip_data (d);unsigned long flags;unsigned int data;u32 offset;
@@ -85,28 +85,28 @@ static void hi6421_spmi_irq_mask(struct irq_data *d) offset = (irqd_to_hwirq (d) >>3 ); offset +=SOC_PMIC_IRQ_MASK_0_ADDR ; -spin_lock_irqsave (&pmic->lock, flags); +spin_lock_irqsave (&ddata->lock, flags); -regmap_read (pmic->map, offset, &data); +regmap_read (ddata->regmap, offset, &data); data |= (1 << (irqd_to_hwirq (d) &0x07 )); -regmap_write (pmic->map, offset, data); -spin_unlock_irqrestore (&pmic->lock, flags); +regmap_write (ddata->regmap, offset, data); +spin_unlock_irqrestore (&ddata->lock, flags); }static void hi6421_spmi_irq_unmask (struct irq_data *d) { -struct hi6421_spmi_pmic *pmic =irq_data_get_irq_chip_data (d); +struct hi6421_spmi_pmic *ddata =irq_data_get_irq_chip_data (d);u32 data, offset;unsigned long flags; offset = (irqd_to_hwirq (d) >>3 ); offset +=SOC_PMIC_IRQ_MASK_0_ADDR ; -spin_lock_irqsave (&pmic->lock, flags); -regmap_read (pmic->map, offset, &data); +spin_lock_irqsave (&ddata->lock, flags); +regmap_read (ddata->regmap, offset, &data); data &= ~(1 << (irqd_to_hwirq (d) &0x07 )); -regmap_write (pmic->map, offset, data); -spin_unlock_irqrestore (&pmic->lock, flags); +regmap_write (ddata->regmap, offset, data); +spin_unlock_irqrestore (&ddata->lock, flags); }static struct irq_chip hi6421_spmi_pmu_irqchip = {
@@ -120,11 +120,11 @@ static struct irq_chip hi6421_spmi_pmu_irqchip = {static int hi6421_spmi_irq_map (struct irq_domain *d,unsigned int virq,irq_hw_number_t hw) { -struct hi6421_spmi_pmic *pmic = d->host_data; +struct hi6421_spmi_pmic *ddata = d->host_data;irq_set_chip_and_handler_name (virq, &hi6421_spmi_pmu_irqchip, handle_simple_irq,"hisi" ); -irq_set_chip_data (virq, pmic); +irq_set_chip_data (virq, ddata);irq_set_irq_type (virq,IRQ_TYPE_NONE );return 0 ;
@@ -135,21 +135,21 @@ static const struct irq_domain_ops hi6421_spmi_domain_ops = { .xlate = irq_domain_xlate_twocell, }; -static void hi6421_spmi_pmic_irq_prc (struct hi6421_spmi_pmic *pmic) +static void hi6421_spmi_pmic_irq_prc (struct hi6421_spmi_pmic *ddata) {int i;unsigned int pending;for (i =0 ; i <HISI_IRQ_ARRAY ; i++) -regmap_write (pmic->map,SOC_PMIC_IRQ_MASK_0_ADDR + i, +regmap_write (ddata->regmap,SOC_PMIC_IRQ_MASK_0_ADDR + i,HISI_MASK_STATE );for (i =0 ; i <HISI_IRQ_ARRAY ; i++) { -regmap_read (pmic->map,SOC_PMIC_IRQ0_ADDR + i, &pending); +regmap_read (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, &pending);pr_debug ("PMU IRQ address value:irq[0x%x] = 0x%x\n" ,SOC_PMIC_IRQ0_ADDR + i, pending); -regmap_write (pmic->map,SOC_PMIC_IRQ0_ADDR + i, +regmap_write (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i,HISI_MASK_STATE ); } }
@@ -165,79 +165,79 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) {struct device *dev = &pdev->dev;struct device_node *np = dev->of_node; -struct hi6421_spmi_pmic *pmic; +struct hi6421_spmi_pmic *ddata;struct regmap *map;unsigned int virq;int ret, i; - pmic =devm_kzalloc (dev,sizeof (*pmic),GFP_KERNEL ); -if (!pmic) + ddata =devm_kzalloc (dev,sizeof (*ddata),GFP_KERNEL ); +if (!ddata)return -ENOMEM ; map =devm_regmap_init_spmi_ext (pdev, &spmi_regmap_config);if (IS_ERR (map))return PTR_ERR (map); -spin_lock_init (&pmic->lock); +spin_lock_init (&ddata->lock); - pmic->dev = dev; - pmic->map = map; + ddata->dev = dev; + ddata->regmap = map; - pmic->gpio =of_get_gpio (np,0 ); -if (pmic->gpio <0 ) -return pmic->gpio; + ddata->gpio =of_get_gpio (np,0 ); +if (ddata->gpio <0 ) +return ddata->gpio; -if (!gpio_is_valid (pmic->gpio)) +if (!gpio_is_valid (ddata->gpio))return -EINVAL ; - ret =devm_gpio_request_one (dev, pmic->gpio,GPIOF_IN ,"pmic" ); + ret =devm_gpio_request_one (dev, ddata->gpio,GPIOF_IN ,"pmic" );if (ret <0 ) { -dev_err (dev,"failed to request gpio%d\n" , pmic->gpio); +dev_err (dev,"failed to request gpio%d\n" , ddata->gpio);return ret; } - pmic->irq =gpio_to_irq (pmic->gpio); + ddata->irq =gpio_to_irq (ddata->gpio); -hi6421_spmi_pmic_irq_prc (pmic); +hi6421_spmi_pmic_irq_prc (ddata); - pmic->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL ); -if (!pmic->irqs) { + ddata->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL ); +if (!ddata->irqs) { ret = -ENOMEM ; goto irq_malloc; } - pmic->domain =irq_domain_add_simple (np,HISI_IRQ_NUM ,0 , - &hi6421_spmi_domain_ops, pmic); -if (!pmic->domain) { + ddata->domain =irq_domain_add_simple (np,HISI_IRQ_NUM ,0 , + &hi6421_spmi_domain_ops, ddata); +if (!ddata->domain) {dev_err (dev,"failed irq domain add simple!\n" ); ret = -ENODEV ; goto irq_malloc; }for (i =0 ; i <HISI_IRQ_NUM ; i++) { - virq =irq_create_mapping (pmic->domain, i); + virq =irq_create_mapping (ddata->domain, i);if (!virq) {dev_err (dev,"Failed mapping hwirq\n" ); ret = -ENOSPC ; goto irq_malloc; } - pmic->irqs[i] = virq; -dev_dbg (dev,"%s: pmic->irqs[%d] = %d\n" , - __func__, i, pmic->irqs[i]); + ddata->irqs[i] = virq; +dev_dbg (dev,"%s: ddata->irqs[%d] = %d\n" , + __func__, i, ddata->irqs[i]); } - ret =request_threaded_irq (pmic->irq, hi6421_spmi_irq_handler,NULL , + ret =request_threaded_irq (ddata->irq, hi6421_spmi_irq_handler,NULL ,IRQF_TRIGGER_LOW |IRQF_SHARED |IRQF_NO_SUSPEND , -"pmic" , pmic); +"pmic" , ddata);if (ret <0 ) {dev_err (dev,"could not claim pmic IRQ: error %d\n" , ret); goto irq_malloc; } -dev_set_drvdata (&pdev->dev, pmic); +dev_set_drvdata (&pdev->dev, ddata);/* -* The logic below will rely that the pmic is already stored at +* The logic below will rely that the ddata is already stored at * drvdata. */ dev_dbg(&pdev->dev, "SPMI-PMIC: adding children for %pOF\n",
@@ -251,16 +251,16 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)dev_err (dev,"Failed to add child devices: %d\n" , ret); irq_malloc: -free_irq (pmic->irq, pmic); +free_irq (ddata->irq, ddata);return ret; }static void hi6421_spmi_pmic_remove (struct spmi_device *pdev) { -struct hi6421_spmi_pmic *pmic =dev_get_drvdata (&pdev->dev); +struct hi6421_spmi_pmic *ddata =dev_get_drvdata (&pdev->dev); -free_irq (pmic->irq, pmic); +free_irq (ddata->irq, ddata); }static const struct of_device_id pmic_spmi_id_table[] = {
drivers/staging/hikey9xx/hi6421v600-regulator.c +5 -5
@@ -104,7 +104,7 @@ static int hi6421_spmi_regulator_enable(struct regulator_dev *rdev)/* cannot enable more than one regulator at one time */ mutex_lock (&sreg->enable_mutex); - ret =regmap_update_bits (pmic->map, rdev->desc->enable_reg, + ret =regmap_update_bits (pmic->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask, rdev->desc->enable_mask);
@@ -121,7 +121,7 @@ static int hi6421_spmi_regulator_disable(struct regulator_dev *rdev)struct hi6421_spmi_reg_info *sreg =rdev_get_drvdata (rdev);struct hi6421_spmi_pmic *pmic = sreg->pmic; -return regmap_update_bits (pmic->map, rdev->desc->enable_reg, +return regmap_update_bits (pmic->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask,0 ); }
@@ -131,7 +131,7 @@ static unsigned int hi6421_spmi_regulator_get_mode(struct regulator_dev *rdev)struct hi6421_spmi_pmic *pmic = sreg->pmic;u32 reg_val; -regmap_read (pmic->map, rdev->desc->enable_reg, ®_val); +regmap_read (pmic->regmap, rdev->desc->enable_reg, ®_val);if (reg_val & sreg->eco_mode_mask)return REGULATOR_MODE_IDLE ;
@@ -157,7 +157,7 @@ static int hi6421_spmi_regulator_set_mode(struct regulator_dev *rdev,return -EINVAL ; } -return regmap_update_bits (pmic->map, rdev->desc->enable_reg, +return regmap_update_bits (pmic->regmap, rdev->desc->enable_reg, sreg->eco_mode_mask, val); }
@@ -266,7 +266,7 @@ static int hi6421_spmi_regulator_probe(struct platform_device *pdev) config.dev = pdev->dev.parent; config.driver_data = sreg; - config.regmap = pmic->map; + config.regmap = pmic->regmap; rdev =devm_regulator_register (dev, &info->desc, &config);if (IS_ERR (rdev)) {
include/linux/mfd/hi6421-spmi-pmic.h +1 -1
@@ -26,7 +26,7 @@ struct hi6421_spmi_pmic {int irq;int gpio;unsigned int *irqs; -struct regmap *map; +struct regmap *regmap; };enum hi6421_spmi_pmic_irq_list {
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 4/14 staging: hikey9xx: hi6421-spmi-pmic: cleanup probe code
In reply to Mauro Carvalho ChehabCleanup the error handling code, making the messages more consistent and removing an uneeded call to free_irq().
While here, also remove debug messages and make the error messages more consistent.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 50 +++++++-------------- 1 file changed, 16 insertions(+), 34 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +16 -34
@@ -154,7 +154,7 @@ static void hi6421_spmi_pmic_irq_prc(struct hi6421_spmi_pmic *ddata) } } -static const struct regmap_config spmi_regmap_config = { +static const struct regmap_config regmap_config = { .reg_bits =16 , .val_bits =8 , .max_register =0xffff ,
@@ -166,7 +166,6 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;struct hi6421_spmi_pmic *ddata; -struct regmap *map;unsigned int virq;int ret, i;
@@ -174,14 +173,13 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)if (!ddata)return -ENOMEM ; - map =devm_regmap_init_spmi_ext (pdev, &spmi_regmap_config); -if (IS_ERR (map)) -return PTR_ERR (map); + ddata->regmap =devm_regmap_init_spmi_ext (pdev, ®map_config); +if (IS_ERR (ddata->regmap)) +return PTR_ERR (ddata->regmap);spin_lock_init (&ddata->lock); ddata->dev = dev; - ddata->regmap = map; ddata->gpio =of_get_gpio (np,0 );if (ddata->gpio <0 )
@@ -192,7 +190,7 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) ret =devm_gpio_request_one (dev, ddata->gpio,GPIOF_IN ,"pmic" );if (ret <0 ) { -dev_err (dev,"failed to request gpio%d\n" , ddata->gpio); +dev_err (dev,"Failed to request gpio%d\n" , ddata->gpio);return ret; }
@@ -201,57 +199,41 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev)hi6421_spmi_pmic_irq_prc (ddata); ddata->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL ); -if (!ddata->irqs) { - ret = -ENOMEM ; - goto irq_malloc; - } +if (!ddata->irqs) +return -ENOMEM ; ddata->domain =irq_domain_add_simple (np,HISI_IRQ_NUM ,0 , &hi6421_spmi_domain_ops, ddata);if (!ddata->domain) { -dev_err (dev,"failed irq domain add simple!\n" ); - ret = -ENODEV ; - goto irq_malloc; +dev_err (dev,"Failed to create IRQ domain\n" ); +return -ENODEV ; }for (i =0 ; i <HISI_IRQ_NUM ; i++) { virq =irq_create_mapping (ddata->domain, i);if (!virq) { -dev_err (dev,"Failed mapping hwirq\n" ); - ret = -ENOSPC ; - goto irq_malloc; +dev_err (dev,"Failed to map H/W IRQ\n" ); +return -ENOSPC ; } ddata->irqs[i] = virq; -dev_dbg (dev,"%s: ddata->irqs[%d] = %d\n" , - __func__, i, ddata->irqs[i]); } ret =request_threaded_irq (ddata->irq, hi6421_spmi_irq_handler,NULL ,IRQF_TRIGGER_LOW |IRQF_SHARED |IRQF_NO_SUSPEND ,"pmic" , ddata);if (ret <0 ) { -dev_err (dev,"could not claim pmic IRQ: error %d\n" , ret); - goto irq_malloc; +dev_err (dev,"Failed to start IRQ handling thread: error %d\n" , + ret); +return ret; }dev_set_drvdata (&pdev->dev, ddata); -/* -* The logic below will rely that the ddata is already stored at -* drvdata. -*/ -dev_dbg (&pdev->dev,"SPMI-PMIC: adding children for %pOF\n" , - pdev->dev.of_node); ret =devm_mfd_add_devices (&pdev->dev,PLATFORM_DEVID_NONE , hi6421v600_devs,ARRAY_SIZE (hi6421v600_devs),NULL ,0 ,NULL ); -if (!ret) -return 0 ; - -dev_err (dev,"Failed to add child devices: %d\n" , ret); - -irq_malloc: -free_irq (ddata->irq, ddata); +if (ret <0 ) +dev_err (dev,"Failed to add child devices: %d\n" , ret);return ret; }
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 5/14 staging: hikey9xx: hi6421-spmi-pmic: cleanup header file
In reply to Mauro Carvalho ChehabRemove the IRQ list from the header, as this is used only inside the driver itself. Also, get rid of two unused defines.
The net result is that only struct hi6421_spmi_pmic remains on it, as this is used by the regulator driver.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 17 +++++++++++++++++ include/linux/mfd/hi6421-spmi-pmic.h | 20 -------------------- 2 files changed, 17 insertions(+), 20 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +17 -0
@@ -17,6 +17,23 @@#include <linux/slab.h> #include <linux/spmi.h> +enum hi6421_spmi_pmic_irq_list { +OTMP =0 , +VBUS_CONNECT , +VBUS_DISCONNECT , +ALARMON_R , +HOLD_6S , +HOLD_1S , +POWERKEY_UP , +POWERKEY_DOWN , +OCP_SCP_R , +COUL_R , +SIM0_HPD_R , +SIM0_HPD_F , +SIM1_HPD_R , +SIM1_HPD_F , +PMIC_IRQ_LIST_MAX , +};/* 8-bit register offset in PMIC */ #define HISI_MASK_STATE 0xff
include/linux/mfd/hi6421-spmi-pmic.h +0 -20
@@ -14,9 +14,6 @@#include <linux/irqdomain.h> #include <linux/regmap.h> -#define HISI_ECO_MODE_ENABLE (1) -#define HISI_ECO_MODE_DISABLE (0) -struct hi6421_spmi_pmic {struct resource *res;struct device *dev;
@@ -29,21 +26,4 @@ struct hi6421_spmi_pmic { struct regmap *regmap; }; -enum hi6421_spmi_pmic_irq_list { -OTMP =0 , -VBUS_CONNECT , -VBUS_DISCONNECT , -ALARMON_R , -HOLD_6S , -HOLD_1S , -POWERKEY_UP , -POWERKEY_DOWN , -OCP_SCP_R , -COUL_R , -SIM0_HPD_R , -SIM0_HPD_F , -SIM1_HPD_R , -SIM1_HPD_F , -PMIC_IRQ_LIST_MAX , -};#endif /* __HISI_PMIC_H */
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 6/14 staging: hikey9xx: hi6421-spmi-pmic: fix IRQ handler code
In reply to Mauro Carvalho ChehabThe conversion to regmap introduced a regression at the code which reads from the IRQ register. Address that.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +1 -1
@@ -66,7 +66,7 @@ static irqreturn_t hi6421_spmi_irq_handler(int irq, void *priv)int i, offset;for (i =0 ; i <HISI_IRQ_ARRAY ; i++) { -regmap_read (ddata->regmap, offset, &data); +regmap_read (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, &data); data &=HISI_MASK_FIELD ;if (data !=0 )pr_debug ("data[%d]=0x%d\n\r" , i, data);
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 7/14 staging: hikey9xx: hi6421-spmi-pmic: cleanup IRQ handling code
In reply to Mauro Carvalho Chehab- Use BIT() and GENMASK();
- Remove duplicated mask definitions;
- Simplify the code under IRQ handler;
- Add a few extra blank lines to make easier to see spin_lock/spin_unlock;
- Remove debug code;
- Fix a few minor coding style issues.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 66 +++++++++------------ 1 file changed, 28 insertions(+), 38 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +28 -38
@@ -7,6 +7,7 @@// // Copyright (c) 2020-2021 Huawei Technologies Co., Ltd +#include <linux/bitops.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/mfd/core.h>
@@ -34,25 +35,19 @@ enum hi6421_spmi_pmic_irq_list {SIM1_HPD_F , PMIC_IRQ_LIST_MAX, }; -/* 8-bit register offset in PMIC */ -#define HISI_MASK_STATE 0xff#define HISI_IRQ_ARRAY 2#define HISI_IRQ_NUM (HISI_IRQ_ARRAY * 8) +#define HISI_IRQ_MASK GENMASK(1, 0)#define SOC_PMIC_IRQ_MASK_0_ADDR 0x0202#define SOC_PMIC_IRQ0_ADDR 0x0212#define HISI_IRQ_KEY_NUM 0 -#define HISI_IRQ_KEY_VALUE 0xc0 -#define HISI_IRQ_KEY_DOWN 7 -#define HISI_IRQ_KEY_UP 6 -#define HISI_MASK_FIELD 0xFF#define HISI_BITS 8 - -/*define the first group interrupt register number*/ -#define HISI_PMIC_FIRST_GROUP_INT_NUM 2 +#define HISI_IRQ_KEY_VALUE (BIT(POWERKEY_DOWN) | BIT(POWERKEY_UP)) +#define HISI_MASK GENMASK(HISI_BITS - 1, 0)static const struct mfd_cell hi6421v600_devs[] = { { .name = "hi6421v600-regulator", },
@@ -62,31 +57,26 @@ static irqreturn_t hi6421_spmi_irq_handler(int irq, void *priv) {struct hi6421_spmi_pmic *ddata = (struct hi6421_spmi_pmic *)priv;unsigned long pending; -unsigned int data; +unsigned int in;int i, offset;for (i =0 ; i <HISI_IRQ_ARRAY ; i++) { -regmap_read (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, &data); - data &=HISI_MASK_FIELD ; -if (data !=0 ) -pr_debug ("data[%d]=0x%d\n\r" , i, data); -regmap_write (ddata->regmap, i +SOC_PMIC_IRQ0_ADDR , data); +regmap_read (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, &in); + pending =HISI_MASK & in; +regmap_write (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, pending); -/* for_each_set_bit() macro requires unsigned long */ - pending = data; - -/* solve powerkey order */ -if ((i ==HISI_IRQ_KEY_NUM ) && - ((pending &HISI_IRQ_KEY_VALUE ) ==HISI_IRQ_KEY_VALUE )) { -generic_handle_irq (ddata->irqs[HISI_IRQ_KEY_DOWN ]); -generic_handle_irq (ddata->irqs[HISI_IRQ_KEY_UP ]); +if (i ==HISI_IRQ_KEY_NUM && + (pending &HISI_IRQ_KEY_VALUE ) ==HISI_IRQ_KEY_VALUE ) { +generic_handle_irq (ddata->irqs[POWERKEY_DOWN ]); +generic_handle_irq (ddata->irqs[POWERKEY_UP ]); pending &= (~HISI_IRQ_KEY_VALUE ); } -if (pending) { -for_each_set_bit (offset, &pending,HISI_BITS ) -generic_handle_irq (ddata->irqs[offset + i *HISI_BITS ]); - } +if (!pending) +continue ; + +for_each_set_bit (offset, &pending,HISI_BITS ) +generic_handle_irq (ddata->irqs[offset + i *HISI_BITS ]); }return IRQ_HANDLED ;
@@ -99,7 +89,7 @@ static void hi6421_spmi_irq_mask(struct irq_data *d)unsigned int data;u32 offset; - offset = (irqd_to_hwirq (d) >>3 ); + offset = (irqd_to_hwirq (d) >>HISI_IRQ_MASK ); offset +=SOC_PMIC_IRQ_MASK_0_ADDR ;spin_lock_irqsave (&ddata->lock, flags);
@@ -107,6 +97,7 @@ static void hi6421_spmi_irq_mask(struct irq_data *d)regmap_read (ddata->regmap, offset, &data); data |= (1 << (irqd_to_hwirq (d) &0x07 ));regmap_write (ddata->regmap, offset, data); +spin_unlock_irqrestore (&ddata->lock, flags); }
@@ -120,9 +111,11 @@ static void hi6421_spmi_irq_unmask(struct irq_data *d) offset +=SOC_PMIC_IRQ_MASK_0_ADDR ;spin_lock_irqsave (&ddata->lock, flags); +regmap_read (ddata->regmap, offset, &data); data &= ~(1 << (irqd_to_hwirq (d) &0x07 ));regmap_write (ddata->regmap, offset, data); +spin_unlock_irqrestore (&ddata->lock, flags); }
@@ -152,28 +145,25 @@ static const struct irq_domain_ops hi6421_spmi_domain_ops = { .xlate = irq_domain_xlate_twocell, }; -static void hi6421_spmi_pmic_irq_prc (struct hi6421_spmi_pmic *ddata) +static void hi6421_spmi_pmic_irq_init (struct hi6421_spmi_pmic *ddata) {int i;unsigned int pending; -for (i =0 ; i <HISI_IRQ_ARRAY ; i++) +for (i =0 ; i <HISI_IRQ_ARRAY ; i++)regmap_write (ddata->regmap,SOC_PMIC_IRQ_MASK_0_ADDR + i, -HISI_MASK_STATE ); +HISI_MASK ); -for (i =0 ; i <HISI_IRQ_ARRAY ; i++) { +for (i =0 ; i <HISI_IRQ_ARRAY ; i++) {regmap_read (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, &pending); - -pr_debug ("PMU IRQ address value:irq[0x%x] = 0x%x\n" , -SOC_PMIC_IRQ0_ADDR + i, pending);regmap_write (ddata->regmap,SOC_PMIC_IRQ0_ADDR + i, -HISI_MASK_STATE ); +HISI_MASK ); } }static const struct regmap_config regmap_config = { .reg_bits =16 , - .val_bits =8 , + .val_bits =HISI_BITS , .max_register =0xffff , .fast_io = true };
@@ -213,7 +203,7 @@ static int hi6421_spmi_pmic_probe(struct spmi_device *pdev) ddata->irq =gpio_to_irq (ddata->gpio); -hi6421_spmi_pmic_irq_prc (ddata); +hi6421_spmi_pmic_irq_init (ddata); ddata->irqs =devm_kzalloc (dev,HISI_IRQ_NUM *sizeof (int ),GFP_KERNEL );if (!ddata->irqs)
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 8/14 staging: hikey9xx: hi6421-spmi-pmic: document registers
In reply to Mauro Carvalho ChehabMake it clearer about how the IRQ registers are filled by adding a table with them, with two macros used to calculate the mask register.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 39 +++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +32 -7
@@ -38,10 +38,6 @@ enum hi6421_spmi_pmic_irq_list {#define HISI_IRQ_ARRAY 2#define HISI_IRQ_NUM (HISI_IRQ_ARRAY * 8) -#define HISI_IRQ_MASK GENMASK(1, 0) - -#define SOC_PMIC_IRQ_MASK_0_ADDR 0x0202 -#define SOC_PMIC_IRQ0_ADDR 0x0212#define HISI_IRQ_KEY_NUM 0
@@ -49,6 +45,36 @@ enum hi6421_spmi_pmic_irq_list {#define HISI_IRQ_KEY_VALUE (BIT(POWERKEY_DOWN) | BIT(POWERKEY_UP))#define HISI_MASK GENMASK(HISI_BITS - 1, 0) +/* +* The IRQs are mapped as: +* +* ====================== ============= ============ ===== +* IRQ MASK REGISTER IRQ REGISTER BIT +* ====================== ============= ============ ===== +* OTMP 0x0202 0x212 bit 0 +* VBUS_CONNECT 0x0202 0x212 bit 1 +* VBUS_DISCONNECT 0x0202 0x212 bit 2 +* ALARMON_R 0x0202 0x212 bit 3 +* HOLD_6S 0x0202 0x212 bit 4 +* HOLD_1S 0x0202 0x212 bit 5 +* POWERKEY_UP 0x0202 0x212 bit 6 +* POWERKEY_DOWN 0x0202 0x212 bit 7 +* +* OCP_SCP_R 0x0203 0x213 bit 0 +* COUL_R 0x0203 0x213 bit 1 +* SIM0_HPD_R 0x0203 0x213 bit 2 +* SIM0_HPD_F 0x0203 0x213 bit 3 +* SIM1_HPD_R 0x0203 0x213 bit 4 +* SIM1_HPD_F 0x0203 0x213 bit 5 +* ====================== ============= ============ ===== +*/ +#define SOC_PMIC_IRQ_MASK_0_ADDR 0x0202 +#define SOC_PMIC_IRQ0_ADDR 0x0212 + +#define IRQ_MASK_REGISTER (irq_data) (SOC_PMIC_IRQ_MASK_0_ADDR + \ + (irqd_to_hwirq(irq_data) >> 3)) +#define IRQ_MASK_BIT (irq_data) BIT(irqd_to_hwirq(irq_data) & 0x07) +static const struct mfd_cell hi6421v600_devs[] = { { .name ="hi6421v600-regulator" , }, };
@@ -89,13 +115,12 @@ static void hi6421_spmi_irq_mask(struct irq_data *d)unsigned int data;u32 offset; - offset = (irqd_to_hwirq (d) >>HISI_IRQ_MASK ); - offset +=SOC_PMIC_IRQ_MASK_0_ADDR ; + offset =IRQ_MASK_REGISTER (d);spin_lock_irqsave (&ddata->lock, flags);regmap_read (ddata->regmap, offset, &data); - data |= (1 << (irqd_to_hwirq (d) &0x07 )); + data |=IRQ_MASK_BIT (d);regmap_write (ddata->regmap, offset, data);spin_unlock_irqrestore (&ddata->lock, flags);
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 9/14 staging: hikey9xx: hi6421-spmi-pmic: update copyright notes
In reply to Mauro Carvalho ChehabAt PMIC subsystem, C89 comments are preferred over C99. While here, also update the copyrights of the header file.
--- drivers/staging/hikey9xx/hi6421-spmi-pmic.c | 14 +++++++------- include/linux/mfd/hi6421-spmi-pmic.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/staging/hikey9xx/hi6421-spmi-pmic.c +7 -7
@@ -1,11 +1,11 @@// SPDX-License-Identifier: GPL-2.0 -// -// Device driver for regulators in HISI PMIC IC -// -// Copyright (c) 2013 Linaro Ltd. -// Copyright (c) 2011 Hisilicon. -// -// Copyright (c) 2020-2021 Huawei Technologies Co., Ltd +/* +* Device driver for regulators in HISI PMIC IC +* +* Copyright (c) 2013 Linaro Ltd. +* Copyright (c) 2011 Hisilicon. +* Copyright (c) 2020-2021 Huawei Technologies Co., Ltd +*/ #include <linux/bitops.h> #include <linux/interrupt.h>
include/linux/mfd/hi6421-spmi-pmic.h +1 -0
@@ -4,6 +4,7 @@* * Copyright (c) 2013 Linaro Ltd. * Copyright (C) 2011 Hisilicon. +* Copyright (c) 2020-2021 Huawei Technologies Co., Ltd * * Guodong Xu <[email protected]> */
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 10/14 phy: phy-hi3670-usb3: move driver from staging into phy
In reply to Mauro Carvalho ChehabThe phy USB3 driver for Hisilicon 970 (hi3670) is ready for mainstream. Mode it from staging into the main driver's phy/ directory.
---
.../bindings/phy/hisilicon,hi3670-usb3.yaml | 0
MAINTAINERS | 9 ++++++++-
drivers/phy/hisilicon/Kconfig | 10 ++++++++++
drivers/phy/hisilicon/Makefile | 1 +
.../hikey9xx => phy/hisilicon}/phy-hi3670-usb3.c | 0
drivers/staging/hikey9xx/Kconfig | 11 -----------
drivers/staging/hikey9xx/Makefile | 2 --
7 files changed, 19 insertions(+), 14 deletions(-)
rename drivers/staging/hikey9xx/phy-hi3670-usb3.yaml => Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml (100%)
rename drivers/{staging/hikey9xx => phy/hisilicon}/phy-hi3670-usb3.c (100%)Documentation/devicetree/bindings/phy/hisilicon,hi3670-usb3.yaml renamed from drivers/staging/hikey9xx/phy-hi3670-usb3.yaml +0 -0
MAINTAINERS +8 -1
@@ -18371,7 +18371,7 @@ L: [email protected] S: Maintained F: drivers/usb/roles/intel-xhci-usb-role-switch.c -USB IP DRIVER FOR HISILICON KIRIN +USB IP DRIVER FOR HISILICON KIRIN 960 M: Yu Chen <[email protected]> M: Binghui Wang <[email protected]> L: [email protected]
@@ -18379,6 +18379,13 @@ S: Maintained F: Documentation/devicetree/bindings/phy/hisilicon,hi3660-usb3.yaml F: drivers/phy/hisilicon/phy-hi3660-usb3.c +USB IP DRIVER FOR HISILICON KIRIN 970 +M: Mauro Carvalho Chehab <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/phy/hisilicon,kirin970-usb3.yaml +F: drivers/phy/hisilicon/phy-kirin970-usb3.c + USB ISP116X DRIVER M: Olav Kongas <[email protected]> L: [email protected]
drivers/phy/hisilicon/Kconfig +10 -0
@@ -23,6 +23,16 @@ config PHY_HI3660_USB To compile this driver as a module, choose M here. +config PHY_HI3670_USB + tristate "hi3670 USB PHY support" + depends on (ARCH_HISI && ARM64) || COMPILE_TEST + select GENERIC_PHY + select MFD_SYSCON + help + Enable this to support the HISILICON HI3670 USB PHY. + + To compile this driver as a module, choose M here. + config PHY_HISTB_COMBPHY tristate "HiSilicon STB SoCs COMBPHY support" depends on (ARCH_HISI && ARM64) || COMPILE_TEST
drivers/phy/hisilicon/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_PHY_HI6220_USB) += phy-hi6220-usb.o obj-$(CONFIG_PHY_HI3660_USB) += phy-hi3660-usb3.o +obj-$(CONFIG_PHY_HI3670_USB) += phy-hi3670-usb3.o obj-$(CONFIG_PHY_HISTB_COMBPHY) += phy-histb-combphy.o obj-$(CONFIG_PHY_HISI_INNO_USB2) += phy-hisi-inno-usb2.o obj-$(CONFIG_PHY_HIX5HD2_SATA) += phy-hix5hd2-sata.o
drivers/phy/hisilicon/phy-hi3670-usb3.c renamed from drivers/staging/hikey9xx/phy-hi3670-usb3.c +0 -0
drivers/staging/hikey9xx/Kconfig +0 -11
@@ -1,16 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -# to be placed at drivers/phy -config PHY_HI3670_USB - tristate "hi3670 USB PHY support" - depends on (ARCH_HISI && ARM64) || COMPILE_TEST - select GENERIC_PHY - select MFD_SYSCON - help - Enable this to support the HISILICON HI3670 USB PHY. - - To compile this driver as a module, choose M here. - # to be placed at drivers/spmi config SPMI_HISI3670 tristate "Hisilicon 3670 SPMI Controller"
drivers/staging/hikey9xx/Makefile +0 -2
@@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_PHY_HI3670_USB) += phy-hi3670-usb3.o - obj-$(CONFIG_SPMI_HISI3670) += hisi-spmi-controller.o obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 11/14 spmi: hisi-spmi-controller: move driver from staging
In reply to Mauro Carvalho ChehabThe Hisilicon 6421v600 SPMI driver is ready for mainstream.
So, move it from staging.
---
.../spmi}/hisilicon,hisi-spmi-controller.yaml | 0
MAINTAINERS | 7 +++++++
drivers/spmi/Kconfig | 9 +++++++++
drivers/spmi/Makefile | 1 +
.../{staging/hikey9xx => spmi}/hisi-spmi-controller.c | 0
drivers/staging/hikey9xx/Kconfig | 11 -----------
drivers/staging/hikey9xx/Makefile | 1 -
7 files changed, 17 insertions(+), 12 deletions(-)
rename {drivers/staging/hikey9xx => Documentation/devicetree/bindings/spmi}/hisilicon,hisi-spmi-controller.yaml (100%)
rename drivers/{staging/hikey9xx => spmi}/hisi-spmi-controller.c (100%)Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml renamed from drivers/staging/hikey9xx/hisilicon,hisi-spmi-controller.yaml +0 -0
MAINTAINERS +7 -0
@@ -8078,6 +8078,13 @@ F: drivers/crypto/hisilicon/sec2/sec_crypto.c F: drivers/crypto/hisilicon/sec2/sec_crypto.h F: drivers/crypto/hisilicon/sec2/sec_main.c +HISILICON SPMI CONTROLLER DRIVER FOR HIKEY 970 +M: Mauro Carvalho Chehab <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml +F: drivers/spmi/hisi-spmi-controller.c + HISILICON STAGING DRIVERS FOR HIKEY 960/970 M: Mauro Carvalho Chehab <[email protected]> L: [email protected]
drivers/spmi/Kconfig +9 -0
@@ -11,6 +11,15 @@ menuconfig SPMI if SPMI +config SPMI_HISI3670 + tristate "Hisilicon 3670 SPMI Controller" + select IRQ_DOMAIN_HIERARCHY + depends on HAS_IOMEM + help + If you say yes to this option, support will be included for the + built-in SPMI PMIC Arbiter interface on Hisilicon 3670 + processors. + config SPMI_MSM_PMIC_ARB tristate "Qualcomm MSM SPMI Controller (PMIC Arbiter)" select IRQ_DOMAIN_HIERARCHY
drivers/spmi/Makefile +1 -0
@@ -4,4 +4,5 @@ # obj-$(CONFIG_SPMI) += spmi.o +obj-$(CONFIG_SPMI_HISI3670) += hisi-spmi-controller.o obj-$(CONFIG_SPMI_MSM_PMIC_ARB) += spmi-pmic-arb.o
drivers/spmi/hisi-spmi-controller.c renamed from drivers/staging/hikey9xx/hisi-spmi-controller.c +0 -0
drivers/staging/hikey9xx/Kconfig +0 -11
@@ -1,16 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -# to be placed at drivers/spmi -config SPMI_HISI3670 - tristate "Hisilicon 3670 SPMI Controller" - select IRQ_DOMAIN_HIERARCHY - depends on HAS_IOMEM - depends on SPMI - help - If you say yes to this option, support will be included for the - built-in SPMI PMIC Arbiter interface on Hisilicon 3670 - processors. - # to be placed at drivers/mfd config MFD_HI6421_SPMI tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC"
drivers/staging/hikey9xx/Makefile +0 -1
@@ -1,5 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_SPMI_HISI3670) += hisi-spmi-controller.o obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o
Signature · 1 line
2.29.2
Re: [PATCH v8 11/14] spmi: hisi-spmi-controller: move driver from staging
Quoting Mauro Carvalho Chehab (2021-01-29 11:51:57)
Quoted 6 lines
The Hisilicon 6421v600 SPMI driver is ready for mainstream.
So, move it from staging.
Signed-off-by Mauro Carvalho Chehab <[email protected]>---
Rob had some comments on the binding that don't look to be addressed though so I'd prefer we get the binding into shape before graduating this driver from staging.
Mauro Carvalho Chehab
maintainerPATCH v8 12/14 mfd: hi6421-spmi-pmic: move driver from staging
In reply to Mauro Carvalho ChehabThis driver is ready for mainstream. So, move it out of staging.
---
.../mfd}/hisilicon,hi6421-spmi-pmic.yaml | 0
MAINTAINERS | 7 +++++++
drivers/mfd/Kconfig | 16 ++++++++++++++++
drivers/mfd/Makefile | 1 +
.../hikey9xx => mfd}/hi6421-spmi-pmic.c | 0
drivers/staging/hikey9xx/Kconfig | 18 ------------------
drivers/staging/hikey9xx/Makefile | 1 -
7 files changed, 24 insertions(+), 19 deletions(-)
rename {drivers/staging/hikey9xx => Documentation/devicetree/bindings/mfd}/hisilicon,hi6421-spmi-pmic.yaml (100%)
rename drivers/{staging/hikey9xx => mfd}/hi6421-spmi-pmic.c (100%)Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml renamed from drivers/staging/hikey9xx/hisilicon,hi6421-spmi-pmic.yaml +0 -0
MAINTAINERS +7 -0
@@ -8085,6 +8085,13 @@ S: Maintained F: Documentation/devicetree/bindings/spmi/hisilicon,hisi-spmi-controller.yaml F: drivers/spmi/hisi-spmi-controller.c +HISILICON SPMI PMIC DRIVER FOR HIKEY 6421v600 +M: Mauro Carvalho Chehab <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml +F: drivers/mfd/hi6421-spmi-pmic.c + HISILICON STAGING DRIVERS FOR HIKEY 960/970 M: Mauro Carvalho Chehab <[email protected]> L: [email protected]
drivers/mfd/Kconfig +16 -0
@@ -509,6 +509,22 @@ config MFD_HI6421_PMIC menus in order to enable them. We communicate with the Hi6421 via memory-mapped I/O. +config MFD_HI6421_SPMI + tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC" + depends on OF + depends on SPMI + select MFD_CORE + select REGMAP_SPMI + help + Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes + multi-functions, such as regulators, RTC, codec, Coulomb counter, + etc. + + This driver includes core APIs _only_. You have to select + individual components like voltage regulators under corresponding + menus in order to enable them. + We communicate with the Hi6421v600 via a SPMI bus. + config MFD_HI655X_PMIC tristate "HiSilicon Hi655X series PMU/Codec IC" depends on ARCH_HISI || COMPILE_TEST
drivers/mfd/Makefile +1 -0
@@ -234,6 +234,7 @@ obj-$(CONFIG_MFD_IPAQ_MICRO) += ipaq-micro.o obj-$(CONFIG_MFD_IQS62X) += iqs62x.o obj-$(CONFIG_MFD_MENF21BMC) += menf21bmc.o obj-$(CONFIG_MFD_HI6421_PMIC) += hi6421-pmic-core.o +obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o
drivers/mfd/hi6421-spmi-pmic.c renamed from drivers/staging/hikey9xx/hi6421-spmi-pmic.c +0 -0
drivers/staging/hikey9xx/Kconfig +0 -18
@@ -1,23 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -# to be placed at drivers/mfd -config MFD_HI6421_SPMI - tristate "HiSilicon Hi6421v600 SPMI PMU/Codec IC" - depends on HAS_IOMEM - depends on OF - depends on SPMI - select MFD_CORE - select REGMAP_SPMI - help - Add support for HiSilicon Hi6421v600 SPMI PMIC. Hi6421 includes - multi-functions, such as regulators, RTC, codec, Coulomb counter, - etc. - - This driver includes core APIs _only_. You have to select - individual components like voltage regulators under corresponding - menus in order to enable them. - We communicate with the Hi6421v600 via a SPMI bus. - # to be placed at drivers/regulator config REGULATOR_HI6421V600 tristate "HiSilicon Hi6421v600 PMIC voltage regulator support"
drivers/staging/hikey9xx/Makefile +0 -1
@@ -1,4 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_MFD_HI6421_SPMI) += hi6421-spmi-pmic.o obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 13/14 regulator: hi6421v600-regulator: move it from staging
In reply to Mauro Carvalho ChehabThis driver is ready for mainstream. Move it out of staging.
---
MAINTAINERS | 7 +------
drivers/regulator/Kconfig | 9 +++++++++
drivers/regulator/Makefile | 1 +
.../hikey9xx => regulator}/hi6421v600-regulator.c | 0
drivers/staging/Kconfig | 2 --
drivers/staging/Makefile | 1 -
drivers/staging/hikey9xx/Kconfig | 12 ------------
drivers/staging/hikey9xx/Makefile | 3 ---
drivers/staging/hikey9xx/TODO | 5 -----
9 files changed, 11 insertions(+), 29 deletions(-)
rename drivers/{staging/hikey9xx => regulator}/hi6421v600-regulator.c (100%)
delete mode 100644 drivers/staging/hikey9xx/Kconfig
delete mode 100644 drivers/staging/hikey9xx/Makefile
delete mode 100644 drivers/staging/hikey9xx/TODOMAINTAINERS +1 -6
@@ -8091,12 +8091,7 @@ L: [email protected] S: Maintained F: Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml F: drivers/mfd/hi6421-spmi-pmic.c - -HISILICON STAGING DRIVERS FOR HIKEY 960/970 -M: Mauro Carvalho Chehab <[email protected]> -L: [email protected] -S: Maintained -F: drivers/staging/hikey9xx/ +F: drivers/regulator/hi6421v600-regulator.c HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT M: Zaibo Xu <[email protected]>
drivers/regulator/Kconfig +9 -0
@@ -423,6 +423,15 @@ config REGULATOR_HI655X This driver provides support for the voltage regulators of the Hisilicon Hi655x PMIC device. +config REGULATOR_HI6421V600 + tristate "HiSilicon Hi6421v600 PMIC voltage regulator support" + depends on MFD_HI6421_SPMI && OF + select REGMAP + help + This driver provides support for the voltage regulators on + HiSilicon Hi6421v600 PMU / Codec IC. + This is used on Kirin 3670 boards, like HiKey 970. + config REGULATOR_ISL9305 tristate "Intersil ISL9305 regulator" depends on I2C
drivers/regulator/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_REGULATOR_FAN53880) += fan53880.o obj-$(CONFIG_REGULATOR_GPIO) += gpio-regulator.o obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o obj-$(CONFIG_REGULATOR_HI6421V530) += hi6421v530-regulator.o +obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o obj-$(CONFIG_REGULATOR_HI655X) += hi655x-regulator.o obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o obj-$(CONFIG_REGULATOR_ISL9305) += isl9305.o
drivers/regulator/hi6421v600-regulator.c renamed from drivers/staging/hikey9xx/hi6421v600-regulator.c +0 -0
drivers/staging/Kconfig +0 -2
@@ -112,6 +112,4 @@ source "drivers/staging/wimax/Kconfig" source "drivers/staging/wfx/Kconfig" -source "drivers/staging/hikey9xx/Kconfig" - endif # STAGING
drivers/staging/Makefile +0 -1
@@ -46,4 +46,3 @@ obj-$(CONFIG_KPC2000) += kpc2000/ obj-$(CONFIG_QLGE) += qlge/ obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_WFX) += wfx/ -obj-y += hikey9xx/
drivers/staging/hikey9xx/Kconfig deleted +0 -12
@@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -# to be placed at drivers/regulator -config REGULATOR_HI6421V600 - tristate "HiSilicon Hi6421v600 PMIC voltage regulator support" - depends on MFD_HI6421_SPMI && OF - depends on REGULATOR - select REGMAP - help - This driver provides support for the voltage regulators on - HiSilicon Hi6421v600 PMU / Codec IC. - This is used on Kirin 3670 boards, like HiKey 970.
drivers/staging/hikey9xx/Makefile deleted +0 -3
@@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 - -obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o
drivers/staging/hikey9xx/TODO deleted +0 -5
@@ -1,5 +0,0 @@ -ToDo list: - -- Port other drivers needed by Hikey 960/970; -- Test drivers on Hikey 960; -- Validate device tree bindings.
Signature · 1 line
2.29.2
Mauro Carvalho Chehab
maintainerPATCH v8 14/14 dts: hisilicon: add support for the PMIC found on Hikey 970
In reply to Mauro Carvalho ChehabAdd a device tree for the HiSilicon 6421v600 SPMI PMIC, used on HiKey970 board.
As we now have support for it, change the fixed regulators used by the SD I/O to use the proper LDO supplies.
--- .../boot/dts/hisilicon/hi3670-hikey970.dts | 22 +---- .../boot/dts/hisilicon/hikey970-pmic.dtsi | 87 +++++++++++++++++++ 2 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 arch/arm64/boot/dts/hisilicon/hikey970-pmic.dtsi
arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dts +3 -19
@@ -12,6 +12,7 @@ #include "hi3670.dtsi" #include "hikey970-pinctrl.dtsi" +#include "hikey970-pmic.dtsi" / { model = "HiKey970";
@@ -39,23 +40,6 @@ memory@0 { reg = <0x0 0x0 0x0 0x0>; }; - sd_1v8: regulator-1v8 { - compatible = "regulator-fixed"; - regulator-name = "fixed-1.8V"; - regulator-min-microvolt = <1800000>; - regulator-max-microvolt = <1800000>; - regulator-always-on; - }; - - sd_3v3: regulator-3v3 { - compatible = "regulator-fixed"; - regulator-name = "fixed-3.3V"; - regulator-min-microvolt = <3300000>; - regulator-max-microvolt = <3300000>; - regulator-boot-on; - regulator-always-on; - }; - wlan_en: wlan-en-1-8v { compatible = "regulator-fixed"; regulator-name = "wlan-en-regulator";
@@ -402,8 +386,8 @@ &dwmmc1 { pinctrl-0 = <&sd_pmx_func &sd_clk_cfg_func &sd_cfg_func>; - vmmc-supply = <&sd_3v3>; - vqmmc-supply = <&sd_1v8>; + vmmc-supply = <&ldo16>; + vqmmc-supply = <&ldo9>; status = "okay"; };
arch/arm64/boot/dts/hisilicon/hikey970-pmic.dtsi new file +87 -0
87 lines not on this page · raw message
Signature · 7 lines
2.29.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel