This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM5728:如何将 PCM186x 驱动程序添加到 Linux?

Guru**** 2546950 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/598218/linux-am5728-how-to-add-pcm186x-driver-to-linux

器件型号:AM5728

工具/软件:Linux

您好!

我们正在使用基于 am57xx-EVM SDK (Linux 4.4.419)的 Linux 制作定制板。 现在,我们正在努力将 PCM186x 驱动程序添加到 Linux 中。

我在 TI Git 上找到了4个文件:
-pcm186x.c;
pcm186x.h;
pcm186x-i2c.c;
- pcm186x-spi.c.

我已将其复制到 Linux-folder/sound/soc/codecs 中

我已经向 Linux-folder/sound/soc/codecs/makefile 添加了以下几行代码:
snd-soc-pcm1862x-objs:= pcm186x.o
snd-sc-pcm1862x-i2c-objs:= pcm186x-i2c.o
snd-soc-pcm1862x-spi-objs:= pcm186x-spi.o
(笑声)
obj-$(CONFIG_SND_SOC_PCM186x)+= snd-so-pcm186x.o
obj-$(CONFIG_SND_SOC_PCM186x_I2C)+= snd-so-pcm186x-i2c.o
obj-$(CONFIG_SND_SOC_PCM186x_SPI)+= snd-so-pcm186x-spi.o

当然、我已经将这几行添加到了 linux-folder/arch/arm/configs/tisdk_am57xx-evm_defconfig 文件中:
CONFIG_SND_SOC_PCM186x = y
CONFIG_SND_SOC_PCM186x_I2C=y
CONFIG_SND_SOC_PCM186x_SPI=y

然后、我在终端中键入2条命令:
使 arch=arm cross_compile=arm-linux-gnueabihf- distclean
使 arch=arm cross_compile=arm-linux-gnueabihf- tisdk_am57xx-evm_defconfig

最后一个文件生成.config 文件、但我没有关于 PCM186x 配置的新行。
shell 我在其他文件中添加了其他行吗?

BR、
亚历山大。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Alexander、

    您还需要修改相应的 Kconfig 文件。

    此致、
    Yordan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我已修改 kconfig 文件、PCM186x 配置行出现在 xconfig 中、但没有.o 文件、也没有错误消息。

    因此、我尝试构建树模块。

    我制作了 makefile:

    # Makefile–我们的第一个驱动
    
    程序#的 makefile 如果定义了 KERNELRELEASE、我们已从
    #内核构建系统调用并可以使用其语言。
    ifneq (${KERNELRELEASE}、)
    obj-m:= pcm186x-i2c.o
    #否则我们直接从命令行调用。
    #调用内核构建系统。
    其他
    kernel_source:=/opt/ti-processor-sdk-linux-am57xx-evm-03.01.00.06/board-support/linux-4.4.19
    pWD:=$(shell pwd)
    默认值:
    ${make}-C ${kernel_source}subdirs=${pWD}modules
    
    clean:
    ${make}-C ${kernel_source}subdirs=${pWD}clean
    endif 

    并使用 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-命令来构建它。

    它创建了.o 和.ko 文件、但也显示了以下警告:
    警告:"pcm186x_pm_ops"[/home/user1/Documents/pcm186x/pcm186x-i2c.ko 未定义!
    警告:"pcm186x_probe"[/home/user1/Documents/pcm186x/pcm186x-i2c.ko 未定义!
    警告:"pcm186x_regmap"[/home/user1/Documents/pcm186x/pcm186x-i2c.ko 未定义!
    警告:"pcm186x_remove"[/home/user1/Documents/pcm186x/pcm186x-i2c.ko 未定义!

    此变量在 pcm186x.c 中定义

    那么、您能告诉我、我应该如何正确构建该驱动程序?

    BR、
    亚历山大

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    大家好、在 obj-m 行中需要 pcm186x.o 和 pcm186x-i2c.o、这是我的 makefile、用于从树中构建此驱动程序

    导出 arch:=arm
    export cross_compile:=arm-linux-gnueabihf-
    
    ifneq ($(KERNELRELEASE)、)
    obj-m:= pcm186x-i2c.o pcm186x.o pcm186x-spi.o
    else
    KDIR:=/home/user/linux-y335x
    all:
    $(make)-C $(KDIR) M=$PWD
    Clean:
    $(make)-C $(KDIR) M=$PWD Clean
    endif