本文整理汇总了C++中devm_snd_soc_register_component函数的典型用法代码示例。如果您正苦于以下问题:C++ devm_snd_soc_register_component函数的具体用法?C++ devm_snd_soc_register_component怎么用?C++ devm_snd_soc_register_component使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了devm_snd_soc_register_component函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snd_soc_dummy_probe
static int snd_soc_dummy_probe(struct platform_device *pdev)
{
int ret;
ret = devm_snd_soc_register_component(&pdev->dev,
&dummy_codec, &dummy_dai, 1);
if (ret < 0)
return ret;
ret = devm_snd_soc_register_component(&pdev->dev, &dummy_platform,
NULL, 0);
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:14,代码来源:soc-utils.c
示例2: wm8524_codec_probe
static int wm8524_codec_probe(struct platform_device *pdev)
{
struct wm8524_priv *wm8524;
int ret;
wm8524 = devm_kzalloc(&pdev->dev, sizeof(struct wm8524_priv),
GFP_KERNEL);
if (wm8524 == NULL)
return -ENOMEM;
platform_set_drvdata(pdev, wm8524);
wm8524->mute = devm_gpiod_get(&pdev->dev, "wlf,mute", GPIOD_OUT_LOW);
if (IS_ERR(wm8524->mute)) {
ret = PTR_ERR(wm8524->mute);
dev_err(&pdev->dev, "Failed to get mute line: %d\n", ret);
return ret;
}
ret = devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_wm8524, &wm8524_dai, 1);
if (ret < 0)
dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:26,代码来源:wm8524.c
示例3: uda134x_codec_probe
static int uda134x_codec_probe(struct platform_device *pdev)
{
struct uda134x_platform_data *pd = pdev->dev.platform_data;
struct uda134x_priv *uda134x;
int ret;
if (!pd) {
dev_err(&pdev->dev, "Missing L3 bitbang function\n");
return -ENODEV;
}
uda134x = devm_kzalloc(&pdev->dev, sizeof(*uda134x), GFP_KERNEL);
if (!uda134x)
return -ENOMEM;
uda134x->pd = pd;
platform_set_drvdata(pdev, uda134x);
if (pd->l3.use_gpios) {
ret = l3_set_gpio_ops(&pdev->dev, &uda134x->pd->l3);
if (ret < 0)
return ret;
}
uda134x->regmap = devm_regmap_init(&pdev->dev, NULL, pd,
&uda134x_regmap_config);
if (IS_ERR(uda134x->regmap))
return PTR_ERR(uda134x->regmap);
return devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_uda134x, &uda134x_dai, 1);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:32,代码来源:uda134x.c
示例4: pcm1789_common_init
int pcm1789_common_init(struct device *dev, struct regmap *regmap)
{
struct pcm1789_private *pcm1789;
pcm1789 = devm_kzalloc(dev, sizeof(struct pcm1789_private),
GFP_KERNEL);
if (!pcm1789)
return -ENOMEM;
pcm1789->regmap = regmap;
pcm1789->dev = dev;
dev_set_drvdata(dev, pcm1789);
pcm1789->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
if (IS_ERR(pcm1789->reset))
return PTR_ERR(pcm1789->reset);
gpiod_set_value_cansleep(pcm1789->reset, 0);
msleep(300);
INIT_WORK(&pcm1789->work, pcm1789_work_queue);
return devm_snd_soc_register_component(dev, &soc_component_dev_pcm1789,
&pcm1789_dai, 1);
}
开发者ID:the-snowwhite,项目名称:linux-socfpga,代码行数:25,代码来源:pcm1789.c
示例5: mt6351_codec_driver_probe
static int mt6351_codec_driver_probe(struct platform_device *pdev)
{
struct mt6351_priv *priv;
priv = devm_kzalloc(&pdev->dev,
sizeof(struct mt6351_priv),
GFP_KERNEL);
if (!priv)
return -ENOMEM;
dev_set_drvdata(&pdev->dev, priv);
priv->dev = &pdev->dev;
priv->regmap = dev_get_regmap(pdev->dev.parent, NULL);
if (!priv->regmap)
return -ENODEV;
dev_dbg(priv->dev, "%s(), dev name %s\n",
__func__, dev_name(&pdev->dev));
return devm_snd_soc_register_component(&pdev->dev,
&mt6351_soc_component_driver,
mt6351_dai_driver,
ARRAY_SIZE(mt6351_dai_driver));
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:26,代码来源:mt6351.c
示例6: s3c24xx_iis_dev_probe
static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
{
struct resource *res;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
s3c24xx_i2s.regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(s3c24xx_i2s.regs))
return PTR_ERR(s3c24xx_i2s.regs);
s3c24xx_i2s_pcm_stereo_out.addr = res->start + S3C2410_IISFIFO;
s3c24xx_i2s_pcm_stereo_in.addr = res->start + S3C2410_IISFIFO;
ret = samsung_asoc_dma_platform_register(&pdev->dev, NULL,
NULL, NULL);
if (ret) {
dev_err(&pdev->dev, "Failed to register the DMA: %d\n", ret);
return ret;
}
ret = devm_snd_soc_register_component(&pdev->dev,
&s3c24xx_i2s_component, &s3c24xx_i2s_dai, 1);
if (ret)
dev_err(&pdev->dev, "Failed to register the DAI\n");
return ret;
}
开发者ID:Ayokunle,项目名称:linux,代码行数:27,代码来源:s3c24xx-i2s.c
示例7: sta529_i2c_probe
static int sta529_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct sta529 *sta529;
int ret;
sta529 = devm_kzalloc(&i2c->dev, sizeof(struct sta529), GFP_KERNEL);
if (!sta529)
return -ENOMEM;
sta529->regmap = devm_regmap_init_i2c(i2c, &sta529_regmap);
if (IS_ERR(sta529->regmap)) {
ret = PTR_ERR(sta529->regmap);
dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
return ret;
}
i2c_set_clientdata(i2c, sta529);
ret = devm_snd_soc_register_component(&i2c->dev,
&sta529_component_driver, &sta529_dai, 1);
if (ret != 0)
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:26,代码来源:sta529.c
示例8: jz4740_i2s_dev_probe
static int jz4740_i2s_dev_probe(struct platform_device *pdev)
{
struct jz4740_i2s *i2s;
struct resource *mem;
int ret;
i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
if (!i2s)
return -ENOMEM;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
i2s->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(i2s->base))
return PTR_ERR(i2s->base);
i2s->phys_base = mem->start;
i2s->clk_aic = devm_clk_get(&pdev->dev, "aic");
if (IS_ERR(i2s->clk_aic))
return PTR_ERR(i2s->clk_aic);
i2s->clk_i2s = devm_clk_get(&pdev->dev, "i2s");
if (IS_ERR(i2s->clk_i2s))
return PTR_ERR(i2s->clk_i2s);
platform_set_drvdata(pdev, i2s);
ret = devm_snd_soc_register_component(&pdev->dev,
&jz4740_i2s_component, &jz4740_i2s_dai, 1);
if (ret)
return ret;
return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
SND_DMAENGINE_PCM_FLAG_COMPAT);
}
开发者ID:Abioy,项目名称:kasan,代码行数:35,代码来源:jz4740-i2s.c
示例9: ak5558_i2c_probe
static int ak5558_i2c_probe(struct i2c_client *i2c)
{
struct ak5558_priv *ak5558;
int ret = 0;
ak5558 = devm_kzalloc(&i2c->dev, sizeof(*ak5558), GFP_KERNEL);
if (!ak5558)
return -ENOMEM;
ak5558->regmap = devm_regmap_init_i2c(i2c, &ak5558_regmap);
if (IS_ERR(ak5558->regmap))
return PTR_ERR(ak5558->regmap);
i2c_set_clientdata(i2c, ak5558);
ak5558->i2c = i2c;
ak5558->reset_gpiod = devm_gpiod_get_optional(&i2c->dev, "reset",
GPIOD_OUT_LOW);
if (IS_ERR(ak5558->reset_gpiod))
return PTR_ERR(ak5558->reset_gpiod);
ret = devm_snd_soc_register_component(&i2c->dev,
&soc_codec_dev_ak5558,
&ak5558_dai, 1);
if (ret)
return ret;
pm_runtime_enable(&i2c->dev);
return 0;
}
开发者ID:Lyude,项目名称:linux,代码行数:31,代码来源:ak5558.c
示例10: mc13783_codec_probe
static int __init mc13783_codec_probe(struct platform_device *pdev)
{
struct mc13783_priv *priv;
struct mc13xxx_codec_platform_data *pdata = pdev->dev.platform_data;
struct device_node *np;
int ret;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
if (pdata) {
priv->adc_ssi_port = pdata->adc_ssi_port;
priv->dac_ssi_port = pdata->dac_ssi_port;
} else {
np = of_get_child_by_name(pdev->dev.parent->of_node, "codec");
if (!np)
return -ENOSYS;
ret = of_property_read_u32(np, "adc-port", &priv->adc_ssi_port);
if (ret) {
of_node_put(np);
return ret;
}
ret = of_property_read_u32(np, "dac-port", &priv->dac_ssi_port);
if (ret) {
of_node_put(np);
return ret;
}
of_node_put(np);
}
dev_set_drvdata(&pdev->dev, priv);
priv->mc13xxx = dev_get_drvdata(pdev->dev.parent);
if (priv->adc_ssi_port == priv->dac_ssi_port)
ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783,
mc13783_dai_sync, ARRAY_SIZE(mc13783_dai_sync));
else
ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783,
mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async));
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:46,代码来源:mc13783.c
示例11: jz4740_i2s_dev_probe
static int jz4740_i2s_dev_probe(struct platform_device *pdev)
{
struct jz4740_i2s *i2s;
struct resource *mem;
int ret;
const struct of_device_id *match;
i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
if (!i2s)
return -ENOMEM;
match = of_match_device(jz4740_of_matches, &pdev->dev);
if (match)
i2s->version = (enum jz47xx_i2s_version)match->data;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
i2s->base = devm_ioremap_resource(&pdev->dev, mem);
if (IS_ERR(i2s->base))
return PTR_ERR(i2s->base);
i2s->phys_base = mem->start;
i2s->clk_aic = devm_clk_get(&pdev->dev, "aic");
if (IS_ERR(i2s->clk_aic))
return PTR_ERR(i2s->clk_aic);
i2s->clk_i2s = devm_clk_get(&pdev->dev, "i2s");
if (IS_ERR(i2s->clk_i2s))
return PTR_ERR(i2s->clk_i2s);
platform_set_drvdata(pdev, i2s);
if (i2s->version == JZ_I2S_JZ4780)
ret = devm_snd_soc_register_component(&pdev->dev,
&jz4740_i2s_component, &jz4780_i2s_dai, 1);
else
ret = devm_snd_soc_register_component(&pdev->dev,
&jz4740_i2s_component, &jz4740_i2s_dai, 1);
if (ret)
return ret;
return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL,
SND_DMAENGINE_PCM_FLAG_COMPAT);
}
开发者ID:020gzh,项目名称:linux,代码行数:45,代码来源:jz4740-i2s.c
示例12: asoc_idma_platform_probe
static int asoc_idma_platform_probe(struct platform_device *pdev)
{
idma_irq = platform_get_irq(pdev, 0);
if (idma_irq < 0)
return idma_irq;
return devm_snd_soc_register_component(&pdev->dev, &asoc_idma_platform,
NULL, 0);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:9,代码来源:idma.c
示例13: tas5720_probe
static int tas5720_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct device *dev = &client->dev;
struct tas5720_data *data;
const struct regmap_config *regmap_config;
int ret;
int i;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->tas5720_client = client;
data->devtype = id->driver_data;
switch (id->driver_data) {
case TAS5720:
regmap_config = &tas5720_regmap_config;
break;
case TAS5722:
regmap_config = &tas5722_regmap_config;
break;
default:
dev_err(dev, "unexpected private driver data\n");
return -EINVAL;
}
data->regmap = devm_regmap_init_i2c(client, regmap_config);
if (IS_ERR(data->regmap)) {
ret = PTR_ERR(data->regmap);
dev_err(dev, "failed to allocate register map: %d\n", ret);
return ret;
}
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tas5720_supply_names[i];
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(data->supplies),
data->supplies);
if (ret != 0) {
dev_err(dev, "failed to request supplies: %d\n", ret);
return ret;
}
dev_set_drvdata(dev, data);
ret = devm_snd_soc_register_component(&client->dev,
&soc_component_dev_tas5720,
tas5720_dai, ARRAY_SIZE(tas5720_dai));
if (ret < 0) {
dev_err(dev, "failed to register component: %d\n", ret);
return ret;
}
return 0;
}
开发者ID:Lyude,项目名称:linux,代码行数:56,代码来源:tas5720.c
示例14: max98373_i2c_probe
static int max98373_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
int ret = 0;
int reg = 0;
struct max98373_priv *max98373 = NULL;
max98373 = devm_kzalloc(&i2c->dev, sizeof(*max98373), GFP_KERNEL);
if (!max98373) {
ret = -ENOMEM;
return ret;
}
i2c_set_clientdata(i2c, max98373);
/* update interleave mode info */
if (device_property_read_bool(&i2c->dev, "maxim,interleave_mode"))
max98373->interleave_mode = 1;
else
max98373->interleave_mode = 0;
/* regmap initialization */
max98373->regmap
= devm_regmap_init_i2c(i2c, &max98373_regmap);
if (IS_ERR(max98373->regmap)) {
ret = PTR_ERR(max98373->regmap);
dev_err(&i2c->dev,
"Failed to allocate regmap: %d\n", ret);
return ret;
}
/* Check Revision ID */
ret = regmap_read(max98373->regmap,
MAX98373_R21FF_REV_ID, ®);
if (ret < 0) {
dev_err(&i2c->dev,
"Failed to read: 0x%02X\n", MAX98373_R21FF_REV_ID);
return ret;
}
dev_info(&i2c->dev, "MAX98373 revisionID: 0x%02X\n", reg);
/* voltage/current slot configuration */
max98373_slot_config(i2c, max98373);
/* codec registeration */
ret = devm_snd_soc_register_component(&i2c->dev, &soc_codec_dev_max98373,
max98373_dai, ARRAY_SIZE(max98373_dai));
if (ret < 0)
dev_err(&i2c->dev, "Failed to register codec: %d\n", ret);
return ret;
}
开发者ID:guribe94,项目名称:linux,代码行数:54,代码来源:max98373.c
示例15: stm32_sai_sub_probe
static int stm32_sai_sub_probe(struct platform_device *pdev)
{
struct stm32_sai_sub_data *sai;
const struct of_device_id *of_id;
int ret;
sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
if (!sai)
return -ENOMEM;
of_id = of_match_device(stm32_sai_sub_ids, &pdev->dev);
if (!of_id)
return -EINVAL;
sai->id = (uintptr_t)of_id->data;
sai->pdev = pdev;
platform_set_drvdata(pdev, sai);
sai->pdata = dev_get_drvdata(pdev->dev.parent);
if (!sai->pdata) {
dev_err(&pdev->dev, "Parent device data not available\n");
return -EINVAL;
}
ret = stm32_sai_sub_parse_of(pdev, sai);
if (ret)
return ret;
ret = stm32_sai_sub_dais_init(pdev, sai);
if (ret)
return ret;
ret = devm_request_irq(&pdev->dev, sai->pdata->irq, stm32_sai_isr,
IRQF_SHARED, dev_name(&pdev->dev), sai);
if (ret) {
dev_err(&pdev->dev, "irq request returned %d\n", ret);
return ret;
}
ret = devm_snd_soc_register_component(&pdev->dev, &stm32_component,
sai->cpu_dai_drv, 1);
if (ret)
return ret;
ret = devm_snd_dmaengine_pcm_register(&pdev->dev,
&stm32_sai_pcm_config, 0);
if (ret) {
dev_err(&pdev->dev, "could not register pcm dma\n");
return ret;
}
return 0;
}
开发者ID:asmalldev,项目名称:linux,代码行数:53,代码来源:stm32_sai_sub.c
示例16: lm4857_i2c_probe
static int lm4857_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct regmap *regmap;
regmap = devm_regmap_init_i2c(i2c, &lm4857_regmap_config);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
return devm_snd_soc_register_component(&i2c->dev,
&lm4857_component_driver, NULL, 0);
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:12,代码来源:lm4857.c
示例17: ak4104_spi_probe
static int ak4104_spi_probe(struct spi_device *spi)
{
struct ak4104_private *ak4104;
struct gpio_desc *reset_gpiod;
unsigned int val;
int ret;
spi->bits_per_word = 8;
spi->mode = SPI_MODE_0;
ret = spi_setup(spi);
if (ret < 0)
return ret;
ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private),
GFP_KERNEL);
if (ak4104 == NULL)
return -ENOMEM;
ak4104->regulator = devm_regulator_get(&spi->dev, "vdd");
if (IS_ERR(ak4104->regulator)) {
ret = PTR_ERR(ak4104->regulator);
dev_err(&spi->dev, "Unable to get Vdd regulator: %d\n", ret);
return ret;
}
ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
if (IS_ERR(ak4104->regmap)) {
ret = PTR_ERR(ak4104->regmap);
return ret;
}
reset_gpiod = devm_gpiod_get_optional(&spi->dev, "reset",
GPIOD_OUT_HIGH);
if (IS_ERR(reset_gpiod) &&
PTR_ERR(reset_gpiod) == -EPROBE_DEFER)
return -EPROBE_DEFER;
/* read the 'reserved' register - according to the datasheet, it
* should contain 0x5b. Not a good way to verify the presence of
* the device, but there is no hardware ID register. */
ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
if (ret != 0)
return ret;
if (val != AK4104_RESERVED_VAL)
return -ENODEV;
spi_set_drvdata(spi, ak4104);
ret = devm_snd_soc_register_component(&spi->dev,
&soc_component_device_ak4104, &ak4104_dai, 1);
return ret;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:52,代码来源:ak4104.c
示例18: asoc_dmic_probe
static int asoc_dmic_probe(struct platform_device *pdev)
{
struct omap_dmic *dmic;
struct resource *res;
int ret;
dmic = devm_kzalloc(&pdev->dev, sizeof(struct omap_dmic), GFP_KERNEL);
if (!dmic)
return -ENOMEM;
platform_set_drvdata(pdev, dmic);
dmic->dev = &pdev->dev;
dmic->sysclk = OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS;
mutex_init(&dmic->mutex);
dmic->fclk = devm_clk_get(dmic->dev, "fck");
if (IS_ERR(dmic->fclk)) {
dev_err(dmic->dev, "cant get fck\n");
return -ENODEV;
}
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
if (!res) {
dev_err(dmic->dev, "invalid dma memory resource\n");
return -ENODEV;
}
dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
dmic->dma_data.filter_data = "up_link";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(dmic->io_base))
return PTR_ERR(dmic->io_base);
ret = devm_snd_soc_register_component(&pdev->dev,
&omap_dmic_component,
&omap_dmic_dai, 1);
if (ret)
return ret;
ret = omap_pcm_platform_register(&pdev->dev);
if (ret)
return ret;
return 0;
}
开发者ID:3null,项目名称:linux,代码行数:49,代码来源:omap-dmic.c
示例19: asoc_mcbsp_probe
static int asoc_mcbsp_probe(struct platform_device *pdev)
{
struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct omap_mcbsp *mcbsp;
const struct of_device_id *match;
int ret;
match = of_match_device(omap_mcbsp_of_match, &pdev->dev);
if (match) {
struct device_node *node = pdev->dev.of_node;
struct omap_mcbsp_platform_data *pdata_quirk = pdata;
int buffer_size;
pdata = devm_kzalloc(&pdev->dev,
sizeof(struct omap_mcbsp_platform_data),
GFP_KERNEL);
if (!pdata)
return -ENOMEM;
memcpy(pdata, match->data, sizeof(*pdata));
if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
pdata->buffer_size = buffer_size;
if (pdata_quirk)
pdata->force_ick_on = pdata_quirk->force_ick_on;
} else if (!pdata) {
dev_err(&pdev->dev, "missing platform data.\n");
return -EINVAL;
}
mcbsp = devm_kzalloc(&pdev->dev, sizeof(struct omap_mcbsp), GFP_KERNEL);
if (!mcbsp)
return -ENOMEM;
mcbsp->id = pdev->id;
mcbsp->pdata = pdata;
mcbsp->dev = &pdev->dev;
platform_set_drvdata(pdev, mcbsp);
ret = omap_mcbsp_init(pdev);
if (ret)
return ret;
ret = devm_snd_soc_register_component(&pdev->dev,
&omap_mcbsp_component,
&omap_mcbsp_dai, 1);
if (ret)
return ret;
return omap_pcm_platform_register(&pdev->dev);
}
开发者ID:AK101111,项目名称:linux,代码行数:49,代码来源:omap-mcbsp.c
示例20: hi6210_i2s_probe
static int hi6210_i2s_probe(struct platform_device *pdev)
{
struct device_node *node = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct hi6210_i2s *i2s;
struct resource *res;
int ret;
i2s = devm_kzalloc(&pdev->dev, sizeof(*i2s), GFP_KERNEL);
if (!i2s)
return -ENOMEM;
i2s->dev = dev;
spin_lock_init(&i2s->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
i2s->base = devm_ioremap_resource(dev, res);
if (IS_ERR(i2s->base))
return PTR_ERR(i2s->base);
i2s->base_phys = (phys_addr_t)res->start;
i2s->dai = hi6210_i2s_dai_init;
dev_set_drvdata(&pdev->dev, i2s);
i2s->sysctrl = syscon_regmap_lookup_by_phandle(node,
"hisilicon,sysctrl-syscon");
if (IS_ERR(i2s->sysctrl))
return PTR_ERR(i2s->sysctrl);
i2s->clk[CLK_DACODEC] = devm_clk_get(&pdev->dev, "dacodec");
if (IS_ERR_OR_NULL(i2s->clk[CLK_DACODEC]))
return PTR_ERR(i2s->clk[CLK_DACODEC]);
i2s->clocks++;
i2s->clk[CLK_I2S_BASE] = devm_clk_get(&pdev->dev, "i2s-base");
if (IS_ERR_OR_NULL(i2s->clk[CLK_I2S_BASE]))
return PTR_ERR(i2s->clk[CLK_I2S_BASE]);
i2s->clocks++;
ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
if (ret)
return ret;
ret = devm_snd_soc_register_component(&pdev->dev, &hi6210_i2s_i2s_comp,
&i2s->dai, 1);
return ret;
}
开发者ID:Lyude,项目名称:linux,代码行数:48,代码来源:hi6210-i2s.c
注:本文中的devm_snd_soc_register_component函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论