Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329971
b: refs/heads/master
c: 2275c54
h: refs/heads/master
i:
  329969: 42a3019
  329967: 11693b8
v: v3
  • Loading branch information
Peter Ujfalusi authored and Samuel Ortiz committed Sep 18, 2012
1 parent c9e573f commit c9be862
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cdf4b67099ee8e038178a9e7d83c1aa16618c1ca
refs/heads/master: 2275c544cb824b469a386e411cbcaa01a19d4f55
32 changes: 32 additions & 0 deletions trunk/drivers/mfd/twl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,38 @@ int twl_get_version(void)
}
EXPORT_SYMBOL_GPL(twl_get_version);

/**
* twl_get_hfclk_rate - API to get TWL external HFCLK clock rate.
*
* Api to get the TWL HFCLK rate based on BOOT_CFG register.
*/
int twl_get_hfclk_rate(void)
{
u8 ctrl;
int rate;

twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &ctrl, R_CFG_BOOT);

switch (ctrl & 0x3) {
case HFCLK_FREQ_19p2_MHZ:
rate = 19200000;
break;
case HFCLK_FREQ_26_MHZ:
rate = 26000000;
break;
case HFCLK_FREQ_38p4_MHZ:
rate = 38400000;
break;
default:
pr_err("TWL4030: HFCLK is not configured\n");
rate = -EINVAL;
break;
}

return rate;
}
EXPORT_SYMBOL_GPL(twl_get_hfclk_rate);

static struct device *
add_numbered_child(unsigned chip, const char *name, int num,
void *pdata, unsigned pdata_len,
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/i2c/twl.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);

int twl_get_type(void);
int twl_get_version(void);
int twl_get_hfclk_rate(void);

int twl6030_interrupt_unmask(u8 bit_mask, u8 offset);
int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
Expand Down

0 comments on commit c9be862

Please sign in to comment.