Re: [RFC 1/2] ARM:Tegra: Device Tree Support: Initialize the audio card from the device tree.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/5/28 John Bonesio <bones@xxxxxxxxxxxx>:
> This patch makes it so the top level audio card is initialized from the device
> tree. This is just the first step getting the audio complex of devices
> iniialized from device tree nodes.
>
> Signed-off-by: John Bonesio<bones@xxxxxxxxxxxx>
> ---
>
> Âarch/arm/boot/dts/tegra-harmony.dts | Â Â4 +++
> Âarch/arm/mach-tegra/board-dt.c   Â|  Â3 ++
> Âsound/soc/tegra/harmony.c      |  45 ++++++++++++++++++++++++++++++++---
> Â3 files changed, 48 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
> index 05521a5..217a7f0 100644
> --- a/arch/arm/boot/dts/tegra-harmony.dts
> +++ b/arch/arm/boot/dts/tegra-harmony.dts
> @@ -53,6 +53,10 @@
> Â Â Â Â Â Â Â Âclock-frequency = <400000>;
> Â Â Â Â};
>
> + Â Â Â harmony_audio: audio_card {
> + Â Â Â Â Â Â Â compatible = "nvidia,harmony-audio";
> + Â Â Â };
> +
> Â Â Â Âserial@70006300 {
> Â Â Â Â Â Â Â Âstatus = "ok";
> Â Â Â Â Â Â Â Âclock-frequency = < 216000000 >;
> diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c
> index c498e84..a569ad9 100644
> --- a/arch/arm/mach-tegra/board-dt.c
> +++ b/arch/arm/mach-tegra/board-dt.c
> @@ -56,6 +56,9 @@ static struct platform_device *tegra250_devices[] __initdata = {
> Â Â Â Â&tegra_i2c_device2,
> Â Â Â Â&tegra_i2c_device3,
> Â Â Â Â&tegra_i2c_device4,
> + Â Â Â &tegra_i2s_device1,
> + Â Â Â &tegra_das_device,
> + Â Â Â &tegra_pcm_device,

i am thinking whether platform_device should be created by
of_platform_device_create after scanning device tree, but not by
hard-code? looks like the two patches are only trying to let device
tree deliver gpio to drivers?

> Â};
>
> Âstatic __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
> diff --git a/sound/soc/tegra/harmony.c b/sound/soc/tegra/harmony.c
> index f225087..faeec14 100644
> --- a/sound/soc/tegra/harmony.c
> +++ b/sound/soc/tegra/harmony.c
> @@ -52,6 +52,18 @@
>
> Â#define DRV_NAME "tegra-snd-harmony"
>
> +/* temporary - info will go into device tree */
> +#define TEGRA_GPIO_PW2 Â Â Â Â Â178
> +#define TEGRA_GPIO_PX0 Â Â Â Â Â184
> +#define TEGRA_GPIO_PX1 Â Â Â Â Â185
> +
> +#define HARMONY_GPIO_WM8903(_x_) Â Â Â (TEGRA_NR_GPIOS + (_x_))
> +#define TEGRA_GPIO_SPKR_EN Â Â Â Â Â Â HARMONY_GPIO_WM8903(2)
> +#define TEGRA_GPIO_HP_DET Â Â Â Â Â Â ÂTEGRA_GPIO_PW2
> +#define TEGRA_GPIO_INT_MIC_EN Â Â Â Â ÂTEGRA_GPIO_PX0
> +#define TEGRA_GPIO_EXT_MIC_EN Â Â Â Â ÂTEGRA_GPIO_PX1
> +/* end temporary */
> +
> Â#define GPIO_SPKR_EN Â ÂBIT(0)
> Â#define GPIO_INT_MIC_EN BIT(1)
> Â#define GPIO_EXT_MIC_EN BIT(2)
> @@ -287,6 +299,14 @@ static struct snd_soc_card snd_soc_harmony = {
> Â Â Â Â.num_links = 1,
> Â};
>
> +/* temporary - put this into the device tree */
> +static struct harmony_audio_platform_data harmony_audio_pdata = {
> +    .gpio_spkr_en      = TEGRA_GPIO_SPKR_EN,
> +    .gpio_hp_det      Â= TEGRA_GPIO_HP_DET,
> +    .gpio_int_mic_en    Â= TEGRA_GPIO_INT_MIC_EN,
> +    .gpio_ext_mic_en    Â= TEGRA_GPIO_EXT_MIC_EN,
> +};
> +
> Âstatic __devinit int tegra_snd_harmony_probe(struct platform_device *pdev)
> Â{
> Â Â Â Âstruct snd_soc_card *card = &snd_soc_harmony;
> @@ -307,10 +327,15 @@ static __devinit int tegra_snd_harmony_probe(struct platform_device *pdev)
> Â Â Â Â}
> Â#endif
>
> - Â Â Â pdata = pdev->dev.platform_data;
> - Â Â Â if (!pdata) {
> - Â Â Â Â Â Â Â dev_err(&pdev->dev, "no platform data supplied\n");
> - Â Â Â Â Â Â Â return -EINVAL;
> + Â Â Â if (pdev->dev.of_node) {
> + Â Â Â Â Â Â Â pdev->dev.platform_data = &harmony_audio_pdata; /* temporary */
> + Â Â Â Â Â Â Â pdata = pdev->dev.platform_data;
> + Â Â Â } else {
> + Â Â Â Â Â Â Â pdata = pdev->dev.platform_data;
> + Â Â Â Â Â Â Â if (!pdata) {
> + Â Â Â Â Â Â Â Â Â Â Â dev_err(&pdev->dev, "no platform data supplied\n");
> + Â Â Â Â Â Â Â Â Â Â Â return -EINVAL;
> + Â Â Â Â Â Â Â }
> Â Â Â Â}
>
> Â Â Â Âharmony = kzalloc(sizeof(struct tegra_harmony), GFP_KERNEL);
> @@ -374,11 +399,23 @@ static int __devexit tegra_snd_harmony_remove(struct platform_device *pdev)
> Â Â Â Âreturn 0;
> Â}
>
> +#if defined(CONFIG_OF)
> +/* Match table for of_platform binding */
> +static const struct of_device_id harmony_of_match[] __devinitconst = {
> + Â Â Â { .compatible = "nvidia,harmony-audio", },
> + Â Â Â {},
> +};
> +MODULE_DEVICE_TABLE(of, harmony_of_match);
> +#endif
> +
> Âstatic struct platform_driver tegra_snd_harmony_driver = {
> Â Â Â Â.driver = {
> Â Â Â Â Â Â Â Â.name = DRV_NAME,
> Â Â Â Â Â Â Â Â.owner = THIS_MODULE,
> Â Â Â Â Â Â Â Â.pm = &snd_soc_pm_ops,
> +#if defined(CONFIG_OF)
> + Â Â Â Â Â Â Â .of_match_table = harmony_of_match,
> +#endif
> Â Â Â Â},
> Â Â Â Â.probe = tegra_snd_harmony_probe,
> Â Â Â Â.remove = __devexit_p(tegra_snd_harmony_remove),
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@xxxxxxxxxxxxxxxx
> https://lists.ozlabs.org/listinfo/devicetree-discuss
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux