Commit a486f183 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/ak4642',...

Merge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/ak4642', 'asoc/topic/ak5386' and 'asoc/topic/arizona' into asoc-next
...@@ -10,10 +10,14 @@ Optional properties: ...@@ -10,10 +10,14 @@ Optional properties:
- reset-gpio : a GPIO spec for the reset/power down pin. - reset-gpio : a GPIO spec for the reset/power down pin.
If specified, it will be deasserted at probe time. If specified, it will be deasserted at probe time.
- va-supply : a regulator spec, providing 5.0V
- vd-supply : a regulator spec, providing 3.3V
Example: Example:
spdif: ak5386@0 { spdif: ak5386@0 {
compatible = "asahi-kasei,ak5386"; compatible = "asahi-kasei,ak5386";
reset-gpio = <&gpio0 23>; reset-gpio = <&gpio0 23>;
va-supply = <&vdd_5v0_reg>;
vd-supply = <&vdd_3v3_reg>;
}; };
...@@ -110,6 +110,12 @@ struct arizona { ...@@ -110,6 +110,12 @@ struct arizona {
int clk32k_ref; int clk32k_ref;
struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_context *dapm;
int tdm_width[ARIZONA_MAX_AIF];
int tdm_slots[ARIZONA_MAX_AIF];
uint16_t dac_comp_coeff;
uint8_t dac_comp_enabled;
}; };
int arizona_clk32k_enable(struct arizona *arizona); int arizona_clk32k_enable(struct arizona *arizona);
......
...@@ -968,7 +968,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap, ...@@ -968,7 +968,7 @@ int adau1977_probe(struct device *dev, struct regmap *regmap,
if (adau1977->dvdd_reg) if (adau1977->dvdd_reg)
power_off_mask = ~0; power_off_mask = ~0;
else else
power_off_mask = ~ADAU1977_BLOCK_POWER_SAI_LDO_EN; power_off_mask = (unsigned int)~ADAU1977_BLOCK_POWER_SAI_LDO_EN;
ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI, ret = regmap_update_bits(adau1977->regmap, ADAU1977_REG_BLOCK_POWER_SAI,
power_off_mask, 0x00); power_off_mask, 0x00);
......
...@@ -547,7 +547,7 @@ static const struct ak4642_drvdata ak4648_drvdata = { ...@@ -547,7 +547,7 @@ static const struct ak4642_drvdata ak4648_drvdata = {
.extended_frequencies = 1, .extended_frequencies = 1,
}; };
static struct of_device_id ak4642_of_match[]; static const struct of_device_id ak4642_of_match[];
static int ak4642_i2c_probe(struct i2c_client *i2c, static int ak4642_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -593,7 +593,7 @@ static int ak4642_i2c_remove(struct i2c_client *client) ...@@ -593,7 +593,7 @@ static int ak4642_i2c_remove(struct i2c_client *client)
return 0; return 0;
} }
static struct of_device_id ak4642_of_match[] = { static const struct of_device_id ak4642_of_match[] = {
{ .compatible = "asahi-kasei,ak4642", .data = &ak4642_drvdata}, { .compatible = "asahi-kasei,ak4642", .data = &ak4642_drvdata},
{ .compatible = "asahi-kasei,ak4643", .data = &ak4643_drvdata}, { .compatible = "asahi-kasei,ak4643", .data = &ak4643_drvdata},
{ .compatible = "asahi-kasei,ak4648", .data = &ak4648_drvdata}, { .compatible = "asahi-kasei,ak4648", .data = &ak4648_drvdata},
......
...@@ -14,12 +14,18 @@ ...@@ -14,12 +14,18 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/regulator/consumer.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/initval.h> #include <sound/initval.h>
static const char * const supply_names[] = {
"va", "vd"
};
struct ak5386_priv { struct ak5386_priv {
int reset_gpio; int reset_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)];
}; };
static const struct snd_soc_dapm_widget ak5386_dapm_widgets[] = { static const struct snd_soc_dapm_widget ak5386_dapm_widgets[] = {
...@@ -32,7 +38,42 @@ static const struct snd_soc_dapm_route ak5386_dapm_routes[] = { ...@@ -32,7 +38,42 @@ static const struct snd_soc_dapm_route ak5386_dapm_routes[] = {
{ "Capture", NULL, "AINR" }, { "Capture", NULL, "AINR" },
}; };
static int ak5386_soc_probe(struct snd_soc_codec *codec)
{
struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec);
return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
}
static int ak5386_soc_remove(struct snd_soc_codec *codec)
{
struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec);
regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
return 0;
}
#ifdef CONFIG_PM
static int ak5386_soc_suspend(struct snd_soc_codec *codec)
{
struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec);
regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies);
return 0;
}
static int ak5386_soc_resume(struct snd_soc_codec *codec)
{
struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec);
return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies);
}
#else
#define ak5386_soc_suspend NULL
#define ak5386_soc_resume NULL
#endif /* CONFIG_PM */
static struct snd_soc_codec_driver soc_codec_ak5386 = { static struct snd_soc_codec_driver soc_codec_ak5386 = {
.probe = ak5386_soc_probe,
.remove = ak5386_soc_remove,
.suspend = ak5386_soc_suspend,
.resume = ak5386_soc_resume,
.dapm_widgets = ak5386_dapm_widgets, .dapm_widgets = ak5386_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ak5386_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ak5386_dapm_widgets),
.dapm_routes = ak5386_dapm_routes, .dapm_routes = ak5386_dapm_routes,
...@@ -122,6 +163,7 @@ static int ak5386_probe(struct platform_device *pdev) ...@@ -122,6 +163,7 @@ static int ak5386_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ak5386_priv *priv; struct ak5386_priv *priv;
int ret, i;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -130,6 +172,14 @@ static int ak5386_probe(struct platform_device *pdev) ...@@ -130,6 +172,14 @@ static int ak5386_probe(struct platform_device *pdev)
priv->reset_gpio = -EINVAL; priv->reset_gpio = -EINVAL;
dev_set_drvdata(dev, priv); dev_set_drvdata(dev, priv);
for (i = 0; i < ARRAY_SIZE(supply_names); i++)
priv->supplies[i].supply = supply_names[i];
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
priv->supplies);
if (ret < 0)
return ret;
if (of_match_device(of_match_ptr(ak5386_dt_ids), dev)) if (of_match_device(of_match_ptr(ak5386_dt_ids), dev))
priv->reset_gpio = of_get_named_gpio(dev->of_node, priv->reset_gpio = of_get_named_gpio(dev->of_node,
"reset-gpio", 0); "reset-gpio", 0);
......
This diff is collapsed.
...@@ -735,8 +735,7 @@ WM5100_MIXER_CONTROLS("LHPF4", WM5100_HPLP4MIX_INPUT_1_SOURCE), ...@@ -735,8 +735,7 @@ WM5100_MIXER_CONTROLS("LHPF4", WM5100_HPLP4MIX_INPUT_1_SOURCE),
static void wm5100_seq_notifier(struct snd_soc_dapm_context *dapm, static void wm5100_seq_notifier(struct snd_soc_dapm_context *dapm,
enum snd_soc_dapm_type event, int subseq) enum snd_soc_dapm_type event, int subseq)
{ {
struct snd_soc_codec *codec = container_of(dapm, struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
struct snd_soc_codec, dapm);
struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
u16 val, expect, i; u16 val, expect, i;
......
...@@ -612,6 +612,62 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, ...@@ -612,6 +612,62 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
return 0; return 0;
} }
static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
uint16_t data;
mutex_lock(&codec->mutex);
data = cpu_to_be16(arizona->dac_comp_coeff);
memcpy(ucontrol->value.bytes.data, &data, sizeof(data));
mutex_unlock(&codec->mutex);
return 0;
}
static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
mutex_lock(&codec->mutex);
memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
sizeof(arizona->dac_comp_coeff));
arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff);
mutex_unlock(&codec->mutex);
return 0;
}
static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
mutex_lock(&codec->mutex);
ucontrol->value.integer.value[0] = arizona->dac_comp_enabled;
mutex_unlock(&codec->mutex);
return 0;
}
static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
mutex_lock(&codec->mutex);
arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
mutex_unlock(&codec->mutex);
return 0;
}
static const char *wm5102_osr_text[] = { static const char *wm5102_osr_text[] = {
"Low power", "Normal", "High performance", "Low power", "Normal", "High performance",
}; };
...@@ -843,6 +899,12 @@ SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL, ...@@ -843,6 +899,12 @@ SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv), ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
SOC_ENUM("Noise Gate Hold", arizona_ng_hold), SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
SND_SOC_BYTES_EXT("Output Compensation Coefficient", 2,
wm5102_out_comp_coeff_get, wm5102_out_comp_coeff_put),
SOC_SINGLE_EXT("Output Compensation Switch", 0, 0, 1, 0,
wm5102_out_comp_switch_get, wm5102_out_comp_switch_put),
WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L), WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R), WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
WM5102_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L), WM5102_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
......
...@@ -281,8 +281,7 @@ static int wm8903_dcs_event(struct snd_soc_dapm_widget *w, ...@@ -281,8 +281,7 @@ static int wm8903_dcs_event(struct snd_soc_dapm_widget *w,
static void wm8903_seq_notifier(struct snd_soc_dapm_context *dapm, static void wm8903_seq_notifier(struct snd_soc_dapm_context *dapm,
enum snd_soc_dapm_type event, int subseq) enum snd_soc_dapm_type event, int subseq)
{ {
struct snd_soc_codec *codec = container_of(dapm, struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
struct snd_soc_codec, dapm);
struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
int dcs_mode = WM8903_DCS_MODE_WRITE_STOP; int dcs_mode = WM8903_DCS_MODE_WRITE_STOP;
int i, val; int i, val;
......
...@@ -690,8 +690,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask) ...@@ -690,8 +690,7 @@ static void wait_for_dc_servo(struct snd_soc_codec *codec, u16 mask)
static void wm8996_seq_notifier(struct snd_soc_dapm_context *dapm, static void wm8996_seq_notifier(struct snd_soc_dapm_context *dapm,
enum snd_soc_dapm_type event, int subseq) enum snd_soc_dapm_type event, int subseq)
{ {
struct snd_soc_codec *codec = container_of(dapm, struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
struct snd_soc_codec, dapm);
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
u16 val, mask; u16 val, mask;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment