Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 1 | /* |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 2 | * MFD driver for twl4030 audio submodule, which contains an audio codec, and |
| 3 | * the vibra control. |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 4 | * |
Peter Ujfalusi | 4a7c00c | 2011-05-10 08:59:23 +0300 | [diff] [blame] | 5 | * Author: Peter Ujfalusi <peter.ujfalusi@ti.com> |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 6 | * |
| 7 | * Copyright: (C) 2009 Nokia Corporation |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, but |
| 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | * General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 | * 02110-1301 USA |
| 22 | * |
| 23 | */ |
| 24 | |
| 25 | #include <linux/module.h> |
| 26 | #include <linux/types.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 28 | #include <linux/kernel.h> |
| 29 | #include <linux/fs.h> |
| 30 | #include <linux/platform_device.h> |
Stephen Rothwell | 8bea867 | 2009-12-15 16:33:10 +1100 | [diff] [blame] | 31 | #include <linux/i2c/twl.h> |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 32 | #include <linux/mfd/core.h> |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 33 | #include <linux/mfd/twl4030-audio.h> |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 34 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 35 | #define TWL4030_AUDIO_CELLS 2 |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 36 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 37 | static struct platform_device *twl4030_audio_dev; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 38 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 39 | struct twl4030_audio_resource { |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 40 | int request_count; |
| 41 | u8 reg; |
| 42 | u8 mask; |
| 43 | }; |
| 44 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 45 | struct twl4030_audio { |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 46 | unsigned int audio_mclk; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 47 | struct mutex mutex; |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 48 | struct twl4030_audio_resource resource[TWL4030_AUDIO_RES_MAX]; |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 49 | struct mfd_cell cells[TWL4030_AUDIO_CELLS]; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 50 | }; |
| 51 | |
| 52 | /* |
| 53 | * Modify the resource, the function returns the content of the register |
| 54 | * after the modification. |
| 55 | */ |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 56 | static int twl4030_audio_set_resource(enum twl4030_audio_res id, int enable) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 57 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 58 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 59 | u8 val; |
| 60 | |
Stephen Rothwell | 8bea867 | 2009-12-15 16:33:10 +1100 | [diff] [blame] | 61 | twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val, |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 62 | audio->resource[id].reg); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 63 | |
| 64 | if (enable) |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 65 | val |= audio->resource[id].mask; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 66 | else |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 67 | val &= ~audio->resource[id].mask; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 68 | |
Stephen Rothwell | 8bea867 | 2009-12-15 16:33:10 +1100 | [diff] [blame] | 69 | twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 70 | val, audio->resource[id].reg); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 71 | |
| 72 | return val; |
| 73 | } |
| 74 | |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 75 | static inline int twl4030_audio_get_resource(enum twl4030_audio_res id) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 76 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 77 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 78 | u8 val; |
| 79 | |
Stephen Rothwell | 8bea867 | 2009-12-15 16:33:10 +1100 | [diff] [blame] | 80 | twl_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &val, |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 81 | audio->resource[id].reg); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 82 | |
| 83 | return val; |
| 84 | } |
| 85 | |
| 86 | /* |
| 87 | * Enable the resource. |
| 88 | * The function returns with error or the content of the register |
| 89 | */ |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 90 | int twl4030_audio_enable_resource(enum twl4030_audio_res id) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 91 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 92 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 93 | int val; |
| 94 | |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 95 | if (id >= TWL4030_AUDIO_RES_MAX) { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 96 | dev_err(&twl4030_audio_dev->dev, |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 97 | "Invalid resource ID (%u)\n", id); |
| 98 | return -EINVAL; |
| 99 | } |
| 100 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 101 | mutex_lock(&audio->mutex); |
| 102 | if (!audio->resource[id].request_count) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 103 | /* Resource was disabled, enable it */ |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 104 | val = twl4030_audio_set_resource(id, 1); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 105 | else |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 106 | val = twl4030_audio_get_resource(id); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 107 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 108 | audio->resource[id].request_count++; |
| 109 | mutex_unlock(&audio->mutex); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 110 | |
| 111 | return val; |
| 112 | } |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 113 | EXPORT_SYMBOL_GPL(twl4030_audio_enable_resource); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 114 | |
| 115 | /* |
| 116 | * Disable the resource. |
| 117 | * The function returns with error or the content of the register |
| 118 | */ |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 119 | int twl4030_audio_disable_resource(unsigned id) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 120 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 121 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 122 | int val; |
| 123 | |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 124 | if (id >= TWL4030_AUDIO_RES_MAX) { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 125 | dev_err(&twl4030_audio_dev->dev, |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 126 | "Invalid resource ID (%u)\n", id); |
| 127 | return -EINVAL; |
| 128 | } |
| 129 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 130 | mutex_lock(&audio->mutex); |
| 131 | if (!audio->resource[id].request_count) { |
| 132 | dev_err(&twl4030_audio_dev->dev, |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 133 | "Resource has been disabled already (%u)\n", id); |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 134 | mutex_unlock(&audio->mutex); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 135 | return -EPERM; |
| 136 | } |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 137 | audio->resource[id].request_count--; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 138 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 139 | if (!audio->resource[id].request_count) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 140 | /* Resource can be disabled now */ |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 141 | val = twl4030_audio_set_resource(id, 0); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 142 | else |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 143 | val = twl4030_audio_get_resource(id); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 144 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 145 | mutex_unlock(&audio->mutex); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 146 | |
| 147 | return val; |
| 148 | } |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 149 | EXPORT_SYMBOL_GPL(twl4030_audio_disable_resource); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 150 | |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 151 | unsigned int twl4030_audio_get_mclk(void) |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 152 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 153 | struct twl4030_audio *audio = platform_get_drvdata(twl4030_audio_dev); |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 154 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 155 | return audio->audio_mclk; |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 156 | } |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 157 | EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk); |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 158 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 159 | static int __devinit twl4030_audio_probe(struct platform_device *pdev) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 160 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 161 | struct twl4030_audio *audio; |
Peter Ujfalusi | 4ae6df5 | 2011-05-31 15:21:13 +0300 | [diff] [blame] | 162 | struct twl4030_audio_data *pdata = pdev->dev.platform_data; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 163 | struct mfd_cell *cell = NULL; |
| 164 | int ret, childs = 0; |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 165 | u8 val; |
| 166 | |
| 167 | if (!pdata) { |
| 168 | dev_err(&pdev->dev, "Platform data is missing\n"); |
| 169 | return -EINVAL; |
| 170 | } |
| 171 | |
| 172 | /* Configure APLL_INFREQ and disable APLL if enabled */ |
| 173 | val = 0; |
| 174 | switch (pdata->audio_mclk) { |
| 175 | case 19200000: |
| 176 | val |= TWL4030_APLL_INFREQ_19200KHZ; |
| 177 | break; |
| 178 | case 26000000: |
| 179 | val |= TWL4030_APLL_INFREQ_26000KHZ; |
| 180 | break; |
| 181 | case 38400000: |
| 182 | val |= TWL4030_APLL_INFREQ_38400KHZ; |
| 183 | break; |
| 184 | default: |
| 185 | dev_err(&pdev->dev, "Invalid audio_mclk\n"); |
| 186 | return -EINVAL; |
| 187 | } |
Stephen Rothwell | 8bea867 | 2009-12-15 16:33:10 +1100 | [diff] [blame] | 188 | twl_i2c_write_u8(TWL4030_MODULE_AUDIO_VOICE, |
Peter Ujfalusi | f9b4639 | 2009-11-04 09:58:19 +0200 | [diff] [blame] | 189 | val, TWL4030_REG_APLL_CTL); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 190 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 191 | audio = kzalloc(sizeof(struct twl4030_audio), GFP_KERNEL); |
| 192 | if (!audio) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 193 | return -ENOMEM; |
| 194 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 195 | platform_set_drvdata(pdev, audio); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 196 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 197 | twl4030_audio_dev = pdev; |
| 198 | mutex_init(&audio->mutex); |
| 199 | audio->audio_mclk = pdata->audio_mclk; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 200 | |
| 201 | /* Codec power */ |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 202 | audio->resource[TWL4030_AUDIO_RES_POWER].reg = TWL4030_REG_CODEC_MODE; |
| 203 | audio->resource[TWL4030_AUDIO_RES_POWER].mask = TWL4030_CODECPDZ; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 204 | |
| 205 | /* PLL */ |
Peter Ujfalusi | 57fe725 | 2011-05-31 12:02:49 +0300 | [diff] [blame] | 206 | audio->resource[TWL4030_AUDIO_RES_APLL].reg = TWL4030_REG_APLL_CTL; |
| 207 | audio->resource[TWL4030_AUDIO_RES_APLL].mask = TWL4030_APLL_EN; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 208 | |
Peter Ujfalusi | 4ae6df5 | 2011-05-31 15:21:13 +0300 | [diff] [blame] | 209 | if (pdata->codec) { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 210 | cell = &audio->cells[childs]; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 211 | cell->name = "twl4030-codec"; |
Peter Ujfalusi | 4ae6df5 | 2011-05-31 15:21:13 +0300 | [diff] [blame] | 212 | cell->platform_data = pdata->codec; |
| 213 | cell->pdata_size = sizeof(*pdata->codec); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 214 | childs++; |
| 215 | } |
| 216 | if (pdata->vibra) { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 217 | cell = &audio->cells[childs]; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 218 | cell->name = "twl4030-vibra"; |
Samuel Ortiz | a4579ad | 2011-04-06 15:57:17 +0200 | [diff] [blame] | 219 | cell->platform_data = pdata->vibra; |
| 220 | cell->pdata_size = sizeof(*pdata->vibra); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 221 | childs++; |
| 222 | } |
| 223 | |
| 224 | if (childs) |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 225 | ret = mfd_add_devices(&pdev->dev, pdev->id, audio->cells, |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 226 | childs, NULL, 0); |
| 227 | else { |
| 228 | dev_err(&pdev->dev, "No platform data found for childs\n"); |
| 229 | ret = -ENODEV; |
| 230 | } |
| 231 | |
| 232 | if (!ret) |
| 233 | return 0; |
| 234 | |
| 235 | platform_set_drvdata(pdev, NULL); |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 236 | kfree(audio); |
| 237 | twl4030_audio_dev = NULL; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 238 | return ret; |
| 239 | } |
| 240 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 241 | static int __devexit twl4030_audio_remove(struct platform_device *pdev) |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 242 | { |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 243 | struct twl4030_audio *audio = platform_get_drvdata(pdev); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 244 | |
| 245 | mfd_remove_devices(&pdev->dev); |
| 246 | platform_set_drvdata(pdev, NULL); |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 247 | kfree(audio); |
| 248 | twl4030_audio_dev = NULL; |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 249 | |
| 250 | return 0; |
| 251 | } |
| 252 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 253 | MODULE_ALIAS("platform:twl4030-audio"); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 254 | |
Peter Ujfalusi | 4fe5668 | 2011-05-03 18:03:43 +0300 | [diff] [blame] | 255 | static struct platform_driver twl4030_audio_driver = { |
| 256 | .probe = twl4030_audio_probe, |
| 257 | .remove = __devexit_p(twl4030_audio_remove), |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 258 | .driver = { |
| 259 | .owner = THIS_MODULE, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 260 | .name = "twl4030-audio", |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 261 | }, |
| 262 | }; |
| 263 | |
Mark Brown | 65349d6 | 2011-11-23 22:58:34 +0000 | [diff] [blame] | 264 | module_platform_driver(twl4030_audio_driver); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 265 | |
Peter Ujfalusi | 4a7c00c | 2011-05-10 08:59:23 +0300 | [diff] [blame] | 266 | MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>"); |
Peter Ujfalusi | 0b83dde | 2009-10-22 13:26:45 +0300 | [diff] [blame] | 267 | MODULE_LICENSE("GPL"); |