sunxi-sound: Fix soc-audio.x should use snd_soc_register_card() warnings

These warnings are thrown at runtime when the device(s) in question are
registering.

Note this is possibly a 3.4 only thing / patch-series.

While almost rewriting this code anyways also fix:
1) script_parser_fetch's last argument is an integer count, not a byte count
2) Fix cleaning up of platform_device when driver registration fails
3) On module onload properly remove both the device and the driver

Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Backported to 3.0
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>

Conflicts:
	sound/soc/sun4i/hdmiaudio/sun4i-sndhdmi.c
	sound/soc/sun4i/i2s/sun4i-sndi2s.c
	sound/soc/sun4i/spdif/sun4i_sndspdif.c
sunxi-sound: Move registration of hdmi-audio devices to sunxi-hdmi code

Registering the hdmi audio-devices when not using hdmi means that userspace
may end up trying to use hdmi while it is not working. When hdmi-audio is
not enabled, and userspace still tries to use it the audio-using app(s) will
hang when trying to write to the audio-device, since the write will never
complete when the video-part is not consuming any hdmi-audio.

Note that this patch does not unregister the audio-card again if the hdmi
block is powered down (dpms / blank screen), so as to avoid audio-streaming
apps to crash / abort because the soundcard has gone away. Instead the app
will pause (write will block) on monitor powerdown and resume again when
the monitor powers back on.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Backported to 3.0
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>

Conflicts:
	sound/soc/sun4i/hdmiaudio/sun4i-hdmiaudio.c
	sound/soc/sun4i/hdmiaudio/sun4i-hdmipcm.c
sunxi-sound: Cleanup spdif_used parsing

Various spdif_used parsing fixes / cleanups:
1) sun4i_spdma was not honoring spdif_used
2) There are 4 .ko files build for spdif, having each of them complain when
   spdif_used is not set is a bit too much
3) script_parser_fetch's last argument is an integer count, not a byte count
4) Fix cleaning up of platform_device when driver registration fails
5) On module onload properly remove both the device and the driver

Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Backported to 3.0
Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
sunxi-sound: Honor audio_used fex file setting

So that devices which don't have analog audio hooked up don't get an
alsa sound-card for it.

While almost rewriting this code anyways also fix:
1) Cleaning up of platform_device when driver registration fails
2) On module onload properly remove both the device and the driver

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-sound: Honor capture_used and playback_used

So that the onboard-coded alsa-card does not advertises that it can playback /
capture sound on boards which cannot.

Note playback_used is a linux-sunxi.org fex file extension for boards which use
the onboard audio codec only for input, such as the uhost_u1a & mk802-a10s.

Since playback_used is a linux-sunxi.org fex file extension, it is assumed to
be 1 when not set.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
sunxi-rfkill: Don't register a bluetooth rfkill device when there is no bt

This also modifies mmc_pm_get_mod_type to make it safe to call before the
mmc_pm module_init function has completed running, since the sunxi-rfkill
module_init function may run first.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>