diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 14:38:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-05 14:38:37 -0400 |
commit | 48f286a28fe13fcbc510720fcffb872a184b51dd (patch) | |
tree | f50d868589138628c04dd5600a029ef80fa21da2 /drivers/mfd | |
parent | ea431793f198e26d1553f36ed8b5a830b531eee4 (diff) | |
parent | fa15ce8ad59e9653d50b8596596cb02d3566d4aa (diff) |
Merge branch 'for-next' of git://git.o-hand.com/linux-mfd
* 'for-next' of git://git.o-hand.com/linux-mfd:
mfd: fix da903x warning
mfd: fix MAINTAINERS entry
mfd: Use the value of the final spin when reading the AUXADC
mfd: Storage class should be before const qualifier
mfd: PASIC3: supply clock_rate to DS1WM via driver_data
mfd: remove DS1WM clock handling
mfd: remove unused PASIC3 bus_shift field
pxa/magician: remove deprecated .bus_shift from PASIC3 platform_data
mfd: convert PASIC3 to use MFD core
mfd: convert DS1WM to use MFD core
mfd: Support active high IRQs on WM835x
mfd: Use bulk read to fill WM8350 register cache
mfd: remove duplicated #include from pcf50633
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/Kconfig | 1 | ||||
-rw-r--r-- | drivers/mfd/da903x.c | 2 | ||||
-rw-r--r-- | drivers/mfd/htc-pasic3.c | 169 | ||||
-rw-r--r-- | drivers/mfd/pcf50633-core.c | 1 | ||||
-rw-r--r-- | drivers/mfd/t7l66xb.c | 4 | ||||
-rw-r--r-- | drivers/mfd/tc6393xb.c | 2 | ||||
-rw-r--r-- | drivers/mfd/twl4030-irq.c | 2 | ||||
-rw-r--r-- | drivers/mfd/wm8350-core.c | 39 |
8 files changed, 102 insertions, 118 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 75f35dbb11dc..ee3927ab11e0 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -52,6 +52,7 @@ config HTC_EGPIO | |||
52 | 52 | ||
53 | config HTC_PASIC3 | 53 | config HTC_PASIC3 |
54 | tristate "HTC PASIC3 LED/DS1WM chip support" | 54 | tristate "HTC PASIC3 LED/DS1WM chip support" |
55 | select MFD_CORE | ||
55 | help | 56 | help |
56 | This core driver provides register access for the LED/DS1WM | 57 | This core driver provides register access for the LED/DS1WM |
57 | chips labeled "AIC2" and "AIC3", found on HTC Blueangel and | 58 | chips labeled "AIC2" and "AIC3", found on HTC Blueangel and |
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c index 99f8dcfe3d98..7283d88656af 100644 --- a/drivers/mfd/da903x.c +++ b/drivers/mfd/da903x.c | |||
@@ -413,7 +413,7 @@ static void da903x_irq_work(struct work_struct *work) | |||
413 | enable_irq(chip->client->irq); | 413 | enable_irq(chip->client->irq); |
414 | } | 414 | } |
415 | 415 | ||
416 | static int da903x_irq_handler(int irq, void *data) | 416 | static irqreturn_t da903x_irq_handler(int irq, void *data) |
417 | { | 417 | { |
418 | struct da903x_chip *chip = data; | 418 | struct da903x_chip *chip = data; |
419 | 419 | ||
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c index 91b294dcc133..386da1566fcc 100644 --- a/drivers/mfd/htc-pasic3.c +++ b/drivers/mfd/htc-pasic3.c | |||
@@ -12,18 +12,17 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | 14 | ||
15 | #include <linux/ds1wm.h> | ||
16 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
17 | #include <linux/io.h> | 16 | #include <linux/io.h> |
18 | #include <linux/irq.h> | 17 | #include <linux/irq.h> |
19 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/mfd/core.h> | ||
20 | #include <linux/mfd/ds1wm.h> | ||
20 | #include <linux/mfd/htc-pasic3.h> | 21 | #include <linux/mfd/htc-pasic3.h> |
21 | 22 | ||
22 | struct pasic3_data { | 23 | struct pasic3_data { |
23 | void __iomem *mapping; | 24 | void __iomem *mapping; |
24 | unsigned int bus_shift; | 25 | unsigned int bus_shift; |
25 | struct platform_device *ds1wm_pdev; | ||
26 | struct platform_device *led_pdev; | ||
27 | }; | 26 | }; |
28 | 27 | ||
29 | #define REG_ADDR 5 | 28 | #define REG_ADDR 5 |
@@ -65,46 +64,15 @@ EXPORT_SYMBOL(pasic3_read_register); /* for leds-pasic3 */ | |||
65 | * LEDs | 64 | * LEDs |
66 | */ | 65 | */ |
67 | 66 | ||
68 | static int led_device_add(struct device *pasic3_dev, | 67 | static struct mfd_cell led_cell __initdata = { |
69 | const struct pasic3_leds_machinfo *pdata) | 68 | .name = "leds-pasic3", |
70 | { | 69 | }; |
71 | struct pasic3_data *asic = pasic3_dev->driver_data; | ||
72 | struct platform_device *pdev; | ||
73 | int ret; | ||
74 | |||
75 | pdev = platform_device_alloc("pasic3-led", -1); | ||
76 | if (!pdev) { | ||
77 | dev_dbg(pasic3_dev, "failed to allocate LED platform device\n"); | ||
78 | return -ENOMEM; | ||
79 | } | ||
80 | |||
81 | ret = platform_device_add_data(pdev, pdata, | ||
82 | sizeof(struct pasic3_leds_machinfo)); | ||
83 | if (ret < 0) { | ||
84 | dev_dbg(pasic3_dev, "failed to add LED platform data\n"); | ||
85 | goto exit_pdev_put; | ||
86 | } | ||
87 | |||
88 | pdev->dev.parent = pasic3_dev; | ||
89 | ret = platform_device_add(pdev); | ||
90 | if (ret < 0) { | ||
91 | dev_dbg(pasic3_dev, "failed to add LED platform device\n"); | ||
92 | goto exit_pdev_put; | ||
93 | } | ||
94 | |||
95 | asic->led_pdev = pdev; | ||
96 | return 0; | ||
97 | |||
98 | exit_pdev_put: | ||
99 | platform_device_put(pdev); | ||
100 | return ret; | ||
101 | } | ||
102 | 70 | ||
103 | /* | 71 | /* |
104 | * DS1WM | 72 | * DS1WM |
105 | */ | 73 | */ |
106 | 74 | ||
107 | static void ds1wm_enable(struct platform_device *pdev) | 75 | static int ds1wm_enable(struct platform_device *pdev) |
108 | { | 76 | { |
109 | struct device *dev = pdev->dev.parent; | 77 | struct device *dev = pdev->dev.parent; |
110 | int c; | 78 | int c; |
@@ -113,9 +81,10 @@ static void ds1wm_enable(struct platform_device *pdev) | |||
113 | pasic3_write_register(dev, 0x28, c & 0x7f); | 81 | pasic3_write_register(dev, 0x28, c & 0x7f); |
114 | 82 | ||
115 | dev_dbg(dev, "DS1WM OWM_EN low (active) %02x\n", c & 0x7f); | 83 | dev_dbg(dev, "DS1WM OWM_EN low (active) %02x\n", c & 0x7f); |
84 | return 0; | ||
116 | } | 85 | } |
117 | 86 | ||
118 | static void ds1wm_disable(struct platform_device *pdev) | 87 | static int ds1wm_disable(struct platform_device *pdev) |
119 | { | 88 | { |
120 | struct device *dev = pdev->dev.parent; | 89 | struct device *dev = pdev->dev.parent; |
121 | int c; | 90 | int c; |
@@ -124,56 +93,33 @@ static void ds1wm_disable(struct platform_device *pdev) | |||
124 | pasic3_write_register(dev, 0x28, c | 0x80); | 93 | pasic3_write_register(dev, 0x28, c | 0x80); |
125 | 94 | ||
126 | dev_dbg(dev, "DS1WM OWM_EN high (inactive) %02x\n", c | 0x80); | 95 | dev_dbg(dev, "DS1WM OWM_EN high (inactive) %02x\n", c | 0x80); |
96 | return 0; | ||
127 | } | 97 | } |
128 | 98 | ||
129 | static struct ds1wm_platform_data ds1wm_pdata = { | 99 | static struct ds1wm_driver_data ds1wm_pdata = { |
130 | .bus_shift = 2, | 100 | .active_high = 0, |
131 | .enable = ds1wm_enable, | ||
132 | .disable = ds1wm_disable, | ||
133 | }; | 101 | }; |
134 | 102 | ||
135 | static int ds1wm_device_add(struct platform_device *pasic3_pdev, int bus_shift) | 103 | static struct resource ds1wm_resources[] __initdata = { |
136 | { | 104 | [0] = { |
137 | struct device *pasic3_dev = &pasic3_pdev->dev; | 105 | .start = 0, |
138 | struct pasic3_data *asic = pasic3_dev->driver_data; | 106 | .flags = IORESOURCE_MEM, |
139 | struct platform_device *pdev; | 107 | }, |
140 | int ret; | 108 | [1] = { |
141 | 109 | .start = 0, | |
142 | pdev = platform_device_alloc("ds1wm", -1); | 110 | .end = 0, |
143 | if (!pdev) { | 111 | .flags = IORESOURCE_IRQ, |
144 | dev_dbg(pasic3_dev, "failed to allocate DS1WM platform device\n"); | 112 | }, |
145 | return -ENOMEM; | 113 | }; |
146 | } | ||
147 | |||
148 | ret = platform_device_add_resources(pdev, pasic3_pdev->resource, | ||
149 | pasic3_pdev->num_resources); | ||
150 | if (ret < 0) { | ||
151 | dev_dbg(pasic3_dev, "failed to add DS1WM resources\n"); | ||
152 | goto exit_pdev_put; | ||
153 | } | ||
154 | |||
155 | ds1wm_pdata.bus_shift = asic->bus_shift; | ||
156 | ret = platform_device_add_data(pdev, &ds1wm_pdata, | ||
157 | sizeof(struct ds1wm_platform_data)); | ||
158 | if (ret < 0) { | ||
159 | dev_dbg(pasic3_dev, "failed to add DS1WM platform data\n"); | ||
160 | goto exit_pdev_put; | ||
161 | } | ||
162 | |||
163 | pdev->dev.parent = pasic3_dev; | ||
164 | ret = platform_device_add(pdev); | ||
165 | if (ret < 0) { | ||
166 | dev_dbg(pasic3_dev, "failed to add DS1WM platform device\n"); | ||
167 | goto exit_pdev_put; | ||
168 | } | ||
169 | |||
170 | asic->ds1wm_pdev = pdev; | ||
171 | return 0; | ||
172 | 114 | ||
173 | exit_pdev_put: | 115 | static struct mfd_cell ds1wm_cell __initdata = { |
174 | platform_device_put(pdev); | 116 | .name = "ds1wm", |
175 | return ret; | 117 | .enable = ds1wm_enable, |
176 | } | 118 | .disable = ds1wm_disable, |
119 | .driver_data = &ds1wm_pdata, | ||
120 | .num_resources = 2, | ||
121 | .resources = ds1wm_resources, | ||
122 | }; | ||
177 | 123 | ||
178 | static int __init pasic3_probe(struct platform_device *pdev) | 124 | static int __init pasic3_probe(struct platform_device *pdev) |
179 | { | 125 | { |
@@ -182,12 +128,27 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
182 | struct pasic3_data *asic; | 128 | struct pasic3_data *asic; |
183 | struct resource *r; | 129 | struct resource *r; |
184 | int ret; | 130 | int ret; |
131 | int irq = 0; | ||
132 | |||
133 | r = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
134 | if (r) { | ||
135 | ds1wm_resources[1].flags = IORESOURCE_IRQ | (r->flags & | ||
136 | (IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE)); | ||
137 | irq = r->start; | ||
138 | } | ||
139 | |||
140 | r = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
141 | if (r) { | ||
142 | ds1wm_resources[1].flags = IORESOURCE_IRQ | (r->flags & | ||
143 | (IORESOURCE_IRQ_HIGHEDGE | IORESOURCE_IRQ_LOWEDGE)); | ||
144 | irq = r->start; | ||
145 | } | ||
185 | 146 | ||
186 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 147 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
187 | if (!r) | 148 | if (!r) |
188 | return -ENXIO; | 149 | return -ENXIO; |
189 | 150 | ||
190 | if (!request_mem_region(r->start, r->end - r->start + 1, "pasic3")) | 151 | if (!request_mem_region(r->start, resource_size(r), "pasic3")) |
191 | return -EBUSY; | 152 | return -EBUSY; |
192 | 153 | ||
193 | asic = kzalloc(sizeof(struct pasic3_data), GFP_KERNEL); | 154 | asic = kzalloc(sizeof(struct pasic3_data), GFP_KERNEL); |
@@ -196,24 +157,33 @@ static int __init pasic3_probe(struct platform_device *pdev) | |||
196 | 157 | ||
197 | platform_set_drvdata(pdev, asic); | 158 | platform_set_drvdata(pdev, asic); |
198 | 159 | ||
199 | if (pdata && pdata->bus_shift) | 160 | asic->mapping = ioremap(r->start, resource_size(r)); |
200 | asic->bus_shift = pdata->bus_shift; | ||
201 | else | ||
202 | asic->bus_shift = 2; | ||
203 | |||
204 | asic->mapping = ioremap(r->start, r->end - r->start + 1); | ||
205 | if (!asic->mapping) { | 161 | if (!asic->mapping) { |
206 | dev_err(dev, "couldn't ioremap PASIC3\n"); | 162 | dev_err(dev, "couldn't ioremap PASIC3\n"); |
207 | kfree(asic); | 163 | kfree(asic); |
208 | return -ENOMEM; | 164 | return -ENOMEM; |
209 | } | 165 | } |
210 | 166 | ||
211 | ret = ds1wm_device_add(pdev, asic->bus_shift); | 167 | /* calculate bus shift from mem resource */ |
212 | if (ret < 0) | 168 | asic->bus_shift = (resource_size(r) - 5) >> 3; |
213 | dev_warn(dev, "failed to register DS1WM\n"); | 169 | |
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 | } | ||
214 | 181 | ||
215 | if (pdata->led_pdata) { | 182 | if (pdata && pdata->led_pdata) { |
216 | ret = led_device_add(dev, pdata->led_pdata); | 183 | led_cell.driver_data = pdata->led_pdata; |
184 | led_cell.platform_data = &led_cell; | ||
185 | led_cell.data_size = sizeof(ds1wm_cell); | ||
186 | ret = mfd_add_devices(&pdev->dev, pdev->id, &led_cell, 1, r, 0); | ||
217 | if (ret < 0) | 187 | if (ret < 0) |
218 | dev_warn(dev, "failed to register LED device\n"); | 188 | dev_warn(dev, "failed to register LED device\n"); |
219 | } | 189 | } |
@@ -226,14 +196,11 @@ static int pasic3_remove(struct platform_device *pdev) | |||
226 | struct pasic3_data *asic = platform_get_drvdata(pdev); | 196 | struct pasic3_data *asic = platform_get_drvdata(pdev); |
227 | struct resource *r; | 197 | struct resource *r; |
228 | 198 | ||
229 | if (asic->led_pdev) | 199 | mfd_remove_devices(&pdev->dev); |
230 | platform_device_unregister(asic->led_pdev); | ||
231 | if (asic->ds1wm_pdev) | ||
232 | platform_device_unregister(asic->ds1wm_pdev); | ||
233 | 200 | ||
234 | iounmap(asic->mapping); | 201 | iounmap(asic->mapping); |
235 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 202 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
236 | release_mem_region(r->start, r->end - r->start + 1); | 203 | release_mem_region(r->start, resource_size(r)); |
237 | kfree(asic); | 204 | kfree(asic); |
238 | return 0; | 205 | return 0; |
239 | } | 206 | } |
diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index 2e36057659e1..7793932a513b 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/sysfs.h> | 17 | #include <linux/sysfs.h> |
18 | #include <linux/device.h> | ||
19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
20 | #include <linux/types.h> | 19 | #include <linux/types.h> |
21 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 9f7024c0f8ec..e9f4323dd2cb 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c | |||
@@ -108,7 +108,7 @@ static int t7l66xb_mmc_disable(struct platform_device *mmc) | |||
108 | 108 | ||
109 | /*--------------------------------------------------------------------------*/ | 109 | /*--------------------------------------------------------------------------*/ |
110 | 110 | ||
111 | const static struct resource t7l66xb_mmc_resources[] = { | 111 | static const struct resource t7l66xb_mmc_resources[] = { |
112 | { | 112 | { |
113 | .start = 0x800, | 113 | .start = 0x800, |
114 | .end = 0x9ff, | 114 | .end = 0x9ff, |
@@ -126,7 +126,7 @@ const static struct resource t7l66xb_mmc_resources[] = { | |||
126 | }, | 126 | }, |
127 | }; | 127 | }; |
128 | 128 | ||
129 | const static struct resource t7l66xb_nand_resources[] = { | 129 | static const struct resource t7l66xb_nand_resources[] = { |
130 | { | 130 | { |
131 | .start = 0xc00, | 131 | .start = 0xc00, |
132 | .end = 0xc07, | 132 | .end = 0xc07, |
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index f856e9463a9f..77a12fc8045e 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -172,7 +172,7 @@ static struct resource __devinitdata tc6393xb_mmc_resources[] = { | |||
172 | }, | 172 | }, |
173 | }; | 173 | }; |
174 | 174 | ||
175 | const static struct resource tc6393xb_ohci_resources[] = { | 175 | static const struct resource tc6393xb_ohci_resources[] = { |
176 | { | 176 | { |
177 | .start = 0x3000, | 177 | .start = 0x3000, |
178 | .end = 0x31ff, | 178 | .end = 0x31ff, |
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c index b10876036983..aca2670afd78 100644 --- a/drivers/mfd/twl4030-irq.c +++ b/drivers/mfd/twl4030-irq.c | |||
@@ -182,7 +182,7 @@ static int twl4030_irq_thread(void *data) | |||
182 | long irq = (long)data; | 182 | long irq = (long)data; |
183 | struct irq_desc *desc = irq_to_desc(irq); | 183 | struct irq_desc *desc = irq_to_desc(irq); |
184 | static unsigned i2c_errors; | 184 | static unsigned i2c_errors; |
185 | const static unsigned max_i2c_errors = 100; | 185 | static const unsigned max_i2c_errors = 100; |
186 | 186 | ||
187 | if (!desc) { | 187 | if (!desc) { |
188 | pr_err("twl4030: Invalid IRQ: %ld\n", irq); | 188 | pr_err("twl4030: Invalid IRQ: %ld\n", irq); |
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c index b457a05b28d9..c2be3088e2e1 100644 --- a/drivers/mfd/wm8350-core.c +++ b/drivers/mfd/wm8350-core.c | |||
@@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) | |||
1111 | do { | 1111 | do { |
1112 | schedule_timeout_interruptible(1); | 1112 | schedule_timeout_interruptible(1); |
1113 | reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); | 1113 | reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); |
1114 | } while (--tries && (reg & WM8350_AUXADC_POLL)); | 1114 | } while ((reg & WM8350_AUXADC_POLL) && --tries); |
1115 | 1115 | ||
1116 | if (!tries) | 1116 | if (!tries) |
1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); | 1117 | dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); |
@@ -1238,7 +1238,7 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) | |||
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | wm8350->reg_cache = | 1240 | wm8350->reg_cache = |
1241 | kzalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); | 1241 | kmalloc(sizeof(u16) * (WM8350_MAX_REGISTER + 1), GFP_KERNEL); |
1242 | if (wm8350->reg_cache == NULL) | 1242 | if (wm8350->reg_cache == NULL) |
1243 | return -ENOMEM; | 1243 | return -ENOMEM; |
1244 | 1244 | ||
@@ -1246,17 +1246,20 @@ static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) | |||
1246 | * a PMIC so the device many not be in a virgin state and we | 1246 | * a PMIC so the device many not be in a virgin state and we |
1247 | * can't rely on the silicon values. | 1247 | * can't rely on the silicon values. |
1248 | */ | 1248 | */ |
1249 | ret = wm8350->read_dev(wm8350, 0, | ||
1250 | sizeof(u16) * (WM8350_MAX_REGISTER + 1), | ||
1251 | wm8350->reg_cache); | ||
1252 | if (ret < 0) { | ||
1253 | dev_err(wm8350->dev, | ||
1254 | "failed to read initial cache values\n"); | ||
1255 | goto out; | ||
1256 | } | ||
1257 | |||
1258 | /* Mask out uncacheable/unreadable bits and the audio. */ | ||
1249 | for (i = 0; i < WM8350_MAX_REGISTER; i++) { | 1259 | for (i = 0; i < WM8350_MAX_REGISTER; i++) { |
1250 | /* audio register range */ | ||
1251 | if (wm8350_reg_io_map[i].readable && | 1260 | if (wm8350_reg_io_map[i].readable && |
1252 | (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { | 1261 | (i < WM8350_CLOCK_CONTROL_1 || i > WM8350_AIF_TEST)) { |
1253 | ret = wm8350->read_dev(wm8350, i, 2, (char *)&value); | 1262 | value = be16_to_cpu(wm8350->reg_cache[i]); |
1254 | if (ret < 0) { | ||
1255 | dev_err(wm8350->dev, | ||
1256 | "failed to read initial cache value\n"); | ||
1257 | goto out; | ||
1258 | } | ||
1259 | value = be16_to_cpu(value); | ||
1260 | value &= wm8350_reg_io_map[i].readable; | 1263 | value &= wm8350_reg_io_map[i].readable; |
1261 | value &= ~wm8350_reg_io_map[i].vol; | 1264 | value &= ~wm8350_reg_io_map[i].vol; |
1262 | wm8350->reg_cache[i] = value; | 1265 | wm8350->reg_cache[i] = value; |
@@ -1435,7 +1438,21 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, | |||
1435 | mutex_init(&wm8350->irq_mutex); | 1438 | mutex_init(&wm8350->irq_mutex); |
1436 | INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); | 1439 | INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); |
1437 | if (irq) { | 1440 | if (irq) { |
1438 | ret = request_irq(irq, wm8350_irq, 0, | 1441 | int flags = 0; |
1442 | |||
1443 | if (pdata && pdata->irq_high) { | ||
1444 | flags |= IRQF_TRIGGER_HIGH; | ||
1445 | |||
1446 | wm8350_set_bits(wm8350, WM8350_SYSTEM_CONTROL_1, | ||
1447 | WM8350_IRQ_POL); | ||
1448 | } else { | ||
1449 | flags |= IRQF_TRIGGER_LOW; | ||
1450 | |||
1451 | wm8350_clear_bits(wm8350, WM8350_SYSTEM_CONTROL_1, | ||
1452 | WM8350_IRQ_POL); | ||
1453 | } | ||
1454 | |||
1455 | ret = request_irq(irq, wm8350_irq, flags, | ||
1439 | "wm8350", wm8350); | 1456 | "wm8350", wm8350); |
1440 | if (ret != 0) { | 1457 | if (ret != 0) { |
1441 | dev_err(wm8350->dev, "Failed to request IRQ: %d\n", | 1458 | dev_err(wm8350->dev, "Failed to request IRQ: %d\n", |