pxa/hx4700: Set DS1WM clock_rate
PATCH 1/1 pxa/hx4700: Set DS1WM clock_rate
The mfd/asic3 driver did not set the ds1wm_driver_data.clock_rate field before passing the structure to the ds1wm cell driver. By chance, ds1wm_find_divisor() returned the correct divisor when this zero clock_rate was passed in. However a recent change to ds1wm_find_divisor() removed this unintended behaviour. This patch explicitly sets the ds1wm_driver_data.clock_rate field.
---
arch/arm/mach-pxa/hx4700.c +1 -0
@@ -310,6 +310,7 @@ static struct asic3_platform_data asic3_ .gpio_config_num = ARRAY_SIZE(asic3_gpio_config), .irq_base = IRQ_BOARD_START, .gpio_base = HX4700_ASIC3_GPIO_BASE, + .clock_rate = 4000000, };static struct platform_device asic3 = {
drivers/mfd/asic3.c +6 -3
@@ -867,10 +867,13 @@ static int __init asic3_mfd_probe(struct asic3_mmc_resources[0 ].start >>= asic->bus_shift; asic3_mmc_resources[0 ].end >>= asic->bus_shift; - ret =mfd_add_devices (&pdev->dev, pdev->id, +if (pdata->clock_rate) { + ds1wm_pdata.clock_rate = pdata->clock_rate; + ret =mfd_add_devices (&pdev->dev, pdev->id, &asic3_cell_ds1wm,1 , mem, asic->irq_base); -if (ret <0 ) - goto out; +if (ret <0 ) + goto out; + }if (mem_sdio && (irq >=0 )) { ret = mfd_add_devices(&pdev->dev, pdev->id,
include/linux/mfd/asic3.h +2 -0
@@ -31,6 +31,8 @@ struct asic3_platform_data {unsigned int gpio_base; +unsigned int clock_rate; +struct asic3_led *leds; };
PATCH 1/1 pxa/hx4700: Set DS1WM clock_rate
Quoted 27 lines · Paul Parsons
The mfd/asic3 driver did not set the ds1wm_driver_data.clock_rate field before passing the structure to the ds1wm cell driver. By chance,
ds1wm_find_divisor()returned the correct divisor when this zeroclock_ratewas passed in. However a recent change tods1wm_find_divisor()removed this unintended behaviour. This patch explicitly sets the ds1wm_driver_data.clock_rate field.Signed-off-by Paul Parsons <[email protected]>---
diff -uprN
clean-3.0.1/arch/arm/mach-pxa/hx4700.clinux-3.0.1/arch/arm/mach-pxa/hx4700.carch/arm/mach-pxa/hx4700.c ? ? ?2011-08-07 23:02:18.653447085 +0100 renamed from arch/arm/mach-pxa/hx4700.c ? ? ?2011-08-05 05:59:21.000000000 +0100 +1
-0@@ -310,6 +310,7 @@ static struct asic3_platform_data asic3_ ? ? ? ?.gpio_config_num = ARRAY_SIZE(asic3_gpio_config), ? ? ? ?.irq_base ? ? ? ?= IRQ_BOARD_START, ? ? ? ?.gpio_base ? ? ? = HX4700_ASIC3_GPIO_BASE, + ? ? ? .clock_rate ? ? ?= 4000000, ?}; ?static struct platform_device asic3 = {diff -uprN
clean-3.0.1/drivers/mfd/asic3.clinux-3.0.1/drivers/mfd/asic3.cdrivers/mfd/asic3.c ? ? 2011-08-07 23:02:18.653447085 +0100 renamed from drivers/mfd/asic3.c ? ? 2011-08-05 05:59:21.000000000 +0100 +0
-0@@ -867,10 +867,13 @@ static int __init asic3_mfd_probe(struct ? ? ? ?asic3_mmc_resources[0].start >>= asic->bus_shift; ? ? ? ?asic3_mmc_resources[0].end ? >>= asic->bus_shift;
drivers/mfd/asic3.c ? ? 2011-08-07 23:02:18.653447085 +0100 static int __init asic3_mfd_probe(struct · line 876
Quoted 10 lines
drivers/mfd/asic3.c ? ? 2011-08-07 23:02:18.653447085 +0100 renamed from drivers/mfd/asic3.c ? ? 2011-08-05 05:59:21.000000000 +0100 +6
-3- ? ? ? ret = mfd_add_devices(&pdev->dev, pdev->id, + ? ? ? if (pdata->clock_rate) { + ? ? ? ? ? ? ? ds1wm_pdata.clock_rate = pdata->clock_rate; + ? ? ? ? ? ? ? ret = mfd_add_devices(&pdev->dev, pdev->id, ? ? ? ? ? ? ? ? ? ? ? ?&asic3_cell_ds1wm, 1, mem, asic->irq_base); - ? ? ? if (ret < 0) - ? ? ? ? ? ? ? goto out; + ? ? ? ? ? ? ? if (ret < 0) + ? ? ? ? ? ? ? ? ? ? ? goto out; + ? ? ? }
Or this parent driver can silently pass the clock_rate to ds1wm sub-driver without the if () condition, as it leaves to the sub-driver to decide whether it's a valid value, unless you want to use 'clock_rate' to explicitly control the registration of the sub-device.
Quoted 17 lines
drivers/mfd/asic3.c ? ? 2011-08-07 23:02:18.653447085 +0100 renamed from drivers/mfd/asic3.c ? ? 2011-08-05 05:59:21.000000000 +0100 +0
-0? ? ? ?if (mem_sdio && (irq >= 0)) { ? ? ? ? ? ? ? ?ret = mfd_add_devices(&pdev->dev, pdev->id,diff -uprN
clean-3.0.1/include/linux/mfd/asic3.hlinux-3.0.1/include/linux/mfd/asic3.hinclude/linux/mfd/asic3.h ? ? ? 2011-08-07 23:02:18.653447085 +0100 renamed from include/linux/mfd/asic3.h ? ? ? 2011-08-05 05:59:21.000000000 +0100 +2
-0@@ -31,6 +31,8 @@ struct asic3_platform_data { ? ? ? ?unsigned int gpio_base; + ? ? ? unsigned int clock_rate; + ? ? ? ?struct asic3_led *leds; ?};
PATCH 1/1 pxa/hx4700: Set DS1WM clock_rate
Hi Eric,
Quoted 7 lines
Or this parent driver can silently pass the
clock_rateto ds1wm sub-driver
without the if () condition, as it leaves to the sub-driver to decide whether
it's a valid value, unless you want to use 'clock_rate' to explicitly control
the registration of the sub-device.
I followed the example of the pxa/magician + mfd/htc-pasic3 platform.
Regards,
Paul
PATCH 1/1 pxa/hx4700: Set DS1WM clock_rate
Quoted 11 lines · Paul Parsons
Hi Eric,
Quoted 7 lines
Or this parent driver can silently pass the
clock_rateto ds1wm sub-driver
without the if () condition, as it leaves to the sub-driver to decide whether
it's a valid value, unless you want to use 'clock_rate' to explicitly control
the registration of the sub-device.I followed the example of the pxa/magician + mfd/htc-pasic3 platform.
For PASIC3 there is a PASIC2 variant that doesn't include the DS1WM. I'm not sure if there are ASIC3 devices that don't use the integrated DS1WM, so this might not be needed in this case.
Either way,
regards
Philipp