aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-11-13 03:28:45 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-11-21 10:08:00 -0500
commit14591d888e35c12b15eccf54e490c7769eb6d6d2 (patch)
tree16631920135867d55fbdace5073cd89b61446c72 /drivers
parent2473d25a2f61985f8980c7c3d41cb85da1abea0f (diff)
mfd/rtc/gpio: twl: No need to allocate bigger buffer for write
Since the twl-core has been converted to use regmap it is no longer needed to allocate bigger buffer for data when writing to twl. CC: Grant Likely <grant.likely@secretlab.ca> CC: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/gpio-twl4030.c12
-rw-r--r--drivers/mfd/twl-core.c9
-rw-r--r--drivers/mfd/twl4030-irq.c6
-rw-r--r--drivers/mfd/twl6030-irq.c4
-rw-r--r--drivers/rtc/rtc-twl.c32
5 files changed, 29 insertions, 34 deletions
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index c5f8ca233e1f..88829c3337bf 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -354,13 +354,13 @@ static struct gpio_chip twl_gpiochip = {
354 354
355static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs) 355static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs)
356{ 356{
357 u8 message[6]; 357 u8 message[5];
358 unsigned i, gpio_bit; 358 unsigned i, gpio_bit;
359 359
360 /* For most pins, a pulldown was enabled by default. 360 /* For most pins, a pulldown was enabled by default.
361 * We should have data that's specific to this board. 361 * We should have data that's specific to this board.
362 */ 362 */
363 for (gpio_bit = 1, i = 1; i < 6; i++) { 363 for (gpio_bit = 1, i = 0; i < 5; i++) {
364 u8 bit_mask; 364 u8 bit_mask;
365 unsigned j; 365 unsigned j;
366 366
@@ -379,16 +379,16 @@ static int __devinit gpio_twl4030_pulls(u32 ups, u32 downs)
379 379
380static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd) 380static int __devinit gpio_twl4030_debounce(u32 debounce, u8 mmc_cd)
381{ 381{
382 u8 message[4]; 382 u8 message[3];
383 383
384 /* 30 msec of debouncing is always used for MMC card detect, 384 /* 30 msec of debouncing is always used for MMC card detect,
385 * and is optional for everything else. 385 * and is optional for everything else.
386 */ 386 */
387 message[1] = (debounce & 0xff) | (mmc_cd & 0x03); 387 message[0] = (debounce & 0xff) | (mmc_cd & 0x03);
388 debounce >>= 8; 388 debounce >>= 8;
389 message[2] = (debounce & 0xff); 389 message[1] = (debounce & 0xff);
390 debounce >>= 8; 390 debounce >>= 8;
391 message[3] = (debounce & 0x03); 391 message[2] = (debounce & 0x03);
392 392
393 return twl_i2c_write(TWL4030_MODULE_GPIO, message, 393 return twl_i2c_write(TWL4030_MODULE_GPIO, message,
394 REG_GPIO_DEBEN1, 3); 394 REG_GPIO_DEBEN1, 3);
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 5043f505a230..a55ab15ecf1a 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -344,7 +344,7 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
344 twl = &twl_modules[sid]; 344 twl = &twl_modules[sid];
345 345
346 ret = regmap_bulk_write(twl->regmap, twl_map[mod_no].base + reg, 346 ret = regmap_bulk_write(twl->regmap, twl_map[mod_no].base + reg,
347 &value[1], num_bytes); 347 value, num_bytes);
348 348
349 if (ret) 349 if (ret)
350 pr_err("%s: Write failed (mod %d, reg 0x%02x count %d)\n", 350 pr_err("%s: Write failed (mod %d, reg 0x%02x count %d)\n",
@@ -406,12 +406,7 @@ EXPORT_SYMBOL(twl_i2c_read);
406 */ 406 */
407int twl_i2c_write_u8(u8 mod_no, u8 value, u8 reg) 407int twl_i2c_write_u8(u8 mod_no, u8 value, u8 reg)
408{ 408{
409 409 return twl_i2c_write(mod_no, &value, reg, 1);
410 /* 2 bytes offset 1 contains the data offset 0 is used by i2c_write */
411 u8 temp_buffer[2] = { 0 };
412 /* offset 1 contains the data */
413 temp_buffer[1] = value;
414 return twl_i2c_write(mod_no, temp_buffer, reg, 1);
415} 410}
416EXPORT_SYMBOL(twl_i2c_write_u8); 411EXPORT_SYMBOL(twl_i2c_write_u8);
417 412
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index ad733d76207a..e900402633f5 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -501,7 +501,7 @@ static void twl4030_sih_bus_sync_unlock(struct irq_data *data)
501 } imr; 501 } imr;
502 502
503 /* byte[0] gets overwritten as we write ... */ 503 /* byte[0] gets overwritten as we write ... */
504 imr.word = cpu_to_le32(agent->imr << 8); 504 imr.word = cpu_to_le32(agent->imr);
505 agent->imr_change_pending = false; 505 agent->imr_change_pending = false;
506 506
507 /* write the whole mask ... simpler than subsetting it */ 507 /* write the whole mask ... simpler than subsetting it */
@@ -526,7 +526,7 @@ static void twl4030_sih_bus_sync_unlock(struct irq_data *data)
526 * any processor on the other IRQ line, EDR registers are 526 * any processor on the other IRQ line, EDR registers are
527 * shared. 527 * shared.
528 */ 528 */
529 status = twl_i2c_read(sih->module, bytes + 1, 529 status = twl_i2c_read(sih->module, bytes,
530 sih->edr_offset, sih->bytes_edr); 530 sih->edr_offset, sih->bytes_edr);
531 if (status) { 531 if (status) {
532 pr_err("twl4030: %s, %s --> %d\n", __func__, 532 pr_err("twl4030: %s, %s --> %d\n", __func__,
@@ -538,7 +538,7 @@ static void twl4030_sih_bus_sync_unlock(struct irq_data *data)
538 while (edge_change) { 538 while (edge_change) {
539 int i = fls(edge_change) - 1; 539 int i = fls(edge_change) - 1;
540 struct irq_data *idata; 540 struct irq_data *idata;
541 int byte = 1 + (i >> 2); 541 int byte = i >> 2;
542 int off = (i & 0x3) * 2; 542 int off = (i & 0x3) * 2;
543 unsigned int type; 543 unsigned int type;
544 544
diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index b76902f1e44a..277a8dba42d5 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -355,7 +355,7 @@ int twl6030_init_irq(struct device *dev, int irq_num)
355 static struct irq_chip twl6030_irq_chip; 355 static struct irq_chip twl6030_irq_chip;
356 int status = 0; 356 int status = 0;
357 int i; 357 int i;
358 u8 mask[4]; 358 u8 mask[3];
359 359
360 nr_irqs = TWL6030_NR_IRQS; 360 nr_irqs = TWL6030_NR_IRQS;
361 361
@@ -370,9 +370,9 @@ int twl6030_init_irq(struct device *dev, int irq_num)
370 370
371 irq_end = irq_base + nr_irqs; 371 irq_end = irq_base + nr_irqs;
372 372
373 mask[0] = 0xFF;
373 mask[1] = 0xFF; 374 mask[1] = 0xFF;
374 mask[2] = 0xFF; 375 mask[2] = 0xFF;
375 mask[3] = 0xFF;
376 376
377 /* mask all int lines */ 377 /* mask all int lines */
378 twl_i2c_write(TWL_MODULE_PIH, &mask[0], REG_INT_MSK_LINE_A, 3); 378 twl_i2c_write(TWL_MODULE_PIH, &mask[0], REG_INT_MSK_LINE_A, 3);
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 9277d945bf48..8b7464c8b5cf 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -233,7 +233,7 @@ static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
233 */ 233 */
234static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm) 234static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
235{ 235{
236 unsigned char rtc_data[ALL_TIME_REGS + 1]; 236 unsigned char rtc_data[ALL_TIME_REGS];
237 int ret; 237 int ret;
238 u8 save_control; 238 u8 save_control;
239 u8 rtc_control; 239 u8 rtc_control;
@@ -300,15 +300,15 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm)
300static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm) 300static int twl_rtc_set_time(struct device *dev, struct rtc_time *tm)
301{ 301{
302 unsigned char save_control; 302 unsigned char save_control;
303 unsigned char rtc_data[ALL_TIME_REGS + 1]; 303 unsigned char rtc_data[ALL_TIME_REGS];
304 int ret; 304 int ret;
305 305
306 rtc_data[1] = bin2bcd(tm->tm_sec); 306 rtc_data[0] = bin2bcd(tm->tm_sec);
307 rtc_data[2] = bin2bcd(tm->tm_min); 307 rtc_data[1] = bin2bcd(tm->tm_min);
308 rtc_data[3] = bin2bcd(tm->tm_hour); 308 rtc_data[2] = bin2bcd(tm->tm_hour);
309 rtc_data[4] = bin2bcd(tm->tm_mday); 309 rtc_data[3] = bin2bcd(tm->tm_mday);
310 rtc_data[5] = bin2bcd(tm->tm_mon + 1); 310 rtc_data[4] = bin2bcd(tm->tm_mon + 1);
311 rtc_data[6] = bin2bcd(tm->tm_year - 100); 311 rtc_data[5] = bin2bcd(tm->tm_year - 100);
312 312
313 /* Stop RTC while updating the TC registers */ 313 /* Stop RTC while updating the TC registers */
314 ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); 314 ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG);
@@ -341,7 +341,7 @@ out:
341 */ 341 */
342static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) 342static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
343{ 343{
344 unsigned char rtc_data[ALL_TIME_REGS + 1]; 344 unsigned char rtc_data[ALL_TIME_REGS];
345 int ret; 345 int ret;
346 346
347 ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, 347 ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data,
@@ -368,19 +368,19 @@ static int twl_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
368 368
369static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) 369static int twl_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
370{ 370{
371 unsigned char alarm_data[ALL_TIME_REGS + 1]; 371 unsigned char alarm_data[ALL_TIME_REGS];
372 int ret; 372 int ret;
373 373
374 ret = twl_rtc_alarm_irq_enable(dev, 0); 374 ret = twl_rtc_alarm_irq_enable(dev, 0);
375 if (ret) 375 if (ret)
376 goto out; 376 goto out;
377 377
378 alarm_data[1] = bin2bcd(alm->time.tm_sec); 378 alarm_data[0] = bin2bcd(alm->time.tm_sec);
379 alarm_data[2] = bin2bcd(alm->time.tm_min); 379 alarm_data[1] = bin2bcd(alm->time.tm_min);
380 alarm_data[3] = bin2bcd(alm->time.tm_hour); 380 alarm_data[2] = bin2bcd(alm->time.tm_hour);
381 alarm_data[4] = bin2bcd(alm->time.tm_mday); 381 alarm_data[3] = bin2bcd(alm->time.tm_mday);
382 alarm_data[5] = bin2bcd(alm->time.tm_mon + 1); 382 alarm_data[4] = bin2bcd(alm->time.tm_mon + 1);
383 alarm_data[6] = bin2bcd(alm->time.tm_year - 100); 383 alarm_data[5] = bin2bcd(alm->time.tm_year - 100);
384 384
385 /* update all the alarm registers in one shot */ 385 /* update all the alarm registers in one shot */
386 ret = twl_i2c_write(TWL_MODULE_RTC, alarm_data, 386 ret = twl_i2c_write(TWL_MODULE_RTC, alarm_data,