drivers/mfd/adp5585.c
Source file repositories/reference/linux-study-clean/drivers/mfd/adp5585.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/adp5585.c- Extension
.c- Size
- 24650 bytes
- Lines
- 844
- Domain
- Driver Families
- Bucket
- drivers/mfd
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/array_size.hlinux/bitfield.hlinux/device.hlinux/err.hlinux/i2c.hlinux/gpio/consumer.hlinux/mfd/adp5585.hlinux/mfd/core.hlinux/mod_devicetable.hlinux/module.hlinux/regmap.hlinux/regulator/consumer.hlinux/types.h
Detected Declarations
function adp5585_validate_eventfunction adp5589_validate_eventfunction adp5585_parse_ev_arrayfunction adp5585_unlock_ev_parsefunction adp5585_reset_ev_parsefunction adp5585_add_devicesfunction adp5585_osc_disablefunction adp5585_report_eventsfunction adp5585_irqfunction adp5585_setupfunction adp5585_parse_fwfunction adp5585_irq_disablefunction adp5585_irq_enablefunction adp5585_i2c_probefunction adp5585_suspendfunction adp5585_resume
Annotated Snippet
switch (prop_val) {
case 0:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 0);
break;
case 1000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 1);
break;
case 1500:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 2);
break;
case 2000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 3);
break;
case 2500:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 4);
break;
case 3000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 5);
break;
case 3500:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 6);
break;
case 4000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_RESET_TRIG_TIME, 7);
break;
default:
return dev_err_probe(dev, -EINVAL,
"Invalid value(%u) for adi,reset-trigger-ms\n",
prop_val);
}
}
ret = device_property_read_u32(dev, "adi,reset-pulse-width-us", &prop_val);
if (!ret) {
switch (prop_val) {
case 500:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_PULSE_WIDTH, 0);
break;
case 1000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_PULSE_WIDTH, 1);
break;
case 2000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_PULSE_WIDTH, 2);
break;
case 10000:
adp5585->reset_cfg |= FIELD_PREP(ADP5585_PULSE_WIDTH, 3);
break;
default:
return dev_err_probe(dev, -EINVAL,
"Invalid value(%u) for adi,reset-pulse-width-us\n",
prop_val);
}
}
return 0;
}
static int adp5585_add_devices(const struct adp5585_dev *adp5585)
{
struct device *dev = adp5585->dev;
const struct mfd_cell *cells;
int ret;
if (adp5585->id == ADP5585_MAN_ID_VALUE)
cells = adp5585_devs;
else
cells = adp5589_devs;
if (device_property_present(dev, "#pwm-cells")) {
/* Make sure the PWM output pin is not used by the GPIO or INPUT devices */
__set_bit(ADP5585_PWM_OUT, adp5585->pin_usage);
ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
&cells[ADP5585_DEV_PWM], 1, NULL, 0, NULL);
if (ret)
return dev_err_probe(dev, ret, "Failed to add PWM device\n");
}
if (device_property_present(dev, "#gpio-cells")) {
ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
&cells[ADP5585_DEV_GPIO], 1, NULL, 0, NULL);
if (ret)
return dev_err_probe(dev, ret, "Failed to add GPIO device\n");
}
if (device_property_present(adp5585->dev, "adi,keypad-pins")) {
ret = devm_mfd_add_devices(adp5585->dev, PLATFORM_DEVID_AUTO,
&cells[ADP5585_DEV_INPUT], 1, NULL, 0, NULL);
if (ret)
return dev_err_probe(dev, ret, "Failed to add input device\n");
}
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/bitfield.h`, `linux/device.h`, `linux/err.h`, `linux/i2c.h`, `linux/gpio/consumer.h`, `linux/mfd/adp5585.h`, `linux/mfd/core.h`.
- Detected declarations: `function adp5585_validate_event`, `function adp5589_validate_event`, `function adp5585_parse_ev_array`, `function adp5585_unlock_ev_parse`, `function adp5585_reset_ev_parse`, `function adp5585_add_devices`, `function adp5585_osc_disable`, `function adp5585_report_events`, `function adp5585_irq`, `function adp5585_setup`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.