Commit 8c107fc4b88a619b5db45727db14c47bc748dc8d

Authored by Eric Lee
1 parent 0e1c8ee222

Add audio aic3x driver support forSMARC-T335X.

Showing 5 changed files with 119 additions and 9 deletions Side-by-side Diff

arch/arm/mach-omap2/board-am335xevm.c
... ... @@ -43,6 +43,7 @@
43 43 #include <linux/pwm/pwm.h>
44 44 #include <linux/rtc/rtc-omap.h>
45 45 #include <linux/opp.h>
  46 +#include <sound/tlv320aic3x.h>
46 47  
47 48 /* LCD controller is similar to DA850 */
48 49 #include <video/da8xx-fb.h>
... ... @@ -175,7 +176,7 @@
175 176 };
176 177  
177 178 static u8 am335x_iis_serializer_direction1[] = {
178   - INACTIVE_MODE, INACTIVE_MODE, TX_MODE, RX_MODE,
  179 + TX_MODE, RX_MODE, INACTIVE_MODE, INACTIVE_MODE,
179 180 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
180 181 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
181 182 INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE, INACTIVE_MODE,
... ... @@ -217,6 +218,19 @@
217 218 omap_pm_get_dev_context_loss_count,
218 219 };
219 220  
  221 +static struct snd_platform_data smarc_t335x_snd_data1 = {
  222 + .tx_dma_offset = 0x46400000, /* McASP1 */
  223 + .rx_dma_offset = 0x46400000,
  224 + .op_mode = DAVINCI_MCASP_IIS_MODE,
  225 + .num_serializer = ARRAY_SIZE(am335x_iis_serializer_direction1),
  226 + .tdm_slots = 2,
  227 + .serial_dir = am335x_iis_serializer_direction1,
  228 + .asp_chan_q = EVENTQ_2,
  229 + .version = MCASP_VERSION_3,
  230 + .txnumevt = 1,
  231 + .rxnumevt = 1,
  232 +};
  233 +
220 234 static struct omap2_hsmmc_info am335x_mmc[] __initdata = {
221 235 {
222 236 .mmc = 1,
... ... @@ -1402,6 +1416,15 @@
1402 1416 omap_init_elm();
1403 1417 }
1404 1418  
  1419 +static struct regulator_consumer_supply smarc_audio_supplies[] = {
  1420 + /* tlv320aic3x analog supplies */
  1421 + REGULATOR_SUPPLY("AVDD", "1-001b"),
  1422 + REGULATOR_SUPPLY("DRVDD", "1-001b"),
  1423 + /* tlv320aic3x digital supplies */
  1424 + REGULATOR_SUPPLY("IOVDD", "1-001b"),
  1425 + REGULATOR_SUPPLY("DVDD", "1-001b"),
  1426 +};
  1427 +
1405 1428 /* TPS65217 voltage regulator support */
1406 1429  
1407 1430 /* 1.8V */
... ... @@ -1601,6 +1624,11 @@
1601 1624 .num_consumer_supplies = ARRAY_SIZE(tps65217_ldo4_consumers),
1602 1625 .consumer_supplies = tps65217_ldo4_consumers,
1603 1626 },
  1627 + /* audio */
  1628 + {
  1629 + .num_consumer_supplies = ARRAY_SIZE(smarc_audio_supplies),
  1630 + .consumer_supplies = smarc_audio_supplies,
  1631 + },
