forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is yet another simple but odd driver for the audio block of the g12a and sm1 SoC families. For TDMOUT's sclk to be properly inverted, bit 29 of AUDIO_CLK_TDMOUT_x_CTRL should be the inverse of bit 28. IOW bit28 == !bit29 at all times This setting is automatically applied on axg and the manual setting was added on g12a. Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,62 @@ const struct clk_ops meson_clk_triphase_ops = { | |
}; | ||
EXPORT_SYMBOL_GPL(meson_clk_triphase_ops); | ||
|
||
/* | ||
* This is a special clock for the audio controller. | ||
* This drive a bit clock inverter for which the | ||
* opposite value of the inverter bit needs to be manually | ||
* set into another bit | ||
*/ | ||
static inline struct meson_sclk_ws_inv_data * | ||
meson_sclk_ws_inv_data(struct clk_regmap *clk) | ||
{ | ||
return (struct meson_sclk_ws_inv_data *)clk->data; | ||
} | ||
|
||
static int meson_sclk_ws_inv_sync(struct clk_hw *hw) | ||
{ | ||
struct clk_regmap *clk = to_clk_regmap(hw); | ||
struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); | ||
unsigned int val; | ||
|
||
/* Get phase and sync the inverted value to ws */ | ||
val = meson_parm_read(clk->map, &tph->ph); | ||
meson_parm_write(clk->map, &tph->ws, val ? 0 : 1); | ||
|
||
return 0; | ||
} | ||
|
||
static int meson_sclk_ws_inv_get_phase(struct clk_hw *hw) | ||
{ | ||
struct clk_regmap *clk = to_clk_regmap(hw); | ||
struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); | ||
unsigned int val; | ||
|
||
val = meson_parm_read(clk->map, &tph->ph); | ||
|
||
return meson_clk_degrees_from_val(val, tph->ph.width); | ||
} | ||
|
||
static int meson_sclk_ws_inv_set_phase(struct clk_hw *hw, int degrees) | ||
{ | ||
struct clk_regmap *clk = to_clk_regmap(hw); | ||
struct meson_sclk_ws_inv_data *tph = meson_sclk_ws_inv_data(clk); | ||
unsigned int val; | ||
|
||
val = meson_clk_degrees_to_val(degrees, tph->ph.width); | ||
meson_parm_write(clk->map, &tph->ph, val); | ||
meson_parm_write(clk->map, &tph->ws, val ? 0 : 1); | ||
return 0; | ||
} | ||
|
||
const struct clk_ops meson_sclk_ws_inv_ops = { | ||
.init = meson_sclk_ws_inv_sync, | ||
.get_phase = meson_sclk_ws_inv_get_phase, | ||
.set_phase = meson_sclk_ws_inv_set_phase, | ||
}; | ||
EXPORT_SYMBOL_GPL(meson_sclk_ws_inv_ops); | ||
|
||
|
||
MODULE_DESCRIPTION("Amlogic phase driver"); | ||
MODULE_AUTHOR("Jerome Brunet <[email protected]>"); | ||
MODULE_LICENSE("GPL v2"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters