Commit 5eed6fe3 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/ads117x',...

Merge remote-tracking branches 'asoc/topic/adav80x', 'asoc/topic/ads117x', 'asoc/topic/ak4104', 'asoc/topic/ak4458' and 'asoc/topic/ak4535' into asoc-next
AK4458 audio DAC
This device supports I2C mode.
Required properties:
- compatible : "asahi-kasei,ak4458"
- reg : The I2C address of the device for I2C
Optional properties:
- reset-gpios: A GPIO specifier for the power down & reset pin
- mute-gpios: A GPIO specifier for the soft mute pin
Example:
&i2c {
ak4458: dac@10 {
compatible = "asahi-kasei,ak4458";
reg = <0x10>;
reset-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>
mute-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>
};
};
...@@ -35,6 +35,7 @@ config SND_SOC_ALL_CODECS ...@@ -35,6 +35,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_ADAU7002 select SND_SOC_ADAU7002
select SND_SOC_ADS117X select SND_SOC_ADS117X
select SND_SOC_AK4104 if SPI_MASTER select SND_SOC_AK4104 if SPI_MASTER
select SND_SOC_AK4458 if I2C
select SND_SOC_AK4535 if I2C select SND_SOC_AK4535 if I2C
select SND_SOC_AK4554 select SND_SOC_AK4554
select SND_SOC_AK4613 if I2C select SND_SOC_AK4613 if I2C
...@@ -376,6 +377,11 @@ config SND_SOC_AK4104 ...@@ -376,6 +377,11 @@ config SND_SOC_AK4104
tristate "AKM AK4104 CODEC" tristate "AKM AK4104 CODEC"
depends on SPI_MASTER depends on SPI_MASTER
config SND_SOC_AK4458
tristate "AKM AK4458 CODEC"
depends on I2C
select REGMAP_I2C
config SND_SOC_AK4535 config SND_SOC_AK4535
tristate tristate
......
...@@ -27,6 +27,7 @@ snd-soc-adav801-objs := adav801.o ...@@ -27,6 +27,7 @@ snd-soc-adav801-objs := adav801.o
snd-soc-adav803-objs := adav803.o snd-soc-adav803-objs := adav803.o
snd-soc-ads117x-objs := ads117x.o snd-soc-ads117x-objs := ads117x.o
snd-soc-ak4104-objs := ak4104.o snd-soc-ak4104-objs := ak4104.o
snd-soc-ak4458-objs := ak4458.o
snd-soc-ak4535-objs := ak4535.o snd-soc-ak4535-objs := ak4535.o
snd-soc-ak4554-objs := ak4554.o snd-soc-ak4554-objs := ak4554.o
snd-soc-ak4613-objs := ak4613.o snd-soc-ak4613-objs := ak4613.o
...@@ -272,6 +273,7 @@ obj-$(CONFIG_SND_SOC_ADAV801) += snd-soc-adav801.o ...@@ -272,6 +273,7 @@ obj-$(CONFIG_SND_SOC_ADAV801) += snd-soc-adav801.o
obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o
obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o obj-$(CONFIG_SND_SOC_ADS117X) += snd-soc-ads117x.o
obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o obj-$(CONFIG_SND_SOC_AK4104) += snd-soc-ak4104.o
obj-$(CONFIG_SND_SOC_AK4458) += snd-soc-ak4458.o
obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o obj-$(CONFIG_SND_SOC_AK4535) += snd-soc-ak4535.o
obj-$(CONFIG_SND_SOC_AK4554) += snd-soc-ak4554.o obj-$(CONFIG_SND_SOC_AK4554) += snd-soc-ak4554.o
obj-$(CONFIG_SND_SOC_AK4613) += snd-soc-ak4613.o obj-$(CONFIG_SND_SOC_AK4613) += snd-soc-ak4613.o
......
...@@ -30,18 +30,11 @@ static int adav80x_spi_probe(struct spi_device *spi) ...@@ -30,18 +30,11 @@ static int adav80x_spi_probe(struct spi_device *spi)
return adav80x_bus_probe(&spi->dev, devm_regmap_init_spi(spi, &config)); return adav80x_bus_probe(&spi->dev, devm_regmap_init_spi(spi, &config));
} }
static int adav80x_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static struct spi_driver adav80x_spi_driver = { static struct spi_driver adav80x_spi_driver = {
.driver = { .driver = {
.name = "adav801", .name = "adav801",
}, },
.probe = adav80x_spi_probe, .probe = adav80x_spi_probe,
.remove = adav80x_spi_remove,
.id_table = adav80x_spi_id, .id_table = adav80x_spi_id,
}; };
module_spi_driver(adav80x_spi_driver); module_spi_driver(adav80x_spi_driver);
......
...@@ -27,18 +27,11 @@ static int adav803_probe(struct i2c_client *client, ...@@ -27,18 +27,11 @@ static int adav803_probe(struct i2c_client *client,
devm_regmap_init_i2c(client, &adav80x_regmap_config)); devm_regmap_init_i2c(client, &adav80x_regmap_config));
} }
static int adav803_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static struct i2c_driver adav803_driver = { static struct i2c_driver adav803_driver = {
.driver = { .driver = {
.name = "adav803", .name = "adav803",
}, },
.probe = adav803_probe, .probe = adav803_probe,
.remove = adav803_remove,
.id_table = adav803_id, .id_table = adav803_id,
}; };
module_i2c_driver(adav803_driver); module_i2c_driver(adav803_driver);
......
This diff is collapsed.
...@@ -58,25 +58,21 @@ static struct snd_soc_dai_driver ads117x_dai = { ...@@ -58,25 +58,21 @@ static struct snd_soc_dai_driver ads117x_dai = {
.formats = ADS117X_FORMATS,}, .formats = ADS117X_FORMATS,},
}; };
static const struct snd_soc_codec_driver soc_codec_dev_ads117x = { static const struct snd_soc_component_driver soc_component_dev_ads117x = {
.component_driver = { .dapm_widgets = ads117x_dapm_widgets,
.dapm_widgets = ads117x_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ads117x_dapm_widgets),
.num_dapm_widgets = ARRAY_SIZE(ads117x_dapm_widgets), .dapm_routes = ads117x_dapm_routes,
.dapm_routes = ads117x_dapm_routes, .num_dapm_routes = ARRAY_SIZE(ads117x_dapm_routes),
.num_dapm_routes = ARRAY_SIZE(ads117x_dapm_routes), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int ads117x_probe(struct platform_device *pdev) static int ads117x_probe(struct platform_device *pdev)
{ {
return snd_soc_register_codec(&pdev->dev, return devm_snd_soc_register_component(&pdev->dev,
&soc_codec_dev_ads117x, &ads117x_dai, 1); &soc_component_dev_ads117x, &ads117x_dai, 1);
}
static int ads117x_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
} }
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
...@@ -95,7 +91,6 @@ static struct platform_driver ads117x_codec_driver = { ...@@ -95,7 +91,6 @@ static struct platform_driver ads117x_codec_driver = {
}, },
.probe = ads117x_probe, .probe = ads117x_probe,
.remove = ads117x_remove,
}; };
module_platform_driver(ads117x_codec_driver); module_platform_driver(ads117x_codec_driver);
......
...@@ -65,8 +65,8 @@ static const struct snd_soc_dapm_route ak4104_dapm_routes[] = { ...@@ -65,8 +65,8 @@ static const struct snd_soc_dapm_route ak4104_dapm_routes[] = {
static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format) unsigned int format)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int val = 0; int val = 0;
int ret; int ret;
...@@ -81,7 +81,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -81,7 +81,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
val |= AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1; val |= AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1;
break; break;
default: default:
dev_err(codec->dev, "invalid dai format\n"); dev_err(component->dev, "invalid dai format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -102,8 +102,8 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -102,8 +102,8 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int ret, val = 0; int ret, val = 0;
/* set the IEC958 bits: consumer mode, no copyright bit */ /* set the IEC958 bits: consumer mode, no copyright bit */
...@@ -141,7 +141,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -141,7 +141,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
val |= IEC958_AES3_CON_FS_192000; val |= IEC958_AES3_CON_FS_192000;
break; break;
default: default:
dev_err(codec->dev, "unsupported sampling rate\n"); dev_err(component->dev, "unsupported sampling rate\n");
return -EINVAL; return -EINVAL;
} }
...@@ -174,14 +174,14 @@ static struct snd_soc_dai_driver ak4104_dai = { ...@@ -174,14 +174,14 @@ static struct snd_soc_dai_driver ak4104_dai = {
.ops = &ak4101_dai_ops, .ops = &ak4101_dai_ops,
}; };
static int ak4104_probe(struct snd_soc_codec *codec) static int ak4104_probe(struct snd_soc_component *component)
{ {
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regulator_enable(ak4104->regulator); ret = regulator_enable(ak4104->regulator);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Unable to enable regulator: %d\n", ret); dev_err(component->dev, "Unable to enable regulator: %d\n", ret);
return ret; return ret;
} }
...@@ -205,30 +205,28 @@ static int ak4104_probe(struct snd_soc_codec *codec) ...@@ -205,30 +205,28 @@ static int ak4104_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
static int ak4104_remove(struct snd_soc_codec *codec) static void ak4104_remove(struct snd_soc_component *component)
{ {
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1, regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1,
AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0); AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0);
regulator_disable(ak4104->regulator); regulator_disable(ak4104->regulator);
return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ak4104_soc_suspend(struct snd_soc_codec *codec) static int ak4104_soc_suspend(struct snd_soc_component *component)
{ {
struct ak4104_private *priv = snd_soc_codec_get_drvdata(codec); struct ak4104_private *priv = snd_soc_component_get_drvdata(component);
regulator_disable(priv->regulator); regulator_disable(priv->regulator);
return 0; return 0;
} }
static int ak4104_soc_resume(struct snd_soc_codec *codec) static int ak4104_soc_resume(struct snd_soc_component *component)
{ {
struct ak4104_private *priv = snd_soc_codec_get_drvdata(codec); struct ak4104_private *priv = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regulator_enable(priv->regulator); ret = regulator_enable(priv->regulator);
...@@ -242,18 +240,19 @@ static int ak4104_soc_resume(struct snd_soc_codec *codec) ...@@ -242,18 +240,19 @@ static int ak4104_soc_resume(struct snd_soc_codec *codec)
#define ak4104_soc_resume NULL #define ak4104_soc_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static const struct snd_soc_codec_driver soc_codec_device_ak4104 = { static const struct snd_soc_component_driver soc_component_device_ak4104 = {
.probe = ak4104_probe, .probe = ak4104_probe,
.remove = ak4104_remove, .remove = ak4104_remove,
.suspend = ak4104_soc_suspend, .suspend = ak4104_soc_suspend,
.resume = ak4104_soc_resume, .resume = ak4104_soc_resume,
.dapm_widgets = ak4104_dapm_widgets,
.component_driver = { .num_dapm_widgets = ARRAY_SIZE(ak4104_dapm_widgets),
.dapm_widgets = ak4104_dapm_widgets, .dapm_routes = ak4104_dapm_routes,
.num_dapm_widgets = ARRAY_SIZE(ak4104_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(ak4104_dapm_routes),
.dapm_routes = ak4104_dapm_routes, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(ak4104_dapm_routes), .use_pmdown_time = 1,
} .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config ak4104_regmap = { static const struct regmap_config ak4104_regmap = {
...@@ -323,17 +322,11 @@ static int ak4104_spi_probe(struct spi_device *spi) ...@@ -323,17 +322,11 @@ static int ak4104_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, ak4104); spi_set_drvdata(spi, ak4104);
ret = snd_soc_register_codec(&spi->dev, ret = devm_snd_soc_register_component(&spi->dev,
&soc_codec_device_ak4104, &ak4104_dai, 1); &soc_component_device_ak4104, &ak4104_dai, 1);
return ret; return ret;
} }
static int ak4104_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static const struct of_device_id ak4104_of_match[] = { static const struct of_device_id ak4104_of_match[] = {
{ .compatible = "asahi-kasei,ak4104", }, { .compatible = "asahi-kasei,ak4104", },
{ } { }
...@@ -353,7 +346,6 @@ static struct spi_driver ak4104_spi_driver = { ...@@ -353,7 +346,6 @@ static struct spi_driver ak4104_spi_driver = {
}, },
.id_table = ak4104_id_table, .id_table = ak4104_id_table,
.probe = ak4104_spi_probe, .probe = ak4104_spi_probe,
.remove = ak4104_spi_remove,
}; };
module_spi_driver(ak4104_spi_driver); module_spi_driver(ak4104_spi_driver);
......
This diff is collapsed.
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Audio driver for AK4458
*
* Copyright (C) 2016 Asahi Kasei Microdevices Corporation
* Copyright 2018 NXP
*/
#ifndef _AK4458_H
#define _AK4458_H
#include <linux/regmap.h>
/* Settings */
#define AK4458_00_CONTROL1 0x00
#define AK4458_01_CONTROL2 0x01
#define AK4458_02_CONTROL3 0x02
#define AK4458_03_LCHATT 0x03
#define AK4458_04_RCHATT 0x04
#define AK4458_05_CONTROL4 0x05
#define AK4458_06_DSD1 0x06
#define AK4458_07_CONTROL5 0x07
#define AK4458_08_SOUND_CONTROL 0x08
#define AK4458_09_DSD2 0x09
#define AK4458_0A_CONTROL6 0x0A
#define AK4458_0B_CONTROL7 0x0B
#define AK4458_0C_CONTROL8 0x0C
#define AK4458_0D_CONTROL9 0x0D
#define AK4458_0E_CONTROL10 0x0E
#define AK4458_0F_L2CHATT 0x0F
#define AK4458_10_R2CHATT 0x10
#define AK4458_11_L3CHATT 0x11
#define AK4458_12_R3CHATT 0x12
#define AK4458_13_L4CHATT 0x13
#define AK4458_14_R4CHATT 0x14
/* Bitfield Definitions */
/* AK4458_00_CONTROL1 (0x00) Fields
* Addr Register Name D7 D6 D5 D4 D3 D2 D1 D0
* 00H Control 1 ACKS 0 0 0 DIF2 DIF1 DIF0 RSTN
*/
/* Digital Filter (SD, SLOW, SSLOW) */
#define AK4458_SD_MASK GENMASK(5, 5)
#define AK4458_SLOW_MASK GENMASK(0, 0)
#define AK4458_SSLOW_MASK GENMASK(0, 0)
/* DIF2 1 0
* x 1 0 MSB justified Figure 3 (default)
* x 1 1 I2S Compliment Figure 4
*/
#define AK4458_DIF_SHIFT 1
#define AK4458_DIF_MASK GENMASK(3, 1)
#define AK4458_DIF_16BIT_LSB (0 << 1)
#define AK4458_DIF_24BIT_I2S (3 << 1)
#define AK4458_DIF_32BIT_LSB (5 << 1)
#define AK4458_DIF_32BIT_MSB (6 << 1)
#define AK4458_DIF_32BIT_I2S (7 << 1)
/* AK4458_00_CONTROL1 (0x00) D0 bit */
#define AK4458_RSTN_MASK GENMASK(0, 0)
#define AK4458_RSTN (0x1 << 0)
/* AK4458_0A_CONTROL6 Mode bits */
#define AK4458_MODE_SHIFT 6
#define AK4458_MODE_MASK GENMASK(7, 6)
#define AK4458_MODE_NORMAL (0 << AK4458_MODE_SHIFT)
#define AK4458_MODE_TDM128 (1 << AK4458_MODE_SHIFT)
#define AK4458_MODE_TDM256 (2 << AK4458_MODE_SHIFT)
#define AK4458_MODE_TDM512 (3 << AK4458_MODE_SHIFT)
/* DAC Digital attenuator transition time setting
* Table 19
* Mode ATS1 ATS2 ATT speed
* 0 0 0 4080/fs
* 1 0 1 2040/fs
* 2 1 0 510/fs
* 3 1 1 255/fs
* */
#define AK4458_ATS_SHIFT 6
#define AK4458_ATS_MASK GENMASK(7, 6)
#endif /* _AK4458_H */
...@@ -251,8 +251,8 @@ static const struct snd_soc_dapm_route ak4535_audio_map[] = { ...@@ -251,8 +251,8 @@ static const struct snd_soc_dapm_route ak4535_audio_map[] = {
static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int ak4535_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); struct ak4535_priv *ak4535 = snd_soc_component_get_drvdata(component);
ak4535->sysclk = freq; ak4535->sysclk = freq;
return 0; return 0;
...@@ -262,9 +262,9 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream, ...@@ -262,9 +262,9 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ak4535_priv *ak4535 = snd_soc_codec_get_drvdata(codec); struct ak4535_priv *ak4535 = snd_soc_component_get_drvdata(component);
u8 mode2 = snd_soc_read(codec, AK4535_MODE2) & ~(0x3 << 5); u8 mode2 = snd_soc_component_read32(component, AK4535_MODE2) & ~(0x3 << 5);
int rate = params_rate(params), fs = 256; int rate = params_rate(params), fs = 256;
if (rate) if (rate)
...@@ -283,14 +283,14 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream, ...@@ -283,14 +283,14 @@ static int ak4535_hw_params(struct snd_pcm_substream *substream,
} }
/* set rate */ /* set rate */
snd_soc_write(codec, AK4535_MODE2, mode2); snd_soc_component_write(component, AK4535_MODE2, mode2);
return 0; return 0;
} }
static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
u8 mode1 = 0; u8 mode1 = 0;
/* interface format */ /* interface format */
...@@ -308,37 +308,37 @@ static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -308,37 +308,37 @@ static int ak4535_set_dai_fmt(struct snd_soc_dai *codec_dai,
/* use 32 fs for BCLK to save power */ /* use 32 fs for BCLK to save power */
mode1 |= 0x4; mode1 |= 0x4;
snd_soc_write(codec, AK4535_MODE1, mode1); snd_soc_component_write(component, AK4535_MODE1, mode1);
return 0; return 0;
} }
static int ak4535_mute(struct snd_soc_dai *dai, int mute) static int ak4535_mute(struct snd_soc_dai *dai, int mute)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
u16 mute_reg = snd_soc_read(codec, AK4535_DAC); u16 mute_reg = snd_soc_component_read32(component, AK4535_DAC);
if (!mute) if (!mute)
snd_soc_write(codec, AK4535_DAC, mute_reg & ~0x20); snd_soc_component_write(component, AK4535_DAC, mute_reg & ~0x20);
else else
snd_soc_write(codec, AK4535_DAC, mute_reg | 0x20); snd_soc_component_write(component, AK4535_DAC, mute_reg | 0x20);
return 0; return 0;
} }
static int ak4535_set_bias_level(struct snd_soc_codec *codec, static int ak4535_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
snd_soc_update_bits(codec, AK4535_DAC, 0x20, 0); snd_soc_component_update_bits(component, AK4535_DAC, 0x20, 0);
break; break;
case SND_SOC_BIAS_PREPARE: case SND_SOC_BIAS_PREPARE:
snd_soc_update_bits(codec, AK4535_DAC, 0x20, 0x20); snd_soc_component_update_bits(component, AK4535_DAC, 0x20, 0x20);
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0x80); snd_soc_component_update_bits(component, AK4535_PM1, 0x80, 0x80);
snd_soc_update_bits(codec, AK4535_PM2, 0x80, 0); snd_soc_component_update_bits(component, AK4535_PM2, 0x80, 0);
break; break;
case SND_SOC_BIAS_OFF: case SND_SOC_BIAS_OFF:
snd_soc_update_bits(codec, AK4535_PM1, 0x80, 0); snd_soc_component_update_bits(component, AK4535_PM1, 0x80, 0);
break; break;
} }
return 0; return 0;
...@@ -372,9 +372,9 @@ static struct snd_soc_dai_driver ak4535_dai = { ...@@ -372,9 +372,9 @@ static struct snd_soc_dai_driver ak4535_dai = {
.ops = &ak4535_dai_ops, .ops = &ak4535_dai_ops,
}; };
static int ak4535_resume(struct snd_soc_codec *codec) static int ak4535_resume(struct snd_soc_component *component)
{ {
snd_soc_cache_sync(codec); snd_soc_component_cache_sync(component);
return 0; return 0;
} }
...@@ -390,19 +390,20 @@ static const struct regmap_config ak4535_regmap = { ...@@ -390,19 +390,20 @@ static const struct regmap_config ak4535_regmap = {
.num_reg_defaults = ARRAY_SIZE(ak4535_reg_defaults), .num_reg_defaults = ARRAY_SIZE(ak4535_reg_defaults),
}; };
static const struct snd_soc_codec_driver soc_codec_dev_ak4535 = { static const struct snd_soc_component_driver soc_component_dev_ak4535 = {
.resume = ak4535_resume, .resume = ak4535_resume,
.set_bias_level = ak4535_set_bias_level, .set_bias_level = ak4535_set_bias_level,
.suspend_bias_off = true, .controls = ak4535_snd_controls,
.num_controls = ARRAY_SIZE(ak4535_snd_controls),
.component_driver = { .dapm_widgets = ak4535_dapm_widgets,
.controls = ak4535_snd_controls, .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
.num_controls = ARRAY_SIZE(ak4535_snd_controls), .dapm_routes = ak4535_audio_map,
.dapm_widgets = ak4535_dapm_widgets, .num_dapm_routes = ARRAY_SIZE(ak4535_audio_map),
.num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), .suspend_bias_off = 1,
.dapm_routes = ak4535_audio_map, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(ak4535_audio_map), .use_pmdown_time = 1,
}, .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static int ak4535_i2c_probe(struct i2c_client *i2c, static int ak4535_i2c_probe(struct i2c_client *i2c,
...@@ -425,18 +426,12 @@ static int ak4535_i2c_probe(struct i2c_client *i2c, ...@@ -425,18 +426,12 @@ static int ak4535_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, ak4535); i2c_set_clientdata(i2c, ak4535);
ret = snd_soc_register_codec(&i2c->dev, ret = devm_snd_soc_register_component(&i2c->dev,
&soc_codec_dev_ak4535, &ak4535_dai, 1); &soc_component_dev_ak4535, &ak4535_dai, 1);
return ret; return ret;
} }
static int ak4535_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id ak4535_i2c_id[] = { static const struct i2c_device_id ak4535_i2c_id[] = {
{ "ak4535", 0 }, { "ak4535", 0 },
{ } { }
...@@ -448,7 +443,6 @@ static struct i2c_driver ak4535_i2c_driver = { ...@@ -448,7 +443,6 @@ static struct i2c_driver ak4535_i2c_driver = {
.name = "ak4535", .name = "ak4535",
}, },
.probe = ak4535_i2c_probe, .probe = ak4535_i2c_probe,
.remove = ak4535_i2c_remove,
.id_table = ak4535_i2c_id, .id_table = ak4535_i2c_id,
}; };
......
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