diff options
| author | Daniel Mack <zonque@gmail.com> | 2013-06-24 10:25:32 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-06-25 05:26:49 -0400 |
| commit | 79b23b564060c5483a489562b01a6eb778a312f7 (patch) | |
| tree | 51581ce2a9ece9c6cd6ff3cf5e14e11627a6e196 | |
| parent | 18710acdeea02777ef70013465f6f7fced411096 (diff) | |
ASoC: tas5086: add support for pwm start mode config
The TAS5086 has two alternative modes to start its PWM channels, Mid-Z
and Low-Z. Which one to use depends on how the PWM power stages are
connected to the TAS5086.
This patch adds 6 optional boolean properties to the DT bindings of the
driver which allow the user to configure each individual channel to the
Mid-Z scheme, and leaves all the others to the default (Low-Z).
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
| -rw-r--r-- | Documentation/devicetree/bindings/sound/ti,tas5086.txt | 11 | ||||
| -rw-r--r-- | sound/soc/codecs/tas5086.c | 22 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/ti,tas5086.txt b/Documentation/devicetree/bindings/sound/ti,tas5086.txt index 8ea4f5b4818d..d2866a0d6a26 100644 --- a/Documentation/devicetree/bindings/sound/ti,tas5086.txt +++ b/Documentation/devicetree/bindings/sound/ti,tas5086.txt | |||
| @@ -20,6 +20,17 @@ Optional properties: | |||
| 20 | When not specified, the hardware default of 1300ms | 20 | When not specified, the hardware default of 1300ms |
| 21 | is retained. | 21 | is retained. |
| 22 | 22 | ||
| 23 | - ti,mid-z-channel-X: Boolean properties, X being a number from 1 to 6. | ||
| 24 | If given, channel X will start with the Mid-Z start | ||
| 25 | sequence, otherwise the default Low-Z scheme is used. | ||
| 26 | |||
| 27 | The correct configuration depends on how the power | ||
| 28 | stages connected to the PWM output pins work. Not all | ||
| 29 | power stages are compatible to Mid-Z - please refer | ||
| 30 | to the datasheets for more details. | ||
| 31 | |||
| 32 | Most systems should not set any of these properties. | ||
| 33 | |||
| 23 | Examples: | 34 | Examples: |
| 24 | 35 | ||
| 25 | i2c_bus { | 36 | i2c_bus { |
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index bcbbec1399b8..72067f79633e 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c | |||
| @@ -88,6 +88,10 @@ | |||
| 88 | 88 | ||
| 89 | #define TAS5086_MAX_REGISTER TAS5086_PWM_OUTPUT_MUX | 89 | #define TAS5086_MAX_REGISTER TAS5086_PWM_OUTPUT_MUX |
| 90 | 90 | ||
| 91 | #define TAS5086_PWM_START_MIDZ_FOR_START_1 (1 << 7) | ||
| 92 | #define TAS5086_PWM_START_MIDZ_FOR_START_2 (1 << 6) | ||
| 93 | #define TAS5086_PWM_START_CHANNEL_MASK (0x3f) | ||
| 94 | |||
| 91 | /* | 95 | /* |
| 92 | * Default TAS5086 power-up configuration | 96 | * Default TAS5086 power-up configuration |
| 93 | */ | 97 | */ |
| @@ -717,13 +721,31 @@ static int tas5086_probe(struct snd_soc_codec *codec) | |||
| 717 | { | 721 | { |
| 718 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 722 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
| 719 | int charge_period = 1300000; /* hardware default is 1300 ms */ | 723 | int charge_period = 1300000; /* hardware default is 1300 ms */ |
| 724 | u8 pwm_start = TAS5086_PWM_START_CHANNEL_MASK; | ||
| 720 | int i, ret; | 725 | int i, ret; |
| 721 | 726 | ||
| 722 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { | 727 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { |
| 723 | struct device_node *of_node = codec->dev->of_node; | 728 | struct device_node *of_node = codec->dev->of_node; |
| 724 | of_property_read_u32(of_node, "ti,charge-period", &charge_period); | 729 | of_property_read_u32(of_node, "ti,charge-period", &charge_period); |
| 730 | |||
| 731 | for (i = 0; i < 6; i++) { | ||
| 732 | char name[25]; | ||
| 733 | |||
| 734 | snprintf(name, sizeof(name), | ||
| 735 | "ti,mid-z-channel-%d", i + 1); | ||
| 736 | |||
| 737 | if (of_get_property(of_node, name, NULL) != NULL) | ||
| 738 | pwm_start &= ~(1 << i); | ||
| 739 | } | ||
| 725 | } | 740 | } |
| 726 | 741 | ||
| 742 | /* | ||
| 743 | * Configure 'part 2' of the PWM starts to always use MID-Z, and tell | ||
| 744 | * all configured mid-z channels to start start under 'part 2'. | ||
| 745 | */ | ||
| 746 | regmap_write(priv->regmap, TAS5086_PWM_START, | ||
| 747 | TAS5086_PWM_START_MIDZ_FOR_START_2 | pwm_start); | ||
| 748 | |||
| 727 | /* lookup and set split-capacitor charge period */ | 749 | /* lookup and set split-capacitor charge period */ |
| 728 | if (charge_period == 0) { | 750 | if (charge_period == 0) { |
| 729 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); | 751 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); |