1604 1632 };
1605 1633  
1606 1634 static struct tps65217_board smarct335x_tps65217_info = {
... ... @@ -1709,6 +1737,9 @@
1709 1737 case EVM_SK:
1710 1738 am335x_register_mcasp(&am335x_evm_sk_snd_data1, 1);
1711 1739 break;
  1740 + case SMARC_T335X:
  1741 + am335x_register_mcasp(&smarc_t335x_snd_data1, 1);
  1742 + break;
1712 1743 default:
1713 1744 am335x_register_mcasp(&am335x_evm_snd_data1, 1);
1714 1745 }
... ... @@ -2607,7 +2638,8 @@
2607 2638  
2608 2639 ret = m->read(m, (char *)&config1, 0, sizeof(config1));
2609 2640 if (ret == sizeof(config1)) {
2610   - pr_info("Detected a daughter card on AM335x EVM..");
  2641 +/* pr_info("Detected a daughter card on AM335x EVM..");*/
  2642 + pr_info("Detected a carrier board for SMARC T335X Module..");
2611 2643 daughter_brd_detected = true;
2612 2644 }
2613 2645 else {
... ... @@ -2992,7 +3024,7 @@
2992 3024 MACHINE_END
2993 3025  
2994 3026 MACHINE_START(SMARCT335XEVM, "smarct335xevm")
2995   - /* Maintainer: Texas Instruments */
  3027 + /* Maintainer: Embedian, Inc. */
2996 3028 .atag_offset = 0x100,
2997 3029 .map_io = am335x_evm_map_io,
2998 3030 .init_early = am33xx_init_early,
drivers/mfd/tps65217.c
... ... @@ -200,8 +200,33 @@
200 200 platform_device_add(pdev);
201 201 }
202 202  
  203 + if (pdata->bl_pdata || pdata->of_node[TPS65217_SUBDEV_BL]) {
  204 + tps->bl_pdev = platform_device_alloc("tps65217-bl", 0);
  205 + if (!tps->bl_pdev) {
  206 + dev_err(tps->dev, "Cannot create backlight platform device\n");
  207 + ret = -ENOMEM;
  208 + goto err_alloc_bl_pdev;
  209 + }
  210 +
  211 + tps->bl_pdev->dev.parent = tps->dev;
  212 +
  213 + if (pdata->bl_pdata)
  214 + tps->bl_pdev->dev.platform_data = pdata->bl_pdata;
  215 + else
  216 + tps->bl_pdev->dev.of_node =
  217 + pdata->of_node[TPS65217_SUBDEV_BL];
  218 +
  219 + platform_device_add(tps->bl_pdev);
  220 + }
  221 +
203 222 return 0;
204 223  
  224 +err_alloc_bl_pdev:
  225 + for (i = 0; i < TPS65217_NUM_REGULATOR; i++)
  226 + platform_device_unregister(tps->regulator_pdev[i]);
  227 +
  228 + return ret;
  229 +
205 230 err_regmap:
206 231 regmap_exit(tps->regmap);
207 232  
... ... @@ -212,6 +237,9 @@
212 237 {
213 238 struct tps65217 *tps = i2c_get_clientdata(client);
214 239 int i;
  240 +
  241 + if (tps->bl_pdev)
  242 + platform_device_unregister(tps->bl_pdev);
215 243  
216 244 for (i = 0; i < TPS65217_NUM_REGULATOR; i++)
217 245 platform_device_unregister(tps->regulator_pdev[i]);
include/linux/mfd/tps65217.h
... ... @@ -209,7 +209,28 @@
209 209 #define TPS65217_NUM_LDO 4
210 210 /* Number of total regulators available */
211 211 #define TPS65217_NUM_REGULATOR (TPS65217_NUM_DCDC + TPS65217_NUM_LDO)
  212 +/* Number of subdevices (regulators + backlight) */
  213 +#define TPS65217_NUM_SUBDEVS (TPS65217_NUM_REGULATOR + 1)
  214 +/* Index of the backlight subdevice */
  215 +#define TPS65217_SUBDEV_BL TPS65217_NUM_REGULATOR
212 216  
  217 +enum tps65217_bl_isel {
  218 + TPS65217_BL_ISET1 = 1,
  219 + TPS65217_BL_ISET2 = 2,
  220 +};
  221 +
  222 +enum tps65217_bl_fdim {
  223 + TPS65217_BL_FDIM_100HZ,
  224 + TPS65217_BL_FDIM_200HZ,
  225 + TPS65217_BL_FDIM_500HZ,
  226 + TPS65217_BL_FDIM_1000HZ,
  227 +};
  228 +
  229 +struct tps65217_bl_pdata {
  230 + enum tps65217_bl_isel isel;
  231 + enum tps65217_bl_fdim fdim;
  232 +};
  233 +
213 234 /**
214 235 * struct tps65217_board - packages regulator init data
215 236 * @tps65217_regulator_data: regulator initialization values
216 237  
... ... @@ -220,10 +241,13 @@
220 241 struct tps65217_board {
221 242 struct regulator_init_data *tps65217_init_data;
222 243 bool status_off;
  244 + struct device_node *of_node[TPS65217_NUM_SUBDEVS];
  245 + struct tps65217_bl_pdata *bl_pdata;
223 246 };
224 247  
225 248 struct tps65217_rdelay {
226 249 int ramp_delay;
  250 + struct platform_device *bl_pdev;
227 251 };
228 252  
229 253 /**
... ... @@ -272,6 +296,7 @@
272 296  
273 297 /* Client devices */
274 298 struct platform_device *regulator_pdev[TPS65217_NUM_REGULATOR];
  299 + struct platform_device *bl_pdev;
275 300 };
276 301  
277 302 static inline struct tps65217 *dev_to_tps65217(struct device *dev)
sound/soc/codecs/tlv320aic3x.c
... ... @@ -52,7 +52,7 @@
52 52  
53 53 #include "tlv320aic3x.h"
54 54  
55   -#define AIC3X_NUM_SUPPLIES 4
  55 +#define AIC3X_NUM_SUPPLIES 0
