diff options
Diffstat (limited to 'drivers/mfd/mfd-core.c')
-rw-r--r-- | drivers/mfd/mfd-core.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c index 892d343193ad..f3338fe9d069 100644 --- a/drivers/mfd/mfd-core.c +++ b/drivers/mfd/mfd-core.c | |||
@@ -78,6 +78,44 @@ static int mfd_platform_add_cell(struct platform_device *pdev, | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | #if IS_ENABLED(CONFIG_ACPI) | ||
82 | static void mfd_acpi_add_device(const struct mfd_cell *cell, | ||
83 | struct platform_device *pdev) | ||
84 | { | ||
85 | struct acpi_device *parent_adev; | ||
86 | struct acpi_device *adev; | ||
87 | |||
88 | parent_adev = ACPI_COMPANION(pdev->dev.parent); | ||
89 | if (!parent_adev) | ||
90 | return; | ||
91 | |||
92 | /* | ||
93 | * MFD child device gets its ACPI handle either from the ACPI | ||
94 | * device directly under the parent that matches the acpi_pnpid or | ||
95 | * it will use the parent handle if is no acpi_pnpid is given. | ||
96 | */ | ||
97 | adev = parent_adev; | ||
98 | if (cell->acpi_pnpid) { | ||
99 | struct acpi_device_id ids[2] = {}; | ||
100 | struct acpi_device *child_adev; | ||
101 | |||
102 | strlcpy(ids[0].id, cell->acpi_pnpid, sizeof(ids[0].id)); | ||
103 | list_for_each_entry(child_adev, &parent_adev->children, node) | ||
104 | if (acpi_match_device_ids(child_adev, ids)) { | ||
105 | adev = child_adev; | ||
106 | break; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | ACPI_COMPANION_SET(&pdev->dev, adev); | ||
111 | } | ||
112 | #else | ||
113 | static inline void mfd_acpi_add_device(const struct mfd_cell *cell, | ||
114 | struct platform_device *pdev) | ||
115 | { | ||
116 | } | ||
117 | #endif | ||
118 | |||
81 | static int mfd_add_device(struct device *parent, int id, | 119 | static int mfd_add_device(struct device *parent, int id, |
82 | const struct mfd_cell *cell, atomic_t *usage_count, | 120 | const struct mfd_cell *cell, atomic_t *usage_count, |
83 | struct resource *mem_base, | 121 | struct resource *mem_base, |
@@ -101,6 +139,7 @@ static int mfd_add_device(struct device *parent, int id, | |||
101 | pdev->dev.type = &mfd_dev_type; | 139 | pdev->dev.type = &mfd_dev_type; |
102 | pdev->dev.dma_mask = parent->dma_mask; | 140 | pdev->dev.dma_mask = parent->dma_mask; |
103 | pdev->dev.dma_parms = parent->dma_parms; | 141 | pdev->dev.dma_parms = parent->dma_parms; |
142 | pdev->dev.coherent_dma_mask = parent->coherent_dma_mask; | ||
104 | 143 | ||
105 | ret = regulator_bulk_register_supply_alias( | 144 | ret = regulator_bulk_register_supply_alias( |
106 | &pdev->dev, cell->parent_supplies, | 145 | &pdev->dev, cell->parent_supplies, |
@@ -118,6 +157,8 @@ static int mfd_add_device(struct device *parent, int id, | |||
118 | } | 157 | } |
119 | } | 158 | } |
120 | 159 | ||
160 | mfd_acpi_add_device(cell, pdev); | ||
161 | |||
121 | if (cell->pdata_size) { | 162 | if (cell->pdata_size) { |
122 | ret = platform_device_add_data(pdev, | 163 | ret = platform_device_add_data(pdev, |
123 | cell->platform_data, cell->pdata_size); | 164 | cell->platform_data, cell->pdata_size); |