/dev/dsp audio device node with busybox and mdev

Jerry Jacobs
Dear FriendlyARM,
I got the latest busybox up and running with all things, and copied over
your rcS and mdev.conf but the /dev/dsp node is not created. And dont have
a solution for it.

Regards,
Jerry Jacobs

Jerry Jacobs
The story goes on and i tried different things:
 + Create uImage from friendlyarm latest kernel source which does not boot
with u-boot (and uboot does not boot zImages).
 + Create uImage from buserror public git tree
(http://repo.or.cz/w/linux-2.6/mini2440.git)
   and get this output from booting:
  
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)

   The nodes pcmC0D0c and pcmC0D0p are created but no /dev/dsp (with as
qtopia rootfs)

  + I tried reflashing with the original vivi qtopia and zImage and it
works then (madplay).

  I dont know where to look to setup the correct settings to get the sound
creating /dev/dsp.

Regards,
Jerry

Jerry Jacobs
I also started a topic here
http://forum.linuxmce.org/index.php?topic=8628.0 and here
http://www.friendlyarm.org/topic.asp?TOPIC_ID=107

Jerry Jacobs
I fixed the problem with help of florian from kernel concepts:

Sourcecode tree:
http://repo.or.cz/w/linux-2.6/mini2440.git?a=tree;h=refs/heads/mini2440-...

This configfile:
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.29.3
# Fri Aug  7 00:47:30 2009
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
# CONFIG_GENERIC_TIME is not set
# CONFIG_GENERIC_CLOCKEVENTS is not set
CONFIG_MMU=y
CONFIG_NO_IOPORT=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_AUDIT is not set

#
# RCU Subsystem
#
CONFIG_CLASSIC_RCU=y
# CONFIG_TREE_RCU is not set
# CONFIG_PREEMPT_RCU is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_PREEMPT_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=17
# CONFIG_GROUP_SCHED is not set
# CONFIG_CGROUPS is not set
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
# CONFIG_EMBEDDED is not set
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLUB_DEBUG=y
# CONFIG_COMPAT_BRK is not set
# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
# CONFIG_PROFILING is not set
CONFIG_HAVE_OPROFILE=y
# CONFIG_KPROBES is not set
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_CLK=y
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
CONFIG_MODULE_FORCE_LOAD=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_BLOCK=y
CONFIG_LBD=y
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_BLK_DEV_BSG is not set
CONFIG_BLK_DEV_INTEGRITY=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"
CONFIG_FREEZER=y

#
# System Type
#
# CONFIG_ARCH_AAEC2000 is not set
# CONFIG_ARCH_INTEGRATOR is not set
# CONFIG_ARCH_REALVIEW is not set
# CONFIG_ARCH_VERSATILE is not set
# CONFIG_ARCH_AT91 is not set
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_EBSA110 is not set
# CONFIG_ARCH_EP93XX is not set
# CONFIG_ARCH_FOOTBRIDGE is not set
# CONFIG_ARCH_NETX is not set
# CONFIG_ARCH_H720X is not set
# CONFIG_ARCH_IMX is not set
# CONFIG_ARCH_IOP13XX is not set
# CONFIG_ARCH_IOP32X is not set
# CONFIG_ARCH_IOP33X is not set
# CONFIG_ARCH_IXP23XX is not set
# CONFIG_ARCH_IXP2000 is not set
# CONFIG_ARCH_IXP4XX is not set
# CONFIG_ARCH_L7200 is not set
# CONFIG_ARCH_KIRKWOOD is not set
# CONFIG_ARCH_KS8695 is not set
# CONFIG_ARCH_NS9XXX is not set
# CONFIG_ARCH_LOKI is not set
# CONFIG_ARCH_MV78XX0 is not set
# CONFIG_ARCH_MXC is not set
# CONFIG_ARCH_ORION5X is not set
# CONFIG_ARCH_PNX4008 is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_RPC is not set
# CONFIG_ARCH_SA1100 is not set
CONFIG_ARCH_S3C2410=y
# CONFIG_ARCH_S3C64XX is not set
# CONFIG_ARCH_SHARK is not set
# CONFIG_ARCH_LH7A40X is not set
# CONFIG_ARCH_DAVINCI is not set
# CONFIG_ARCH_OMAP is not set
# CONFIG_ARCH_MSM is not set
# CONFIG_ARCH_W90X900 is not set
CONFIG_PLAT_S3C24XX=y
CONFIG_S3C2410_CLOCK=y
CONFIG_CPU_S3C244X=y
CONFIG_S3C24XX_PWM=y
CONFIG_S3C24XX_GPIO_EXTRA=0
CONFIG_S3C2410_DMA=y
# CONFIG_S3C2410_DMA_DEBUG is not set
CONFIG_S3C24XX_ADC=y
CONFIG_PLAT_S3C=y
CONFIG_CPU_LLSERIAL_S3C2440_ONLY=y
CONFIG_CPU_LLSERIAL_S3C2440=y

