···11+Texas Instruments TAS5711/TAS5717/TAS5719 stereo power amplifiers22+33+The codec is controlled through an I2C interface. It also has two other44+signals that can be wired up to GPIOs: reset (strongly recommended), and55+powerdown (optional).66+77+Required properties:88+99+- compatible: "ti,tas5711", "ti,tas5717", or "ti,tas5719"1010+- reg: The I2C address of the device1111+- #sound-dai-cells: must be equal to 01212+1313+Optional properties:1414+1515+- reset-gpios: GPIO specifier for the TAS571x's active low reset line1616+- pdn-gpios: GPIO specifier for the TAS571x's active low powerdown line1717+- clocks: clock phandle for the MCLK input1818+- clock-names: should be "mclk"1919+- AVDD-supply: regulator phandle for the AVDD supply (all chips)2020+- DVDD-supply: regulator phandle for the DVDD supply (all chips)2121+- HPVDD-supply: regulator phandle for the HPVDD supply (5717/5719)2222+- PVDD_AB-supply: regulator phandle for the PVDD_AB supply (5717/5719)2323+- PVDD_CD-supply: regulator phandle for the PVDD_CD supply (5717/5719)2424+- PVDD_A-supply: regulator phandle for the PVDD_A supply (5711)2525+- PVDD_B-supply: regulator phandle for the PVDD_B supply (5711)2626+- PVDD_C-supply: regulator phandle for the PVDD_C supply (5711)2727+- PVDD_D-supply: regulator phandle for the PVDD_D supply (5711)2828+2929+Example:3030+3131+ tas5717: audio-codec@2a {3232+ compatible = "ti,tas5717";3333+ reg = <0x2a>;3434+ #sound-dai-cells = <0>;3535+3636+ reset-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;3737+ pdn-gpios = <&gpio5 2 GPIO_ACTIVE_LOW>;3838+3939+ clocks = <&clk_core CLK_I2S>;4040+ clock-names = "mclk";4141+ };
+6
MAINTAINERS
···99229922S: Maintained99239923F: drivers/net/ethernet/ti/netcp*9924992499259925+TI TAS571X FAMILY ASoC CODEC DRIVER99269926+M: Kevin Cernekee <cernekee@chromium.org>99279927+L: alsa-devel@alsa-project.org (moderated for non-subscribers)99289928+S: Odd Fixes99299929+F: sound/soc/codecs/tas571x*99309930+99259931TI TWL4030 SERIES SOC CODEC DRIVER99269932M: Peter Ujfalusi <peter.ujfalusi@ti.com>99279933L: alsa-devel@alsa-project.org (moderated for non-subscribers)
···104104 select SND_SOC_STAC9766 if SND_SOC_AC97_BUS105105 select SND_SOC_TAS2552 if I2C106106 select SND_SOC_TAS5086 if I2C107107+ select SND_SOC_TAS571X if I2C107108 select SND_SOC_TFA9879 if I2C108109 select SND_SOC_TLV320AIC23_I2C if I2C109110 select SND_SOC_TLV320AIC23_SPI if SPI_MASTER···611610612611config SND_SOC_TAS5086613612 tristate "Texas Instruments TAS5086 speaker amplifier"613613+ depends on I2C614614+615615+config SND_SOC_TAS571X616616+ tristate "Texas Instruments TAS5711/TAS5717/TAS5719 power amplifiers"614617 depends on I2C615618616619config SND_SOC_TFA9879
···11+/*22+ * TAS571x amplifier audio driver33+ *44+ * Copyright (C) 2015 Google, Inc.55+ * Copyright (c) 2013 Daniel Mack <zonque@gmail.com>66+ *77+ * This program is free software; you can redistribute it and/or modify88+ * it under the terms of the GNU General Public License as published by99+ * the Free Software Foundation; either version 2 of the License, or1010+ * (at your option) any later version.1111+ */1212+1313+#include <linux/clk.h>1414+#include <linux/delay.h>1515+#include <linux/device.h>1616+#include <linux/gpio/consumer.h>1717+#include <linux/i2c.h>1818+#include <linux/init.h>1919+#include <linux/kernel.h>2020+#include <linux/module.h>2121+#include <linux/of_device.h>2222+#include <linux/regmap.h>2323+#include <linux/regulator/consumer.h>2424+#include <linux/stddef.h>2525+#include <sound/pcm_params.h>2626+#include <sound/soc.h>2727+#include <sound/tlv.h>2828+2929+#include "tas571x.h"3030+3131+#define TAS571X_MAX_SUPPLIES 63232+3333+struct tas571x_chip {3434+ const char *const *supply_names;3535+ int num_supply_names;3636+ const struct snd_kcontrol_new *controls;3737+ int num_controls;3838+ const struct regmap_config *regmap_config;3939+ int vol_reg_size;4040+};4141+4242+struct tas571x_private {4343+ const struct tas571x_chip *chip;4444+ struct regmap *regmap;4545+ struct regulator_bulk_data supplies[TAS571X_MAX_SUPPLIES];4646+ struct clk *mclk;4747+ unsigned int format;4848+ struct gpio_desc *reset_gpio;4949+ struct gpio_desc *pdn_gpio;5050+ struct snd_soc_codec_driver codec_driver;5151+};5252+5353+static int tas571x_register_size(struct tas571x_private *priv, unsigned int reg)5454+{5555+ switch (reg) {5656+ case TAS571X_MVOL_REG:5757+ case TAS571X_CH1_VOL_REG:5858+ case TAS571X_CH2_VOL_REG:5959+ return priv->chip->vol_reg_size;6060+ default:6161+ return 1;6262+ }6363+}6464+6565+static int tas571x_reg_write(void *context, unsigned int reg,6666+ unsigned int value)6767+{6868+ struct i2c_client *client = context;6969+ struct tas571x_private *priv = i2c_get_clientdata(client);7070+ unsigned int i, size;7171+ uint8_t buf[5];7272+ int ret;7373+7474+ size = tas571x_register_size(priv, reg);7575+ buf[0] = reg;7676+7777+ for (i = size; i >= 1; --i) {7878+ buf[i] = value;7979+ value >>= 8;8080+ }8181+8282+ ret = i2c_master_send(client, buf, size + 1);8383+ if (ret == size + 1)8484+ return 0;8585+ else if (ret < 0)8686+ return ret;8787+ else8888+ return -EIO;8989+}9090+9191+static int tas571x_reg_read(void *context, unsigned int reg,9292+ unsigned int *value)9393+{9494+ struct i2c_client *client = context;9595+ struct tas571x_private *priv = i2c_get_clientdata(client);9696+ uint8_t send_buf, recv_buf[4];9797+ struct i2c_msg msgs[2];9898+ unsigned int size;9999+ unsigned int i;100100+ int ret;101101+102102+ size = tas571x_register_size(priv, reg);103103+ send_buf = reg;104104+105105+ msgs[0].addr = client->addr;106106+ msgs[0].len = sizeof(send_buf);107107+ msgs[0].buf = &send_buf;108108+ msgs[0].flags = 0;109109+110110+ msgs[1].addr = client->addr;111111+ msgs[1].len = size;112112+ msgs[1].buf = recv_buf;113113+ msgs[1].flags = I2C_M_RD;114114+115115+ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));116116+ if (ret < 0)117117+ return ret;118118+ else if (ret != ARRAY_SIZE(msgs))119119+ return -EIO;120120+121121+ *value = 0;122122+123123+ for (i = 0; i < size; i++) {124124+ *value <<= 8;125125+ *value |= recv_buf[i];126126+ }127127+128128+ return 0;129129+}130130+131131+static int tas571x_set_dai_fmt(struct snd_soc_dai *dai, unsigned int format)132132+{133133+ struct tas571x_private *priv = snd_soc_codec_get_drvdata(dai->codec);134134+135135+ priv->format = format;136136+137137+ return 0;138138+}139139+140140+static int tas571x_hw_params(struct snd_pcm_substream *substream,141141+ struct snd_pcm_hw_params *params,142142+ struct snd_soc_dai *dai)143143+{144144+ struct tas571x_private *priv = snd_soc_codec_get_drvdata(dai->codec);145145+ u32 val;146146+147147+ switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) {148148+ case SND_SOC_DAIFMT_RIGHT_J:149149+ val = 0x00;150150+ break;151151+ case SND_SOC_DAIFMT_I2S:152152+ val = 0x03;153153+ break;154154+ case SND_SOC_DAIFMT_LEFT_J:155155+ val = 0x06;156156+ break;157157+ default:158158+ return -EINVAL;159159+ }160160+161161+ if (params_width(params) >= 24)162162+ val += 2;163163+ else if (params_width(params) >= 20)164164+ val += 1;165165+166166+ return regmap_update_bits(priv->regmap, TAS571X_SDI_REG,167167+ TAS571X_SDI_FMT_MASK, val);168168+}169169+170170+static int tas571x_set_bias_level(struct snd_soc_codec *codec,171171+ enum snd_soc_bias_level level)172172+{173173+ struct tas571x_private *priv = snd_soc_codec_get_drvdata(codec);174174+ int ret;175175+176176+ switch (level) {177177+ case SND_SOC_BIAS_ON:178178+ break;179179+ case SND_SOC_BIAS_PREPARE:180180+ break;181181+ case SND_SOC_BIAS_STANDBY:182182+ if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {183183+ if (!IS_ERR(priv->mclk)) {184184+ ret = clk_prepare_enable(priv->mclk);185185+ if (ret) {186186+ dev_err(codec->dev,187187+ "Failed to enable master clock: %d\n",188188+ ret);189189+ return ret;190190+ }191191+ }192192+193193+ gpiod_set_value(priv->pdn_gpio, 0);194194+ usleep_range(5000, 6000);195195+196196+ regcache_cache_only(priv->regmap, false);197197+ ret = regcache_sync(priv->regmap);198198+ if (ret)199199+ return ret;200200+ }201201+ break;202202+ case SND_SOC_BIAS_OFF:203203+ regcache_cache_only(priv->regmap, true);204204+ gpiod_set_value(priv->pdn_gpio, 1);205205+206206+ if (!IS_ERR(priv->mclk))207207+ clk_disable_unprepare(priv->mclk);208208+ break;209209+ }210210+211211+ return 0;212212+}213213+214214+static const struct snd_soc_dai_ops tas571x_dai_ops = {215215+ .set_fmt = tas571x_set_dai_fmt,216216+ .hw_params = tas571x_hw_params,217217+};218218+219219+static const char *const tas5711_supply_names[] = {220220+ "AVDD",221221+ "DVDD",222222+ "PVDD_A",223223+ "PVDD_B",224224+ "PVDD_C",225225+ "PVDD_D",226226+};227227+228228+static const DECLARE_TLV_DB_SCALE(tas5711_volume_tlv, -10350, 50, 1);229229+230230+static const struct snd_kcontrol_new tas5711_controls[] = {231231+ SOC_SINGLE_TLV("Master Volume",232232+ TAS571X_MVOL_REG,233233+ 0, 0xff, 1, tas5711_volume_tlv),234234+ SOC_DOUBLE_R_TLV("Speaker Volume",235235+ TAS571X_CH1_VOL_REG,236236+ TAS571X_CH2_VOL_REG,237237+ 0, 0xff, 1, tas5711_volume_tlv),238238+ SOC_DOUBLE("Speaker Switch",239239+ TAS571X_SOFT_MUTE_REG,240240+ TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,241241+ 1, 1),242242+};243243+244244+static const struct reg_default tas5711_reg_defaults[] = {245245+ { 0x04, 0x05 },246246+ { 0x05, 0x40 },247247+ { 0x06, 0x00 },248248+ { 0x07, 0xff },249249+ { 0x08, 0x30 },250250+ { 0x09, 0x30 },251251+ { 0x1b, 0x82 },252252+};253253+254254+static const struct regmap_config tas5711_regmap_config = {255255+ .reg_bits = 8,256256+ .val_bits = 32,257257+ .max_register = 0xff,258258+ .reg_read = tas571x_reg_read,259259+ .reg_write = tas571x_reg_write,260260+ .reg_defaults = tas5711_reg_defaults,261261+ .num_reg_defaults = ARRAY_SIZE(tas5711_reg_defaults),262262+ .cache_type = REGCACHE_RBTREE,263263+};264264+265265+static const struct tas571x_chip tas5711_chip = {266266+ .supply_names = tas5711_supply_names,267267+ .num_supply_names = ARRAY_SIZE(tas5711_supply_names),268268+ .controls = tas5711_controls,269269+ .num_controls = ARRAY_SIZE(tas5711_controls),270270+ .regmap_config = &tas5711_regmap_config,271271+ .vol_reg_size = 1,272272+};273273+274274+static const char *const tas5717_supply_names[] = {275275+ "AVDD",276276+ "DVDD",277277+ "HPVDD",278278+ "PVDD_AB",279279+ "PVDD_CD",280280+};281281+282282+static const DECLARE_TLV_DB_SCALE(tas5717_volume_tlv, -10375, 25, 0);283283+284284+static const struct snd_kcontrol_new tas5717_controls[] = {285285+ /* MVOL LSB is ignored - see comments in tas571x_i2c_probe() */286286+ SOC_SINGLE_TLV("Master Volume",287287+ TAS571X_MVOL_REG, 1, 0x1ff, 1,288288+ tas5717_volume_tlv),289289+ SOC_DOUBLE_R_TLV("Speaker Volume",290290+ TAS571X_CH1_VOL_REG, TAS571X_CH2_VOL_REG,291291+ 1, 0x1ff, 1, tas5717_volume_tlv),292292+ SOC_DOUBLE("Speaker Switch",293293+ TAS571X_SOFT_MUTE_REG,294294+ TAS571X_SOFT_MUTE_CH1_SHIFT, TAS571X_SOFT_MUTE_CH2_SHIFT,295295+ 1, 1),296296+};297297+298298+static const struct reg_default tas5717_reg_defaults[] = {299299+ { 0x04, 0x05 },300300+ { 0x05, 0x40 },301301+ { 0x06, 0x00 },302302+ { 0x07, 0x03ff },303303+ { 0x08, 0x00c0 },304304+ { 0x09, 0x00c0 },305305+ { 0x1b, 0x82 },306306+};307307+308308+static const struct regmap_config tas5717_regmap_config = {309309+ .reg_bits = 8,310310+ .val_bits = 32,311311+ .max_register = 0xff,312312+ .reg_read = tas571x_reg_read,313313+ .reg_write = tas571x_reg_write,314314+ .reg_defaults = tas5717_reg_defaults,315315+ .num_reg_defaults = ARRAY_SIZE(tas5717_reg_defaults),316316+ .cache_type = REGCACHE_RBTREE,317317+};318318+319319+/* This entry is reused for tas5719 as the software interface is identical. */320320+static const struct tas571x_chip tas5717_chip = {321321+ .supply_names = tas5717_supply_names,322322+ .num_supply_names = ARRAY_SIZE(tas5717_supply_names),323323+ .controls = tas5717_controls,324324+ .num_controls = ARRAY_SIZE(tas5717_controls),325325+ .regmap_config = &tas5717_regmap_config,326326+ .vol_reg_size = 2,327327+};328328+329329+static const struct snd_soc_dapm_widget tas571x_dapm_widgets[] = {330330+ SND_SOC_DAPM_DAC("DACL", NULL, SND_SOC_NOPM, 0, 0),331331+ SND_SOC_DAPM_DAC("DACR", NULL, SND_SOC_NOPM, 0, 0),332332+333333+ SND_SOC_DAPM_OUTPUT("OUT_A"),334334+ SND_SOC_DAPM_OUTPUT("OUT_B"),335335+ SND_SOC_DAPM_OUTPUT("OUT_C"),336336+ SND_SOC_DAPM_OUTPUT("OUT_D"),337337+};338338+339339+static const struct snd_soc_dapm_route tas571x_dapm_routes[] = {340340+ { "DACL", NULL, "Playback" },341341+ { "DACR", NULL, "Playback" },342342+343343+ { "OUT_A", NULL, "DACL" },344344+ { "OUT_B", NULL, "DACL" },345345+ { "OUT_C", NULL, "DACR" },346346+ { "OUT_D", NULL, "DACR" },347347+};348348+349349+static const struct snd_soc_codec_driver tas571x_codec = {350350+ .set_bias_level = tas571x_set_bias_level,351351+ .idle_bias_off = true,352352+353353+ .dapm_widgets = tas571x_dapm_widgets,354354+ .num_dapm_widgets = ARRAY_SIZE(tas571x_dapm_widgets),355355+ .dapm_routes = tas571x_dapm_routes,356356+ .num_dapm_routes = ARRAY_SIZE(tas571x_dapm_routes),357357+};358358+359359+static struct snd_soc_dai_driver tas571x_dai = {360360+ .name = "tas571x-hifi",361361+ .playback = {362362+ .stream_name = "Playback",363363+ .channels_min = 2,364364+ .channels_max = 2,365365+ .rates = SNDRV_PCM_RATE_8000_48000,366366+ .formats = SNDRV_PCM_FMTBIT_S32_LE |367367+ SNDRV_PCM_FMTBIT_S24_LE |368368+ SNDRV_PCM_FMTBIT_S16_LE,369369+ },370370+ .ops = &tas571x_dai_ops,371371+};372372+373373+static const struct of_device_id tas571x_of_match[];374374+375375+static int tas571x_i2c_probe(struct i2c_client *client,376376+ const struct i2c_device_id *id)377377+{378378+ struct tas571x_private *priv;379379+ struct device *dev = &client->dev;380380+ const struct of_device_id *of_id;381381+ int i, ret;382382+383383+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);384384+ if (!priv)385385+ return -ENOMEM;386386+ i2c_set_clientdata(client, priv);387387+388388+ of_id = of_match_device(tas571x_of_match, dev);389389+ if (!of_id) {390390+ dev_err(dev, "Unknown device type\n");391391+ return -EINVAL;392392+ }393393+ priv->chip = of_id->data;394394+395395+ priv->mclk = devm_clk_get(dev, "mclk");396396+ if (IS_ERR(priv->mclk) && PTR_ERR(priv->mclk) != -ENOENT) {397397+ dev_err(dev, "Failed to request mclk: %ld\n",398398+ PTR_ERR(priv->mclk));399399+ return PTR_ERR(priv->mclk);400400+ }401401+402402+ BUG_ON(priv->chip->num_supply_names > TAS571X_MAX_SUPPLIES);403403+ for (i = 0; i < priv->chip->num_supply_names; i++)404404+ priv->supplies[i].supply = priv->chip->supply_names[i];405405+406406+ ret = devm_regulator_bulk_get(dev, priv->chip->num_supply_names,407407+ priv->supplies);408408+ if (ret) {409409+ dev_err(dev, "Failed to get supplies: %d\n", ret);410410+ return ret;411411+ }412412+ ret = regulator_bulk_enable(priv->chip->num_supply_names,413413+ priv->supplies);414414+ if (ret) {415415+ dev_err(dev, "Failed to enable supplies: %d\n", ret);416416+ return ret;417417+ }418418+419419+ priv->regmap = devm_regmap_init(dev, NULL, client,420420+ priv->chip->regmap_config);421421+ if (IS_ERR(priv->regmap))422422+ return PTR_ERR(priv->regmap);423423+424424+ priv->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_LOW);425425+ if (IS_ERR(priv->pdn_gpio)) {426426+ dev_err(dev, "error requesting pdn_gpio: %ld\n",427427+ PTR_ERR(priv->pdn_gpio));428428+ return PTR_ERR(priv->pdn_gpio);429429+ }430430+431431+ priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",432432+ GPIOD_OUT_HIGH);433433+ if (IS_ERR(priv->reset_gpio)) {434434+ dev_err(dev, "error requesting reset_gpio: %ld\n",435435+ PTR_ERR(priv->reset_gpio));436436+ return PTR_ERR(priv->reset_gpio);437437+ } else if (priv->reset_gpio) {438438+ /* pulse the active low reset line for ~100us */439439+ usleep_range(100, 200);440440+ gpiod_set_value(priv->reset_gpio, 0);441441+ usleep_range(12000, 20000);442442+ }443443+444444+ ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0);445445+ if (ret)446446+ return ret;447447+448448+ ret = regmap_update_bits(priv->regmap, TAS571X_SYS_CTRL_2_REG,449449+ TAS571X_SYS_CTRL_2_SDN_MASK, 0);450450+ if (ret)451451+ return ret;452452+453453+ memcpy(&priv->codec_driver, &tas571x_codec, sizeof(priv->codec_driver));454454+ priv->codec_driver.controls = priv->chip->controls;455455+ priv->codec_driver.num_controls = priv->chip->num_controls;456456+457457+ if (priv->chip->vol_reg_size == 2) {458458+ /*459459+ * The master volume defaults to 0x3ff (mute), but we ignore460460+ * (zero) the LSB because the hardware step size is 0.125 dB461461+ * and TLV_DB_SCALE_ITEM has a resolution of 0.01 dB.462462+ */463463+ ret = regmap_update_bits(priv->regmap, TAS571X_MVOL_REG, 1, 0);464464+ if (ret)465465+ return ret;466466+ }467467+468468+ regcache_cache_only(priv->regmap, true);469469+ gpiod_set_value(priv->pdn_gpio, 1);470470+471471+ return snd_soc_register_codec(&client->dev, &priv->codec_driver,472472+ &tas571x_dai, 1);473473+}474474+475475+static int tas571x_i2c_remove(struct i2c_client *client)476476+{477477+ struct tas571x_private *priv = i2c_get_clientdata(client);478478+479479+ snd_soc_unregister_codec(&client->dev);480480+ regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies);481481+482482+ return 0;483483+}484484+485485+static const struct of_device_id tas571x_of_match[] = {486486+ { .compatible = "ti,tas5711", .data = &tas5711_chip, },487487+ { .compatible = "ti,tas5717", .data = &tas5717_chip, },488488+ { .compatible = "ti,tas5719", .data = &tas5717_chip, },489489+ { }490490+};491491+MODULE_DEVICE_TABLE(of, tas571x_of_match);492492+493493+static const struct i2c_device_id tas571x_i2c_id[] = {494494+ { "tas5711", 0 },495495+ { "tas5717", 0 },496496+ { "tas5719", 0 },497497+ { }498498+};499499+MODULE_DEVICE_TABLE(i2c, tas571x_i2c_id);500500+501501+static struct i2c_driver tas571x_i2c_driver = {502502+ .driver = {503503+ .name = "tas571x",504504+ .of_match_table = of_match_ptr(tas571x_of_match),505505+ },506506+ .probe = tas571x_i2c_probe,507507+ .remove = tas571x_i2c_remove,508508+ .id_table = tas571x_i2c_id,509509+};510510+module_i2c_driver(tas571x_i2c_driver);511511+512512+MODULE_DESCRIPTION("ASoC TAS571x driver");513513+MODULE_AUTHOR("Kevin Cernekee <cernekee@chromium.org>");514514+MODULE_LICENSE("GPL");
+33
sound/soc/codecs/tas571x.h
···11+/*22+ * TAS571x amplifier audio driver33+ *44+ * Copyright (C) 2015 Google, Inc.55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License as published by88+ * the Free Software Foundation; either version 2 of the License, or99+ * (at your option) any later version.1010+ */1111+1212+#ifndef _TAS571X_H1313+#define _TAS571X_H1414+1515+/* device registers */1616+#define TAS571X_SDI_REG 0x041717+#define TAS571X_SDI_FMT_MASK 0x0f1818+1919+#define TAS571X_SYS_CTRL_2_REG 0x052020+#define TAS571X_SYS_CTRL_2_SDN_MASK 0x402121+2222+#define TAS571X_SOFT_MUTE_REG 0x062323+#define TAS571X_SOFT_MUTE_CH1_SHIFT 02424+#define TAS571X_SOFT_MUTE_CH2_SHIFT 12525+#define TAS571X_SOFT_MUTE_CH3_SHIFT 22626+2727+#define TAS571X_MVOL_REG 0x072828+#define TAS571X_CH1_VOL_REG 0x082929+#define TAS571X_CH2_VOL_REG 0x093030+3131+#define TAS571X_OSC_TRIM_REG 0x1b3232+3333+#endif /* _TAS571X_H */
+7-8
sound/soc/codecs/ts3a227e.c
···254254 .num_reg_defaults = ARRAY_SIZE(ts3a227e_reg_defaults),255255};256256257257-static int ts3a227e_parse_dt(struct ts3a227e *ts3a227e, struct device_node *np)257257+static int ts3a227e_parse_device_property(struct ts3a227e *ts3a227e,258258+ struct device *dev)258259{259260 u32 micbias;260261 int err;261262262262- err = of_property_read_u32(np, "ti,micbias", &micbias);263263+ err = device_property_read_u32(dev, "ti,micbias", &micbias);263264 if (!err) {264265 regmap_update_bits(ts3a227e->regmap, TS3A227E_REG_SETTING_3,265266 MICBIAS_SETTING_MASK,···288287 if (IS_ERR(ts3a227e->regmap))289288 return PTR_ERR(ts3a227e->regmap);290289291291- if (dev->of_node) {292292- ret = ts3a227e_parse_dt(ts3a227e, dev->of_node);293293- if (ret) {294294- dev_err(dev, "Failed to parse device tree: %d\n", ret);295295- return ret;296296- }290290+ ret = ts3a227e_parse_device_property(ts3a227e, dev);291291+ if (ret) {292292+ dev_err(dev, "Failed to parse device property: %d\n", ret);293293+ return ret;297294 }298295299296 ret = devm_request_threaded_irq(dev, i2c->irq, NULL, ts3a227e_interrupt,