56 56 static const char *aic3x_supply_names[AIC3X_NUM_SUPPLIES] = {
57 57 "IOVDD", /* I/O Voltage */
58 58 "DVDD", /* Digital Core Voltage */
sound/soc/davinci/davinci-evm.c
... ... @@ -27,6 +27,9 @@
27 27 #ifdef CONFIG_MACH_AM335XEVM
28 28 #include <mach/board-am335xevm.h>
29 29 #endif
  30 +#ifdef CONFIG_MACH_SMARCT335XEVM
  31 +#include <mach/board-am335xevm.h>
  32 +#endif
30 33  
31 34 #include "davinci-pcm.h"
32 35 #include "davinci-i2s.h"
... ... @@ -59,11 +62,13 @@
59 62 machine_is_davinci_da850_evm())
60 63 sysclk = 24576000;
61 64 /* On AM335X, CODEC gets MCLK from external Xtal (12MHz). */
62   - else if (machine_is_am335xevm())
63   -#ifdef CONFIG_MACH_AM335XEVM
64   - if (am335x_evm_get_id() == EVM_SK)
65   - sysclk = 24000000;
66   - else
  65 + else if (machine_is_am335xevm() || machine_is_smarct335xevm())
  66 +#ifdef CONFIG_MACH_SMARCT335XEVM
  67 + if (am335x_evm_get_id() == EVM_SK)
  68 + sysclk = 24000000;
  69 + else if (am335x_evm_get_id() == SMARC_T335X)
  70 + sysclk = 24576000;
  71 + else
67 72 #endif
68 73 sysclk = 12000000;
69 74  
... ... @@ -260,6 +265,17 @@
260 265 .ops = &evm_ops,
261 266 };
262 267  
  268 +static struct snd_soc_dai_link smarct335x_evm_dai = {
  269 + .name = "TLV320AIC3X",
  270 + .stream_name = "AIC3X",
  271 + .cpu_dai_name = "davinci-mcasp.1",
  272 + .codec_dai_name = "tlv320aic3x-hifi",
  273 + .codec_name = "tlv320aic3x-codec.1-001b",
  274 + .platform_name = "davinci-pcm-audio",
  275 + .init = evm_aic3x_init,
  276 + .ops = &evm_ops,
  277 +};
  278 +
263 279 static struct snd_soc_dai_link am335x_evm_sk_dai = {
264 280 .name = "TLV320AIC3X",
265 281 .stream_name = "AIC3X",
... ... @@ -317,6 +333,12 @@
317 333 .num_links = 1,
318 334 };
319 335  
  336 +static struct snd_soc_card smarct335x_snd_soc_card = {
  337 + .name = "TLV320AIC3X SOUND CARD",
  338 + .dai_link = &smarct335x_evm_dai,
  339 + .num_links = 1,
  340 +};
  341 +
320 342 static struct snd_soc_card am335x_evm_sk_snd_soc_card = {
321 343 .name = "AM335X EVM",
322 344 .dai_link = &am335x_evm_sk_dai,
... ... @@ -356,6 +378,9 @@
356 378 evm_snd_dev_data = &am335x_evm_sk_snd_soc_card;
357 379 #endif
358 380 index = 0;
  381 + } else if (machine_is_smarct335xevm()) {
  382 + evm_snd_dev_data = &smarct335x_snd_soc_card;
  383 + index = 0;
359 384 } else
360 385 return -EINVAL;
361 386