Commit 47c10edd715d420cabd8622a4a458e9ac755b24d

Authored by Philipp Zabel
Committed by Samuel Ortiz
1 parent 7d33ccbeec

mfd: PASIC3: supply clock_rate to DS1WM via driver_data

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>

Showing 1 changed file with 13 additions and 9 deletions Side-by-side Diff

drivers/mfd/htc-pasic3.c
... ... @@ -167,15 +167,19 @@
167 167 /* calculate bus shift from mem resource */
168 168 asic->bus_shift = (resource_size(r) - 5) >> 3;
169 169  
170   - /* the first 5 PASIC3 registers control the DS1WM */
171   - ds1wm_resources[0].end = (5 << asic->bus_shift) - 1;
172   - ds1wm_cell.platform_data = &ds1wm_cell;
173   - ds1wm_cell.data_size = sizeof(ds1wm_cell);
174   - ret = mfd_add_devices(&pdev->dev, pdev->id, &ds1wm_cell, 1, r, irq);
175   - if (ret < 0)
176   - dev_warn(dev, "failed to register DS1WM\n");
  170 + if (pdata && pdata->clock_rate) {
  171 + ds1wm_pdata.clock_rate = pdata->clock_rate;
  172 + /* the first 5 PASIC3 registers control the DS1WM */
  173 + ds1wm_resources[0].end = (5 << asic->bus_shift) - 1;
  174 + ds1wm_cell.platform_data = &ds1wm_cell;
  175 + ds1wm_cell.data_size = sizeof(ds1wm_cell);
  176 + ret = mfd_add_devices(&pdev->dev, pdev->id,
  177 + &ds1wm_cell, 1, r, irq);
  178 + if (ret < 0)
  179 + dev_warn(dev, "failed to register DS1WM\n");
  180 + }
177 181  
178   - if (pdata->led_pdata) {
  182 + if (pdata && pdata->led_pdata) {
179 183 led_cell.driver_data = pdata->led_pdata;
180 184 led_cell.platform_data = &led_cell;
181 185 led_cell.data_size = sizeof(ds1wm_cell);