10e45cab6SChristian Glindkamp /* 20e45cab6SChristian Glindkamp * max9850.c -- codec driver for max9850 30e45cab6SChristian Glindkamp * 40e45cab6SChristian Glindkamp * Copyright (C) 2011 taskit GmbH 50e45cab6SChristian Glindkamp * 60e45cab6SChristian Glindkamp * Author: Christian Glindkamp <christian.glindkamp@taskit.de> 70e45cab6SChristian Glindkamp * 80e45cab6SChristian Glindkamp * Initial development of this code was funded by 90e45cab6SChristian Glindkamp * MICRONIC Computer Systeme GmbH, http://www.mcsberlin.de/ 100e45cab6SChristian Glindkamp * 110e45cab6SChristian Glindkamp * This program is free software; you can redistribute it and/or modify it 120e45cab6SChristian Glindkamp * under the terms of the GNU General Public License as published by the 130e45cab6SChristian Glindkamp * Free Software Foundation; either version 2 of the License, or (at your 140e45cab6SChristian Glindkamp * option) any later version. 150e45cab6SChristian Glindkamp * 160e45cab6SChristian Glindkamp */ 170e45cab6SChristian Glindkamp 180e45cab6SChristian Glindkamp #include <linux/module.h> 190e45cab6SChristian Glindkamp #include <linux/init.h> 200e45cab6SChristian Glindkamp #include <linux/i2c.h> 2106841662SMark Brown #include <linux/regmap.h> 220e45cab6SChristian Glindkamp #include <linux/slab.h> 230e45cab6SChristian Glindkamp #include <sound/pcm.h> 240e45cab6SChristian Glindkamp #include <sound/pcm_params.h> 250e45cab6SChristian Glindkamp #include <sound/soc.h> 260e45cab6SChristian Glindkamp #include <sound/tlv.h> 270e45cab6SChristian Glindkamp 280e45cab6SChristian Glindkamp #include "max9850.h" 290e45cab6SChristian Glindkamp 300e45cab6SChristian Glindkamp struct max9850_priv { 3106841662SMark Brown struct regmap *regmap; 320e45cab6SChristian Glindkamp unsigned int sysclk; 330e45cab6SChristian Glindkamp }; 340e45cab6SChristian Glindkamp 350e45cab6SChristian Glindkamp /* max9850 register cache */ 3606841662SMark Brown static const struct reg_default max9850_reg[] = { 3706841662SMark Brown { 2, 0x0c }, 3806841662SMark Brown { 3, 0x00 }, 3906841662SMark Brown { 4, 0x00 }, 4006841662SMark Brown { 5, 0x00 }, 4106841662SMark Brown { 6, 0x00 }, 4206841662SMark Brown { 7, 0x00 }, 4306841662SMark Brown { 8, 0x00 }, 4406841662SMark Brown { 9, 0x00 }, 4506841662SMark Brown { 10, 0x00 }, 460e45cab6SChristian Glindkamp }; 470e45cab6SChristian Glindkamp 480e45cab6SChristian Glindkamp /* these registers are not used at the moment but provided for the sake of 490e45cab6SChristian Glindkamp * completeness */ 5006841662SMark Brown static bool max9850_volatile_register(struct device *dev, unsigned int reg) 510e45cab6SChristian Glindkamp { 520e45cab6SChristian Glindkamp switch (reg) { 530e45cab6SChristian Glindkamp case MAX9850_STATUSA: 540e45cab6SChristian Glindkamp case MAX9850_STATUSB: 55*038541daSGustavo A. R. Silva return true; 560e45cab6SChristian Glindkamp default: 57*038541daSGustavo A. R. Silva return false; 580e45cab6SChristian Glindkamp } 590e45cab6SChristian Glindkamp } 600e45cab6SChristian Glindkamp 6106841662SMark Brown static const struct regmap_config max9850_regmap = { 6206841662SMark Brown .reg_bits = 8, 6306841662SMark Brown .val_bits = 8, 6406841662SMark Brown 6506841662SMark Brown .max_register = MAX9850_DIGITAL_AUDIO, 6606841662SMark Brown .volatile_reg = max9850_volatile_register, 6706841662SMark Brown .cache_type = REGCACHE_RBTREE, 6806841662SMark Brown }; 6906841662SMark Brown 70e0340985SLars-Peter Clausen static const DECLARE_TLV_DB_RANGE(max9850_tlv, 710e45cab6SChristian Glindkamp 0x18, 0x1f, TLV_DB_SCALE_ITEM(-7450, 400, 0), 720e45cab6SChristian Glindkamp 0x20, 0x33, TLV_DB_SCALE_ITEM(-4150, 200, 0), 730e45cab6SChristian Glindkamp 0x34, 0x37, TLV_DB_SCALE_ITEM(-150, 100, 0), 74e0340985SLars-Peter Clausen 0x38, 0x3f, TLV_DB_SCALE_ITEM(250, 50, 0) 75e0340985SLars-Peter Clausen ); 760e45cab6SChristian Glindkamp 770e45cab6SChristian Glindkamp static const struct snd_kcontrol_new max9850_controls[] = { 780e45cab6SChristian Glindkamp SOC_SINGLE_TLV("Headphone Volume", MAX9850_VOLUME, 0, 0x3f, 1, max9850_tlv), 790e45cab6SChristian Glindkamp SOC_SINGLE("Headphone Switch", MAX9850_VOLUME, 7, 1, 1), 800e45cab6SChristian Glindkamp SOC_SINGLE("Mono Switch", MAX9850_GENERAL_PURPOSE, 2, 1, 0), 810e45cab6SChristian Glindkamp }; 820e45cab6SChristian Glindkamp 830e45cab6SChristian Glindkamp static const struct snd_kcontrol_new max9850_mixer_controls[] = { 840e45cab6SChristian Glindkamp SOC_DAPM_SINGLE("Line In Switch", MAX9850_ENABLE, 1, 1, 0), 850e45cab6SChristian Glindkamp }; 860e45cab6SChristian Glindkamp 870e45cab6SChristian Glindkamp static const struct snd_soc_dapm_widget max9850_dapm_widgets[] = { 880e45cab6SChristian Glindkamp SND_SOC_DAPM_SUPPLY("Charge Pump 1", MAX9850_ENABLE, 4, 0, NULL, 0), 890e45cab6SChristian Glindkamp SND_SOC_DAPM_SUPPLY("Charge Pump 2", MAX9850_ENABLE, 5, 0, NULL, 0), 900e45cab6SChristian Glindkamp SND_SOC_DAPM_SUPPLY("MCLK", MAX9850_ENABLE, 6, 0, NULL, 0), 910e45cab6SChristian Glindkamp SND_SOC_DAPM_SUPPLY("SHDN", MAX9850_ENABLE, 7, 0, NULL, 0), 920e45cab6SChristian Glindkamp SND_SOC_DAPM_MIXER_NAMED_CTL("Output Mixer", MAX9850_ENABLE, 2, 0, 930e45cab6SChristian Glindkamp &max9850_mixer_controls[0], 940e45cab6SChristian Glindkamp ARRAY_SIZE(max9850_mixer_controls)), 950e45cab6SChristian Glindkamp SND_SOC_DAPM_PGA("Headphone Output", MAX9850_ENABLE, 3, 0, NULL, 0), 960e45cab6SChristian Glindkamp SND_SOC_DAPM_DAC("DAC", "HiFi Playback", MAX9850_ENABLE, 0, 0), 970e45cab6SChristian Glindkamp SND_SOC_DAPM_OUTPUT("OUTL"), 980e45cab6SChristian Glindkamp SND_SOC_DAPM_OUTPUT("HPL"), 990e45cab6SChristian Glindkamp SND_SOC_DAPM_OUTPUT("OUTR"), 1000e45cab6SChristian Glindkamp SND_SOC_DAPM_OUTPUT("HPR"), 1010e45cab6SChristian Glindkamp SND_SOC_DAPM_MIXER("Line Input", SND_SOC_NOPM, 0, 0, NULL, 0), 1020e45cab6SChristian Glindkamp SND_SOC_DAPM_INPUT("INL"), 1030e45cab6SChristian Glindkamp SND_SOC_DAPM_INPUT("INR"), 1040e45cab6SChristian Glindkamp }; 1050e45cab6SChristian Glindkamp 1065ee65ec6SAxel Lin static const struct snd_soc_dapm_route max9850_dapm_routes[] = { 1070e45cab6SChristian Glindkamp /* output mixer */ 1080e45cab6SChristian Glindkamp {"Output Mixer", NULL, "DAC"}, 1090e45cab6SChristian Glindkamp {"Output Mixer", "Line In Switch", "Line Input"}, 1100e45cab6SChristian Glindkamp 1110e45cab6SChristian Glindkamp /* outputs */ 1120e45cab6SChristian Glindkamp {"Headphone Output", NULL, "Output Mixer"}, 1130e45cab6SChristian Glindkamp {"HPL", NULL, "Headphone Output"}, 1140e45cab6SChristian Glindkamp {"HPR", NULL, "Headphone Output"}, 1150e45cab6SChristian Glindkamp {"OUTL", NULL, "Output Mixer"}, 1160e45cab6SChristian Glindkamp {"OUTR", NULL, "Output Mixer"}, 1170e45cab6SChristian Glindkamp 1180e45cab6SChristian Glindkamp /* inputs */ 1190e45cab6SChristian Glindkamp {"Line Input", NULL, "INL"}, 1200e45cab6SChristian Glindkamp {"Line Input", NULL, "INR"}, 1210e45cab6SChristian Glindkamp 1220e45cab6SChristian Glindkamp /* supplies */ 1230e45cab6SChristian Glindkamp {"Output Mixer", NULL, "Charge Pump 1"}, 1240e45cab6SChristian Glindkamp {"Output Mixer", NULL, "Charge Pump 2"}, 1250e45cab6SChristian Glindkamp {"Output Mixer", NULL, "SHDN"}, 1260e45cab6SChristian Glindkamp {"DAC", NULL, "MCLK"}, 1270e45cab6SChristian Glindkamp }; 1280e45cab6SChristian Glindkamp 1290e45cab6SChristian Glindkamp static int max9850_hw_params(struct snd_pcm_substream *substream, 1300e45cab6SChristian Glindkamp struct snd_pcm_hw_params *params, 1310e45cab6SChristian Glindkamp struct snd_soc_dai *dai) 1320e45cab6SChristian Glindkamp { 1330b3eda28SKuninori Morimoto struct snd_soc_component *component = dai->component; 1340b3eda28SKuninori Morimoto struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); 1350e45cab6SChristian Glindkamp u64 lrclk_div; 1360e45cab6SChristian Glindkamp u8 sf, da; 1370e45cab6SChristian Glindkamp 1380e45cab6SChristian Glindkamp if (!max9850->sysclk) 1390e45cab6SChristian Glindkamp return -EINVAL; 1400e45cab6SChristian Glindkamp 1410e45cab6SChristian Glindkamp /* lrclk_div = 2^22 * rate / iclk with iclk = mclk / sf */ 1420b3eda28SKuninori Morimoto sf = (snd_soc_component_read32(component, MAX9850_CLOCK) >> 2) + 1; 1430e45cab6SChristian Glindkamp lrclk_div = (1 << 22); 1440e45cab6SChristian Glindkamp lrclk_div *= params_rate(params); 1450e45cab6SChristian Glindkamp lrclk_div *= sf; 1460e45cab6SChristian Glindkamp do_div(lrclk_div, max9850->sysclk); 1470e45cab6SChristian Glindkamp 1480b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_LRCLK_MSB, (lrclk_div >> 8) & 0x7f); 1490b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_LRCLK_LSB, lrclk_div & 0xff); 1500e45cab6SChristian Glindkamp 1510058e459SMark Brown switch (params_width(params)) { 1520058e459SMark Brown case 16: 1530e45cab6SChristian Glindkamp da = 0; 1540e45cab6SChristian Glindkamp break; 1550058e459SMark Brown case 20: 1560e45cab6SChristian Glindkamp da = 0x2; 1570e45cab6SChristian Glindkamp break; 1580058e459SMark Brown case 24: 1590e45cab6SChristian Glindkamp da = 0x3; 1600e45cab6SChristian Glindkamp break; 1610e45cab6SChristian Glindkamp default: 1620e45cab6SChristian Glindkamp return -EINVAL; 1630e45cab6SChristian Glindkamp } 1640b3eda28SKuninori Morimoto snd_soc_component_update_bits(component, MAX9850_DIGITAL_AUDIO, 0x3, da); 1650e45cab6SChristian Glindkamp 1660e45cab6SChristian Glindkamp return 0; 1670e45cab6SChristian Glindkamp } 1680e45cab6SChristian Glindkamp 1690e45cab6SChristian Glindkamp static int max9850_set_dai_sysclk(struct snd_soc_dai *codec_dai, 1700e45cab6SChristian Glindkamp int clk_id, unsigned int freq, int dir) 1710e45cab6SChristian Glindkamp { 1720b3eda28SKuninori Morimoto struct snd_soc_component *component = codec_dai->component; 1730b3eda28SKuninori Morimoto struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); 1740e45cab6SChristian Glindkamp 1750e45cab6SChristian Glindkamp /* calculate mclk -> iclk divider */ 1760e45cab6SChristian Glindkamp if (freq <= 13000000) 1770b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_CLOCK, 0x0); 1780e45cab6SChristian Glindkamp else if (freq <= 26000000) 1790b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_CLOCK, 0x4); 1800e45cab6SChristian Glindkamp else if (freq <= 40000000) 1810b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_CLOCK, 0x8); 1820e45cab6SChristian Glindkamp else 1830e45cab6SChristian Glindkamp return -EINVAL; 1840e45cab6SChristian Glindkamp 1850e45cab6SChristian Glindkamp max9850->sysclk = freq; 1860e45cab6SChristian Glindkamp return 0; 1870e45cab6SChristian Glindkamp } 1880e45cab6SChristian Glindkamp 1890e45cab6SChristian Glindkamp static int max9850_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) 1900e45cab6SChristian Glindkamp { 1910b3eda28SKuninori Morimoto struct snd_soc_component *component = codec_dai->component; 1920e45cab6SChristian Glindkamp u8 da = 0; 1930e45cab6SChristian Glindkamp 1940e45cab6SChristian Glindkamp /* set master/slave audio interface */ 1950e45cab6SChristian Glindkamp switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 1960e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_CBM_CFM: 1970e45cab6SChristian Glindkamp da |= MAX9850_MASTER; 1980e45cab6SChristian Glindkamp break; 1990e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_CBS_CFS: 2000e45cab6SChristian Glindkamp break; 2010e45cab6SChristian Glindkamp default: 2020e45cab6SChristian Glindkamp return -EINVAL; 2030e45cab6SChristian Glindkamp } 2040e45cab6SChristian Glindkamp 2050e45cab6SChristian Glindkamp /* interface format */ 2060e45cab6SChristian Glindkamp switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 2070e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_I2S: 2080e45cab6SChristian Glindkamp da |= MAX9850_DLY; 2090e45cab6SChristian Glindkamp break; 2100e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_RIGHT_J: 2110e45cab6SChristian Glindkamp da |= MAX9850_RTJ; 2120e45cab6SChristian Glindkamp break; 2130e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_LEFT_J: 2140e45cab6SChristian Glindkamp break; 2150e45cab6SChristian Glindkamp default: 2160e45cab6SChristian Glindkamp return -EINVAL; 2170e45cab6SChristian Glindkamp } 2180e45cab6SChristian Glindkamp 2190e45cab6SChristian Glindkamp /* clock inversion */ 2200e45cab6SChristian Glindkamp switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 2210e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_NB_NF: 2220e45cab6SChristian Glindkamp break; 2230e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_IB_IF: 2240e45cab6SChristian Glindkamp da |= MAX9850_BCINV | MAX9850_INV; 2250e45cab6SChristian Glindkamp break; 2260e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_IB_NF: 2270e45cab6SChristian Glindkamp da |= MAX9850_BCINV; 2280e45cab6SChristian Glindkamp break; 2290e45cab6SChristian Glindkamp case SND_SOC_DAIFMT_NB_IF: 2300e45cab6SChristian Glindkamp da |= MAX9850_INV; 2310e45cab6SChristian Glindkamp break; 2320e45cab6SChristian Glindkamp default: 2330e45cab6SChristian Glindkamp return -EINVAL; 2340e45cab6SChristian Glindkamp } 2350e45cab6SChristian Glindkamp 2360e45cab6SChristian Glindkamp /* set da */ 2370b3eda28SKuninori Morimoto snd_soc_component_write(component, MAX9850_DIGITAL_AUDIO, da); 2380e45cab6SChristian Glindkamp 2390e45cab6SChristian Glindkamp return 0; 2400e45cab6SChristian Glindkamp } 2410e45cab6SChristian Glindkamp 2420b3eda28SKuninori Morimoto static int max9850_set_bias_level(struct snd_soc_component *component, 2430e45cab6SChristian Glindkamp enum snd_soc_bias_level level) 2440e45cab6SChristian Glindkamp { 2450b3eda28SKuninori Morimoto struct max9850_priv *max9850 = snd_soc_component_get_drvdata(component); 2460e45cab6SChristian Glindkamp int ret; 2470e45cab6SChristian Glindkamp 2480e45cab6SChristian Glindkamp switch (level) { 2490e45cab6SChristian Glindkamp case SND_SOC_BIAS_ON: 2500e45cab6SChristian Glindkamp break; 2510e45cab6SChristian Glindkamp case SND_SOC_BIAS_PREPARE: 2520e45cab6SChristian Glindkamp break; 2530e45cab6SChristian Glindkamp case SND_SOC_BIAS_STANDBY: 2540b3eda28SKuninori Morimoto if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { 25506841662SMark Brown ret = regcache_sync(max9850->regmap); 2560e45cab6SChristian Glindkamp if (ret) { 2570b3eda28SKuninori Morimoto dev_err(component->dev, 2580e45cab6SChristian Glindkamp "Failed to sync cache: %d\n", ret); 2590e45cab6SChristian Glindkamp return ret; 2600e45cab6SChristian Glindkamp } 2610e45cab6SChristian Glindkamp } 2620e45cab6SChristian Glindkamp break; 2630e45cab6SChristian Glindkamp case SND_SOC_BIAS_OFF: 2640e45cab6SChristian Glindkamp break; 2650e45cab6SChristian Glindkamp } 2660e45cab6SChristian Glindkamp return 0; 2670e45cab6SChristian Glindkamp } 2680e45cab6SChristian Glindkamp 2690e45cab6SChristian Glindkamp #define MAX9850_RATES SNDRV_PCM_RATE_8000_48000 2700e45cab6SChristian Glindkamp 2710e45cab6SChristian Glindkamp #define MAX9850_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 2720e45cab6SChristian Glindkamp SNDRV_PCM_FMTBIT_S24_LE) 2730e45cab6SChristian Glindkamp 27485e7652dSLars-Peter Clausen static const struct snd_soc_dai_ops max9850_dai_ops = { 2750e45cab6SChristian Glindkamp .hw_params = max9850_hw_params, 2760e45cab6SChristian Glindkamp .set_sysclk = max9850_set_dai_sysclk, 2770e45cab6SChristian Glindkamp .set_fmt = max9850_set_dai_fmt, 2780e45cab6SChristian Glindkamp }; 2790e45cab6SChristian Glindkamp 2800e45cab6SChristian Glindkamp static struct snd_soc_dai_driver max9850_dai = { 2810e45cab6SChristian Glindkamp .name = "max9850-hifi", 2820e45cab6SChristian Glindkamp .playback = { 2830e45cab6SChristian Glindkamp .stream_name = "Playback", 2840e45cab6SChristian Glindkamp .channels_min = 1, 2850e45cab6SChristian Glindkamp .channels_max = 2, 2860e45cab6SChristian Glindkamp .rates = MAX9850_RATES, 2870e45cab6SChristian Glindkamp .formats = MAX9850_FORMATS 2880e45cab6SChristian Glindkamp }, 2890e45cab6SChristian Glindkamp .ops = &max9850_dai_ops, 2900e45cab6SChristian Glindkamp }; 2910e45cab6SChristian Glindkamp 2920b3eda28SKuninori Morimoto static int max9850_probe(struct snd_soc_component *component) 2930e45cab6SChristian Glindkamp { 2940e45cab6SChristian Glindkamp /* enable zero-detect */ 2950b3eda28SKuninori Morimoto snd_soc_component_update_bits(component, MAX9850_GENERAL_PURPOSE, 1, 1); 2960e45cab6SChristian Glindkamp /* enable slew-rate control */ 2970b3eda28SKuninori Morimoto snd_soc_component_update_bits(component, MAX9850_VOLUME, 0x40, 0x40); 2980e45cab6SChristian Glindkamp /* set slew-rate 125ms */ 2990b3eda28SKuninori Morimoto snd_soc_component_update_bits(component, MAX9850_CHARGE_PUMP, 0xff, 0xc0); 3000e45cab6SChristian Glindkamp 3010e45cab6SChristian Glindkamp return 0; 3020e45cab6SChristian Glindkamp } 3030e45cab6SChristian Glindkamp 3040b3eda28SKuninori Morimoto static const struct snd_soc_component_driver soc_component_dev_max9850 = { 3050e45cab6SChristian Glindkamp .probe = max9850_probe, 3060e45cab6SChristian Glindkamp .set_bias_level = max9850_set_bias_level, 3075ee65ec6SAxel Lin .controls = max9850_controls, 3085ee65ec6SAxel Lin .num_controls = ARRAY_SIZE(max9850_controls), 3095ee65ec6SAxel Lin .dapm_widgets = max9850_dapm_widgets, 3105ee65ec6SAxel Lin .num_dapm_widgets = ARRAY_SIZE(max9850_dapm_widgets), 3115ee65ec6SAxel Lin .dapm_routes = max9850_dapm_routes, 3125ee65ec6SAxel Lin .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes), 3130b3eda28SKuninori Morimoto .suspend_bias_off = 1, 3140b3eda28SKuninori Morimoto .idle_bias_on = 1, 3150b3eda28SKuninori Morimoto .use_pmdown_time = 1, 3160b3eda28SKuninori Morimoto .endianness = 1, 3170b3eda28SKuninori Morimoto .non_legacy_dai_naming = 1, 3180e45cab6SChristian Glindkamp }; 3190e45cab6SChristian Glindkamp 3207a79e94eSBill Pemberton static int max9850_i2c_probe(struct i2c_client *i2c, 3210e45cab6SChristian Glindkamp const struct i2c_device_id *id) 3220e45cab6SChristian Glindkamp { 3230e45cab6SChristian Glindkamp struct max9850_priv *max9850; 3240e45cab6SChristian Glindkamp int ret; 3250e45cab6SChristian Glindkamp 326bf791bdbSAxel Lin max9850 = devm_kzalloc(&i2c->dev, sizeof(struct max9850_priv), 327bf791bdbSAxel Lin GFP_KERNEL); 3280e45cab6SChristian Glindkamp if (max9850 == NULL) 3290e45cab6SChristian Glindkamp return -ENOMEM; 3300e45cab6SChristian Glindkamp 33106841662SMark Brown max9850->regmap = devm_regmap_init_i2c(i2c, &max9850_regmap); 33206841662SMark Brown if (IS_ERR(max9850->regmap)) 33306841662SMark Brown return PTR_ERR(max9850->regmap); 33406841662SMark Brown 3350e45cab6SChristian Glindkamp i2c_set_clientdata(i2c, max9850); 3360e45cab6SChristian Glindkamp 3370b3eda28SKuninori Morimoto ret = devm_snd_soc_register_component(&i2c->dev, 3380b3eda28SKuninori Morimoto &soc_component_dev_max9850, &max9850_dai, 1); 3390e45cab6SChristian Glindkamp return ret; 3400e45cab6SChristian Glindkamp } 3410e45cab6SChristian Glindkamp 3420e45cab6SChristian Glindkamp static const struct i2c_device_id max9850_i2c_id[] = { 3430e45cab6SChristian Glindkamp { "max9850", 0 }, 3440e45cab6SChristian Glindkamp { } 3450e45cab6SChristian Glindkamp }; 3460e45cab6SChristian Glindkamp MODULE_DEVICE_TABLE(i2c, max9850_i2c_id); 3470e45cab6SChristian Glindkamp 3480e45cab6SChristian Glindkamp static struct i2c_driver max9850_i2c_driver = { 3490e45cab6SChristian Glindkamp .driver = { 3500e45cab6SChristian Glindkamp .name = "max9850", 3510e45cab6SChristian Glindkamp }, 3520e45cab6SChristian Glindkamp .probe = max9850_i2c_probe, 3530e45cab6SChristian Glindkamp .id_table = max9850_i2c_id, 3540e45cab6SChristian Glindkamp }; 3550e45cab6SChristian Glindkamp 3564abdc8c8SSachin Kamat module_i2c_driver(max9850_i2c_driver); 3570e45cab6SChristian Glindkamp 3580e45cab6SChristian Glindkamp MODULE_AUTHOR("Christian Glindkamp <christian.glindkamp@taskit.de>"); 3590e45cab6SChristian Glindkamp MODULE_DESCRIPTION("ASoC MAX9850 codec driver"); 3600e45cab6SChristian Glindkamp MODULE_LICENSE("GPL"); 361