#
# Boot options
#
# CONFIG_S3C_BOOT_WATCHDOG is not set
# CONFIG_S3C_BOOT_ERROR_RESET is not set
CONFIG_S3C_BOOT_UART_FORCE_FIFO=y

#
# Power management
#
# CONFIG_S3C2410_PM_DEBUG is not set
# CONFIG_S3C2410_PM_CHECK is not set
CONFIG_S3C_LOWLEVEL_UART_PORT=0
CONFIG_S3C_GPIO_SPACE=0

#
# S3C2400 Machines
#
CONFIG_S3C2410_PM=y
CONFIG_S3C2410_GPIO=y

#
# S3C2410 Machines
#
# CONFIG_ARCH_SMDK2410 is not set
# CONFIG_ARCH_H1940 is not set
# CONFIG_MACH_N30 is not set
# CONFIG_ARCH_BAST is not set
# CONFIG_MACH_OTOM is not set
# CONFIG_MACH_AML_M5900 is not set
# CONFIG_MACH_TCT_HAMMER is not set
# CONFIG_MACH_VR1000 is not set
# CONFIG_MACH_QT2410 is not set

#
# S3C2412 Machines
#
# CONFIG_MACH_JIVE is not set
# CONFIG_MACH_SMDK2413 is not set
# CONFIG_MACH_SMDK2412 is not set
# CONFIG_MACH_VSTMS is not set
CONFIG_CPU_S3C2440=y
CONFIG_S3C2440_DMA=y

#
# S3C2440 Machines
#
# CONFIG_MACH_ANUBIS is not set
# CONFIG_MACH_OSIRIS is not set
# CONFIG_MACH_RX3715 is not set
# CONFIG_ARCH_S3C2440 is not set
# CONFIG_MACH_NEXCODER_2440 is not set
# CONFIG_MACH_AT2440EVB is not set
CONFIG_MACH_MINI2440=y

#
# S3C2442 Machines
#

#
# S3C2443 Machines
#
# CONFIG_MACH_SMDK2443 is not set

#
# Processor Type
#
CONFIG_CPU_32=y
CONFIG_CPU_ARM920T=y
CONFIG_CPU_32v4T=y
CONFIG_CPU_ABRT_EV4T=y
CONFIG_CPU_PABRT_NOIFAR=y
CONFIG_CPU_CACHE_V4WT=y
CONFIG_CPU_CACHE_VIVT=y
CONFIG_CPU_COPY_V4WB=y
CONFIG_CPU_TLB_V4WBI=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y

#
# Processor Features
#
CONFIG_ARM_THUMB=y
# CONFIG_CPU_ICACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
# CONFIG_OUTER_CACHE is not set

#
# Bus support
#
# CONFIG_PCI_SYSCALL is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_PCCARD is not set

#
# Kernel Features
#
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xC0000000
# CONFIG_PREEMPT is not set
CONFIG_HZ=200
CONFIG_AEABI=y
# CONFIG_OABI_COMPAT is not set
CONFIG_ARCH_FLATMEM_HAS_HOLES=y
# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4096
# CONFIG_PHYS_ADDR_T_64BIT is not set
CONFIG_ZONE_DMA_FLAG=0
CONFIG_VIRT_TO_BUS=y
CONFIG_UNEVICTABLE_LRU=y
CONFIG_ALIGNMENT_TRAP=y

#
# Boot options
#
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_CMDLINE=""
# CONFIG_XIP_KERNEL is not set
CONFIG_KEXEC=y
CONFIG_ATAGS_PROC=y

#
# CPU Power Management
#
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_GOV_LADDER=y

#
# Floating point emulation
#

#
# At least one emulation must be selected
#

#
# Userspace binary formats
#
CONFIG_BINFMT_ELF=y
# CONFIG_CORE_DUMP...stripped-down

Jerry Jacobs
Bad post,
Please email me to get the correct defconfig

Andreas Watterott
Hello Jerry,

The post size is limited to 8000 characters.

I think a better place for the config is the mini2440-wiki at Google Code:
http://code.google.com/p/mini2440/w/list

Regards
Andreas

Rauf Kuliyev
Hello Jerry,

Could you please send me the full kernel config to rauf@kuliyev.com or just
copy and paste necessary config options here.

Thanks,
Rauf

Peter
Hello Jerry,

trying to get the sound working, too (Buserrors kernel).

Can you send me the config, pelase? my eMail is 4art at gmx.de

Thank you, Pete

mgalemin
Hi Jerry, 

Could you please post here a diff between linux configs you used for
building you kernel without /dev/dsp creation and the one you obtained from
Florian (Kernel Concepts)? Thank you.

