mfd: max8907: for Lee
cover mfd: max8907: for Lee
These are all MFD related patches collected from my MAX8907 related patchsets.
Svyatoslav Ryhel (6):
mfd: max8907: Remove platform_data based probing
mfd: max8907: Switch to resource-managed versions of helpers
mfd: max8907: Convert to use device managed poweroff handler
mfd: max8907: Add restart handler
mfd: max8907: Add ADC client support
mfd: max8907: Add ADC cell
drivers/mfd/max8907.c | 243 +++++++++++++++----------- drivers/regulator/max8907-regulator.c | 8 +- include/linux/mfd/max8907.h | 57 +++++- 3 files changed, 193 insertions(+), 115 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/6 mfd: max8907: Remove platform_data based probing
There are no in-tree users of this driver, but it supports devicetree based probing, which means external dtb files may exist that work with this.
Remove the unused legacy code and make this a DT-only driver.
--- drivers/mfd/max8907.c | 8 +------- drivers/regulator/max8907-regulator.c | 8 +++----- include/linux/mfd/max8907.h | 5 ----- 3 files changed, 4 insertions(+), 17 deletions(-)
drivers/mfd/max8907.c +1 -7
@@ -189,13 +189,7 @@ static int max8907_i2c_probe(struct i2c_client *i2c) {struct max8907 *max8907;int ret; -struct max8907_platform_data *pdata =dev_get_platdata (&i2c->dev); -bool pm_off = false; - -if (pdata) - pm_off = pdata->pm_off; -else if (i2c->dev.of_node) - pm_off =of_property_read_bool (i2c->dev.of_node, +bool pm_off =of_property_read_bool (i2c->dev.of_node,"maxim,system-power-controller" ); max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907);
drivers/regulator/max8907-regulator.c +3 -5
@@ -274,7 +274,6 @@ static inline struct device_node *match_of_node(int index)static int max8907_regulator_probe (struct platform_device *pdev) {struct max8907 *max8907 =dev_get_drvdata (pdev->dev.parent); -struct max8907_platform_data *pdata =dev_get_platdata (max8907->dev);int ret;struct max8907_regulator *pmic;unsigned int val;
@@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)struct regulator_dev *rdev; config.dev = pdev->dev.parent; -if (pdata) - idata = pdata->init_data[i]; -else - idata =match_init_data (i); + + idata =match_init_data (i); + config.init_data = idata; config.driver_data = pmic; config.regmap = max8907->regmap_gen;
include/linux/mfd/max8907.h +0 -5
@@ -227,11 +227,6 @@ enum { MAX8907_IRQ_RTC_ALARM0, }; -struct max8907_platform_data { -struct regulator_init_data *init_data[MAX8907_NUM_REGULATORS ]; -bool pm_off; -}; -struct regmap_irq_chips_data ;struct max8907 {
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v1 1/6] mfd: max8907: Remove platform_data based probing
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] regulator: max8907: null pointer…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] regulator: max8907: null pointer dereference in max8907_regulator_probe() [1]
--
commit 7e0914d1aef4d600071fd9eab1f727f16437c245
Author: Svyatoslav Ryhel <[email protected]>
mfd: max8907: Remove platform_data based probing
This commit removes legacy struct max8907_platform_data handling from the max8907 MFD core and regulator drivers, leaving only devicetree-based probing.
Quoted 4 lines
drivers/regulator/max8907-regulator.c +0
-0
[ ... ]
Quoted 4 lines
drivers/regulator/max8907-regulator.c +0
-0@@ -312,10 +311,9 @@ static int max8907_regulator_probe(struct platform_device *pdev)struct regulator_dev *rdev; config.dev = pdev->dev.parent;
drivers/regulator/max8907-regulator.c static int max8907_regulator_probe(struct platform_device *pdev) · line 319
Quoted 10 lines
drivers/regulator/max8907-regulator.c +3
-4-if (pdata) - idata = pdata->init_data[i]; -else - idata =match_init_data (i); + + idata =match_init_data (i); + config.init_data = idata; config.driver_data = pmic; config.regmap = max8907->regmap_gen;
[Severity: High]
This problem wasn't introduced by this patch, but can idata be dereferenced when NULL [1] a few lines below?
drivers/regulator/max8907-regulator.c:max8907_regulator_probe() {
...
switch (pmic->desc[i].id) {
case MAX8907_MBATT:
if (idata && idata->constraints.name)
mbatt_rail_name = idata->constraints.name;
else
mbatt_rail_name = pmic->desc[i].name;
break;
case MAX8907_BBAT:
case MAX8907_SDBY:
case MAX8907_VRTC:
idata->supply_regulator = mbatt_rail_name;
break;
}
...
}If the devicetree omits the node for bbat, sdby, or vrtc, match_init_data(i) returns NULL and writing idata->supply_regulator triggers a NULL pointer dereference during probe.
[1] https://sashiko.dev/#/bug/linux-372cd4b4-65df-47bd-8b31-5a7b416b2f91
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/6 mfd: max8907: Switch to resource-managed versions of helpers
In reply to Svyatoslav RyhelSwitch to resource-managed versions of regmap_add_irq_chip() and i2c_new_dummy_device(). This involves probe refactoring in order to remove jumps and allows to drop the .remove callback.
--- drivers/mfd/max8907.c | 140 ++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 94 deletions(-)
drivers/mfd/max8907.c +46 -94
@@ -187,117 +187,70 @@ static int max8907_power_off(struct sys_off_data *data)static int max8907_i2c_probe (struct i2c_client *i2c) { +struct device *dev = &i2c->dev;struct max8907 *max8907;int ret; -bool pm_off =of_property_read_bool (i2c->dev.of_node, +bool pm_off =of_property_read_bool (dev->of_node,"maxim,system-power-controller" ); - max8907 = devm_kzalloc_obj(&i2c->dev, struct max8907); -if (!max8907) { - ret = -ENOMEM ; - goto err_alloc_drvdata; - } + max8907 = devm_kzalloc_obj(dev, struct max8907); +if (!max8907) +return -ENOMEM ; - max8907->dev = &i2c->dev; + max8907->dev = dev; max8907->i2c_gen = i2c;i2c_set_clientdata (i2c, max8907); + max8907->regmap_gen =devm_regmap_init_i2c (i2c, - &max8907_regmap_gen_config); -if (IS_ERR (max8907->regmap_gen)) { - ret =PTR_ERR (max8907->regmap_gen); -dev_err (&i2c->dev,"gen regmap init failed: %d\n" , ret); - goto err_regmap_gen; - } + &max8907_regmap_gen_config); +if (IS_ERR (max8907->regmap_gen)) +return dev_err_probe (dev,PTR_ERR (max8907->regmap_gen), +"GEN regmap init failed\n" ); - max8907->i2c_rtc =i2c_new_dummy_device (i2c->adapter,MAX8907_RTC_I2C_ADDR ); -if (IS_ERR (max8907->i2c_rtc)) { - ret =PTR_ERR (max8907->i2c_rtc); - goto err_dummy_rtc; - } -i2c_set_clientdata (max8907->i2c_rtc, max8907); - max8907->regmap_rtc =devm_regmap_init_i2c (max8907->i2c_rtc, - &max8907_regmap_rtc_config); -if (IS_ERR (max8907->regmap_rtc)) { - ret =PTR_ERR (max8907->regmap_rtc); -dev_err (&i2c->dev,"rtc regmap init failed: %d\n" , ret); - goto err_regmap_rtc; - } + max8907->i2c_rtc =devm_i2c_new_dummy_device (dev, i2c->adapter,MAX8907_RTC_I2C_ADDR ); +if (IS_ERR (max8907->i2c_rtc)) +return PTR_ERR (max8907->i2c_rtc); - ret =regmap_add_irq_chip (max8907->regmap_gen, max8907->i2c_gen->irq, -IRQF_ONESHOT |IRQF_SHARED , --1 , &max8907_chg_irq_chip, - &max8907->irqc_chg); -if (ret !=0 ) { -dev_err (&i2c->dev,"failed to add chg irq chip: %d\n" , ret); - goto err_irqc_chg; - } - ret =regmap_add_irq_chip (max8907->regmap_gen, max8907->i2c_gen->irq, -IRQF_ONESHOT |IRQF_SHARED ,-1 , - &max8907_on_off_irq_chip, - &max8907->irqc_on_off); -if (ret !=0 ) { -dev_err (&i2c->dev,"failed to add on off irq chip: %d\n" , ret); - goto err_irqc_on_off; - } - ret =regmap_add_irq_chip (max8907->regmap_rtc, max8907->i2c_gen->irq, -IRQF_ONESHOT |IRQF_SHARED ,-1 , - &max8907_rtc_irq_chip, - &max8907->irqc_rtc); -if (ret !=0 ) { -dev_err (&i2c->dev,"failed to add rtc irq chip: %d\n" , ret); - goto err_irqc_rtc; - } +i2c_set_clientdata (max8907->i2c_rtc, max8907); - ret =mfd_add_devices (max8907->dev,-1 , max8907_cells, -ARRAY_SIZE (max8907_cells),NULL ,0 ,NULL ); -if (ret !=0 ) { -dev_err (&i2c->dev,"failed to add MFD devices %d\n" , ret); - goto err_add_devices; - } + max8907->regmap_rtc =devm_regmap_init_i2c (max8907->i2c_rtc, + &max8907_regmap_rtc_config); +if (IS_ERR (max8907->regmap_rtc)) +return dev_err_probe (dev,PTR_ERR (max8907->regmap_rtc), +"RTC regmap init failed\n" ); + + ret =devm_regmap_add_irq_chip (dev, max8907->regmap_gen, max8907->i2c_gen->irq, +IRQF_ONESHOT |IRQF_SHARED ,-1 , &max8907_chg_irq_chip, + &max8907->irqc_chg); +if (ret) +return dev_err_probe (dev, ret,"Failed to add chg irq chip\n" ); + + ret =devm_regmap_add_irq_chip (dev, max8907->regmap_gen, max8907->i2c_gen->irq, +IRQF_ONESHOT |IRQF_SHARED ,-1 , &max8907_on_off_irq_chip, + &max8907->irqc_on_off); +if (ret) +return dev_err_probe (dev, ret,"Failed to add on off irq chip\n" ); + + ret =devm_regmap_add_irq_chip (dev, max8907->regmap_rtc, max8907->i2c_gen->irq, +IRQF_ONESHOT |IRQF_SHARED ,-1 , &max8907_rtc_irq_chip, + &max8907->irqc_rtc); +if (ret) +return dev_err_probe (dev, ret,"Failed to add rtc irq chip\n" ); + + ret =devm_mfd_add_devices (dev,-1 , max8907_cells,ARRAY_SIZE (max8907_cells), +NULL ,0 ,NULL ); +if (ret) +return dev_err_probe (dev, ret,"Failed to add MFD devices\n" );if (pm_off) { - ret =devm_register_sys_off_handler (&i2c->dev, -SYS_OFF_MODE_POWER_OFF , + ret =devm_register_sys_off_handler (dev,SYS_OFF_MODE_POWER_OFF ,SYS_OFF_PRIO_DEFAULT , max8907_power_off, max8907); -if (ret) { -dev_err (&i2c->dev, -"failed to register sys-off handler: %d\n" , - ret); - goto err_sys_off; - } +if (ret) +return dev_err_probe (dev, ret,"failed to register sys-off handler\n" ); }return 0 ; - -err_sys_off: -mfd_remove_devices (max8907->dev); -err_add_devices: -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_rtc); -err_irqc_rtc: -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_on_off); -err_irqc_on_off: -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_chg); -err_irqc_chg: -err_regmap_rtc: -i2c_unregister_device (max8907->i2c_rtc); -err_dummy_rtc: -err_regmap_gen: -err_alloc_drvdata: -return ret; -} - -static void max8907_i2c_remove (struct i2c_client *i2c) -{ -struct max8907 *max8907 =i2c_get_clientdata (i2c); - -mfd_remove_devices (max8907->dev); - -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_rtc); -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_on_off); -regmap_del_irq_chip (max8907->i2c_gen->irq, max8907->irqc_chg); - -i2c_unregister_device (max8907->i2c_rtc); }#ifdef CONFIG_OF
@@ -320,7 +273,6 @@ static struct i2c_driver max8907_i2c_driver = { .of_match_table = of_match_ptr(max8907_of_match), }, .probe = max8907_i2c_probe, - .remove = max8907_i2c_remove, .id_table = max8907_i2c_id, };
Signature · 1 line
2.53.0
PATCH 3/6 mfd: max8907: Convert to use device managed poweroff handler
In reply to Svyatoslav RyhelReplace devm_register_sys_off_handler() function with the dedicated devm_register_power_off_handler() helper.
There are no in-kernel users of maxim,system-power-controller property and all new users will use generic system-power-controller so check for the legacy property can be removed.
--- drivers/mfd/max8907.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/mfd/max8907.c +3 -7
@@ -190,8 +190,6 @@ static int max8907_i2c_probe(struct i2c_client *i2c)struct device *dev = &i2c->dev;struct max8907 *max8907;int ret; -bool pm_off =of_property_read_bool (dev->of_node, -"maxim,system-power-controller" ); max8907 = devm_kzalloc_obj(dev, struct max8907);if (!max8907)
@@ -242,12 +240,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c)if (ret)return dev_err_probe (dev, ret,"Failed to add MFD devices\n" ); -if (pm_off) { - ret =devm_register_sys_off_handler (dev,SYS_OFF_MODE_POWER_OFF , -SYS_OFF_PRIO_DEFAULT , - max8907_power_off, max8907); +if (of_device_is_system_power_controller (dev->of_node)) { + ret =devm_register_power_off_handler (dev, max8907_power_off, max8907);if (ret) -return dev_err_probe (dev, ret,"failed to register sys-off handler\n" ); +return dev_err_probe (dev, ret,"failed to register power-off handler\n" ); }return 0 ;
Signature · 1 line
2.53.0
PATCH 4/6 mfd: max8907: Add restart handler
In reply to Svyatoslav RyhelAdd restart handler to reset hardware properly on system reboot.
--- drivers/mfd/max8907.c | 14 ++++++++++++++ include/linux/mfd/max8907.h | 1 + 2 files changed, 15 insertions(+)
drivers/mfd/max8907.c +14 -0
@@ -185,6 +185,16 @@ static int max8907_power_off(struct sys_off_data *data)return NOTIFY_DONE ; } +static int max8907_restart (struct sys_off_data *data) +{ +struct max8907 *max8907 = data->cb_data; + +regmap_update_bits (max8907->regmap_gen,MAX8907_REG_RESET_CNFG , +MAX8907_MASK_SOFT_RESET ,MAX8907_MASK_SOFT_RESET ); + +return NOTIFY_DONE ; +} +static int max8907_i2c_probe (struct i2c_client *i2c) {struct device *dev = &i2c->dev;
@@ -244,6 +254,10 @@ static int max8907_i2c_probe(struct i2c_client *i2c) ret =devm_register_power_off_handler (dev, max8907_power_off, max8907);if (ret)return dev_err_probe (dev, ret,"failed to register power-off handler\n" ); + + ret =devm_register_restart_handler (dev, max8907_restart, max8907); +if (ret) +return dev_err_probe (dev, ret,"failed to register restart handler\n" ); }return 0 ;
include/linux/mfd/max8907.h +1 -0
@@ -164,6 +164,7 @@#define MAX8907_MASK_OUT5V_VINEN 0x10#define MAX8907_MASK_OUT5V_ENSRC 0x0E#define MAX8907_MASK_OUT5V_EN 0x01 +#define MAX8907_MASK_SOFT_RESET 0x20#define MAX8907_MASK_POWER_OFF 0x40/* Regulator IDs */
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v1 4/6] mfd: max8907: Add restart handler
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] mfd: max8907: sleep in atomic context…
Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce:
- [High] mfd: max8907: sleep in atomic context in max8907_power_off()
[1]
--
commit 3ff678ec45fb0fff7c90331a76083a6b71a149d3
Author: Svyatoslav Ryhel <[email protected]>
mfd: max8907: Add restart handler
This commit adds a restart handler for MAX8907 to trigger a hardware soft reset via MAX8907_REG_RESET_CNFG on system reboot.
Quoted 7 lines
drivers/mfd/max8907.c +0
-0@@ -185,6 +185,16 @@ static int max8907_power_off(struct sys_off_data *data)return NOTIFY_DONE ; }
drivers/mfd/max8907.c static int max8907_power_off(struct sys_off_data *data) · line 196
Quoted 10 lines
drivers/mfd/max8907.c +9
-0+static int max8907_restart (struct sys_off_data *data) +{ +struct max8907 *max8907 = data->cb_data; + +regmap_update_bits (max8907->regmap_gen,MAX8907_REG_RESET_CNFG , +MAX8907_MASK_SOFT_RESET ,MAX8907_MASK_SOFT_RESET ); + +return NOTIFY_DONE ; +}
[Severity: High]
This problem wasn't introduced by this patch, but can max8907_power_off() (and max8907_restart()) sleep in atomic context [1]?
System power-off and restart handlers run in atomic context, whereas regmap_update_bits() on max8907->regmap_gen acquires a sleepable mutex and performs sleeping I2C transfers, which can trigger a sleep-in-atomic bug or hang the system during shutdown.
[1] https://sashiko.dev/#/bug/linux-01ccb5e5-8cd7-47b3-81d8-f6c05e2ca293
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH 5/6 mfd: max8907: Add ADC client support
In reply to Svyatoslav RyhelThe Maxim MAX8907 has an 8-channel ADC at a fixed location. Add client support for it along with its regmap and interrupts.
--- drivers/mfd/max8907.c | 74 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/max8907.h | 53 ++++++++++++++++++++++++++ 2 files changed, 127 insertions(+)
drivers/mfd/max8907.c +74 -0
@@ -113,6 +113,48 @@ static const struct regmap_config max8907_regmap_rtc_config = { .cache_type = REGCACHE_MAPLE, }; +static bool max8907_adc_is_volatile_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : + case MAX8907_REG_AUX1_MSB ... MAX8907_REG_TDIE_LSB: +return true; +default : +return false; + } +} + +static bool max8907_adc_is_precious_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : +return true; +default : +return false; + } +} + +static bool max8907_adc_is_writeable_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : + case MAX8907_REG_AUX1_MSB ... MAX8907_REG_TDIE_LSB: +return false; +default : +return true; + } +} + +static const struct regmap_config max8907_regmap_adc_config = { + .reg_bits =8 , + .val_bits =8 , + .volatile_reg = max8907_adc_is_volatile_reg, + .precious_reg = max8907_adc_is_precious_reg, + .writeable_reg = max8907_adc_is_writeable_reg, + .max_register =MAX8907_REG_TDIE_MEASURE , + .cache_type =REGCACHE_MAPLE , +}; +static const struct regmap_irq max8907_chg_irqs[] = { { .reg_offset =0 , .mask =1 <<0 , }, { .reg_offset =0 , .mask =1 <<1 , },
@@ -175,6 +217,20 @@ static const struct regmap_irq_chip max8907_rtc_irq_chip = { .num_irqs = ARRAY_SIZE(max8907_rtc_irqs), }; +static const struct regmap_irq max8907_adc_irqs[] = { + { .reg_offset =0 , .mask =BIT (0 ), }, + { .reg_offset =0 , .mask =BIT (1 ), }, +}; + +static const struct regmap_irq_chip max8907_adc_irq_chip = { + .name ="max8907 adc" , + .status_base =MAX8907_REG_TSC_STA_INT , + .mask_base =MAX8907_REG_TSC_INT_MASK , + .num_regs =1 , + .irqs = max8907_adc_irqs, + .num_irqs =ARRAY_SIZE (max8907_adc_irqs), +}; +static int max8907_power_off (struct sys_off_data *data) {struct max8907 *max8907 = data->cb_data;
@@ -227,6 +283,18 @@ static int max8907_i2c_probe(struct i2c_client *i2c)return dev_err_probe (dev,PTR_ERR (max8907->regmap_rtc),"RTC regmap init failed\n" ); + max8907->i2c_adc =devm_i2c_new_dummy_device (dev, i2c->adapter,MAX8907_ADC_I2C_ADDR ); +if (IS_ERR (max8907->i2c_adc)) +return PTR_ERR (max8907->i2c_adc); + +i2c_set_clientdata (max8907->i2c_adc, max8907); + + max8907->regmap_adc =devm_regmap_init_i2c (max8907->i2c_adc, + &max8907_regmap_adc_config); +if (IS_ERR (max8907->regmap_adc)) +return dev_err_probe (dev,PTR_ERR (max8907->regmap_adc), +"ADC regmap init failed\n" ); + ret =devm_regmap_add_irq_chip (dev, max8907->regmap_gen, max8907->i2c_gen->irq,IRQF_ONESHOT |IRQF_SHARED ,-1 , &max8907_chg_irq_chip, &max8907->irqc_chg);
@@ -245,6 +313,12 @@ static int max8907_i2c_probe(struct i2c_client *i2c)if (ret)return dev_err_probe (dev, ret,"Failed to add rtc irq chip\n" ); + ret =devm_regmap_add_irq_chip (dev, max8907->regmap_adc, max8907->i2c_gen->irq, +IRQF_ONESHOT |IRQF_SHARED ,-1 , &max8907_adc_irq_chip, + &max8907->irqc_adc); +if (ret) +return dev_err_probe (dev, ret,"Failed to add adc irq chip\n" ); + ret =devm_mfd_add_devices (dev,-1 , max8907_cells,ARRAY_SIZE (max8907_cells),NULL ,0 ,NULL );if (ret)
include/linux/mfd/max8907.h +53 -0
82 lines not on this page · raw message
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH v1 5/6] mfd: max8907: Add ADC client support
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] mfd: max8907: missing TSC result registers in max8907_adc_is_volatile_reg() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] mfd: max8907: missing TSC result registers in max8907_adc_is_volatile_reg()
--
commit 95f9130d9b22203166a62ce2610b261784729ba5
Author: Svyatoslav Ryhel <[email protected]>
mfd: max8907: Add ADC client support
This commit adds I2C dummy client, regmap, and interrupt controller support for the MAX8907 ADC and touchscreen controller.
Quoted 29 lines
drivers/mfd/max8907.c +21
-0@@ -113,6 +113,48 @@ static const struct regmap_config max8907_regmap_rtc_config = { .cache_type = REGCACHE_MAPLE, }; +static bool max8907_adc_is_volatile_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : + case MAX8907_REG_AUX1_MSB ... MAX8907_REG_TDIE_LSB: +return true; +default : +return false; + } +} + +static bool max8907_adc_is_precious_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : +return true; +default : +return false; + } +} +
drivers/mfd/max8907.c static const struct regmap_config max8907_regmap_rtc_config = { · line 146
Quoted 10 lines
drivers/mfd/max8907.c +10
-0+static bool max8907_adc_is_writeable_reg (struct device *dev,unsigned int reg) +{ +switch (reg) { +case MAX8907_REG_TSC_STA_INT : + case MAX8907_REG_AUX1_MSB ... MAX8907_REG_TDIE_LSB: +return false; +default : +return true; + } +}
[Severity: Medium]
Should the touchscreen conversion result registers (MAX8907_REG_X_MSB ... MAX8907_REG_Z2_LSB) also be marked volatile in max8907_adc_is_volatile_reg() and non-writeable in max8907_adc_is_writeable_reg()? With REGCACHE_MAPLE enabled, reading any of those result registers caches the first sample and returns stale values on subsequent reads instead of querying the hardware.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
PATCH 6/6 mfd: max8907: Add ADC cell
In reply to Svyatoslav RyhelAdd the ADC cell name to the list of MAX8907 cells.
--- drivers/mfd/max8907.c | 1 + 1 file changed, 1 insertion(+)
drivers/mfd/max8907.c +1 -0
@@ -20,6 +20,7 @@#include <linux/slab.h> static const struct mfd_cell max8907_cells[] = { + { .name ="max8907-adc" , }, { .name ="max8907-leds" , }, { .name ="max8907-regulator" , }, { .name ="max8907-rtc" , },
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has finished reviewing this 6-patch series:
Sashiko has finished reviewing this 6-patch series:
- Patches 2, 3, and 6: no issues found.
- Patch 1 ("mfd: max8907: Remove platform_data based probing"): 1 related pre-existing bug noted
- Patch 4 ("mfd: max8907: Add restart handler"): 1 related pre-existing bug noted
- Patch 5 ("mfd: max8907: Add ADC client support"): 1 potential issue (1 Medium)
Detailed reviews have been sent as separate replies to patches 1, 4, and 5.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]