mfd: PASIC3: supply clock_rate to DS1WM via driver_data
authorPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 17 Feb 2009 09:09:44 +0000 (10:09 +0100)
committerSamuel Ortiz <samuel@sortiz.org>
Sat, 4 Apr 2009 22:32:23 +0000 (00:32 +0200)
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
drivers/mfd/htc-pasic3.c

index 92b683790ad89ca29ad176d131a99b0be06029e8..386da1566fccb41f76a6828e3e5de2dde965ccfb 100644 (file)
@@ -167,15 +167,19 @@ static int __init pasic3_probe(struct platform_device *pdev)
        /* calculate bus shift from mem resource */
        asic->bus_shift = (resource_size(r) - 5) >> 3;
 
-       /* the first 5 PASIC3 registers control the DS1WM */
-       ds1wm_resources[0].end = (5 << asic->bus_shift) - 1;
-       ds1wm_cell.platform_data = &ds1wm_cell;
-       ds1wm_cell.data_size = sizeof(ds1wm_cell);
-       ret = mfd_add_devices(&pdev->dev, pdev->id, &ds1wm_cell, 1, r, irq);
-       if (ret < 0)
-               dev_warn(dev, "failed to register DS1WM\n");
-
-       if (pdata->led_pdata) {
+       if (pdata && pdata->clock_rate) {
+               ds1wm_pdata.clock_rate = pdata->clock_rate;
+               /* the first 5 PASIC3 registers control the DS1WM */
+               ds1wm_resources[0].end = (5 << asic->bus_shift) - 1;
+               ds1wm_cell.platform_data = &ds1wm_cell;
+               ds1wm_cell.data_size = sizeof(ds1wm_cell);
+               ret = mfd_add_devices(&pdev->dev, pdev->id,
+                               &ds1wm_cell, 1, r, irq);
+               if (ret < 0)
+                       dev_warn(dev, "failed to register DS1WM\n");
+       }
+
+       if (pdata && pdata->led_pdata) {
                led_cell.driver_data = pdata->led_pdata;
                led_cell.platform_data = &led_cell;
                led_cell.data_size = sizeof(ds1wm_cell);