diff options
| author | Daniel Mack <zonque@gmail.com> | 2013-10-01 08:48:24 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-10-03 09:14:36 -0400 |
| commit | 648c538204c23370c734d72921155cc24aff928d (patch) | |
| tree | f430036fe44023cfc60ad23d6e96a6902fe8762c | |
| parent | 15c03dd4859ab16f9212238f29dd315654aa94f6 (diff) | |
ASoC: tas5086: move two variables into private struct
We need to access the charge_period and start_mid_z values from other
places later, so move them to the private struct.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
| -rw-r--r-- | sound/soc/codecs/tas5086.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 6d31d88f7204..31b5868ef7c1 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c | |||
| @@ -244,6 +244,8 @@ struct tas5086_private { | |||
| 244 | unsigned int mclk, sclk; | 244 | unsigned int mclk, sclk; |
| 245 | unsigned int format; | 245 | unsigned int format; |
| 246 | bool deemph; | 246 | bool deemph; |
| 247 | unsigned int charge_period; | ||
| 248 | unsigned int pwm_start_mid_z; | ||
| 247 | /* Current sample rate for de-emphasis control */ | 249 | /* Current sample rate for de-emphasis control */ |
| 248 | int rate; | 250 | int rate; |
| 249 | /* GPIO driving Reset pin, if any */ | 251 | /* GPIO driving Reset pin, if any */ |
| @@ -720,13 +722,15 @@ static const int tas5086_charge_period[] = { | |||
| 720 | static int tas5086_probe(struct snd_soc_codec *codec) | 722 | static int tas5086_probe(struct snd_soc_codec *codec) |
| 721 | { | 723 | { |
| 722 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); | 724 | struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec); |
| 723 | int charge_period = 1300000; /* hardware default is 1300 ms */ | ||
| 724 | u8 pwm_start_mid_z = 0; | ||
| 725 | int i, ret; | 725 | int i, ret; |
| 726 | 726 | ||
| 727 | priv->pwm_start_mid_z = 0; | ||
| 728 | priv->charge_period = 1300000; /* hardware default is 1300 ms */ | ||
| 729 | |||
| 727 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { | 730 | if (of_match_device(of_match_ptr(tas5086_dt_ids), codec->dev)) { |
| 728 | struct device_node *of_node = codec->dev->of_node; | 731 | struct device_node *of_node = codec->dev->of_node; |
| 729 | of_property_read_u32(of_node, "ti,charge-period", &charge_period); | 732 | of_property_read_u32(of_node, "ti,charge-period", |
| 733 | &priv->charge_period); | ||
| 730 | 734 | ||
| 731 | for (i = 0; i < 6; i++) { | 735 | for (i = 0; i < 6; i++) { |
| 732 | char name[25]; | 736 | char name[25]; |
| @@ -735,7 +739,7 @@ static int tas5086_probe(struct snd_soc_codec *codec) | |||
| 735 | "ti,mid-z-channel-%d", i + 1); | 739 | "ti,mid-z-channel-%d", i + 1); |
| 736 | 740 | ||
| 737 | if (of_get_property(of_node, name, NULL) != NULL) | 741 | if (of_get_property(of_node, name, NULL) != NULL) |
| 738 | pwm_start_mid_z |= 1 << i; | 742 | priv->pwm_start_mid_z |= 1 << i; |
| 739 | } | 743 | } |
| 740 | } | 744 | } |
| 741 | 745 | ||
| @@ -744,25 +748,25 @@ static int tas5086_probe(struct snd_soc_codec *codec) | |||
| 744 | * configure 'part 1' of the PWM starts to use Mid-Z, and tell | 748 | * configure 'part 1' of the PWM starts to use Mid-Z, and tell |
| 745 | * all configured mid-z channels to start start under 'part 1'. | 749 | * all configured mid-z channels to start start under 'part 1'. |
| 746 | */ | 750 | */ |
| 747 | if (pwm_start_mid_z) | 751 | if (priv->pwm_start_mid_z) |
| 748 | regmap_write(priv->regmap, TAS5086_PWM_START, | 752 | regmap_write(priv->regmap, TAS5086_PWM_START, |
| 749 | TAS5086_PWM_START_MIDZ_FOR_START_1 | | 753 | TAS5086_PWM_START_MIDZ_FOR_START_1 | |
| 750 | pwm_start_mid_z); | 754 | priv->pwm_start_mid_z); |
| 751 | 755 | ||
| 752 | /* lookup and set split-capacitor charge period */ | 756 | /* lookup and set split-capacitor charge period */ |
| 753 | if (charge_period == 0) { | 757 | if (priv->charge_period == 0) { |
| 754 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); | 758 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, 0); |
| 755 | } else { | 759 | } else { |
| 756 | i = index_in_array(tas5086_charge_period, | 760 | i = index_in_array(tas5086_charge_period, |
| 757 | ARRAY_SIZE(tas5086_charge_period), | 761 | ARRAY_SIZE(tas5086_charge_period), |
| 758 | charge_period); | 762 | priv->charge_period); |
| 759 | if (i >= 0) | 763 | if (i >= 0) |
| 760 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, | 764 | regmap_write(priv->regmap, TAS5086_SPLIT_CAP_CHARGE, |
| 761 | i + 0x08); | 765 | i + 0x08); |
| 762 | else | 766 | else |
| 763 | dev_warn(codec->dev, | 767 | dev_warn(codec->dev, |
| 764 | "Invalid split-cap charge period of %d ns.\n", | 768 | "Invalid split-cap charge period of %d ns.\n", |
| 765 | charge_period); | 769 | priv->charge_period); |
| 766 | } | 770 | } |
| 767 | 771 | ||
| 768 | /* enable factory trim */ | 772 | /* enable factory trim */ |
