ASoC: sigmadsp: Split regmap and I2C support into separate modules

When the SigmaDSP module is built-in, but I2C is build as a module we'll get a
undefined reference:

	sound/built-in.o: In function `sigma_action_write_i2c':
		:(.text+0x5d8d4): undefined reference to `i2c_master_send'

This can happen if a audio driver that is using the regmap SigmaDSP interface is
built into the kernel, but I2C support is build as a module. To fix this split
the SigmaDSP module into three modules, one module providing the core
infrastructure and two small modules implementing the regmap and I2C interfaces.
This allows e.g. the core infrastructure and regmap support to be built into the
kernel while I2C support can still be build as a module.

Fixes: dab464b60 ("ASoC: Add ADAU1361/ADAU1761 audio CODEC support")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
clk: Fix double free due to devm_clk_register()

Now that clk_unregister() frees the struct clk we're
unregistering we'll free memory twice: first we'll call kfree()
in __clk_release() with an address kmalloc doesn't know about and
second we'll call kfree() in the devres layer. Remove the
allocation of struct clk in devm_clk_register() and let
clk_release() handle it. This fixes slab errors like:

=============================================================================
BUG kmalloc-128 (Not tainted): Invalid object pointer 0xed08e8d0
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: Slab 0xeec503f8 objects=25 used=15 fp=0xed08ea00 flags=0x4081
CPU: 2 PID: 73 Comm: rmmod Tainted: G    B         3.14.0-11032-g526e9c764381 #34
[<c0014be0>] (unwind_backtrace) from [<c0012240>] (show_stack+0x10/0x14)
[<c0012240>] (show_stack) from [<c04b74dc>] (dump_stack+0x70/0xbc)
[<c04b74dc>] (dump_stack) from [<c00f6778>] (slab_err+0x74/0x84)
[<c00f6778>] (slab_err) from [<c04b6278>] (free_debug_processing+0x2cc/0x31c)
[<c04b6278>] (free_debug_processing) from [<c04b6300>] (__slab_free+0x38/0x41c)
[<c04b6300>] (__slab_free) from [<c03931bc>] (clk_unregister+0xd4/0x140)
[<c03931bc>] (clk_unregister) from [<c02fb774>] (release_nodes+0x164/0x1d8)
[<c02fb774>] (release_nodes) from [<c02f8698>] (__device_release_driver+0x60/0xb0)
[<c02f8698>] (__device_release_driver) from [<c02f9080>] (driver_detach+0xb4/0xb8)
[<c02f9080>] (driver_detach) from [<c02f8480>] (bus_remove_driver+0x5c/0xc4)
[<c02f8480>] (bus_remove_driver) from [<c008c9b8>] (SyS_delete_module+0x148/0x1d8)
[<c008c9b8>] (SyS_delete_module) from [<c000ef80>] (ret_fast_syscall+0x0/0x48)
FIX kmalloc-128: Object at 0xed08e8d0 not freed

Fixes: fcb0ee6a3d33 (clk: Implement clk_unregister)
Cc: Jiada Wang <jiada_wang@mentor.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Cc: stable@vger.kernel.org
iio: cf_axi_dds: Free clock notifier

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Disable correct clock in remove()

We need to disable the refin clock and not the converter clock.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Use devm_clk_register to register clocks

This makes sure that the clocks are properly freed when the device is removed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Remove unnecessary clock enables

The ref clocks will automatically be enabled when the PLL clocks are enabled, no
need to do this manually.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Make sure to disable clocks again

Make sure to disable the clocks that are enabled in ad9361_setup() when
resetting or removing the device.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Properly unregister clock provider

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Get parent clock name from devicetree

Get the name of the ref clock from the devicetree rather than hardcoding it to a
specific value. This make sure things work regardless of the name that was given
to the refclock.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Do not allocate refclk_scale structs separately

Embed the te refclk_scale structs into the driver state driver. This avoids
unnecessary memory allocations.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Fix ad9361_rf_phy struct forward declaration

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Do not allocate separate array for clk_data clks array

We already have a array containing pointers to all the clocks, use that instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
iio: ad9361: Remove unnecessary spi_set_drvdata(NULL)

The core takes already care of setting drvdata to NULL, no need to do this
manually.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>