diff options
author | Oder Chiou <oder_chiou@realtek.com> | 2014-09-15 23:37:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-09-16 12:16:12 -0400 |
commit | 44caf7648064502fd1d37d18443ae92c064ebadd (patch) | |
tree | eb012a83958e73cc0c82f396be745ae4fd0ec974 /sound/soc/codecs/rt5677.h | |
parent | e5b2791d2a57e9da369bd75ae2a209bcce2ad4d3 (diff) |
ASoC: rt5677: Add the GPIO function
The patch adds the GPIO function.
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5677.h')
-rw-r--r-- | sound/soc/codecs/rt5677.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h index a334eb66cfc1..b61b72cfcbd7 100644 --- a/sound/soc/codecs/rt5677.h +++ b/sound/soc/codecs/rt5677.h | |||
@@ -1363,10 +1363,109 @@ | |||
1363 | #define RT5677_SEL_SRC_IB01 (0x1 << 0) | 1363 | #define RT5677_SEL_SRC_IB01 (0x1 << 0) |
1364 | #define RT5677_SEL_SRC_IB01_SFT 0 | 1364 | #define RT5677_SEL_SRC_IB01_SFT 0 |
1365 | 1365 | ||
1366 | /* GPIO status (0xbf) */ | ||
1367 | #define RT5677_GPIO6_STATUS_MASK (0x1 << 5) | ||
1368 | #define RT5677_GPIO6_STATUS_SFT 5 | ||
1369 | #define RT5677_GPIO5_STATUS_MASK (0x1 << 4) | ||
1370 | #define RT5677_GPIO5_STATUS_SFT 4 | ||
1371 | #define RT5677_GPIO4_STATUS_MASK (0x1 << 3) | ||
1372 | #define RT5677_GPIO4_STATUS_SFT 3 | ||
1373 | #define RT5677_GPIO3_STATUS_MASK (0x1 << 2) | ||
1374 | #define RT5677_GPIO3_STATUS_SFT 2 | ||
1375 | #define RT5677_GPIO2_STATUS_MASK (0x1 << 1) | ||
1376 | #define RT5677_GPIO2_STATUS_SFT 1 | ||
1377 | #define RT5677_GPIO1_STATUS_MASK (0x1 << 0) | ||
1378 | #define RT5677_GPIO1_STATUS_SFT 0 | ||
1379 | |||
1380 | /* GPIO Control 1 (0xc0) */ | ||
1381 | #define RT5677_GPIO1_PIN_MASK (0x1 << 15) | ||
1382 | #define RT5677_GPIO1_PIN_SFT 15 | ||
1383 | #define RT5677_GPIO1_PIN_GPIO1 (0x0 << 15) | ||
1384 | #define RT5677_GPIO1_PIN_IRQ (0x1 << 15) | ||
1385 | #define RT5677_IPTV_MODE_MASK (0x1 << 14) | ||
1386 | #define RT5677_IPTV_MODE_SFT 14 | ||
1387 | #define RT5677_IPTV_MODE_GPIO (0x0 << 14) | ||
1388 | #define RT5677_IPTV_MODE_IPTV (0x1 << 14) | ||
1389 | #define RT5677_FUNC_MODE_MASK (0x1 << 13) | ||
1390 | #define RT5677_FUNC_MODE_SFT 13 | ||
1391 | #define RT5677_FUNC_MODE_DMIC_GPIO (0x0 << 13) | ||
1392 | #define RT5677_FUNC_MODE_JTAG (0x1 << 13) | ||
1393 | |||
1366 | /* GPIO Control 2 (0xc1) */ | 1394 | /* GPIO Control 2 (0xc1) */ |
1367 | #define RT5677_GPIO5_DIR_MASK (0x1 << 14) | 1395 | #define RT5677_GPIO5_DIR_MASK (0x1 << 14) |
1396 | #define RT5677_GPIO5_DIR_SFT 14 | ||
1368 | #define RT5677_GPIO5_DIR_IN (0x0 << 14) | 1397 | #define RT5677_GPIO5_DIR_IN (0x0 << 14) |
1369 | #define RT5677_GPIO5_DIR_OUT (0x1 << 14) | 1398 | #define RT5677_GPIO5_DIR_OUT (0x1 << 14) |
1399 | #define RT5677_GPIO5_OUT_MASK (0x1 << 13) | ||
1400 | #define RT5677_GPIO5_OUT_SFT 13 | ||
1401 | #define RT5677_GPIO5_OUT_LO (0x0 << 13) | ||
1402 | #define RT5677_GPIO5_OUT_HI (0x1 << 13) | ||
1403 | #define RT5677_GPIO5_P_MASK (0x1 << 12) | ||
1404 | #define RT5677_GPIO5_P_SFT 12 | ||
1405 | #define RT5677_GPIO5_P_NOR (0x0 << 12) | ||
1406 | #define RT5677_GPIO5_P_INV (0x1 << 12) | ||
1407 | #define RT5677_GPIO4_DIR_MASK (0x1 << 11) | ||
1408 | #define RT5677_GPIO4_DIR_SFT 11 | ||
1409 | #define RT5677_GPIO4_DIR_IN (0x0 << 11) | ||
1410 | #define RT5677_GPIO4_DIR_OUT (0x1 << 11) | ||
1411 | #define RT5677_GPIO4_OUT_MASK (0x1 << 10) | ||
1412 | #define RT5677_GPIO4_OUT_SFT 10 | ||
1413 | #define RT5677_GPIO4_OUT_LO (0x0 << 10) | ||
1414 | #define RT5677_GPIO4_OUT_HI (0x1 << 10) | ||
1415 | #define RT5677_GPIO4_P_MASK (0x1 << 9) | ||
1416 | #define RT5677_GPIO4_P_SFT 9 | ||
1417 | #define RT5677_GPIO4_P_NOR (0x0 << 9) | ||
1418 | #define RT5677_GPIO4_P_INV (0x1 << 9) | ||
1419 | #define RT5677_GPIO3_DIR_MASK (0x1 << 8) | ||
1420 | #define RT5677_GPIO3_DIR_SFT 8 | ||
1421 | #define RT5677_GPIO3_DIR_IN (0x0 << 8) | ||
1422 | #define RT5677_GPIO3_DIR_OUT (0x1 << 8) | ||
1423 | #define RT5677_GPIO3_OUT_MASK (0x1 << 7) | ||
1424 | #define RT5677_GPIO3_OUT_SFT 7 | ||
1425 | #define RT5677_GPIO3_OUT_LO (0x0 << 7) | ||
1426 | #define RT5677_GPIO3_OUT_HI (0x1 << 7) | ||
1427 | #define RT5677_GPIO3_P_MASK (0x1 << 6) | ||
1428 | #define RT5677_GPIO3_P_SFT 6 | ||
1429 | #define RT5677_GPIO3_P_NOR (0x0 << 6) | ||
1430 | #define RT5677_GPIO3_P_INV (0x1 << 6) | ||
1431 | #define RT5677_GPIO2_DIR_MASK (0x1 << 5) | ||
1432 | #define RT5677_GPIO2_DIR_SFT 5 | ||
1433 | #define RT5677_GPIO2_DIR_IN (0x0 << 5) | ||
1434 | #define RT5677_GPIO2_DIR_OUT (0x1 << 5) | ||
1435 | #define RT5677_GPIO2_OUT_MASK (0x1 << 4) | ||
1436 | #define RT5677_GPIO2_OUT_SFT 4 | ||
1437 | #define RT5677_GPIO2_OUT_LO (0x0 << 4) | ||
1438 | #define RT5677_GPIO2_OUT_HI (0x1 << 4) | ||
1439 | #define RT5677_GPIO2_P_MASK (0x1 << 3) | ||
1440 | #define RT5677_GPIO2_P_SFT 3 | ||
1441 | #define RT5677_GPIO2_P_NOR (0x0 << 3) | ||
1442 | #define RT5677_GPIO2_P_INV (0x1 << 3) | ||
1443 | #define RT5677_GPIO1_DIR_MASK (0x1 << 2) | ||
1444 | #define RT5677_GPIO1_DIR_SFT 2 | ||
1445 | #define RT5677_GPIO1_DIR_IN (0x0 << 2) | ||
1446 | #define RT5677_GPIO1_DIR_OUT (0x1 << 2) | ||
1447 | #define RT5677_GPIO1_OUT_MASK (0x1 << 1) | ||
1448 | #define RT5677_GPIO1_OUT_SFT 1 | ||
1449 | #define RT5677_GPIO1_OUT_LO (0x0 << 1) | ||
1450 | #define RT5677_GPIO1_OUT_HI (0x1 << 1) | ||
1451 | #define RT5677_GPIO1_P_MASK (0x1 << 0) | ||
1452 | #define RT5677_GPIO1_P_SFT 0 | ||
1453 | #define RT5677_GPIO1_P_NOR (0x0 << 0) | ||
1454 | #define RT5677_GPIO1_P_INV (0x1 << 0) | ||
1455 | |||
1456 | /* GPIO Control 3 (0xc2) */ | ||
1457 | #define RT5677_GPIO6_DIR_MASK (0x1 << 2) | ||
1458 | #define RT5677_GPIO6_DIR_SFT 2 | ||
1459 | #define RT5677_GPIO6_DIR_IN (0x0 << 2) | ||
1460 | #define RT5677_GPIO6_DIR_OUT (0x1 << 2) | ||
1461 | #define RT5677_GPIO6_OUT_MASK (0x1 << 1) | ||
1462 | #define RT5677_GPIO6_OUT_SFT 1 | ||
1463 | #define RT5677_GPIO6_OUT_LO (0x0 << 1) | ||
1464 | #define RT5677_GPIO6_OUT_HI (0x1 << 1) | ||
1465 | #define RT5677_GPIO6_P_MASK (0x1 << 0) | ||
1466 | #define RT5677_GPIO6_P_SFT 0 | ||
1467 | #define RT5677_GPIO6_P_NOR (0x0 << 0) | ||
1468 | #define RT5677_GPIO6_P_INV (0x1 << 0) | ||
1370 | 1469 | ||
1371 | /* Virtual DSP Mixer Control (0xf7 0xf8 0xf9) */ | 1470 | /* Virtual DSP Mixer Control (0xf7 0xf8 0xf9) */ |
1372 | #define RT5677_DSP_IB_01_H (0x1 << 15) | 1471 | #define RT5677_DSP_IB_01_H (0x1 << 15) |
@@ -1428,6 +1527,16 @@ enum { | |||
1428 | RT5677_AIFS, | 1527 | RT5677_AIFS, |
1429 | }; | 1528 | }; |
1430 | 1529 | ||
1530 | enum { | ||
1531 | RT5677_GPIO1, | ||
1532 | RT5677_GPIO2, | ||
1533 | RT5677_GPIO3, | ||
1534 | RT5677_GPIO4, | ||
1535 | RT5677_GPIO5, | ||
1536 | RT5677_GPIO6, | ||
1537 | RT5677_GPIO_NUM, | ||
1538 | }; | ||
1539 | |||
1431 | struct rt5677_priv { | 1540 | struct rt5677_priv { |
1432 | struct snd_soc_codec *codec; | 1541 | struct snd_soc_codec *codec; |
1433 | struct rt5677_platform_data pdata; | 1542 | struct rt5677_platform_data pdata; |
@@ -1441,6 +1550,9 @@ struct rt5677_priv { | |||
1441 | int pll_src; | 1550 | int pll_src; |
1442 | int pll_in; | 1551 | int pll_in; |
1443 | int pll_out; | 1552 | int pll_out; |
1553 | #ifdef CONFIG_GPIOLIB | ||
1554 | struct gpio_chip gpio_chip; | ||
1555 | #endif | ||
1444 | }; | 1556 | }; |
1445 | 1557 | ||
1446 | #endif /* __RT5677_H__ */ | 1558 | #endif /* __RT5677_H__ */ |