tpa6130a2.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. /*
  2. * ALSA SoC Texas Instruments TPA6130A2 headset stereo amplifier driver
  3. *
  4. * Copyright (C) Nokia Corporation
  5. *
  6. * Author: Peter Ujfalusi <peter.ujfalusi@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. */
  22. #include <linux/module.h>
  23. #include <linux/errno.h>
  24. #include <linux/device.h>
  25. #include <linux/i2c.h>
  26. #include <linux/gpio.h>
  27. #include <linux/regulator/consumer.h>
  28. #include <sound/tpa6130a2-plat.h>
  29. #include <sound/soc.h>
  30. #include <sound/soc-dapm.h>
  31. #include <sound/tlv.h>
  32. #include "tpa6130a2.h"
  33. static struct i2c_client *tpa6130a2_client;
  34. #define TPA6130A2_NUM_SUPPLIES 2
  35. static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
  36. "CPVSS",
  37. "Vdd",
  38. };
  39. static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
  40. "HPVdd",
  41. "AVdd",
  42. };
  43. #define TPA6130A2_GAIN_MAX 0x3f
  44. #define TPA6140A2_GAIN_MAX 0x1f
  45. /* This struct is used to save the context */
  46. struct tpa6130a2_data {
  47. struct mutex mutex;
  48. unsigned char regs[TPA6130A2_CACHEREGNUM];
  49. struct regulator_bulk_data supplies[TPA6130A2_NUM_SUPPLIES];
  50. int power_gpio;
  51. unsigned char power_state;
  52. enum tpa_model id;
  53. int gain_limit;
  54. };
  55. static int tpa6130a2_i2c_read(int reg)
  56. {
  57. struct tpa6130a2_data *data;
  58. int val;
  59. BUG_ON(tpa6130a2_client == NULL);
  60. data = i2c_get_clientdata(tpa6130a2_client);
  61. /* If powered off, return the cached value */
  62. if (data->power_state) {
  63. val = i2c_smbus_read_byte_data(tpa6130a2_client, reg);
  64. if (val < 0)
  65. dev_err(&tpa6130a2_client->dev, "Read failed\n");
  66. else
  67. data->regs[reg] = val;
  68. } else {
  69. val = data->regs[reg];
  70. }
  71. return val;
  72. }
  73. static int tpa6130a2_i2c_write(int reg, u8 value)
  74. {
  75. struct tpa6130a2_data *data;
  76. int val = 0;
  77. BUG_ON(tpa6130a2_client == NULL);
  78. data = i2c_get_clientdata(tpa6130a2_client);
  79. if (data->power_state) {
  80. val = i2c_smbus_write_byte_data(tpa6130a2_client, reg, value);
  81. if (val < 0)
  82. dev_err(&tpa6130a2_client->dev, "Write failed\n");
  83. }
  84. /* Either powered on or off, we save the context */
  85. data->regs[reg] = value;
  86. return val;
  87. }
  88. static u8 tpa6130a2_read(int reg)
  89. {
  90. struct tpa6130a2_data *data;
  91. BUG_ON(tpa6130a2_client == NULL);
  92. data = i2c_get_clientdata(tpa6130a2_client);
  93. return data->regs[reg];
  94. }
  95. static void tpa6130a2_initialize(void)
  96. {
  97. struct tpa6130a2_data *data;
  98. int i;
  99. BUG_ON(tpa6130a2_client == NULL);
  100. data = i2c_get_clientdata(tpa6130a2_client);
  101. for (i = 1; i < TPA6130A2_REG_VERSION; i++)
  102. tpa6130a2_i2c_write(i, data->regs[i]);
  103. }
  104. static int tpa6130a2_power(int power)
  105. {
  106. struct tpa6130a2_data *data;
  107. u8 val;
  108. int ret;
  109. BUG_ON(tpa6130a2_client == NULL);
  110. data = i2c_get_clientdata(tpa6130a2_client);
  111. mutex_lock(&data->mutex);
  112. if (power) {
  113. /* Power on */
  114. if (data->power_gpio >= 0)
  115. gpio_set_value(data->power_gpio, 1);
  116. ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies),
  117. data->supplies);
  118. if (ret != 0) {
  119. dev_err(&tpa6130a2_client->dev,
  120. "Failed to enable supplies: %d\n", ret);
  121. goto exit;
  122. }
  123. data->power_state = 1;
  124. tpa6130a2_initialize();
  125. /* Clear SWS */
  126. val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
  127. val &= ~TPA6130A2_SWS;
  128. tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
  129. } else {
  130. /* set SWS */
  131. val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
  132. val |= TPA6130A2_SWS;
  133. tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
  134. /* Power off */
  135. if (data->power_gpio >= 0)
  136. gpio_set_value(data->power_gpio, 0);
  137. ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies),
  138. data->supplies);
  139. if (ret != 0) {
  140. dev_err(&tpa6130a2_client->dev,
  141. "Failed to disable supplies: %d\n", ret);
  142. goto exit;
  143. }
  144. data->power_state = 0;
  145. }
  146. exit:
  147. mutex_unlock(&data->mutex);
  148. return ret;
  149. }
  150. static int tpa6130a2_info_volsw(struct snd_kcontrol *kcontrol,
  151. struct snd_ctl_elem_info *uinfo)
  152. {
  153. struct soc_mixer_control *mc =
  154. (struct soc_mixer_control *)kcontrol->private_value;
  155. struct tpa6130a2_data *data;
  156. BUG_ON(tpa6130a2_client == NULL);
  157. data = i2c_get_clientdata(tpa6130a2_client);
  158. mutex_lock(&data->mutex);
  159. switch (mc->reg) {
  160. case TPA6130A2_REG_VOL_MUTE:
  161. if (data->gain_limit != mc->max)
  162. mc->max = data->gain_limit;
  163. break;
  164. default:
  165. dev_err(&tpa6130a2_client->dev,
  166. "Invalid register: 0x02%x\n", mc->reg);
  167. goto out;
  168. }
  169. if (unlikely(mc->max == 1))
  170. uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
  171. else
  172. uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
  173. uinfo->count = 1;
  174. uinfo->value.integer.min = 0;
  175. uinfo->value.integer.max = mc->max;
  176. out:
  177. mutex_unlock(&data->mutex);
  178. return 0;
  179. }
  180. static int tpa6130a2_get_reg(struct snd_kcontrol *kcontrol,
  181. struct snd_ctl_elem_value *ucontrol)
  182. {
  183. struct soc_mixer_control *mc =
  184. (struct soc_mixer_control *)kcontrol->private_value;
  185. struct tpa6130a2_data *data;
  186. unsigned int reg = mc->reg;
  187. unsigned int shift = mc->shift;
  188. unsigned int mask = mc->max;
  189. unsigned int invert = mc->invert;
  190. BUG_ON(tpa6130a2_client == NULL);
  191. data = i2c_get_clientdata(tpa6130a2_client);
  192. mutex_lock(&data->mutex);
  193. ucontrol->value.integer.value[0] =
  194. (tpa6130a2_read(reg) >> shift) & mask;
  195. if (invert)
  196. ucontrol->value.integer.value[0] =
  197. mask - ucontrol->value.integer.value[0];
  198. mutex_unlock(&data->mutex);
  199. return 0;
  200. }
  201. static int tpa6130a2_set_reg(struct snd_kcontrol *kcontrol,
  202. struct snd_ctl_elem_value *ucontrol)
  203. {
  204. struct soc_mixer_control *mc =
  205. (struct soc_mixer_control *)kcontrol->private_value;
  206. struct tpa6130a2_data *data;
  207. unsigned int reg = mc->reg;
  208. unsigned int shift = mc->shift;
  209. unsigned int mask = mc->max;
  210. unsigned int invert = mc->invert;
  211. unsigned int val = (ucontrol->value.integer.value[0] & mask);
  212. unsigned int val_reg;
  213. BUG_ON(tpa6130a2_client == NULL);
  214. data = i2c_get_clientdata(tpa6130a2_client);
  215. if (invert)
  216. val = mask - val;
  217. mutex_lock(&data->mutex);
  218. val_reg = tpa6130a2_read(reg);
  219. if (((val_reg >> shift) & mask) == val) {
  220. mutex_unlock(&data->mutex);
  221. return 0;
  222. }
  223. val_reg &= ~(mask << shift);
  224. val_reg |= val << shift;
  225. tpa6130a2_i2c_write(reg, val_reg);
  226. mutex_unlock(&data->mutex);
  227. return 1;
  228. }
  229. #define SOC_SINGLE_EXT_TLV_TPA(xname, xreg, xshift, xmax, xinvert, tlv_array) \
  230. { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
  231. .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
  232. SNDRV_CTL_ELEM_ACCESS_READWRITE,\
  233. .tlv.p = (tlv_array), \
  234. .info = tpa6130a2_info_volsw, \
  235. .get = tpa6130a2_get_reg, .put = tpa6130a2_set_reg, \
  236. .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
  237. /*
  238. * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going
  239. * down in gain.
  240. */
  241. static const unsigned int tpa6130_tlv[] = {
  242. TLV_DB_RANGE_HEAD(10),
  243. 0, 1, TLV_DB_SCALE_ITEM(-5950, 600, 0),
  244. 2, 3, TLV_DB_SCALE_ITEM(-5000, 250, 0),
  245. 4, 5, TLV_DB_SCALE_ITEM(-4550, 160, 0),
  246. 6, 7, TLV_DB_SCALE_ITEM(-4140, 190, 0),
  247. 8, 9, TLV_DB_SCALE_ITEM(-3650, 120, 0),
  248. 10, 11, TLV_DB_SCALE_ITEM(-3330, 160, 0),
  249. 12, 13, TLV_DB_SCALE_ITEM(-3040, 180, 0),
  250. 14, 20, TLV_DB_SCALE_ITEM(-2710, 110, 0),
  251. 21, 37, TLV_DB_SCALE_ITEM(-1960, 74, 0),
  252. 38, 63, TLV_DB_SCALE_ITEM(-720, 45, 0),
  253. };
  254. static const struct snd_kcontrol_new tpa6130a2_controls[] = {
  255. SOC_SINGLE_EXT_TLV_TPA("TPA6130A2 Headphone Playback Volume",
  256. TPA6130A2_REG_VOL_MUTE, 0, TPA6130A2_GAIN_MAX, 0,
  257. tpa6130_tlv),
  258. };
  259. static const unsigned int tpa6140_tlv[] = {
  260. TLV_DB_RANGE_HEAD(3),
  261. 0, 8, TLV_DB_SCALE_ITEM(-5900, 400, 0),
  262. 9, 16, TLV_DB_SCALE_ITEM(-2500, 200, 0),
  263. 17, 31, TLV_DB_SCALE_ITEM(-1000, 100, 0),
  264. };
  265. static const struct snd_kcontrol_new tpa6140a2_controls[] = {
  266. SOC_SINGLE_EXT_TLV_TPA("TPA6140A2 Headphone Playback Volume",
  267. TPA6130A2_REG_VOL_MUTE, 1, TPA6140A2_GAIN_MAX, 0,
  268. tpa6140_tlv),
  269. };
  270. /*
  271. * Enable or disable channel (left or right)
  272. * The bit number for mute and amplifier are the same per channel:
  273. * bit 6: Right channel
  274. * bit 7: Left channel
  275. * in both registers.
  276. */
  277. static void tpa6130a2_channel_enable(u8 channel, int enable)
  278. {
  279. u8 val;
  280. if (enable) {
  281. /* Enable channel */
  282. /* Enable amplifier */
  283. val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
  284. val |= channel;
  285. tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
  286. /* Unmute channel */
  287. val = tpa6130a2_read(TPA6130A2_REG_VOL_MUTE);
  288. val &= ~channel;
  289. tpa6130a2_i2c_write(TPA6130A2_REG_VOL_MUTE, val);
  290. } else {
  291. /* Disable channel */
  292. /* Mute channel */
  293. val = tpa6130a2_read(TPA6130A2_REG_VOL_MUTE);
  294. val |= channel;
  295. tpa6130a2_i2c_write(TPA6130A2_REG_VOL_MUTE, val);
  296. /* Disable amplifier */
  297. val = tpa6130a2_read(TPA6130A2_REG_CONTROL);
  298. val &= ~channel;
  299. tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val);
  300. }
  301. }
  302. static int tpa6130a2_left_event(struct snd_soc_dapm_widget *w,
  303. struct snd_kcontrol *kcontrol, int event)
  304. {
  305. switch (event) {
  306. case SND_SOC_DAPM_POST_PMU:
  307. tpa6130a2_channel_enable(TPA6130A2_HP_EN_L, 1);
  308. break;
  309. case SND_SOC_DAPM_POST_PMD:
  310. tpa6130a2_channel_enable(TPA6130A2_HP_EN_L, 0);
  311. break;
  312. }
  313. return 0;
  314. }
  315. static int tpa6130a2_right_event(struct snd_soc_dapm_widget *w,
  316. struct snd_kcontrol *kcontrol, int event)
  317. {
  318. switch (event) {
  319. case SND_SOC_DAPM_POST_PMU:
  320. tpa6130a2_channel_enable(TPA6130A2_HP_EN_R, 1);
  321. break;
  322. case SND_SOC_DAPM_POST_PMD:
  323. tpa6130a2_channel_enable(TPA6130A2_HP_EN_R, 0);
  324. break;
  325. }
  326. return 0;
  327. }
  328. static int tpa6130a2_supply_event(struct snd_soc_dapm_widget *w,
  329. struct snd_kcontrol *kcontrol, int event)
  330. {
  331. int ret = 0;
  332. switch (event) {
  333. case SND_SOC_DAPM_POST_PMU:
  334. ret = tpa6130a2_power(1);
  335. break;
  336. case SND_SOC_DAPM_POST_PMD:
  337. ret = tpa6130a2_power(0);
  338. break;
  339. }
  340. return ret;
  341. }
  342. static const struct snd_soc_dapm_widget tpa6130a2_dapm_widgets[] = {
  343. SND_SOC_DAPM_PGA_E("TPA6130A2 Left", SND_SOC_NOPM,
  344. 0, 0, NULL, 0, tpa6130a2_left_event,
  345. SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
  346. SND_SOC_DAPM_PGA_E("TPA6130A2 Right", SND_SOC_NOPM,
  347. 0, 0, NULL, 0, tpa6130a2_right_event,
  348. SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
  349. SND_SOC_DAPM_SUPPLY("TPA6130A2 Enable", SND_SOC_NOPM,
  350. 0, 0, tpa6130a2_supply_event,
  351. SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
  352. /* Outputs */
  353. SND_SOC_DAPM_HP("TPA6130A2 Headphone Left", NULL),
  354. SND_SOC_DAPM_HP("TPA6130A2 Headphone Right", NULL),
  355. };
  356. static const struct snd_soc_dapm_route audio_map[] = {
  357. {"TPA6130A2 Headphone Left", NULL, "TPA6130A2 Left"},
  358. {"TPA6130A2 Headphone Right", NULL, "TPA6130A2 Right"},
  359. {"TPA6130A2 Headphone Left", NULL, "TPA6130A2 Enable"},
  360. {"TPA6130A2 Headphone Right", NULL, "TPA6130A2 Enable"},
  361. };
  362. int tpa6130a2_add_controls(struct snd_soc_codec *codec)
  363. {
  364. struct tpa6130a2_data *data;
  365. BUG_ON(tpa6130a2_client == NULL);
  366. data = i2c_get_clientdata(tpa6130a2_client);
  367. snd_soc_dapm_new_controls(codec, tpa6130a2_dapm_widgets,
  368. ARRAY_SIZE(tpa6130a2_dapm_widgets));
  369. snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
  370. if (data->id == TPA6140A2)
  371. return snd_soc_add_controls(codec, tpa6140a2_controls,
  372. ARRAY_SIZE(tpa6140a2_controls));
  373. else
  374. return snd_soc_add_controls(codec, tpa6130a2_controls,
  375. ARRAY_SIZE(tpa6130a2_controls));
  376. }
  377. EXPORT_SYMBOL_GPL(tpa6130a2_add_controls);
  378. static int __devinit tpa6130a2_probe(struct i2c_client *client,
  379. const struct i2c_device_id *id)
  380. {
  381. struct device *dev;
  382. struct tpa6130a2_data *data;
  383. struct tpa6130a2_platform_data *pdata;
  384. int i, ret;
  385. dev = &client->dev;
  386. if (client->dev.platform_data == NULL) {
  387. dev_err(dev, "Platform data not set\n");
  388. dump_stack();
  389. return -ENODEV;
  390. }
  391. data = kzalloc(sizeof(*data), GFP_KERNEL);
  392. if (data == NULL) {
  393. dev_err(dev, "Can not allocate memory\n");
  394. return -ENOMEM;
  395. }
  396. tpa6130a2_client = client;
  397. i2c_set_clientdata(tpa6130a2_client, data);
  398. pdata = client->dev.platform_data;
  399. data->power_gpio = pdata->power_gpio;
  400. data->id = pdata->id;
  401. mutex_init(&data->mutex);
  402. /* Set default register values */
  403. data->regs[TPA6130A2_REG_CONTROL] = TPA6130A2_SWS;
  404. data->regs[TPA6130A2_REG_VOL_MUTE] = TPA6130A2_MUTE_R |
  405. TPA6130A2_MUTE_L;
  406. if (data->power_gpio >= 0) {
  407. ret = gpio_request(data->power_gpio, "tpa6130a2 enable");
  408. if (ret < 0) {
  409. dev_err(dev, "Failed to request power GPIO (%d)\n",
  410. data->power_gpio);
  411. goto err_gpio;
  412. }
  413. gpio_direction_output(data->power_gpio, 0);
  414. }
  415. switch (data->id) {
  416. case TPA6130A2:
  417. for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
  418. data->supplies[i].supply = tpa6130a2_supply_names[i];
  419. if (pdata->limit_gain > 0 &&
  420. pdata->limit_gain < TPA6130A2_GAIN_MAX)
  421. data->gain_limit = pdata->limit_gain;
  422. else
  423. data->gain_limit = TPA6130A2_GAIN_MAX;
  424. break;
  425. case TPA6140A2:
  426. for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
  427. data->supplies[i].supply = tpa6140a2_supply_names[i];;
  428. if (pdata->limit_gain > 0 &&
  429. pdata->limit_gain < TPA6140A2_GAIN_MAX)
  430. data->gain_limit = pdata->limit_gain;
  431. else
  432. data->gain_limit = TPA6140A2_GAIN_MAX;
  433. break;
  434. default:
  435. dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
  436. pdata->id);
  437. for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
  438. data->supplies[i].supply = tpa6130a2_supply_names[i];
  439. if (pdata->limit_gain > 0 &&
  440. pdata->limit_gain < TPA6130A2_GAIN_MAX)
  441. data->gain_limit = pdata->limit_gain;
  442. else
  443. data->gain_limit = TPA6130A2_GAIN_MAX;
  444. }
  445. ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies),
  446. data->supplies);
  447. if (ret != 0) {
  448. dev_err(dev, "Failed to request supplies: %d\n", ret);
  449. goto err_regulator;
  450. }
  451. ret = tpa6130a2_power(1);
  452. if (ret != 0)
  453. goto err_power;
  454. /* Read version */
  455. ret = tpa6130a2_i2c_read(TPA6130A2_REG_VERSION) &
  456. TPA6130A2_VERSION_MASK;
  457. if ((ret != 1) && (ret != 2))
  458. dev_warn(dev, "UNTESTED version detected (%d)\n", ret);
  459. /* Disable the chip */
  460. ret = tpa6130a2_power(0);
  461. if (ret != 0)
  462. goto err_power;
  463. return 0;
  464. err_power:
  465. regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies);
  466. err_regulator:
  467. if (data->power_gpio >= 0)
  468. gpio_free(data->power_gpio);
  469. err_gpio:
  470. kfree(data);
  471. i2c_set_clientdata(tpa6130a2_client, NULL);
  472. tpa6130a2_client = NULL;
  473. return ret;
  474. }
  475. static int __devexit tpa6130a2_remove(struct i2c_client *client)
  476. {
  477. struct tpa6130a2_data *data = i2c_get_clientdata(client);
  478. tpa6130a2_power(0);
  479. if (data->power_gpio >= 0)
  480. gpio_free(data->power_gpio);
  481. regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies);
  482. kfree(data);
  483. tpa6130a2_client = NULL;
  484. return 0;
  485. }
  486. static const struct i2c_device_id tpa6130a2_id[] = {
  487. { "tpa6130a2", 0 },
  488. { }
  489. };
  490. MODULE_DEVICE_TABLE(i2c, tpa6130a2_id);
  491. static struct i2c_driver tpa6130a2_i2c_driver = {
  492. .driver = {
  493. .name = "tpa6130a2",
  494. .owner = THIS_MODULE,
  495. },
  496. .probe = tpa6130a2_probe,
  497. .remove = __devexit_p(tpa6130a2_remove),
  498. .id_table = tpa6130a2_id,
  499. };
  500. static int __init tpa6130a2_init(void)
  501. {
  502. return i2c_add_driver(&tpa6130a2_i2c_driver);
  503. }
  504. static void __exit tpa6130a2_exit(void)
  505. {
  506. i2c_del_driver(&tpa6130a2_i2c_driver);
  507. }
  508. MODULE_AUTHOR("Peter Ujfalusi");
  509. MODULE_DESCRIPTION("TPA6130A2 Headphone amplifier driver");
  510. MODULE_LICENSE("GPL");
  511. module_init(tpa6130a2_init);
  512. module_exit(tpa6130a2_exit);