mgalemin
To have /dev/dsp device in your system you have to include 'udev' package
to your rootfs (if you build rootfs using buildroot). Just uncheck "Package
Selection for the target" -> "Hide applications that are provided by
busybox" and check "Package Selection for the target" -> "Hardware handling
/ blockdevices and filesystem maintenance" -> "udev" while configuring
buildrood using 'make menuconfig'.

But I found that I couldn't hear anything because of some issue in driver
/sound/soc/codecs/uda134x.c. I dug in to the kernel (2.6.31 from buserror
repo), traced hardware calls and found that on UDA134X driver loading
during the kernel boot value 0x80 is written to the STATUS register
(address 0x16) of the UDA1341 IC and according to the datasheet it means
that ADC and DAC are both switched off. It happens bias level setting in
/sound/soc/soc-dapm.c file in function dapm_power_widgets:

Code:
   /* If we just powered the last thing off drop to standby bias */
   if (codec->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
      ret = snd_soc_dapm_set_bias_level(socdev,
                    SND_SOC_BIAS_STANDBY);


sys_power value is set in the same function:

Code:
   /* Check which widgets we need to power and store them in
    * lists indicating if they should be powered up or down.
    */
   list_for_each_entry(w, &codec->dapm_widgets, list) {
      switch (w->id) {
      case snd_soc_dapm_pre:
         list_add_tail(&codec->down_list, &w->power_list);
         break;
      case snd_soc_dapm_post:
         list_add_tail(&codec->up_list, &w->power_list);
         break;

      default:
         if (!w->power_check)
            continue;

         power = w->power_check(w);
         if (power)
            sys_power = 1;



As you can see to set sys_power to 1 we need to add widget to
codec->dapm_widgets and initialize its power_check pointer. As a temporary
hack I added dummy widget to the codec in /sound/soc/codecs/uda134x.c (id =
snd_soc_dapm_vmid because function that adds new widget doesn't initialize
power_check pointer for this id):

Code:
int uda134x_soc_dummy_power_check(struct snd_soc_dapm_widget *w)
{
    return 1;
}

static const struct snd_soc_dapm_widget uda134x_dummy_dapm_widget = {
    .id = snd_soc_dapm_vmid, 
    .power_check = uda134x_soc_dummy_power_check
};


And in uda134x_soc_probe function before snd_soc_init_card I added:

Code:
   snd_soc_dapm_new_controls(codec, &uda134x_dummy_dapm_widget, 1);
   snd_soc_dapm_new_widgets(codec);


This resolved the sound issue. Is it bug in driver? And if so is it a
proper workaround to solve this issue?

P.S. There is also bug in /sound/soc/codecs/uda134x.c file in function
uda134x_mute:

Shoul be: 

Code:
uda134x_write(codec, UDA134X_DATA010, mute_reg);


instead of

Code:
uda134x_write(codec, UDA134X_DATA010, mute_reg & ~(1<<2));



My diff for uda134x.c:

Code:
===========================================================
--- a/sound/soc/codecs/uda134x.c   2009-10-07 19:48:17.000000000 +0300
+++ b/sound/soc/codecs/uda134x.c   2009-10-15 22:24:00.000000000 +0300
@@ -163,7 +163,7 @@
   else
      mute_reg &= ~(1<<2);

-   uda134x_write(codec, UDA134X_DATA010, mute_reg & ~(1<<2));
+   uda134x_write(codec, UDA134X_DATA010, mute_reg);

   return 0;
}
@@ -419,6 +419,16 @@
SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0),
};

+int uda134x_soc_dummy_power_check(struct snd_soc_dapm_widget *w)
+{
+    return 1;
+}
+
+static const struct snd_soc_dapm_widget uda134x_dummy_dapm_widget = {
+    .id = snd_soc_dapm_vmid, 
+    .power_check = uda134x_soc_dummy_power_check
+};
+
static const struct snd_kcontrol_new uda1340_snd_controls[] = {
SOC_SINGLE("Master Playback Volume", UDA134X_DATA000, 0, 0x3F, 1),

@@ -562,6 +572,9 @@
      goto pcm_err;
   }

+   snd_soc_dapm_new_controls(codec, &uda134x_dummy_dapm_widget, 1);
+   snd_soc_dapm_new_widgets(codec);
+   
   ret = snd_soc_init_card(socdev);
   if (ret < 0) {
      printk(KERN_ERR "UDA134X: failed to register card\n");
===========================================================

Thanks.

mgalemin
Update:

Sorry, but I forgot to say that to have /dev/dsp and /dev/mixer nodes you
should also set in /arch/arm/configs/mini2440_defconfig next values:

CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y

But Alsa sound works normally without /dev/dsp and /dev/mixer nodes. So you
may leave mini2440_defconfig for 2.6.31 kernel in its default state.

Peter
GREAT, workaround works, Thanks alot mgalemin!