mfd: mt6360: Merge different sub-devices I2C read/write
Subsystems (2)
v7 cover mfd: mt6360: Merge different sub-devices I2C read/write
This patch series merge different sub-device I2C read/write into one Regmap and fix coding style for well-organized.
Gene Chen (11)
mfd: mt6360: Rearrange include file
mfd: mt6360: Remove redundant brackets around raw numbers
mfd: mt6360: Indicate sub-dev compatible name by using
mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360
mfd: mt6360: Rename mt6360_pmu_data by mt6360_ddata
mfd: mt6360: Rename mt6360_pmu by mt6360
mfd: mt6360: Remove handle_post_irq callback function
mfd: mt6360: Fix flow which is used to check ic exist
mfd: mt6360: Merge header file into driver and remove unuse register define
mfd: mt6360: Merge different sub-devices I2C read/write
mfd: mt6360: Remove MT6360 regulator of_compatible
b/drivers/mfd/Kconfig | 1 b/drivers/mfd/mt6360-core.c | 554 +++++++++++++++++++++++++++++--------------- include/linux/mfd/mt6360.h | 240 ------------------- 3 files changed, 376 insertions(+), 419 deletions(-)
changelogs between v2 & v3
- Replace mt6360_data to mt6360_ddata
- Split I2C read/write to regmap driver
changelogs between v3 & v4
- Merge back mt6360 regmap driver to MFD driver
changelogs between v4 & v5
- use devm_regmap_init
- define crc calculation magic number
changelogs between v5 & v6
- Remove unrelated change
- Remove regulator device of_compatible
changelogs between v6 & v7
- Replace OF_MFD_CELL by MFD_CELL_RES
PATCH v7 1/11 mfd: mt6360: Rearrange include file
From: Gene Chen <[email protected]>
Rearrange include file without sorting by alphabet.
--- drivers/mfd/mt6360-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/mfd/mt6360-core.c +3 -4
@@ -5,15 +5,14 @@* Author: Gene Chen <[email protected]> */ +#include <linux/crc8.h> #include <linux/i2c.h> -#include <linux/init.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/mfd/core.h> #include <linux/module.h> -#include <linux/of_irq.h> -#include <linux/of_platform.h> -#include <linux/version.h> +#include <linux/regmap.h> +#include <linux/slab.h> #include <linux/mfd/mt6360.h>
Signature · 1 line
2.7.4
PATCH v7 2/11 mfd: mt6360: Remove redundant brackets around raw numbers
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Remove redundant brackets around raw numbers.
--- drivers/mfd/mt6360-core.c | 172 +++++++++---------- include/linux/mfd/mt6360.h | 410 ++++++++++++++++++++++----------------------- 2 files changed, 291 insertions(+), 291 deletions(-)
drivers/mfd/mt6360-core.c +86 -86
@@ -17,107 +17,107 @@#include <linux/mfd/mt6360.h> /* reg 0 -> 0 ~ 7 */ -#define MT6360_CHG_TREG_EVT (4) -#define MT6360_CHG_AICR_EVT (5) -#define MT6360_CHG_MIVR_EVT (6) -#define MT6360_PWR_RDY_EVT (7) +#define MT6360_CHG_TREG_EVT 4 +#define MT6360_CHG_AICR_EVT 5 +#define MT6360_CHG_MIVR_EVT 6 +#define MT6360_PWR_RDY_EVT 7/* REG 1 -> 8 ~ 15 */ -#define MT6360_CHG_BATSYSUV_EVT (9) -#define MT6360_FLED_CHG_VINOVP_EVT (11) -#define MT6360_CHG_VSYSUV_EVT (12) -#define MT6360_CHG_VSYSOV_EVT (13) -#define MT6360_CHG_VBATOV_EVT (14) -#define MT6360_CHG_VBUSOV_EVT (15) +#define MT6360_CHG_BATSYSUV_EVT 9 +#define MT6360_FLED_CHG_VINOVP_EVT 11 +#define MT6360_CHG_VSYSUV_EVT 12 +#define MT6360_CHG_VSYSOV_EVT 13 +#define MT6360_CHG_VBATOV_EVT 14 +#define MT6360_CHG_VBUSOV_EVT 15/* REG 2 -> 16 ~ 23 */ /* REG 3 -> 24 ~ 31 */ -#define MT6360_WD_PMU_DET (25) -#define MT6360_WD_PMU_DONE (26) -#define MT6360_CHG_TMRI (27) -#define MT6360_CHG_ADPBADI (29) -#define MT6360_CHG_RVPI (30) -#define MT6360_OTPI (31) +#define MT6360_WD_PMU_DET 25 +#define MT6360_WD_PMU_DONE 26 +#define MT6360_CHG_TMRI 27 +#define MT6360_CHG_ADPBADI 29 +#define MT6360_CHG_RVPI 30 +#define MT6360_OTPI 31/* REG 4 -> 32 ~ 39 */ -#define MT6360_CHG_AICCMEASL (32) -#define MT6360_CHGDET_DONEI (34) -#define MT6360_WDTMRI (35) -#define MT6360_SSFINISHI (36) -#define MT6360_CHG_RECHGI (37) -#define MT6360_CHG_TERMI (38) -#define MT6360_CHG_IEOCI (39) +#define MT6360_CHG_AICCMEASL 32 +#define MT6360_CHGDET_DONEI 34 +#define MT6360_WDTMRI 35 +#define MT6360_SSFINISHI 36 +#define MT6360_CHG_RECHGI 37 +#define MT6360_CHG_TERMI 38 +#define MT6360_CHG_IEOCI 39/* REG 5 -> 40 ~ 47 */ -#define MT6360_PUMPX_DONEI (40) -#define MT6360_BAT_OVP_ADC_EVT (41) -#define MT6360_TYPEC_OTP_EVT (42) -#define MT6360_ADC_WAKEUP_EVT (43) -#define MT6360_ADC_DONEI (44) -#define MT6360_BST_BATUVI (45) -#define MT6360_BST_VBUSOVI (46) -#define MT6360_BST_OLPI (47) +#define MT6360_PUMPX_DONEI 40 +#define MT6360_BAT_OVP_ADC_EVT 41 +#define MT6360_TYPEC_OTP_EVT 42 +#define MT6360_ADC_WAKEUP_EVT 43 +#define MT6360_ADC_DONEI 44 +#define MT6360_BST_BATUVI 45 +#define MT6360_BST_VBUSOVI 46 +#define MT6360_BST_OLPI 47/* REG 6 -> 48 ~ 55 */ -#define MT6360_ATTACH_I (48) -#define MT6360_DETACH_I (49) -#define MT6360_QC30_STPDONE (51) -#define MT6360_QC_VBUSDET_DONE (52) -#define MT6360_HVDCP_DET (53) -#define MT6360_CHGDETI (54) -#define MT6360_DCDTI (55) +#define MT6360_ATTACH_I 48 +#define MT6360_DETACH_I 49 +#define MT6360_QC30_STPDONE 51 +#define MT6360_QC_VBUSDET_DONE 52 +#define MT6360_HVDCP_DET 53 +#define MT6360_CHGDETI 54 +#define MT6360_DCDTI 55/* REG 7 -> 56 ~ 63 */ -#define MT6360_FOD_DONE_EVT (56) -#define MT6360_FOD_OV_EVT (57) -#define MT6360_CHRDET_UVP_EVT (58) -#define MT6360_CHRDET_OVP_EVT (59) -#define MT6360_CHRDET_EXT_EVT (60) -#define MT6360_FOD_LR_EVT (61) -#define MT6360_FOD_HR_EVT (62) -#define MT6360_FOD_DISCHG_FAIL_EVT (63) +#define MT6360_FOD_DONE_EVT 56 +#define MT6360_FOD_OV_EVT 57 +#define MT6360_CHRDET_UVP_EVT 58 +#define MT6360_CHRDET_OVP_EVT 59 +#define MT6360_CHRDET_EXT_EVT 60 +#define MT6360_FOD_LR_EVT 61 +#define MT6360_FOD_HR_EVT 62 +#define MT6360_FOD_DISCHG_FAIL_EVT 63/* REG 8 -> 64 ~ 71 */ -#define MT6360_USBID_EVT (64) -#define MT6360_APWDTRST_EVT (65) -#define MT6360_EN_EVT (66) -#define MT6360_QONB_RST_EVT (67) -#define MT6360_MRSTB_EVT (68) -#define MT6360_OTP_EVT (69) -#define MT6360_VDDAOV_EVT (70) -#define MT6360_SYSUV_EVT (71) +#define MT6360_USBID_EVT 64 +#define MT6360_APWDTRST_EVT 65 +#define MT6360_EN_EVT 66 +#define MT6360_QONB_RST_EVT 67 +#define MT6360_MRSTB_EVT 68 +#define MT6360_OTP_EVT 69 +#define MT6360_VDDAOV_EVT 70 +#define MT6360_SYSUV_EVT 71/* REG 9 -> 72 ~ 79 */ -#define MT6360_FLED_STRBPIN_EVT (72) -#define MT6360_FLED_TORPIN_EVT (73) -#define MT6360_FLED_TX_EVT (74) -#define MT6360_FLED_LVF_EVT (75) -#define MT6360_FLED2_SHORT_EVT (78) -#define MT6360_FLED1_SHORT_EVT (79) +#define MT6360_FLED_STRBPIN_EVT 72 +#define MT6360_FLED_TORPIN_EVT 73 +#define MT6360_FLED_TX_EVT 74 +#define MT6360_FLED_LVF_EVT 75 +#define MT6360_FLED2_SHORT_EVT 78 +#define MT6360_FLED1_SHORT_EVT 79/* REG 10 -> 80 ~ 87 */ -#define MT6360_FLED2_STRB_EVT (80) -#define MT6360_FLED1_STRB_EVT (81) -#define MT6360_FLED2_STRB_TO_EVT (82) -#define MT6360_FLED1_STRB_TO_EVT (83) -#define MT6360_FLED2_TOR_EVT (84) -#define MT6360_FLED1_TOR_EVT (85) +#define MT6360_FLED2_STRB_EVT 80 +#define MT6360_FLED1_STRB_EVT 81 +#define MT6360_FLED2_STRB_TO_EVT 82 +#define MT6360_FLED1_STRB_TO_EVT 83 +#define MT6360_FLED2_TOR_EVT 84 +#define MT6360_FLED1_TOR_EVT 85/* REG 11 -> 88 ~ 95 */ /* REG 12 -> 96 ~ 103 */ -#define MT6360_BUCK1_PGB_EVT (96) -#define MT6360_BUCK1_OC_EVT (100) -#define MT6360_BUCK1_OV_EVT (101) -#define MT6360_BUCK1_UV_EVT (102) +#define MT6360_BUCK1_PGB_EVT 96 +#define MT6360_BUCK1_OC_EVT 100 +#define MT6360_BUCK1_OV_EVT 101 +#define MT6360_BUCK1_UV_EVT 102/* REG 13 -> 104 ~ 111 */ -#define MT6360_BUCK2_PGB_EVT (104) -#define MT6360_BUCK2_OC_EVT (108) -#define MT6360_BUCK2_OV_EVT (109) -#define MT6360_BUCK2_UV_EVT (110) +#define MT6360_BUCK2_PGB_EVT 104 +#define MT6360_BUCK2_OC_EVT 108 +#define MT6360_BUCK2_OV_EVT 109 +#define MT6360_BUCK2_UV_EVT 110/* REG 14 -> 112 ~ 119 */ -#define MT6360_LDO1_OC_EVT (113) -#define MT6360_LDO2_OC_EVT (114) -#define MT6360_LDO3_OC_EVT (115) -#define MT6360_LDO5_OC_EVT (117) -#define MT6360_LDO6_OC_EVT (118) -#define MT6360_LDO7_OC_EVT (119) +#define MT6360_LDO1_OC_EVT 113 +#define MT6360_LDO2_OC_EVT 114 +#define MT6360_LDO3_OC_EVT 115 +#define MT6360_LDO5_OC_EVT 117 +#define MT6360_LDO6_OC_EVT 118 +#define MT6360_LDO7_OC_EVT 119/* REG 15 -> 120 ~ 127 */ -#define MT6360_LDO1_PGB_EVT (121) -#define MT6360_LDO2_PGB_EVT (122) -#define MT6360_LDO3_PGB_EVT (123) -#define MT6360_LDO5_PGB_EVT (125) -#define MT6360_LDO6_PGB_EVT (126) -#define MT6360_LDO7_PGB_EVT (127) +#define MT6360_LDO1_PGB_EVT 121 +#define MT6360_LDO2_PGB_EVT 122 +#define MT6360_LDO3_PGB_EVT 123 +#define MT6360_LDO5_PGB_EVT 125 +#define MT6360_LDO6_PGB_EVT 126 +#define MT6360_LDO7_PGB_EVT 127static const struct regmap_irq mt6360_pmu_irqs[] = {REGMAP_IRQ_REG_LINE (MT6360_CHG_TREG_EVT ,8 ),
include/linux/mfd/mt6360.h +205 -205
426 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v7 3/11 mfd: mt6360: Indicate sub-dev compatible name by using "-"
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Indicate sub-dev compatible name by using "-".
--- drivers/mfd/mt6360-core.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/mfd/mt6360-core.c +12 -12
@@ -292,18 +292,18 @@ static const struct resource mt6360_ldo_resources[] = { };static const struct mfd_cell mt6360_devs[] = { -OF_MFD_CELL ("mt6360_adc" , mt6360_adc_resources, -NULL ,0 ,0 ,"mediatek,mt6360_adc" ), -OF_MFD_CELL ("mt6360_chg" , mt6360_chg_resources, -NULL ,0 ,0 ,"mediatek,mt6360_chg" ), -OF_MFD_CELL ("mt6360_led" , mt6360_led_resources, -NULL ,0 ,0 ,"mediatek,mt6360_led" ), -OF_MFD_CELL ("mt6360_pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360_pmic" ), -OF_MFD_CELL ("mt6360_ldo" , mt6360_ldo_resources, -NULL ,0 ,0 ,"mediatek,mt6360_ldo" ), -OF_MFD_CELL ("mt6360_tcpc" ,NULL , -NULL ,0 ,0 ,"mediatek,mt6360_tcpc" ), +OF_MFD_CELL ("mt6360-adc" , mt6360_adc_resources, +NULL ,0 ,0 ,"mediatek,mt6360-adc" ), +OF_MFD_CELL ("mt6360-chg" , mt6360_chg_resources, +NULL ,0 ,0 ,"mediatek,mt6360-chg" ), +OF_MFD_CELL ("mt6360-led" , mt6360_led_resources, +NULL ,0 ,0 ,"mediatek,mt6360-led" ), +OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, +NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), +OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, +NULL ,0 ,0 ,"mediatek,mt6360-ldo" ), +OF_MFD_CELL ("mt6360-tcpc" ,NULL , +NULL ,0 ,0 ,"mediatek,mt6360-tcpc" ), };static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX ] = {
Signature · 1 line
2.7.4
PATCH v7 4/11 mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/mfd/mt6360-core.c +3 -8
@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),
@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, -NULL ,0 ,0 ,"mediatek,mt6360-ldo" ), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, +NULL ,0 ,0 ,"mediatek,mt6360-regulator" ),OF_MFD_CELL ("mt6360-tcpc" ,NULL , NULL, 0, 0, "mediatek,mt6360-tcpc"), };
Signature · 1 line
2.7.4
Matthias Brugger
maintainerRe: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Quoted 35 lines · Gene Chen
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),
As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias
[1] https://lore.kernel.org/linux-mediatek/[email protected]/
drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 302
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 52 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
Quoted 7 lines
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
Should I use parent's device to find sub-devices of_node if without compatible name?
I trace the function mfd_add_device,
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) {
.....
ret = mfd_match_of_node_to_dev(pdev, np, cell);
.....
}which is binding mfd sub-device with compatible. Does it be removed in the feature?
Quoted 4 lines
drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 302
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Quoted 59 lines · Gene Chen
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Quoted 17 lines
Should I use parent's device to find sub-devices
of_nodeif without compatible name?
I trace the functionmfd_add_device,if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { ..... ret = mfd_match_of_node_to_dev(pdev, np, cell); ..... }which is binding mfd sub-device with compatible. Does it be removed in the feature?
Quoted 4 lines
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };
Signature · 9 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 63 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
Quoted 8 lines
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supported of_compatible, we prefer use of_compatible mapping.
Quoted 18 lines
Quoted 4 lines
Should I use parent's device to find sub-devices
of_nodeif without compatible name?
I trace the functionmfd_add_device,Quoted 13 lines
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { ..... ret = mfd_match_of_node_to_dev(pdev, np, cell); ..... }which is binding mfd sub-device with compatible. Does it be removed in the feature?
Quoted 4 lines
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };
Quoted 5 lines
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer ServicesLinaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Gene Chen <[email protected]> 於 2021年3月2日 週二 下午3:16寫道:
Quoted 70 lines
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 68 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
Quoted 8 lines
Quoted 3 lines
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supportedof_compatible, we prefer useof_compatiblemapping.
Is there any update?
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Should I use parent's device to find sub-devices
of_nodeif without compatible name?
I trace the functionmfd_add_device,if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { ..... ret = mfd_match_of_node_to_dev(pdev, np, cell); ..... }which is binding mfd sub-device with compatible. Does it be removed in the feature?
Quoted 4 lines
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };
Quoted 5 lines
Quoted 5 lines
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer ServicesLinaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
In reply to Gene ChenQuoted 69 lines · Gene Chen
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 68 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
Quoted 7 lines
Quoted 3 lines
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supportedof_compatible, we prefer useof_compatiblemapping.
I would resubmit the set. We can start afresh from there.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Lee Jones <[email protected]> 於 2021年3月23日 週二 下午5:38寫道:
Quoted 76 lines · Gene Chen
Quoted 74 lines
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 71 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Quoted 6 lines
Quoted 3 lines
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supportedof_compatible, we prefer useof_compatiblemapping.I would resubmit the set. We can start afresh from there.
Dear Jones,
Should I send fixed patch about adding regulator node directly can
make easier for you to re-submit new patch?
Quoted 5 lines
--
Lee Jones [李琼斯]
Senior Technical Lead - Developer ServicesLinaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
Quoted 81 lines · Gene Chen
Lee Jones <[email protected]> 於 2021年3月23日 週二 下午5:38寫道:
Quoted 80 lines · Gene Chen
Quoted 77 lines
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 63 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
Quoted 8 lines
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supportedof_compatible, we prefer useof_compatiblemapping.
Quoted 6 lines
Quoted 1 line
I would resubmit the set. We can start afresh from there.
Dear Jones,
Should I send fixed patch about adding regulator node directly can
make easier for you to re-submit new patch?
Don't worry about me. Do what's best for you.
I look forward to receiving the new set soon.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Matthias Brugger
maintainerRe: [PATCH v7 04/11] mfd: mt6360: Combine mt6360 pmic/ldo resources into mt6360 regulator resources
In reply to Gene ChenQuoted 69 lines · Gene Chen
Lee Jones <[email protected]> 於 2021年1月15日 週五 下午3:32寫道:
Quoted 68 lines · Gene Chen
Quoted 60 lines
Matthias Brugger <[email protected]> 於 2021年1月12日 週二 下午8:32寫道:
Quoted 58 lines · Gene Chen
Quoted 35 lines
From: Gene Chen <[email protected]>
Combine mt6360 pmic/ldo resources into mt6360 regulator resources to simplify the similar resources object.
Signed-off-by Gene Chen <[email protected]>Acked-for-MFD-by Lee Jones <[email protected]>--- drivers/mfd/mt6360-core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mfd/mt6360-core.c +1
-4@@ -265,7 +265,7 @@ static const struct resource mt6360_led_resources[] = { DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"), }; -static const struct resource mt6360_pmic_resources[] = { +static const struct resource mt6360_regulator_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_PGB_EVT ,"buck1_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OC_EVT ,"buck1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_BUCK1_OV_EVT ,"buck1_ov_evt" ),@@ -278,9 +278,6 @@ static const struct resource mt6360_pmic_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO7_OC_EVT ,"ldo7_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO6_PGB_EVT ,"ldo6_pgb_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO7_PGB_EVT ,"ldo7_pgb_evt" ), -}; - -static const struct resource mt6360_ldo_resources[] = {DEFINE_RES_IRQ_NAMED (MT6360_LDO1_OC_EVT ,"ldo1_oc_evt" ),DEFINE_RES_IRQ_NAMED (MT6360_LDO2_OC_EVT ,"ldo2_oc_evt" ), DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),drivers/mfd/mt6360-core.c static const struct mfd_cell mt6360_devs[] = { · line 299
Quoted 9 lines
drivers/mfd/mt6360-core.c +2
-4@@ -298,10 +295,8 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-pmic" , mt6360_pmic_resources, -NULL ,0 ,0 ,"mediatek,mt6360-pmic" ), -OF_MFD_CELL ("mt6360-ldo" , mt6360_ldo_resources, - NULL, 0, 0, "mediatek,mt6360-ldo"), +OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, + NULL, 0, 0, "mediatek,mt6360-regulator"),As discussed with the MFD maintainer [1], the regulator (and probably all cells) shouldn't have a DT binding.
So please send a new version which fixes that.
Regards,
Matthias[1] https://lore.kernel.org/linux-mediatek/[email protected]/
I don't think Mark is correct here.
We usually do implement compatible strings for sub-devices and they do tend to have their own device nodes.
Quoted 8 lines
Quoted 3 lines
It's a very long time ago since I coded this up myself, but from memory, you can't have 2 devices share a compatible string.
Either Mark or Lee suggestion is work.
Is there a conclusion that we can apply it?
If MFD is already supportedof_compatible, we prefer useof_compatiblemapping.
For regulator on PMIC you should add the regulator to the pmic node directly. Please see the series from Hsin-Hsiung for referece:
https://lore.kernel.org/linux-mediatek/[email protected]/T/#u
Regards,
Matthias
Quoted 23 lines
Quoted 23 lines
Quoted 4 lines
Should I use parent's device to find sub-devices
of_nodeif without compatible name?
I trace the functionmfd_add_device,Quoted 13 lines
if (IS_ENABLED(CONFIG_OF) && parent->of_node && cell->of_compatible) { ..... ret = mfd_match_of_node_to_dev(pdev, np, cell); ..... }which is binding mfd sub-device with compatible. Does it be removed in the feature?
Quoted 4 lines
Quoted 4 lines
drivers/mfd/mt6360-core.c +0
-0OF_MFD_CELL("mt6360-tcpc", NULL, NULL, 0, 0, "mediatek,mt6360-tcpc"), };--
Lee Jones [李琼斯]
Senior Technical Lead - Developer ServicesLinaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v7 5/11 mfd: mt6360: Rename mt6360_pmu_data by mt6360_ddata
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Rename mt6360_pmu_data by mt6360_ddata because of including not only PMU part, but also entire MT6360 IC.
--- drivers/mfd/mt6360-core.c | 44 ++++++++++++++++++++++---------------------- include/linux/mfd/mt6360.h | 2 +- 2 files changed, 23 insertions(+), 23 deletions(-)
drivers/mfd/mt6360-core.c +22 -22
@@ -210,9 +210,9 @@ static const struct regmap_irq mt6360_pmu_irqs[] = {static int mt6360_pmu_handle_post_irq (void *irq_drv_data) { -struct mt6360_pmu_data *mpd = irq_drv_data; +struct mt6360_ddata *ddata = irq_drv_data; -return regmap_update_bits (mpd->regmap, +return regmap_update_bits (ddata->regmap,MT6360_PMU_IRQ_SET ,MT6360_IRQ_RETRIG ,MT6360_IRQ_RETRIG ); }
@@ -310,61 +310,61 @@ static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {static int mt6360_pmu_probe (struct i2c_client *client) { -struct mt6360_pmu_data *mpd; +struct mt6360_ddata *ddata;unsigned int reg_data;int i, ret; - mpd =devm_kzalloc (&client->dev,sizeof (*mpd),GFP_KERNEL ); -if (!mpd) + ddata =devm_kzalloc (&client->dev,sizeof (*ddata),GFP_KERNEL ); +if (!ddata)return -ENOMEM ; - mpd->dev = &client->dev; -i2c_set_clientdata (client, mpd); + ddata->dev = &client->dev; +i2c_set_clientdata (client, ddata); - mpd->regmap =devm_regmap_init_i2c (client, &mt6360_pmu_regmap_config); -if (IS_ERR (mpd->regmap)) { + ddata->regmap =devm_regmap_init_i2c (client, &mt6360_pmu_regmap_config); +if (IS_ERR (ddata->regmap)) {dev_err (&client->dev,"Failed to register regmap\n" ); -return PTR_ERR (mpd->regmap); +return PTR_ERR (ddata->regmap); } - ret =regmap_read (mpd->regmap,MT6360_PMU_DEV_INFO , ®_data); + ret =regmap_read (ddata->regmap,MT6360_PMU_DEV_INFO , ®_data);if (ret) {dev_err (&client->dev,"Device not found\n" );return ret; } - mpd->chip_rev = reg_data &CHIP_REV_MASK ; -if (mpd->chip_rev !=CHIP_VEN_MT6360 ) { + ddata->chip_rev = reg_data &CHIP_REV_MASK ; +if (ddata->chip_rev !=CHIP_VEN_MT6360 ) {dev_err (&client->dev,"Device not supported\n" );return -ENODEV ; } - mt6360_pmu_irq_chip.irq_drv_data = mpd; - ret =devm_regmap_add_irq_chip (&client->dev, mpd->regmap, client->irq, + mt6360_pmu_irq_chip.irq_drv_data = ddata; + ret =devm_regmap_add_irq_chip (&client->dev, ddata->regmap, client->irq,IRQF_TRIGGER_FALLING ,0 , - &mt6360_pmu_irq_chip, &mpd->irq_data); + &mt6360_pmu_irq_chip, &ddata->irq_data);if (ret) {dev_err (&client->dev,"Failed to add Regmap IRQ Chip\n" );return ret; } - mpd->i2c[0 ] = client; + ddata->i2c[0 ] = client;for (i =1 ; i <MT6360_SLAVE_MAX ; i++) { - mpd->i2c[i] =devm_i2c_new_dummy_device (&client->dev, + ddata->i2c[i] =devm_i2c_new_dummy_device (&client->dev, client->adapter, mt6360_slave_addr[i]); -if (IS_ERR (mpd->i2c[i])) { +if (IS_ERR (ddata->i2c[i])) {dev_err (&client->dev,"Failed to get new dummy I2C device for address 0x%x" , mt6360_slave_addr[i]); -return PTR_ERR (mpd->i2c[i]); +return PTR_ERR (ddata->i2c[i]); } -i2c_set_clientdata (mpd->i2c[i], mpd); +i2c_set_clientdata (ddata->i2c[i], ddata); } ret =devm_mfd_add_devices (&client->dev,PLATFORM_DEVID_AUTO , mt6360_devs,ARRAY_SIZE (mt6360_devs),NULL , -0 ,regmap_irq_get_domain (mpd->irq_data)); +0 ,regmap_irq_get_domain (ddata->irq_data));if (ret) {dev_err (&client->dev,"Failed to register subordinate devices\n" );
include/linux/mfd/mt6360.h +1 -1
@@ -21,7 +21,7 @@ enum {#define MT6360_LDO_SLAVEID 0x64#define MT6360_TCPC_SLAVEID 0x4E -struct mt6360_pmu_data { +struct mt6360_ddata {struct i2c_client *i2c[MT6360_SLAVE_MAX ];struct device *dev;struct regmap *regmap;
Signature · 1 line
2.7.4
PATCH v7 6/11 mfd: mt6360: Rename mt6360_pmu by mt6360
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Rename mt6360_pmu by mt6360, because of including
not only PMU part, but also entire MT6360 IC
--- drivers/mfd/mt6360-core.c | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/mfd/mt6360-core.c +20 -21
@@ -119,7 +119,7 @@#define MT6360_LDO6_PGB_EVT 126#define MT6360_LDO7_PGB_EVT 127 -static const struct regmap_irq mt6360_pmu_irqs[] = { +static const struct regmap_irq mt6360_irqs[] = {REGMAP_IRQ_REG_LINE (MT6360_CHG_TREG_EVT ,8 ),REGMAP_IRQ_REG_LINE (MT6360_CHG_AICR_EVT ,8 ),REGMAP_IRQ_REG_LINE (MT6360_CHG_MIVR_EVT ,8 ),
@@ -216,9 +216,9 @@ static int mt6360_pmu_handle_post_irq(void *irq_drv_data) MT6360_PMU_IRQ_SET, MT6360_IRQ_RETRIG, MT6360_IRQ_RETRIG); } -static struct regmap_irq_chip mt6360_pmu_irq_chip = { - .irqs = mt6360_pmu_irqs, - .num_irqs =ARRAY_SIZE (mt6360_pmu_irqs), +static struct regmap_irq_chip mt6360_irq_chip = { + .irqs = mt6360_irqs, + .num_irqs =ARRAY_SIZE (mt6360_irqs), .num_regs =MT6360_PMU_IRQ_REGNUM , .mask_base =MT6360_PMU_CHG_MASK1 , .status_base =MT6360_PMU_CHG_IRQ1 ,
@@ -308,7 +308,7 @@ static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = { MT6360_TCPC_SLAVEID, }; -static int mt6360_pmu_probe (struct i2c_client *client) +static int mt6360_probe (struct i2c_client *client) {struct mt6360_ddata *ddata;unsigned int reg_data;
@@ -339,10 +339,10 @@ static int mt6360_pmu_probe(struct i2c_client *client)return -ENODEV ; } - mt6360_pmu_irq_chip.irq_drv_data = ddata; + mt6360_irq_chip.irq_drv_data = ddata; ret =devm_regmap_add_irq_chip (&client->dev, ddata->regmap, client->irq,IRQF_TRIGGER_FALLING ,0 , - &mt6360_pmu_irq_chip, &ddata->irq_data); + &mt6360_irq_chip, &ddata->irq_data);if (ret) {dev_err (&client->dev,"Failed to add Regmap IRQ Chip\n" );return ret;
@@ -374,7 +374,7 @@ static int mt6360_pmu_probe(struct i2c_client *client)return 0 ; } -static int __maybe_unused mt6360_pmu_suspend (struct device *dev) +static int __maybe_unused mt6360_suspend (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);
@@ -384,7 +384,7 @@ static int __maybe_unused mt6360_pmu_suspend(struct device *dev)return 0 ; } -static int __maybe_unused mt6360_pmu_resume (struct device *dev) +static int __maybe_unused mt6360_resume (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);
@@ -395,25 +395,24 @@ static int __maybe_unused mt6360_pmu_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(mt6360_pmu_pm_ops, - mt6360_pmu_suspend, mt6360_pmu_resume); +static SIMPLE_DEV_PM_OPS(mt6360_pm_ops, mt6360_suspend, mt6360_resume); -static const struct of_device_id __maybe_unused mt6360_pmu_of_id[] = { - { .compatible ="mediatek,mt6360_pmu" , }, +static const struct of_device_id __maybe_unused mt6360_of_id[] = { + { .compatible ="mediatek,mt6360" , }, {}, }; -MODULE_DEVICE_TABLE (of, mt6360_pmu_of_id); +MODULE_DEVICE_TABLE (of, mt6360_of_id); -static struct i2c_driver mt6360_pmu_driver = { +static struct i2c_driver mt6360_driver = { .driver = { - .name ="mt6360_pmu" , - .pm = &mt6360_pmu_pm_ops, - .of_match_table =of_match_ptr (mt6360_pmu_of_id), + .name ="mt6360" , + .pm = &mt6360_pm_ops, + .of_match_table =of_match_ptr (mt6360_of_id), }, - .probe_new = mt6360_pmu_probe, + .probe_new = mt6360_probe, }; -module_i2c_driver (mt6360_pmu_driver); +module_i2c_driver (mt6360_driver);MODULE_AUTHOR ("Gene Chen <[email protected]>" ); -MODULE_DESCRIPTION ("MT6360 PMU I2C Driver" ); +MODULE_DESCRIPTION ("MT6360 I2C Driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.7.4
PATCH v7 7/11 mfd: mt6360: Remove handle_post_irq callback function
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Remove handle_post_irq which is used to retrigger IRQ. Set IRQ level low trigger in dtsi to keep IRQ always be handled.
--- drivers/mfd/mt6360-core.c | 17 ++++------------- include/linux/mfd/mt6360.h | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-)
drivers/mfd/mt6360-core.c +4 -13
@@ -208,15 +208,8 @@ static const struct regmap_irq mt6360_irqs[] = { REGMAP_IRQ_REG_LINE(MT6360_LDO7_PGB_EVT, 8), }; -static int mt6360_pmu_handle_post_irq (void *irq_drv_data) -{ -struct mt6360_ddata *ddata = irq_drv_data; - -return regmap_update_bits (ddata->regmap, -MT6360_PMU_IRQ_SET ,MT6360_IRQ_RETRIG ,MT6360_IRQ_RETRIG ); -} - -static struct regmap_irq_chip mt6360_irq_chip = { +static const struct regmap_irq_chip mt6360_irq_chip = { + .name ="mt6360_irqs" , .irqs = mt6360_irqs, .num_irqs =ARRAY_SIZE (mt6360_irqs), .num_regs =MT6360_PMU_IRQ_REGNUM ,
@@ -225,7 +218,6 @@ static struct regmap_irq_chip mt6360_irq_chip = { .ack_base = MT6360_PMU_CHG_IRQ1, .init_ack_masked = true, .use_ack = true, - .handle_post_irq = mt6360_pmu_handle_post_irq, };static const struct regmap_config mt6360_pmu_regmap_config = {
@@ -339,10 +331,9 @@ static int mt6360_probe(struct i2c_client *client)return -ENODEV ; } - mt6360_irq_chip.irq_drv_data = ddata; ret =devm_regmap_add_irq_chip (&client->dev, ddata->regmap, client->irq, -IRQF_TRIGGER_FALLING ,0 , - &mt6360_irq_chip, &ddata->irq_data); +0 ,0 , &mt6360_irq_chip, + &ddata->irq_data);if (ret) {dev_err (&client->dev,"Failed to add Regmap IRQ Chip\n" );return ret;
include/linux/mfd/mt6360.h +1 -1
@@ -230,7 +230,7 @@ struct mt6360_ddata {#define MT6360_PMU_MAXREG MT6360_PMU_LDO_MASK2/* MT6360_PMU_IRQ_SET */ -#define MT6360_PMU_IRQ_REGNUM (MT6360_PMU_LDO_IRQ2 - MT6360_PMU_CHG_IRQ1 + 1) +#define MT6360_PMU_IRQ_REGNUM 16#define MT6360_IRQ_RETRIG BIT(2)#define CHIP_VEN_MASK 0xF0
Signature · 1 line
2.7.4
PATCH v7 8/11 mfd: mt6360: Fix flow which is used to check ic exist
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Fix flow which is used to check ic exist.
--- drivers/mfd/mt6360-core.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
drivers/mfd/mt6360-core.c +21 -11
@@ -293,6 +293,25 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-tcpc"), }; +static int mt6360_check_vendor_info (struct mt6360_ddata *ddata) +{ +u32 info; +int ret; + + ret =regmap_read (ddata->regmap,MT6360_PMU_DEV_INFO , &info); +if (ret <0 ) +return ret; + +if ((info &CHIP_VEN_MASK ) !=CHIP_VEN_MT6360 ) { +dev_err (ddata->dev,"Device not supported\n" ); +return -ENODEV ; + } + + ddata->chip_rev = info &CHIP_REV_MASK ; + +return 0 ; +} +static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX ] = {MT6360_PMU_SLAVEID ,MT6360_PMIC_SLAVEID ,
@@ -303,7 +322,6 @@ static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {static int mt6360_probe (struct i2c_client *client) {struct mt6360_ddata *ddata; -unsigned int reg_data;int i, ret; ddata =devm_kzalloc (&client->dev,sizeof (*ddata),GFP_KERNEL );
@@ -319,17 +337,9 @@ static int mt6360_probe(struct i2c_client *client)return PTR_ERR (ddata->regmap); } - ret =regmap_read (ddata->regmap,MT6360_PMU_DEV_INFO , ®_data); -if (ret) { -dev_err (&client->dev,"Device not found\n" ); + ret =mt6360_check_vendor_info (ddata); +if (ret)return ret; - } - - ddata->chip_rev = reg_data &CHIP_REV_MASK ; -if (ddata->chip_rev !=CHIP_VEN_MT6360 ) { -dev_err (&client->dev,"Device not supported\n" ); -return -ENODEV ; - } ret = devm_regmap_add_irq_chip(&client->dev, ddata->regmap, client->irq, 0, 0, &mt6360_irq_chip,
Signature · 1 line
2.7.4
PATCH v7 9/11 mfd: mt6360: Merge header file into driver and remove unuse register define
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Merge header file into driver and remove unuse register define
--- drivers/mfd/mt6360-core.c | 48 ++++++++- include/linux/mfd/mt6360.h | 240 --------------------------------------------- 2 files changed, 47 insertions(+), 241 deletions(-) delete mode 100644 include/linux/mfd/mt6360.h
drivers/mfd/mt6360-core.c +47 -1
@@ -14,7 +14,53 @@#include <linux/regmap.h> #include <linux/slab.h> -#include <linux/mfd/mt6360.h> +enum { +MT6360_SLAVE_TCPC =0 , +MT6360_SLAVE_PMIC , +MT6360_SLAVE_LDO , +MT6360_SLAVE_PMU , +MT6360_SLAVE_MAX , +}; + +struct mt6360_ddata { +struct i2c_client *i2c[MT6360_SLAVE_MAX ]; +struct device *dev; +struct regmap *regmap; +struct regmap_irq_chip_data *irq_data; +unsigned int chip_rev; +u8 crc8_tbl[CRC8_TABLE_SIZE ]; +}; + +#define MT6360_TCPC_SLAVEID 0x4E +#define MT6360_PMIC_SLAVEID 0x1A +#define MT6360_LDO_SLAVEID 0x64 +#define MT6360_PMU_SLAVEID 0x34 + +#define MT6360_REG_TCPCSTART 0x00 +#define MT6360_REG_TCPCEND 0xFF +#define MT6360_REG_PMICSTART 0x100 +#define MT6360_REG_PMICEND 0x13B +#define MT6360_REG_LDOSTART 0x200 +#define MT6360_REG_LDOEND 0x21C +#define MT6360_REG_PMUSTART 0x300 +#define MT6360_PMU_DEV_INFO 0x300 +#define MT6360_PMU_CHG_IRQ1 0x3D0 +#define MT6360_PMU_CHG_MASK1 0x3F0 +#define MT6360_REG_PMUEND 0x3FF + +#define MT6360_PMU_IRQ_REGNUM 16 + +#define CHIP_VEN_MASK 0xF0 +#define CHIP_VEN_MT6360 0x50 +#define CHIP_REV_MASK 0x0F + +#define MT6360_ADDRESS_MASK 0x3F +#define MT6360_DATA_SIZE_1_BYTE 0x00 +#define MT6360_DATA_SIZE_2_BYTES 0x40 +#define MT6360_DATA_SIZE_3_BYTES 0x80 +#define MT6360_DATA_SIZE_4_BYTES 0xC0 + +#define MT6360_CRC8_POLYNOMIAL 0x7/* reg 0 -> 0 ~ 7 */ #define MT6360_CHG_TREG_EVT 4
include/linux/mfd/mt6360.h deleted +0 -240
240 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v7 10/11 mfd: mt6360: Merge different sub-devices I2C read/write
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Merge different sub-devices I2C read/write functions into one Regmap, because PMIC and LDO part need CRC bits for access protection.
--- drivers/mfd/Kconfig | 1 + drivers/mfd/mt6360-core.c | 203 ++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 181 insertions(+), 23 deletions(-)
drivers/mfd/Kconfig +1 -0
@@ -913,6 +913,7 @@ config MFD_MT6360 select MFD_CORE select REGMAP_I2C select REGMAP_IRQ + select CRC8 depends on I2C help Say Y here to enable MT6360 PMU/PMIC/LDO functional support.
drivers/mfd/mt6360-core.c +180 -23
235 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v7 11/11 mfd: mt6360: Remove MT6360 regulator of_compatible attribute
In reply to Gene ChenFrom: Gene Chen <[email protected]>
Remove MT6360 regulator of_compatible attribute because MFD device should just instantiate the platform device.
--- drivers/mfd/mt6360-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mfd/mt6360-core.c +1 -2
@@ -339,8 +339,7 @@ static const struct mfd_cell mt6360_devs[] = { NULL, 0, 0, "mediatek,mt6360-chg"),OF_MFD_CELL ("mt6360-led" , mt6360_led_resources,NULL ,0 ,0 ,"mediatek,mt6360-led" ), -OF_MFD_CELL ("mt6360-regulator" , mt6360_regulator_resources, -NULL ,0 ,0 ,"mediatek,mt6360-regulator" ), +MFD_CELL_RES ("mt6360-regulator" , mt6360_regulator_resources),OF_MFD_CELL ("mt6360-tcpc" ,NULL , NULL, 0, 0, "mediatek,mt6360-tcpc"), };
Signature · 1 line
2.7.4