aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-07-04 03:28:28 -0400
committerPeter Ujfalusi <peter.ujfalusi@ti.com>2011-07-07 07:23:46 -0400
commitcfb7a33bea259d2d72a64adcb3de28532170dc25 (patch)
treec7faae49b5bf6f5396207591ffde2dd1f3d724e8 /drivers
parent753621c2155bd49bff7d5d3844b3ddc203e44a06 (diff)
MFD: twl6040: Remove enum for PLL tracking
There is no need to have two different types for tracking the selected PLL. Use only the defines, when dealing with the PLLs. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/twl6040-core.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c
index 6843977f4e87..24d436c2fe4a 100644
--- a/drivers/mfd/twl6040-core.c
+++ b/drivers/mfd/twl6040-core.c
@@ -270,7 +270,8 @@ int twl6040_power(struct twl6040 *twl6040, int on)
270 goto out; 270 goto out;
271 } 271 }
272 } 272 }
273 twl6040->pll = TWL6040_LPPLL_ID; 273 /* Default PLL configuration after power up */
274 twl6040->pll = TWL6040_SYSCLK_SEL_LPPLL;
274 twl6040->sysclk = 19200000; 275 twl6040->sysclk = 19200000;
275 } else { 276 } else {
276 /* already powered-down */ 277 /* already powered-down */
@@ -294,7 +295,6 @@ int twl6040_power(struct twl6040 *twl6040, int on)
294 /* use manual power-down sequence */ 295 /* use manual power-down sequence */
295 twl6040_power_down(twl6040); 296 twl6040_power_down(twl6040);
296 } 297 }
297 twl6040->pll = TWL6040_NOPLL_ID;
298 twl6040->sysclk = 0; 298 twl6040->sysclk = 0;
299 } 299 }
300 300
@@ -304,7 +304,7 @@ out:
304} 304}
305EXPORT_SYMBOL(twl6040_power); 305EXPORT_SYMBOL(twl6040_power);
306 306
307int twl6040_set_pll(struct twl6040 *twl6040, enum twl6040_pll_id id, 307int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
308 unsigned int freq_in, unsigned int freq_out) 308 unsigned int freq_in, unsigned int freq_out)
309{ 309{
310 u8 hppllctl, lppllctl; 310 u8 hppllctl, lppllctl;
@@ -315,8 +315,8 @@ int twl6040_set_pll(struct twl6040 *twl6040, enum twl6040_pll_id id,
315 hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL); 315 hppllctl = twl6040_reg_read(twl6040, TWL6040_REG_HPPLLCTL);
316 lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL); 316 lppllctl = twl6040_reg_read(twl6040, TWL6040_REG_LPPLLCTL);
317 317
318 switch (id) { 318 switch (pll_id) {
319 case TWL6040_LPPLL_ID: 319 case TWL6040_SYSCLK_SEL_LPPLL:
320 /* low-power PLL divider */ 320 /* low-power PLL divider */
321 switch (freq_out) { 321 switch (freq_out) {
322 case 17640000: 322 case 17640000:
@@ -352,10 +352,8 @@ int twl6040_set_pll(struct twl6040 *twl6040, enum twl6040_pll_id id,
352 ret = -EINVAL; 352 ret = -EINVAL;
353 goto pll_out; 353 goto pll_out;
354 } 354 }
355
356 twl6040->pll = TWL6040_LPPLL_ID;
357 break; 355 break;
358 case TWL6040_HPPLL_ID: 356 case TWL6040_SYSCLK_SEL_HPPLL:
359 /* high-performance PLL can provide only 19.2 MHz */ 357 /* high-performance PLL can provide only 19.2 MHz */
360 if (freq_out != 19200000) { 358 if (freq_out != 19200000) {
361 dev_err(&twl6040_dev->dev, 359 dev_err(&twl6040_dev->dev,
@@ -406,16 +404,15 @@ int twl6040_set_pll(struct twl6040 *twl6040, enum twl6040_pll_id id,
406 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); 404 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl);
407 lppllctl &= ~TWL6040_LPLLENA; 405 lppllctl &= ~TWL6040_LPLLENA;
408 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl); 406 twl6040_reg_write(twl6040, TWL6040_REG_LPPLLCTL, lppllctl);
409
410 twl6040->pll = TWL6040_HPPLL_ID;
411 break; 407 break;
412 default: 408 default:
413 dev_err(&twl6040_dev->dev, "unknown pll id %d\n", id); 409 dev_err(&twl6040_dev->dev, "unknown pll id %d\n", pll_id);
414 ret = -EINVAL; 410 ret = -EINVAL;
415 goto pll_out; 411 goto pll_out;
416 } 412 }
417 413
418 twl6040->sysclk = freq_out; 414 twl6040->sysclk = freq_out;
415 twl6040->pll = pll_id;
419 416
420pll_out: 417pll_out:
421 mutex_unlock(&twl6040->mutex); 418 mutex_unlock(&twl6040->mutex);
@@ -423,9 +420,12 @@ pll_out:
423} 420}
424EXPORT_SYMBOL(twl6040_set_pll); 421EXPORT_SYMBOL(twl6040_set_pll);
425 422
426enum twl6040_pll_id twl6040_get_pll(struct twl6040 *twl6040) 423int twl6040_get_pll(struct twl6040 *twl6040)
427{ 424{
428 return twl6040->pll; 425 if (twl6040->power_count)
426 return twl6040->pll;
427 else
428 return -ENODEV;
429} 429}
430EXPORT_SYMBOL(twl6040_get_pll); 430EXPORT_SYMBOL(twl6040_get_pll);
431 431