Skip to content
  1. Feb 08, 2021
  2. Feb 06, 2021
  3. Feb 05, 2021
  4. Feb 04, 2021
    • Hans de Goede's avatar
      mfd: arizona: Add support for ACPI enumeration of WM5102 connected over SPI · e9338367
      Hans de Goede authored
      
      
      The Intel Bay Trail (x86/ACPI) based Lenovo Yoga Tablet 2 series use
      a WM5102 codec connected over SPI.
      
      Add support for ACPI enumeration to arizona-spi so that arizona-spi can
      bind to the codec on these tablets.
      
      This is loosely based on an earlier attempt (for Android-x86) at this by
      Christian Hartmann, combined with insights in things like the speaker GPIO
      from the android-x86 android port for the Lenovo Yoga Tablet 2 1051F/L [1].
      
      [1] https://github.com/Kitsune2222/Android_Yoga_Tablet_2-1051F_Kernel
      
      Cc: Christian Hartmann <cornogle@googlemail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      e9338367
    • Hans de Goede's avatar
      mfd: arizona: Replace arizona_of_get_type() with device_get_match_data() · 039da225
      Hans de Goede authored
      
      
      Replace the custom arizona_of_get_type() function with the generic
      device_get_match_data() helper. Besides being a nice cleanup this
      also makes it easier to add support for binding to ACPI enumerated
      devices.
      
      While at it also fix a possible NULL pointer deref of the id
      argument to the probe functions (this could happen on e.g. manual
      driver binding through sysfs).
      
      Suggested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      039da225
    • Hans de Goede's avatar
      mfd: arizona: Add MODULE_SOFTDEP("pre: arizona_ldo1") · 06e577b4
      Hans de Goede authored
      
      
      The (shared) probing code of the arizona-i2c and arizona-spi modules
      takes the following steps during init:
      
      1. Call mfd_add_devices() for a set of early child-devices, this
      includes the arizona_ldo1 device which provides one of the
      core-regulators.
      
      2. Bulk enable the core-regulators.
      
      3. Read the device id.
      
      4. Call mfd_add_devices() for the other child-devices.
      
      This sequence depends on 1. leading to not only the child-device
      being created, but also the driver for the child-device binding
      to it and registering its regulator.
      
      This requires the arizona_ldo1 driver to be loaded before the
      shared probing code runs. Add a softdep for this to both modules to
      ensure that this requirement is met.
      
      Note this mirrors the existing MODULE_SOFTDEP("pre: wm8994_regulator")
      in the wm8994 code, which has a similar init sequence.
      
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
      06e577b4
    • Mark Brown's avatar
      Merge series "ASoC: soc-pcm: cleanup soc_new_pcm() and bugfix" from Kuninori... · 1c4273a5
      Mark Brown authored
      Merge series "ASoC: soc-pcm: cleanup soc_new_pcm() and bugfix" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
      
      Hi Mark
      
      These are soc-pcm cleanup patchset.
      
      	1) - 3) : cleanup soc_new_pcm() function
      	4)      : cleanup dpcm_runtime_merge_xxx() function
      	5)      : bugfix of snd_pcm_limit_hw_rates() order
      
      Kuninori Morimoto (5):
        1) ASoC: soc-pcm: tidyup pcm setting
        2) ASoC: soc-pcm: add soc_get_playback_capture() and simplify soc_new_pcm()
        3) ASoC: soc-pcm: add soc_create_pcm() and simplify soc_new_pcm()
        4) ASoC: soc-pcm: use snd_pcm_hardware at dpcm_runtime_merge_xxx()
        5) ASoC: soc-pcm: fixup snd_pcm_limit_hw_rates() timing
      
       sound/soc/soc-pcm.c | 124 +++++++++++++++++++++++++++-----------------
       1 file changed, 75 insertions(+), 49 deletions(-)
      
      --
      2.25.1
      1c4273a5
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: fixup snd_pcm_limit_hw_rates() timing · dd5abc78
      Kuninori Morimoto authored
      
      
      soc-pcm has snd_pcm_limit_hw_rates() which determine rate_min/rate_max.
      It updates runtime->hw.rate_min/max (A) based on hw->rates (B).
      
      	int snd_pcm_limit_hw_rates(...)
      	{
      		int i;
      		for (...) {
      (B)			if (runtime->hw.rates & (1 << i)) {
      (A)				runtime->hw.rate_min = ...
      				break;
      			}
      		}
      		for (...) {
      (B)			if (runtime->hw.rates & (1 << i)) {
      (A)				runtime->hw.rate_max = ...
      				break;
      			}
      		}
      		return 0;
      	}
      
      This means, setup order is
      
      	1) set hw->rates
      	2) call snd_pcm_limit_hw_rates()
      	3) update hw->rate_min/max
      
      soc_pcm_init_runtime_hw() is calling it in good order
      
      	static void soc_pcm_init_runtime_hw(xxx)
      	{
      		...
      1)		hw->rates = snd_pcm_rate_mask_intersect(...);
      
      2)		snd_pcm_limit_hw_rates(...);
      
      3)		hw->rate_min = max(...);
      		hw->rate_min = max(...);
      		hw->rate_max = min_not_zero(...);
      		hw->rate_max = min_not_zero(...);
      	}
      
      But, dpcm_fe_dai_startup() is not.
      
      	static int dpcm_fe_dai_startup(xxx)
      	{
      		...
      1) 3)		dpcm_set_fe_runtime(...);
      2)		snd_pcm_limit_hw_rates(...);
      		...
      	}
      
      More detail of dpcm_set_fe_runtime() is
      
      	static void dpcm_set_fe_runtime()
      	{
      		...
      		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
      			...
      
      3) 1)			dpcm_init_runtime_hw(...);
      		}
      		...
      3) 1)		dpcm_runtime_merge_rate(...);
      	}
      
      This patch fixup these into
      
      	static void dpcm_set_fe_runtime()
      	{
      		...
      		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
      			...
      
      1) 2) 3)		dpcm_init_runtime_hw(...);
      		}
      		...
      1) 2) 3)	dpcm_runtime_merge_rate(...);
      	}
      
      	static int dpcm_fe_dai_startup(xxx)
      	{
      		...
      		dpcm_set_fe_runtime(...);
      -		snd_pcm_limit_hw_rates(...);
      		...
      	}
      
      Link: https://lore.kernel.org/r/87k15l7ewd.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/8735ytaig8.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      dd5abc78
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: use snd_pcm_hardware at dpcm_runtime_merge_xxx() · 4b260f42
      Kuninori Morimoto authored
      
      
      soc-pcm has dpcm_runtime_merge_xxx() functions,
      but uses parameters are very verbose.
      
      	dpcm_runtime_merge_format(...,	&runtime->hw.formats);
      	dpcm_runtime_merge_chan(...,	&runtime->hw.channels_min,
      					&runtime->hw.channels_max);
      	dpcm_runtime_merge_rate(...,	&runtime->hw.rates,
      					&runtime->hw.rate_min,
      					&runtime->hw.rate_max);
      
      We want to replace it into
      
      	dpcm_runtime_merge_format(...,	runtime);
      	dpcm_runtime_merge_chan(...,	runtime);
      	dpcm_runtime_merge_rate(...,	runtime);
      
      This patch do it.
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/874kj9aigd.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      4b260f42
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: add soc_create_pcm() and simplify soc_new_pcm() · 2b39123b
      Kuninori Morimoto authored
      
      
      soc_new_pcm() implementation is very long / verbose / complex,
      thus, it is very difficult to read.
      If we read it carefully, we can notice that it is consisted by
      
      	int soc_new_pcm(...)
      	{
      		(1) judging playback/caputre part
      		(2) creating the PCM part
      		(3) setup pcm/rtd part
      	}
      
      This patch adds new soc_create_pcm() for (2) part
      and offload it from snd_pcm_new().
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/875z3paigi.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      2b39123b
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: add soc_get_playback_capture() and simplify soc_new_pcm() · 7fc6bebd
      Kuninori Morimoto authored
      
      
      soc_new_pcm() implementation is very long / verbose / complex,
      thus, it is very difficult to read.
      If we read it carefully, we can notice that it is consisted by
      
      	int soc_new_pcm(...)
      	{
      		(1) judging playback/caputre part
      		(2) creating the PCM part
      		(3) setup pcm/rtd part
      	}
      
      This patch adds new soc_get_playback_capture() for (1) part
      and offload it from soc_new_pcm().
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/877do5aign.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      7fc6bebd
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: tidyup pcm setting · e04e7b8c
      Kuninori Morimoto authored
      
      
      Current soc_new_pcm() setups pcm randomly.
      This patch tidyup it.
      
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/878s8laigt.wl-kuninori.morimoto.gx@renesas.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      e04e7b8c