mfd: Add Rockchip rk817 audio CODEC support
Subsystems (5)
PATCH v7 1/4 mfd: Add Rockchip rk817 audio CODEC support
From: Chris Morgan <[email protected]>
Add rk817 codec support cell to rk808 mfd driver.
---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions from rk817_codec.h to main rk808.h register definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removed of_compatible from mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Created set_pll() call.
- Created user visible gain control in mic.
- Check for return value of clk_prepare_enable().
- Removed duplicate clk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs.
drivers/mfd/rk808.c | 85 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/rk808.h | 81 +++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+)
drivers/mfd/rk808.c +85 -0
@@ -65,6 +65,7 @@ static bool rk817_is_volatile_reg(struct device *dev, unsigned int reg)switch (reg) { case RK817_SECONDS_REG ... RK817_WEEKS_REG:case RK817_RTC_STATUS_REG : +case RK817_CODEC_DTOP_LPT_SRST :case RK817_INT_STS_REG0 :case RK817_INT_STS_REG1 :case RK817_INT_STS_REG2 :
@@ -163,6 +164,11 @@ static const struct mfd_cell rk817s[] = { .num_resources = ARRAY_SIZE(rk817_rtc_resources), .resources = &rk817_rtc_resources[0], }, +#ifdef CONFIG_SND_SOC_RK817 + { + .name = "rk817-codec", + }, +#endif }; static const struct mfd_cell rk818s[] = {
@@ -201,6 +207,85 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = {static const struct rk808_reg_data rk817_pre_init_reg[] = { {RK817_RTC_CTRL_REG ,RTC_STOP ,RTC_STOP }, +/* Codec specific registers */ + {RK817_CODEC_DTOP_VUCTL ,MASK_ALL ,0x03 }, + {RK817_CODEC_DTOP_VUCTIME ,MASK_ALL ,0x00 }, + {RK817_CODEC_DTOP_LPT_SRST ,MASK_ALL ,0x00 }, + {RK817_CODEC_DTOP_DIGEN_CLKE ,MASK_ALL ,0x00 }, +/* from vendor driver, CODEC_AREF_RTCFG0 not defined in data sheet */ + {RK817_CODEC_AREF_RTCFG0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_AREF_RTCFG1 ,MASK_ALL ,0x06 }, + {RK817_CODEC_AADC_CFG0 ,MASK_ALL ,0xc8 }, +/* from vendor driver, CODEC_AADC_CFG1 not defined in data sheet */ + {RK817_CODEC_AADC_CFG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_VOLL ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_VOLR ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_SR_ACL0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_ALC1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_ALC2 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_NG ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_HPF ,MASK_ALL ,0x00 }, + {RK817_CODEC_DADC_RVOLL ,MASK_ALL ,0xff }, + {RK817_CODEC_DADC_RVOLR ,MASK_ALL ,0xff }, + {RK817_CODEC_AMIC_CFG0 ,MASK_ALL ,0x70 }, + {RK817_CODEC_AMIC_CFG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_PGA_GAIN ,MASK_ALL ,0x66 }, + {RK817_CODEC_DMIC_LMT1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_LMT2 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_NG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_NG2 ,MASK_ALL ,0x00 }, +/* from vendor driver, CODEC_ADAC_CFG0 not defined in data sheet */ + {RK817_CODEC_ADAC_CFG0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_ADAC_CFG1 ,MASK_ALL ,0x07 }, + {RK817_CODEC_DDAC_POPD_DACST ,MASK_ALL ,0x82 }, + {RK817_CODEC_DDAC_VOLL ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_VOLR ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_SR_LMT0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_LMT1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_LMT2 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_MUTE_MIXCTL ,MASK_ALL ,0xa0 }, + {RK817_CODEC_DDAC_RVOLL ,MASK_ALL ,0xff }, + {RK817_CODEC_DADC_RVOLR ,MASK_ALL ,0xff }, + {RK817_CODEC_AMIC_CFG0 ,MASK_ALL ,0x70 }, + {RK817_CODEC_AMIC_CFG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_PGA_GAIN ,MASK_ALL ,0x66 }, + {RK817_CODEC_DMIC_LMT1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_LMT2 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_NG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DMIC_NG2 ,MASK_ALL ,0x00 }, +/* from vendor driver, CODEC_ADAC_CFG0 not defined in data sheet */ + {RK817_CODEC_ADAC_CFG0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_ADAC_CFG1 ,MASK_ALL ,0x07 }, + {RK817_CODEC_DDAC_POPD_DACST ,MASK_ALL ,0x82 }, + {RK817_CODEC_DDAC_VOLL ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_VOLR ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_SR_LMT0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_LMT1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_LMT2 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DDAC_MUTE_MIXCTL ,MASK_ALL ,0xa0 }, + {RK817_CODEC_DDAC_RVOLL ,MASK_ALL ,0xff }, + {RK817_CODEC_DDAC_RVOLR ,MASK_ALL ,0xff }, + {RK817_CODEC_AHP_ANTI0 ,MASK_ALL ,0x00 }, + {RK817_CODEC_AHP_ANTI1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_AHP_CFG0 ,MASK_ALL ,0xe0 }, + {RK817_CODEC_AHP_CFG1 ,MASK_ALL ,0x1f }, + {RK817_CODEC_AHP_CP ,MASK_ALL ,0x09 }, + {RK817_CODEC_ACLASSD_CFG1 ,MASK_ALL ,0x69 }, + {RK817_CODEC_ACLASSD_CFG2 ,MASK_ALL ,0x44 }, + {RK817_CODEC_APLL_CFG0 ,MASK_ALL ,0x04 }, + {RK817_CODEC_APLL_CFG1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_APLL_CFG2 ,MASK_ALL ,0x30 }, + {RK817_CODEC_APLL_CFG3 ,MASK_ALL ,0x19 }, + {RK817_CODEC_APLL_CFG4 ,MASK_ALL ,0x65 }, + {RK817_CODEC_APLL_CFG5 ,MASK_ALL ,0x01 }, + {RK817_CODEC_DI2S_CKM ,MASK_ALL ,0x01 }, + {RK817_CODEC_DI2S_RSD ,MASK_ALL ,0x00 }, + {RK817_CODEC_DI2S_RXCR1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DI2S_RXCR2 ,MASK_ALL ,0x17 }, + {RK817_CODEC_DI2S_RXCMD_TSD ,MASK_ALL ,0x00 }, + {RK817_CODEC_DI2S_TXCR1 ,MASK_ALL ,0x00 }, + {RK817_CODEC_DI2S_TXCR2 ,MASK_ALL ,0x17 }, + {RK817_CODEC_DI2S_TXCR3_TXCMD ,MASK_ALL ,0x00 }, {RK817_GPIO_INT_CFG ,RK817_INT_POL_MSK ,RK817_INT_POL_L }, {RK817_SYS_CFG (1 ),RK817_HOTDIE_TEMP_MSK |RK817_TSD_TEMP_MSK ,RK817_HOTDIE_105 |RK817_TSD_140 },
include/linux/mfd/rk808.h +81 -0
87 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v7 2/4 ASoC: Add Rockchip rk817 audio CODEC support
From: Chris Morgan <[email protected]>
Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel.
---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions from rk817_codec.h to main rk808.h register definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removed of_compatible from mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Created set_pll() call.
- Created user visible gain control in mic.
- Check for return value of clk_prepare_enable().
- Removed duplicate clk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs.
sound/soc/codecs/Kconfig | 6 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rk817_codec.c | 560 +++++++++++++++++++++++++++++++++ 3 files changed, 568 insertions(+) create mode 100644 sound/soc/codecs/rk817_codec.c
sound/soc/codecs/Kconfig +6 -0
@@ -155,6 +155,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_PCM512x_I2C imply SND_SOC_PCM512x_SPI imply SND_SOC_RK3328 + imply SND_SOC_RK817 imply SND_SOC_RT274 imply SND_SOC_RT286 imply SND_SOC_RT298
@@ -1058,6 +1059,11 @@ config SND_SOC_RK3328 tristate "Rockchip RK3328 audio CODEC" select REGMAP_MMIO +config SND_SOC_RK817 + tristate "Rockchip RK817 audio CODEC" + depends on MFD_RK808 + select REGMAP_I2C + config SND_SOC_RL6231 tristate default y if SND_SOC_RT5514=y
sound/soc/codecs/Makefile +2 -0
@@ -165,6 +165,7 @@ snd-soc-pcm512x-objs := pcm512x.o snd-soc-pcm512x-i2c-objs := pcm512x-i2c.o snd-soc-pcm512x-spi-objs := pcm512x-spi.o snd-soc-rk3328-objs := rk3328_codec.o +snd-soc-rk817-objs := rk817_codec.o snd-soc-rl6231-objs := rl6231.o snd-soc-rl6347a-objs := rl6347a.o snd-soc-rt1011-objs := rt1011.o
@@ -479,6 +480,7 @@ obj-$(CONFIG_SND_SOC_PCM512x) += snd-soc-pcm512x.o obj-$(CONFIG_SND_SOC_PCM512x_I2C) += snd-soc-pcm512x-i2c.o obj-$(CONFIG_SND_SOC_PCM512x_SPI) += snd-soc-pcm512x-spi.o obj-$(CONFIG_SND_SOC_RK3328) += snd-soc-rk3328.o +obj-$(CONFIG_SND_SOC_RK817) += snd-soc-rk817.o obj-$(CONFIG_SND_SOC_RL6231) += snd-soc-rl6231.o obj-$(CONFIG_SND_SOC_RL6347A) += snd-soc-rl6347a.o obj-$(CONFIG_SND_SOC_RT1011) += snd-soc-rt1011.o
sound/soc/codecs/rk817_codec.c new file +560 -0
560 lines not on this page · raw message
Signature · 1 line
2.25.1
Mark Brown
maintainerRe: [v7 2/4] ASoC: Add Rockchip rk817 audio CODEC support
Quoted 8 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add support for the Rockchip rk817 audio codec integrated into the rk817 PMIC. This is based on the sources provided by Rockchip from their BSP kernel.
Signed-off-by Chris Morgan <[email protected]>---
If you've not made substantial changes to a patch you should carry forwards any tags you've got when resending so reviewers know they don't need to do things again.
kernel test robot
build botRe: [v7 2/4] ASoC: Add Rockchip rk817 audio CODEC support
In reply to Chris MorganThank you for the patch! Yet something to improve:
Hi Chris,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on asoc/for-next]
[also build test ERROR on lee-mfd/for-mfd-next sound/for-next v5.12-rc8 next-20210420] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Chris-Morgan/mfd-Add-Rockchip-rk817-audio-CODEC-support/20210421-000916 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: m68k-allmodconfig (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/438ec6f1ceec6d4d7cde8169bc80110102e6a396
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chris-Morgan/mfd-Add-Rockchip-rk817-audio-CODEC-support/20210421-000916 git checkout 438ec6f1ceec6d4d7cde8169bc80110102e6a396
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
sound/soc/codecs/rk817_codec.c: In function 'rk817_probe':
sound/soc/codecs/rk817_codec.c:418:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
418 | int ret;
| ^~~
In file included from include/linux/bpf.h:19,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/linux/memcontrol.h:13,
from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from include/linux/regulator/consumer.h:35,
from include/linux/regulator/machine.h:15,
from include/linux/mfd/rk808.h:18,
from sound/soc/codecs/rk817_codec.c:10:
sound/soc/codecs/rk817_codec.c: At top level:
>> sound/soc/codecs/rk817_codec.c:546:25: error: 'rk817_codec_dt_ids' undeclared here (not in a function); did you mean 'rk817_codec_priv'?
546 | MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);
| ^~~~~~~~~~~~~~~~~~
include/linux/module.h:238:15: note: in definition of macro 'MODULE_DEVICE_TABLE'
238 | extern typeof(name) __mod_##type##__##name##_device_table \
| ^~~~
>> include/linux/module.h:238:21: error: '__mod_of__rk817_codec_dt_ids_device_table' aliased to undefined symbol 'rk817_codec_dt_ids'
238 | extern typeof(name) __mod_##type##__##name##_device_table \
| ^~~~~~
sound/soc/codecs/rk817_codec.c:546:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
546 | MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);
| ^~~~~~~~~~~~~~~~~~~vim +546 sound/soc/codecs/rk817_codec.c
545
> 546 MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);
547
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [v7 2/4] ASoC: Add Rockchip rk817 audio CODEC support
In reply to Chris MorganThank you for the patch! Yet something to improve:
Hi Chris,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on asoc/for-next]
[also build test ERROR on lee-mfd/for-mfd-next sound/for-next v5.12-rc8 next-20210420] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Chris-Morgan/mfd-Add-Rockchip-rk817-audio-CODEC-support/20210421-000916 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: nds32-randconfig-r004-20210420 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/438ec6f1ceec6d4d7cde8169bc80110102e6a396
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chris-Morgan/mfd-Add-Rockchip-rk817-audio-CODEC-support/20210421-000916 git checkout 438ec6f1ceec6d4d7cde8169bc80110102e6a396
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
sound/soc/codecs/rk817_codec.c: In function 'rk817_probe':
>> sound/soc/codecs/rk817_codec.c:418:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
418 | int ret;
| ^~~
In file included from include/linux/bpf.h:19,
from include/linux/bpf-cgroup.h:5,
from include/linux/cgroup-defs.h:22,
from include/linux/cgroup.h:28,
from include/linux/memcontrol.h:13,
from include/linux/swap.h:9,
from include/linux/suspend.h:5,
from include/linux/regulator/consumer.h:35,
from include/linux/regulator/machine.h:15,
from include/linux/mfd/rk808.h:18,
from sound/soc/codecs/rk817_codec.c:10:
sound/soc/codecs/rk817_codec.c: At top level:
>> sound/soc/codecs/rk817_codec.c:546:25: error: 'rk817_codec_dt_ids' undeclared here (not in a function); did you mean 'rk817_codec_priv'?
546 | MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);
| ^~~~~~~~~~~~~~~~~~
include/linux/module.h:238:15: note: in definition of macro 'MODULE_DEVICE_TABLE'
238 | extern typeof(name) __mod_##type##__##name##_device_table \
| ^~~~
>> include/linux/module.h:238:21: error: '__mod_of__rk817_codec_dt_ids_device_table' aliased to undefined symbol 'rk817_codec_dt_ids'
238 | extern typeof(name) __mod_##type##__##name##_device_table \
| ^~~~~~
sound/soc/codecs/rk817_codec.c:546:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
546 | MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);
| ^~~~~~~~~~~~~~~~~~~vim +546 sound/soc/codecs/rk817_codec.c
413
414 static int rk817_probe(struct snd_soc_component *component)
415 {
416 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component);
417 struct rk808 *rk808 = dev_get_drvdata(component->dev->parent);
> 418 int ret;
419
420 snd_soc_component_init_regmap(component, rk808->regmap);
421 rk817->component = component;
422
423 ret = snd_soc_component_write(component, RK817_CODEC_DTOP_LPT_SRST, 0x40);
424
425 rk817_init(component);
426
427 /* setting initial pll values so that we can continue to leverage simple-audio-card.
428 * The values aren't important since no parameters are used.
429 */
430
431 snd_soc_component_set_pll(component, 0, 0, 0, 0);
432
433 return 0;
434 }
435
436 static void rk817_remove(struct snd_soc_component *component)
437 {
438 snd_soc_component_exit_regmap(component);
439 }
440
441 static const struct snd_soc_component_driver soc_codec_dev_rk817 = {
442 .probe = rk817_probe,
443 .remove = rk817_remove,
444 .idle_bias_on = 1,
445 .use_pmdown_time = 1,
446 .endianness = 1,
447 .non_legacy_dai_naming = 1,
448 .controls = rk817_volume_controls,
449 .num_controls = ARRAY_SIZE(rk817_volume_controls),
450 .dapm_routes = rk817_dapm_routes,
451 .num_dapm_routes = ARRAY_SIZE(rk817_dapm_routes),
452 .dapm_widgets = rk817_dapm_widgets,
453 .num_dapm_widgets = ARRAY_SIZE(rk817_dapm_widgets),
454 .set_pll = rk817_set_component_pll,
455 };
456
457 static int rk817_codec_parse_dt_property(struct device *dev,
458 struct rk817_codec_priv *rk817)
459 {
460 struct device_node *node = dev->parent->of_node;
461
462 if (!node) {
463 dev_err(dev, "%s() dev->parent->of_node is NULL\n",
464 __func__);
465 return -ENODEV;
466 }
467
468 node = of_get_child_by_name(dev->parent->of_node, "codec");
469 if (!node) {
470 dev_err(dev, "%s() Can not get child: codec\n",
471 __func__);
472 return -ENODEV;
473 }
474
475 rk817->mic_in_differential =
476 of_property_read_bool(node, "mic-in-differential");
477
478 return 0;
479 }
480
481 static int rk817_platform_probe(struct platform_device *pdev)
482 {
483 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
484 struct rk817_codec_priv *rk817_codec_data;
485 int ret;
486
487 if (!rk808) {
488 dev_err(&pdev->dev, "%s : rk817 is NULL\n", __func__);
489 return -EINVAL;
490 }
491
492 rk817_codec_data = devm_kzalloc(&pdev->dev,
493 sizeof(struct rk817_codec_priv),
494 GFP_KERNEL);
495 if (!rk817_codec_data)
496 return -ENOMEM;
497
498 platform_set_drvdata(pdev, rk817_codec_data);
499
500 rk817_codec_data->rk808 = rk808;
501
502 ret = rk817_codec_parse_dt_property(&pdev->dev, rk817_codec_data);
503 if (ret < 0) {
504 dev_err(&pdev->dev, "%s() parse device tree property error %d\n",
505 __func__, ret);
506 goto err_;
507 }
508
509 rk817_codec_data->mclk = clk_get(pdev->dev.parent, "mclk");
510 if (IS_ERR(rk817_codec_data->mclk)) {
511 dev_err(&pdev->dev, "Unable to get mclk\n");
512 ret = -ENXIO;
513 goto err_;
514 }
515
516 ret = clk_prepare_enable(rk817_codec_data->mclk);
517 if (ret < 0) {
518 dev_err(&pdev->dev, "%s() clock prepare error %d\n",
519 __func__, ret);
520 goto err_;
521 }
522
523 ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk817,
524 rk817_dai, ARRAY_SIZE(rk817_dai));
525 if (ret < 0) {
526 dev_err(&pdev->dev, "%s() register codec error %d\n",
527 __func__, ret);
528 goto err_;
529 }
530
531 return 0;
532 err_:
533
534 return ret;
535 }
536
537 static int rk817_platform_remove(struct platform_device *pdev)
538 {
539 struct rk817_codec_priv *rk817 = platform_get_drvdata(pdev);
540
541 clk_disable_unprepare(rk817->mclk);
542
543 return 0;
544 }
545
> 546 MODULE_DEVICE_TABLE(of, rk817_codec_dt_ids);547
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v7 3/4 dt-bindings: Add Rockchip rk817 audio CODEC support
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Create dt-binding documentation to document rk817 codec.
---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions from rk817_codec.h to main rk808.h register definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removed of_compatible from mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Created set_pll() call.
- Created user visible gain control in mic.
- Check for return value of clk_prepare_enable().
- Removed duplicate clk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs.
.../devicetree/bindings/mfd/rk808.txt | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+)
Documentation/devicetree/bindings/mfd/rk808.txt +181 -0
@@ -63,6 +63,11 @@ Optional RK809 properties: - vcc9-supply: The input supply for DCDC_REG5, SWITCH_REG2 Optional RK817 properties: +- clocks: The input clock for the audio codec +- clock-names: The clock name for the codec clock. Should be "mclk". +- codec: The child node for the codec to hold additional properties. +- mic-in-differential: Telling if the microphone uses differential mode. Should + be under the codec child node. - vcc8-supply: The input supply for BOOST - vcc9-supply: The input supply for OTG_SWITCH
@@ -275,3 +280,179 @@ Example: }; }; }; + + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + interrupt-parent = <&gpio0>; + interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; + wakeup-source; + #clock-cells = <1>; + #sound-dai-cells = <0>; + + vcc1-supply = <&vccsys>; + vcc2-supply = <&vccsys>; + vcc3-supply = <&vccsys>; + vcc4-supply = <&vccsys>; + vcc5-supply = <&vccsys>; + vcc6-supply = <&vccsys>; + vcc7-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-name = "vcc_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-name = "vcc_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-name = "vdd_1v0"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-name = "vcc3v3_pmu"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-name = "vcc_bl"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-name = "vcc_lcd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc_cam: LDO_REG9 { + regulator-name = "vcc_cam"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + }; + rk817_codec: codec { + mic-in-differential; + }; + };
Signature · 1 line
2.25.1
Re: [v7 3/4] dt-bindings: Add Rockchip rk817 audio CODEC support
Hi Chris,
Some comments. Have a look if they are useful.
Quoted 45 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Create dt-binding documentation to document rk817 codec.
Signed-off-by Chris Morgan <[email protected]>---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions fromrk817_codec.hto mainrk808.hregister definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removedof_compatiblefrom mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Createdset_pll()call.
- Created user visible gain control in mic.
- Check for return value ofclk_prepare_enable().
- Removed duplicateclk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs..../devicetree/bindings/mfd/rk808.txt | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+)Documentation/devicetree/bindings/mfd/rk808.txt +0
-0
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 67
Quoted 5 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0@@ -63,6 +63,11 @@ Optional RK809 properties: - vcc9-supply: The input supply for DCDC_REG5, SWITCH_REG2 Optional RK817 properties: +- clocks: The input clock for the audio codec +- clock-names: The clock name for the codec clock. Should be "mclk".
#sound-dai-cells:
Needed for the interpretation of sound dais.
Should be 0.
Add empty line
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 68
Quoted 1 line
Documentation/devicetree/bindings/mfd/rk808.txt +1
-0+- codec: The child node for the codec to hold additional properties.
This is a nodename and not a property. Add below "vcc9-supply".
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 70
Quoted 2 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+- mic-in-differential: Telling if the microphone uses differential mode. Should + be under the codec child node.
This goes in a subnode. Maybe add indent a bit? "mic-in-differential" is a property specific for Rockchip.
Ask rob+dt for exact name.
Maybe this has to change to "rockchip,mic-in-differential" Update code as well!
Add new added property names explicit in your commit message, so rob+dt can review more easy.
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 282
Quoted 7 lines
Documentation/devicetree/bindings/mfd/rk808.txt +0
-0- vcc8-supply: The input supply for BOOST - vcc9-supply: The input supply for OTG_SWITCH@@ -275,3 +280,179 @@ Example: }; }; };
Maybe add separator/title?
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 287
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rk808.txt +5
-0+ + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + interrupt-parent = <&gpio0>;
Missing in properties.
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 294
Quoted 8 lines
Documentation/devicetree/bindings/mfd/rk808.txt +7
-0+ interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; + wakeup-source;
Missing in properties.
Is this common for all rkXXX?
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 296
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ #clock-cells = <1>; + #sound-dai-cells = <0>;
Missing in properties.
Quoted 148 lines
Documentation/devicetree/bindings/mfd/rk808.txt +148
-0+ + vcc1-supply = <&vccsys>; + vcc2-supply = <&vccsys>; + vcc3-supply = <&vccsys>; + vcc4-supply = <&vccsys>; + vcc5-supply = <&vccsys>; + vcc6-supply = <&vccsys>; + vcc7-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-name = "vcc_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-name = "vcc_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-name = "vdd_1v0"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-name = "vcc3v3_pmu"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-name = "vcc_bl"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-name = "vcc_lcd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc_cam: LDO_REG9 {
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 454
Quoted 10 lines
Documentation/devicetree/bindings/mfd/rk808.txt +10
-0+ regulator-name = "vcc_cam"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + };
Add empty line, like the rest.
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 456
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ rk817_codec: codec { + mic-in-differential;
See comment above.
rockchip,mic-in-differential ??
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ }; + };
Re: [v7 3/4] dt-bindings: Add Rockchip rk817 audio CODEC support
Quoted 52 lines · Johan Jonker
Hi Chris,
Some comments. Have a look if they are useful.
Quoted 47 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Create dt-binding documentation to document rk817 codec.
Signed-off-by Chris Morgan <[email protected]>---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions fromrk817_codec.hto mainrk808.hregister definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removedof_compatiblefrom mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Createdset_pll()call.
- Created user visible gain control in mic.
- Check for return value ofclk_prepare_enable().
- Removed duplicateclk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs..../devicetree/bindings/mfd/rk808.txt | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+)Documentation/devicetree/bindings/mfd/rk808.txt +0
-0@@ -63,6 +63,11 @@ Optional RK809 properties: - vcc9-supply: The input supply for DCDC_REG5, SWITCH_REG2
Quoted 8 lines
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 67
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0Optional RK817 properties: +- clocks: The input clock for the audio codec +- clock-names: The clock name for the codec clock. Should be "mclk".#sound-dai-cells:
Needed for the interpretation of sound dais.
Should be 0.
Will add, thank you.
Quoted 7 lines
Add empty line
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 68
Quoted 1 line
Documentation/devicetree/bindings/mfd/rk808.txt +1
-0+- codec: The child node for the codec to hold additional properties.This is a nodename and not a property. Add below "vcc9-supply".
Will change, thank you.
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rk808.txt Optional RK809 properties: · line 70
Quoted 2 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+- mic-in-differential: Telling if the microphone uses differential mode. Should + be under the codec child node.This goes in a subnode. Maybe add indent a bit? "mic-in-differential" is a property specific for Rockchip.
I've moved it after the codec description to hopefully clarify that its position.
Quoted 4 lines
Ask rob+dt for exact name.
Maybe this has to change to "rockchip,mic-in-differential" Update code as well!
Will do.
Quoted 14 lines
Add new added property names explicit in your commit message, so rob+dt can review more easy.
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 282
Quoted 7 lines
Documentation/devicetree/bindings/mfd/rk808.txt +0
-0- vcc8-supply: The input supply for BOOST - vcc9-supply: The input supply for OTG_SWITCH@@ -275,3 +280,179 @@ Example: }; }; };Maybe add separator/title?
Quoted 9 lines
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 287
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rk808.txt +5
-0+ + rk817: pmic@20 { + compatible = "rockchip,rk817"; + reg = <0x20>; + interrupt-parent = <&gpio0>;Missing in properties.
This one was tricky; I honestly am not 100% sure but I think it's a required property. I added it to the required properties as I see it used on every implementation for this chip.
Quoted 7 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rk808.txt +6
-0+ interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>;
Quoted 5 lines
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 294
Quoted 1 line
Documentation/devicetree/bindings/mfd/rk808.txt +1
-0+ wakeup-source;Missing in properties.
Is this common for all rkXXX?
I don't think this is common for all, I believe it is optional for some. If I am not mistaken this is because there is a button connected to the PMIC that is used to wake/suspend/poweron/poweroff the device. I put it under optional for now as I'm not sure if every device has this or not.
Quoted 5 lines
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 296
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ #clock-cells = <1>; + #sound-dai-cells = <0>;Missing in properties.
Will fix.
Quoted 153 lines
Quoted 153 lines
Documentation/devicetree/bindings/mfd/rk808.txt +152
-0+ + vcc1-supply = <&vccsys>; + vcc2-supply = <&vccsys>; + vcc3-supply = <&vccsys>; + vcc4-supply = <&vccsys>; + vcc5-supply = <&vccsys>; + vcc6-supply = <&vccsys>; + vcc7-supply = <&vccsys>; + + regulators { + vdd_logic: DCDC_REG1 { + regulator-name = "vdd_logic"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1150000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vdd_arm: DCDC_REG2 { + regulator-name = "vdd_arm"; + regulator-min-microvolt = <950000>; + regulator-max-microvolt = <1350000>; + regulator-ramp-delay = <6001>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <950000>; + }; + }; + + vcc_ddr: DCDC_REG3 { + regulator-name = "vcc_ddr"; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + }; + }; + + vcc_3v3: DCDC_REG4 { + regulator-name = "vcc_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_1v8: LDO_REG2 { + regulator-name = "vcc_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1800000>; + }; + }; + + vdd_1v0: LDO_REG3 { + regulator-name = "vdd_1v0"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1000000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <1000000>; + }; + }; + + vcc3v3_pmu: LDO_REG4 { + regulator-name = "vcc3v3_pmu"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vccio_sd: LDO_REG5 { + regulator-name = "vccio_sd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_sd: LDO_REG6 { + regulator-name = "vcc_sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + + regulator-state-mem { + regulator-on-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_bl: LDO_REG7 { + regulator-name = "vcc_bl"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3300000>; + }; + }; + + vcc_lcd: LDO_REG8 { + regulator-name = "vcc_lcd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + + regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <2800000>; + }; + }; + + vcc_cam: LDO_REG9 { + regulator-name = "vcc_cam"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; +
Quoted 9 lines
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 454
Quoted 6 lines
Documentation/devicetree/bindings/mfd/rk808.txt +6
-0+ regulator-state-mem { + regulator-off-in-suspend; + regulator-suspend-microvolt = <3000000>; + }; + }; + };Add empty line, like the rest.
My mistake, will fix.
Quoted 11 lines
Documentation/devicetree/bindings/mfd/rk808.txt Example: · line 456
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ rk817_codec: codec { + mic-in-differential;See comment above.
rockchip,mic-in-differential ??Documentation/devicetree/bindings/mfd/rk808.txt
Quoted 3 lines
Documentation/devicetree/bindings/mfd/rk808.txt +2
-0+ }; + };
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v7 4/4 arm64: dts: rockchip: add rk817 codec to Odroid Go
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Add the new rk817 codec driver to the Odroid Go Advance.
---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions from rk817_codec.h to main rk808.h register definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removed of_compatible from mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Created set_pll() call.
- Created user visible gain control in mic.
- Check for return value of clk_prepare_enable().
- Removed duplicate clk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs.
.../boot/dts/rockchip/rk3326-odroid-go2.dts | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +34 -2
@@ -161,6 +161,29 @@ blue_led: led-0 { }; }; + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk817-codec"; + simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>; + simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + }; + simple-audio-card,codec { + sound-dai = <&rk817>; + }; + }; + vccsys: vccsys { compatible = "regulator-fixed"; regulator-name = "vcc3v8_sys";
@@ -265,11 +288,14 @@ rk817: pmic@20 { reg = <0x20>; interrupt-parent = <&gpio0>; interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; pinctrl-names = "default"; - pinctrl-0 = <&pmic_int>; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; wakeup-source; #clock-cells = <1>; - clock-output-names = "rk808-clkout1", "xin32k"; + #sound-dai-cells = <0>; vcc1-supply = <&vccsys>; vcc2-supply = <&vccsys>;
@@ -428,6 +454,10 @@ regulator-state-mem { }; }; }; + + rk817_codec: codec { + mic-in-differential; + }; }; };
@@ -439,6 +469,8 @@ &i2c1 { /* I2S 1 Channel Used */ &i2s1_2ch { + resets = <&cru SRST_I2S1>, <&cru SRST_I2S1_H>; + reset-names = "reset-m", "reset-h"; status = "okay"; };
Signature · 1 line
2.25.1
Re: [v7 4/4] arm64: dts: rockchip: add rk817 codec to Odroid Go
Quoted 45 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add the new rk817 codec driver to the Odroid Go Advance.
Signed-off-by Chris Morgan <[email protected]>---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions fromrk817_codec.hto mainrk808.hregister definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removedof_compatiblefrom mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Createdset_pll()call.
- Created user visible gain control in mic.
- Check for return value ofclk_prepare_enable().
- Removed duplicateclk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs..../boot/dts/rockchip/rk3326-odroid-go2.dts | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +0
-0
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 168
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +4
-0@@ -161,6 +161,29 @@ blue_led: led-0 { }; }; + rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk817-codec";
"simple-audio-card,name" is an exception to the Heiko's sort rules. Move above all other "simple-audio-card" properties.
===
"rockchip,rk817-codec" is too long for the "aplay -l" command. Maybe keep it in line with other boards
?? "Analog" ??
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 178
Quoted 11 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +11
-0+ simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;
Add empty line between nodes.
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 181
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +3
-0+ simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + };
Add empty line between nodes.
Quoted 26 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +5
-0+ simple-audio-card,codec { + sound-dai = <&rk817>; + }; + }; + vccsys: vccsys { compatible = "regulator-fixed";arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +5
-2regulator-name = "vcc3v8_sys";@@ -265,11 +288,14 @@ rk817: pmic@20 { reg = <0x20>; interrupt-parent = <&gpio0>; interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; pinctrl-names = "default"; - pinctrl-0 = <&pmic_int>; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; wakeup-source; #clock-cells = <1>; - clock-output-names = "rk808-clkout1", "xin32k"; + #sound-dai-cells = <0>; vcc1-supply = <&vccsys>; vcc2-supply = <&vccsys>;
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts regulator-state-mem { · line 460
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +3
-0@@ -428,6 +454,10 @@ regulator-state-mem { }; }; }; + + rk817_codec: codec { + mic-in-differential;
This property name might have to change.
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts &i2c1 { · line 474
Quoted 11 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +3
-0+ }; }; };@@ -439,6 +469,8 @@ &i2c1 { /* I2S 1 Channel Used */ &i2s1_2ch { + resets = <&cru SRST_I2S1>, <&cru SRST_I2S1_H>; + reset-names = "reset-m", "reset-h";
Remove.
"resets" and "reset-names" have no support in mainline. See rockchip-i2s.yaml
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +0
-0status = "okay"; };
Re: [v7 4/4] arm64: dts: rockchip: add rk817 codec to Odroid Go
Quoted 49 lines · Johan Jonker
Quoted 48 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add the new rk817 codec driver to the Odroid Go Advance.
Signed-off-by Chris Morgan <[email protected]>---
Changes in v7:
- Removed ifdef around register definitions for MFD.
- Replaced codec documentation with updates to MFD documentation.
- Reordered elements in example to comply with upstream rules.
- Added binding update back for Odroid Go Advance as requested.
- Submitting patches from gmail now.
Changes in v6:
- Included additional project maintainers for correct subsystems.
- Removed unneeded compatible from DT documentation.
- Removed binding update for Odroid Go Advance (will do in seperate series).
Changes in v5:
- Move register definitions fromrk817_codec.hto mainrk808.hregister definitions.
- Add volatile register for codec bits.
- Add default values for codec bits.
- Removedof_compatiblefrom mtd driver (not necessary).
- Switched to using parent regmap instead of private regmap for codec.
Changes in v4:
- Createdset_pll()call.
- Created user visible gain control in mic.
- Check for return value ofclk_prepare_enable().
- Removed duplicateclk_prepare_enable().
- Split DT documentation to separate commit.
Changes in v3:
- Use DAPM macros to set audio path.
- Updated devicetree binding (as every rk817 has this codec chip).
- Changed documentation to yaml format.
- Split MFD changes to separate commit.
Changes in v2:
- Fixed audio path registers to solve some bugs..../boot/dts/rockchip/rk3326-odroid-go2.dts | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-)arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +0
-0@@ -161,6 +161,29 @@ blue_led: led-0 { }; };
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 167
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +4
-0+ rk817-sound { + compatible = "simple-audio-card"; + simple-audio-card,format = "i2s"; + simple-audio-card,name = "rockchip,rk817-codec";"simple-audio-card,name" is an exception to the Heiko's sort rules. Move above all other "simple-audio-card" properties.
Will do.
Quoted 8 lines
===
"rockchip,rk817-codec" is too long for the "aplay -l" command. Maybe keep it in line with other boards
?? "Analog" ??
I can do analog if you want, or maybe just rk817-codec? I notice that several boards (such as the pinebook pro) do have longish names (21 characters versus 20 for this board). Happy to change it though, your call.
Quoted 53 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 178
Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +11
-0+ simple-audio-card,mclk-fs = <256>; + simple-audio-card,widgets = + "Microphone", "Mic Jack", + "Headphone", "Headphones", + "Speaker", "Speaker"; + simple-audio-card,routing = + "MICL", "Mic Jack", + "Headphones", "HPOL", + "Headphones", "HPOR", + "Speaker", "SPKO"; + simple-audio-card,hp-det-gpio = <&gpio2 RK_PC6 GPIO_ACTIVE_HIGH>;Add empty line between nodes.
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts blue_led: led-0 { · line 181
Quoted 3 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +3
-0+ simple-audio-card,cpu { + sound-dai = <&i2s1_2ch>; + };Add empty line between nodes.
Quoted 31 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +5
-0+ simple-audio-card,codec { + sound-dai = <&rk817>; + }; + }; + vccsys: vccsys { compatible = "regulator-fixed";arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +7
-2regulator-name = "vcc3v8_sys";@@ -265,11 +288,14 @@ rk817: pmic@20 { reg = <0x20>; interrupt-parent = <&gpio0>; interrupts = <RK_PB2 IRQ_TYPE_LEVEL_LOW>; + clock-output-names = "rk808-clkout1", "xin32k"; + clock-names = "mclk"; + clocks = <&cru SCLK_I2S1_OUT>; pinctrl-names = "default"; - pinctrl-0 = <&pmic_int>; + pinctrl-0 = <&pmic_int>, <&i2s1_2ch_mclk>; wakeup-source; #clock-cells = <1>; - clock-output-names = "rk808-clkout1", "xin32k"; + #sound-dai-cells = <0>; vcc1-supply = <&vccsys>; vcc2-supply = <&vccsys>;@@ -428,6 +454,10 @@ regulator-state-mem { }; }; }; + + rk817_codec: codec {
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts regulator-state-mem { · line 459
Quoted 1 line
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +1
-0+ mic-in-differential;This property name might have to change.
Yep, will do.
Quoted 9 lines
Quoted 8 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +1
-0+ }; }; };@@ -439,6 +469,8 @@ &i2c1 { /* I2S 1 Channel Used */ &i2s1_2ch {
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts &i2c1 { · line 473
Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +2
-0+ resets = <&cru SRST_I2S1>, <&cru SRST_I2S1_H>; + reset-names = "reset-m", "reset-h";Remove.
"resets" and "reset-names" have no support in mainline. Seerockchip-i2s.yaml
Did not know that, will remove!
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts &i2c1 { · line 476
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +0
-0status = "okay"; };
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip