aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-03-18 08:50:10 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-23 05:42:11 -0400
commit316b6cc081b112546842d44ded21512bd8454a85 (patch)
tree8159c62fb4e04cc98beef9a4c6543bbc7f502204 /drivers/mfd
parent8bd4d7c4c500e88bff975bbcb7fe0d89da319cdd (diff)
mfd: Push byte swaps out of wm8994 bulk read path
For consistency with the write path push byte swaps of the WM8994 register data out of the bulk read data path into the per-register APIs. The only user of the bulk register read is the interrupt code which is updated to do the swaps itself part of this patch. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/wm8994-core.c10
-rw-r--r--drivers/mfd/wm8994-irq.c6
2 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index 3f5b7cc85f1d..e198d40292e7 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -40,10 +40,8 @@ static int wm8994_read(struct wm8994 *wm8994, unsigned short reg,
40 return ret; 40 return ret;
41 41
42 for (i = 0; i < bytes / 2; i++) { 42 for (i = 0; i < bytes / 2; i++) {
43 buf[i] = be16_to_cpu(buf[i]);
44
45 dev_vdbg(wm8994->dev, "Read %04x from R%d(0x%x)\n", 43 dev_vdbg(wm8994->dev, "Read %04x from R%d(0x%x)\n",
46 buf[i], reg + i, reg + i); 44 be16_to_cpu(buf[i]), reg + i, reg + i);
47 } 45 }
48 46
49 return 0; 47 return 0;
@@ -69,7 +67,7 @@ int wm8994_reg_read(struct wm8994 *wm8994, unsigned short reg)
69 if (ret < 0) 67 if (ret < 0)
70 return ret; 68 return ret;
71 else 69 else
72 return val; 70 return be16_to_cpu(val);
73} 71}
74EXPORT_SYMBOL_GPL(wm8994_reg_read); 72EXPORT_SYMBOL_GPL(wm8994_reg_read);
75 73
@@ -79,7 +77,7 @@ EXPORT_SYMBOL_GPL(wm8994_reg_read);
79 * @wm8994: Device to read from 77 * @wm8994: Device to read from
80 * @reg: First register 78 * @reg: First register
81 * @count: Number of registers 79 * @count: Number of registers
82 * @buf: Buffer to fill. 80 * @buf: Buffer to fill. The data will be returned big endian.
83 */ 81 */
84int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg, 82int wm8994_bulk_read(struct wm8994 *wm8994, unsigned short reg,
85 int count, u16 *buf) 83 int count, u16 *buf)
@@ -180,6 +178,8 @@ int wm8994_set_bits(struct wm8994 *wm8994, unsigned short reg,
180 if (ret < 0) 178 if (ret < 0)
181 goto out; 179 goto out;
182 180
181 r = be16_to_cpu(r);
182
183 r &= ~mask; 183 r &= ~mask;
184 r |= val; 184 r |= val;
185 185
diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c
index f5e439a37dc5..1e3bf4a2ff8e 100644
--- a/drivers/mfd/wm8994-irq.c
+++ b/drivers/mfd/wm8994-irq.c
@@ -225,9 +225,11 @@ static irqreturn_t wm8994_irq_thread(int irq, void *data)
225 return IRQ_NONE; 225 return IRQ_NONE;
226 } 226 }
227 227
228 /* Apply masking */ 228 /* Bit swap and apply masking */
229 for (i = 0; i < WM8994_NUM_IRQ_REGS; i++) 229 for (i = 0; i < WM8994_NUM_IRQ_REGS; i++) {
230 status[i] = be16_to_cpu(status[i]);
230 status[i] &= ~wm8994->irq_masks_cur[i]; 231 status[i] &= ~wm8994->irq_masks_cur[i];
232 }
231 233
232 /* Report */ 234 /* Report */
233 for (i = 0; i < ARRAY_SIZE(wm8994_irqs); i++) { 235 for (i = 0; i < ARRAY_SIZE(wm8994_irqs); i++) {