This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

platform data from board file to DTS for audio codec

As am new to DTS & I have L3 interface for my audio codec UDA1345TS that needs to be ported onto DTS in TI SDK 7 & the reference for the same I have is the board file concept as shown below

/home/srinivasan/workspace/linux_wrking_copy/arch/arm/mach-s3c24xx (Board file)
===============================================================================

static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
    .l3_clk = S3C2410_GPB(4),
    .l3_mode = S3C2410_GPB(2),
    .l3_data = S3C2410_GPB(3),
    .model = UDA134X_UDA1341
};

static struct platform_device mini2440_audio = {
    .name        = "s3c24xx_uda134x",
    .id        = 0,
    .dev        = {
        .platform_data    = &mini2440_audio_pins,
    },
};

static struct platform_device uda1340_codec = {
        .name = "uda134x-codec",
        .id = -1,
};

static struct platform_device *mini2440_devices[] __initdata = {
    &s3c_device_ohci,
    &s3c_device_wdt,
    &s3c_device_i2c0,
    &s3c_device_rtc,
    &s3c_device_usbgadget,
    &mini2440_device_eth,
    &mini2440_led1,
    &mini2440_led2,
    &mini2440_led3,
    &mini2440_led4,
    &mini2440_button_device,
    &s3c_device_nand,
    &s3c_device_sdi,
    &s3c_device_iis,
    &uda1340_codec,
    &mini2440_audio,
};

sound/soc/samsung/s3c24xx_uda134x.c (platform driver file)
===================================================================

static struct s3c24xx_uda134x_platform_data *s3c24xx_uda134x_l3_pins;

static void setdat(int v)
{
    gpio_set_value(s3c24xx_uda134x_l3_pins->l3_data, v > 0);
}

static void setclk(int v)
{
    gpio_set_value(s3c24xx_uda134x_l3_pins->l3_clk, v > 0);
}

static void setmode(int v)
{
    gpio_set_value(s3c24xx_uda134x_l3_pins->l3_mode, v > 0);
}

/* FIXME - This must be codec platform data but in which board file ?? */
static struct uda134x_platform_data s3c24xx_uda134x = {
    .l3 = {
        .setdat = setdat,
        .setclk = setclk,
        .setmode = setmode,
        .data_hold = 1,
        .data_setup = 1,
        .clock_high = 1,
        .mode_hold = 1,
        .mode = 1,
        .mode_setup = 1,
    },
};

static int s3c24xx_uda134x_setup_pin(int pin, char *fun)
{
    if (gpio_request(pin, "s3c24xx_uda134x") < 0) {
        printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
               "l3 %s pin already in use", fun);
        return -EBUSY;
    }
    gpio_direction_output(pin, 0);
    return 0;
}

static int s3c24xx_uda134x_probe(struct platform_device *pdev)
{
    int ret;

    printk(KERN_INFO "S3C24XX_UDA134X SoC Audio driver\n");

    s3c24xx_uda134x_l3_pins = pdev->dev.platform_data;
    if (s3c24xx_uda134x_l3_pins == NULL) {
        printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
               "unable to find platform data\n");
        return -ENODEV;
    }
    s3c24xx_uda134x.power = s3c24xx_uda134x_l3_pins->power;
    s3c24xx_uda134x.model = s3c24xx_uda134x_l3_pins->model;

    if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_data,
                      "data") < 0)
        return -EBUSY;
    if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_clk,
                      "clk") < 0) {
        gpio_free(s3c24xx_uda134x_l3_pins->l3_data);
        return -EBUSY;
    }
    if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_mode,
                      "mode") < 0) {
        gpio_free(s3c24xx_uda134x_l3_pins->l3_data);
        gpio_free(s3c24xx_uda134x_l3_pins->l3_clk);
        return -EBUSY;
    }

    s3c24xx_uda134x_snd_device = platform_device_alloc("soc-audio", -1);
    if (!s3c24xx_uda134x_snd_device) {
        printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
               "Unable to register\n");
        return -ENOMEM;
    }

    platform_set_drvdata(s3c24xx_uda134x_snd_device,
                 &snd_soc_s3c24xx_uda134x);
    platform_device_add_data(s3c24xx_uda134x_snd_device, &s3c24xx_uda134x, sizeof(s3c24xx_uda134x));
    ret = platform_device_add(s3c24xx_uda134x_snd_device);
    if (ret) {
        printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n");
        platform_device_put(s3c24xx_uda134x_snd_device);
    }

    return ret;
}

static int s3c24xx_uda134x_remove(struct platform_device *pdev)
{
    platform_device_unregister(s3c24xx_uda134x_snd_device);
    gpio_free(s3c24xx_uda134x_l3_pins->l3_data);
    gpio_free(s3c24xx_uda134x_l3_pins->l3_clk);
    gpio_free(s3c24xx_uda134x_l3_pins->l3_mode);
    return 0;
}

static struct platform_driver s3c24xx_uda134x_driver = {
    .probe  = s3c24xx_uda134x_probe,
    .remove = s3c24xx_uda134x_remove,
    .driver = {
        .name = "s3c24xx_uda134x",
        .owner = THIS_MODULE,
    },
};

module_platform_driver(s3c24xx_uda134x_driver);

sound/soc/codecs/Uda134x.c ( client driver file)
===================================================================

static int uda134x_soc_probe(struct snd_soc_codec *codec)
{
    struct uda134x_priv *uda134x;
    struct uda134x_platform_data *pd = codec->card->dev->platform_data;
    const struct snd_soc_dapm_widget *widgets;
    unsigned num_widgets;

    int ret;

    printk(KERN_INFO "SRINIII CLIENT DRIVER UDA134X SoC Audio Codec probe....\n");

    if (!pd) {
        printk(KERN_ERR "UDA134X SoC codec: "
               "missing L3 bitbang function\n");
        return -ENODEV;
    }

    switch (pd->model) {
    case UDA134X_UDA1340:
    case UDA134X_UDA1341:
    case UDA134X_UDA1344:
    case UDA134X_UDA1345:
        break;
    default:
        printk(KERN_ERR "UDA134X SoC codec: "
               "unsupported model %d\n",
            pd->model);
        return -EINVAL;
    }

    uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL);
    if (uda134x == NULL)
        return -ENOMEM;
    snd_soc_codec_set_drvdata(codec, uda134x);

    codec->control_data = pd;

    if (pd->power)
        pd->power(1);

    uda134x_reset(codec);

    if (pd->is_powered_on_standby)
        uda134x_set_bias_level(codec, SND_SOC_BIAS_ON);
    else
        uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

    if (pd->model == UDA134X_UDA1341) {
        widgets = uda1341_dapm_widgets;
        num_widgets = ARRAY_SIZE(uda1341_dapm_widgets);
    } else {
        widgets = uda1340_dapm_widgets;
        num_widgets = ARRAY_SIZE(uda1340_dapm_widgets);
    }

    ret = snd_soc_dapm_new_controls(&codec->dapm, widgets, num_widgets);
    if (ret) {
        printk(KERN_ERR "%s failed to register dapm controls: %d",
            __func__, ret);
        kfree(uda134x);
        return ret;
    }


    switch (pd->model) {
    case UDA134X_UDA1340:
    case UDA134X_UDA1344:
        ret = snd_soc_add_codec_controls(codec, uda1340_snd_controls,
                    ARRAY_SIZE(uda1340_snd_controls));
    break;
    case UDA134X_UDA1341:
        ret = snd_soc_add_codec_controls(codec, uda1341_snd_controls,
                    ARRAY_SIZE(uda1341_snd_controls));
    break;
    case UDA134X_UDA1345:
        printk("SWITCHING TO UDA134X_UDA1345 SNDDDDDDDDDDD CONTROLSSSSSSSSSS\n");
        ret = snd_soc_add_codec_controls(codec, uda1345_snd_controls,
                    ARRAY_SIZE(uda1345_snd_controls));
    break;
    default:
        printk(KERN_ERR "%s unknown codec type: %d",
            __func__, pd->model);
        kfree(uda134x);
        return -EINVAL;
    }

    if (ret < 0) {
        printk(KERN_ERR "UDA134X: failed to register controls\n");
        kfree(uda134x);
        return ret;
    }

    return 0;
}

I have done few code changes in DTS as shown below for which the platform data needs to be parsed in davinci-evm.c similar to s3c24xx_uda134x.c, please correct me if my approach is wrong


DTS file changes
================

arch/arm/boot/dts/am335x-bone-common.dtsi

        uda1345_l3_default: uda1345_l3_default {
            pinctrl-single,pins = <
                0xc8 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpio2_16.LCD_DATA10.U3 MP1 OVERFL output */
                0xcc (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpio2_17.LCD_DATA11.U4 MP2 L3MODE  */
                0xd8 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpio0_10.LCD_DATA14.V4 MP3 L3CLOCK */
                0xd0 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpio0_8.LCD_DATA12.V2 MP4 L3DATA   */
                0xd4 (PIN_OUTPUT_PULLUP | MUX_MODE7)    /* gpio0_9.LCD_DATA13.V3 MP5 ADC 1V or 2V (RMS) input control*/
            >;
        };
 
        uda1345_l3_sleep: uda1345_l3_sleep {
            pinctrl-single,pins = <
 
                0xc8 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpio2_16.LCD_DATA10.U3 MP1 OVERFL output */
                0xcc (PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpio2_17.LCD_DATA11.U4 MP2 L3MODE  */
                0xd8 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpio0_10.LCD_DATA14.V4 MP3 L3CLOCK */
                0xd0 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpio0_8.LCD_DATA12.V2 MP4 L3DATA   */
                0xd4 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)    /* gpio0_9.LCD_DATA13.V3 MP5  ADC 1V or 2V (RMS) input control*/
        
 
            >;
        };



           uda134x: uda134x {
        compatible = "ti,uda134x";
    
            model = "UDA134X_UDA1345";            
 
    };



        sound {
                        compatible = "ti,uda134x-audio-codec";
            ti,model = "TI UDA1345TS";
                        //ti,model = "AM335x-EVM";
                        ti,audio-codec = <&uda134x>;
                        ti,mcasp-controller = <&mcasp0>;
                        /*ti,codec-clock-rate = <12000000>;*/
            ti,codec-clock-rate = <12288000>;
                        ti,audio-routing =
                "ADC",       "VINL1",
                "ADC",       "VINR1",
                "VOUTL",               "DAC",
                "VOUTR",               "DAC";
 
            power = <1>; // THIS VALUE NEEDS TO BE RECHECKED AGAIN
            
            model = "UDA134X_UDA1345";
            // gpio0_8.LCD_DATA12.V2 MP4 L3DATA    
            l3_data = <&gpio0 8 0x1>;
 
            // gpio0_10.LCD_DATA14.V4 MP3 L3CLOCK  
            l3_clk = <&gpio0 10 0x1>;
 
            // gpio2_17.LCD_DATA11.U4 MP2 L3MODE   
                           l3_mode = <&gpio2 17 0x1>;
 
            // gpio0_9.LCD_DATA13.V3 MP5 is set LOW, 0 dB gain is selected. when MP5 is set HIGH, 6dB gain is selected
            l3_gain = <&gpio0 9 0x1>;    
            
            // gpio2_16.LCD_DATA10.U3 MP1 OVERFL output
            l3_overfl = <&gpio2 16 0x0>;
 
            pinctrl-names = "default", "sleep";
            pinctrl-0 = <&uda1345_l3_default>;
            pinctrl-1 = <&uda1345_l3_sleep>;
 
 
         };
 



sound/soc/Davinci/Davinci-evm.c
================================

#ifdef CONFIG_OF
static int davinci_uda1345_probe_dt(/*struct am335x_uda134x_platform_data *data,*/
             struct platform_device *pdev)
{
    
    struct device_node *node = pdev->dev.of_node;
    struct am335x_uda134x_platform_data *pdata;
    enum of_gpio_flags flags;
    int gpio;

    int ret=0;

        if (!node)
        {
            printk("DAVINCI_UDA1345_PROBE_DT device lacks DT UDA1345TS data\n");
            //return ERR_PTR(-ENODEV);
            return 0;
        }

        pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata) {
            printk("DAVINCI_UDA1345_PROBE_DT could not allocate memory for platform data for UDA1345TS\n");
            return -ENOMEM;
        }

        if (node) {

                printk("DAVINCI_UDA1345_PROBE_DT NODE L3_DATATAAA\n");

                gpio = of_get_named_gpio_flags(node, "l3_data", 0, &flags);
#if 1
                if (gpio_is_valid(gpio)) {
                    printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_DATATAA PINNNNN\n");
                    ret = devm_gpio_request_one(&pdev->dev, gpio,
                             flags & OF_GPIO_ACTIVE_LOW ?
                            GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                             "uda1345 l3_data");
                    if (ret < 0)
                    {
                        printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_DATATAAA\n");
                        return ret;
                    }    
                }
#endif
                pdata->l3_data = gpio;
        }

        



        if (node) {

                printk("DAVINCI_UDA1345_PROBE_DT NODE L3_clkkkkkk\n");

                gpio = of_get_named_gpio_flags(node, "l3_clk", 0, &flags);
#if 1
                if (gpio_is_valid(gpio)) {
                    printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_clkkkkkk PINNNNNNNNN\n");
                    ret = devm_gpio_request_one(&pdev->dev, gpio,
                             flags & OF_GPIO_ACTIVE_LOW ?
                            GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                             "uda1345 l3_clk");
                    if (ret < 0)
                    {
                        printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_clkkkkkk\n");
                        return ret;
                    }    
                }
#endif            
                pdata->l3_clk = gpio;        
                
          }

        
        

        if (node) {

                printk("DAVINCI_UDA1345_PROBE_DT NODE L3_modeeeee\n");

                gpio = of_get_named_gpio_flags(node, "l3_mode", 0, &flags);
#if 1                
                if (gpio_is_valid(gpio)) {
                    printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_modeeeee PINNNNNNNNN\n");
                    ret = devm_gpio_request_one(&pdev->dev, gpio,
                             flags & OF_GPIO_ACTIVE_LOW ?
                            GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                             "uda1345 l3_mode");
                    if (ret < 0)
                    {
                        printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_modeeeee\n");
                        return ret;
                    }    
                }
#endif
                pdata->l3_mode = gpio;    
        
        }

#if 0

        ret = of_property_read_u32(node, "model",
                       &pdata->model);
        if (ret) {
            printk("Not found L3 PLATFORM DATA MODEL NOT FOUND!!!!!!!!!!!!!!!\n");
            //pdata->companion_addr = 0;
        }
        else
        {
            printk("FOUNDDDD L3 PLATFORM DATA MODEL NOT FOUND!!!!!!!!!!!!!!!\n");
        }
        


        ret = of_property_read_u32(node, "power",
                       &pdata->power);
        if (ret) {
            printk("Not found L3 PLATFORM DATA POWER NOT FOUND!!!!!!!!!!!!!!!\n");
            //pdata->companion_addr = 0;
        }
        else
        {
            printk("FOUNDDDD L3 PLATFORM DATA POWER NOT FOUND!!!!!!!!!!!!!!!\n");
        }
#endif        
        pdev->dev.platform_data = pdata;

#if 0
                     /* no such property */
        if (of_property_read_u32(node, "l3_clk", &pdata->l3_clk) != 0)
                    return NULL;

     if (of_property_read_u32(node, "l3_mode", &pdata->l3_mode) != 0)
                    return NULL;

      if (of_property_read_u32(node, "l3_data", &pdata->l3_data) != 0)
                    return NULL;
         
                /* pdata->bar is filled in with 5 */
         return pdata;
#endif                
    
#if 0    
    u32 prop;

    if (!node)
        return -EINVAL;


    if (of_property_read_u32(node, "bus_freq", &prop)) {
        pr_err("Missing bus_freq property in the DT.\n");
        return -EINVAL;
    }
    data->bus_freq = prop;

    return 0;
#endif    
    return 0;
}
#endif

static int davinci_evm_probe(struct platform_device *pdev)
{
    struct device_node *np = pdev->dev.of_node;
    const struct of_device_id *match =
        of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
    struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data;
    struct snd_soc_card_drvdata_davinci *drvdata = NULL;
    struct clk *mclk;
    int ret = 0;
    //struct am335x_uda134x_platform_data *pdata;
    //struct am335x_uda134x_platform_data *pdata = dev_get_platdata(&pdev->dev);
    //struct am335x_uda134x_platform_data *pdata;

        //struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
    //struct platform_pwm_backlight_data defdata;

    //struct pinctrl *pinctrl;

    evm_soc_card.dai_link = dai;

    printk(KERN_INFO "DAVINCI EVM PROBE FOR UDA1345TSSSSSSSSS CODEC SoC Audio driver\n");


#if 1    
        ret = davinci_uda1345_probe_dt(/*&data->pdata,*/ pdev);
        if (ret)
        {
            printk(KERN_ERR "AM335X_UDA134X SoC Audio unable to find platform data\n");
            return ret;
        }
        else
        {
            printk(KERN_ERR "AM335X_UDA134X SoC Audio DAVINCIIIIIIIIII able to find platform data\n");
        }

#endif          

#if 1
    
    am335x_uda134x_l3_pins = pdev->dev.platform_data;
    if (am335x_uda134x_l3_pins == NULL) {
        printk(KERN_ERR "AM335X_UDA134X SoC Audio: "
               "unable to find platform data\n");
        return -ENODEV;
    }
    
    //am335x_uda134x.model = am335x_uda134x_l3_pins->model;
    //am335x_uda134x_l3_pins->power = 1;
    am335x_uda134x_l3_pins->power = 1;
    am335x_uda134x_l3_pins->model = 4;
    am335x_uda134x.power = am335x_uda134x_l3_pins->power;
    am335x_uda134x.model = am335x_uda134x_l3_pins->model;
    am335x_uda134x_l3_pins->l3_data = 8; // // gpio0_8.LCD_DATA12.V2 MP4 L3DATA  0*32 + 8 = 8
    am335x_uda134x_l3_pins->l3_clk = 10; // // gpio0_10.LCD_DATA14.V4 MP3 L3CLOCK 0*32+ 10 = 10
    am335x_uda134x_l3_pins->l3_mode = 81;// // gpio2_17.LCD_DATA11.U4 MP2 L3MODE 2*32+17 = 81

    if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_data,
                      "data") < 0)
        return -EBUSY;
    if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_clk,
                      "clk") < 0) {
        gpio_free(am335x_uda134x_l3_pins->l3_data);
        return -EBUSY;
    }
    if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_mode,
                      "mode") < 0) {
        gpio_free(am335x_uda134x_l3_pins->l3_data);
        gpio_free(am335x_uda134x_l3_pins->l3_clk);
        return -EBUSY;
    }

#endif

    dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
    if (!dai->codec_of_node)
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS FAILUREEE ti,audio-codec \n");
        return -EINVAL;

    }
    else
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS SUCCESSFULL ti,audio-codec\n");
    }        

    dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0);
    if (!dai->cpu_of_node)
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS FAILURE ti,mcasp-controller\n");
        return -EINVAL;
    }
    else
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS SUCCESSFULL ti,mcasp-controller\n");
    }

    /* Only set the platform_of_node if the platform_name is not set */
    if (!dai->platform_name)
        dai->platform_of_node = dai->cpu_of_node;

    evm_soc_card.dev = &pdev->dev;
    ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model");
    if (ret)
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is failuree\n");
        return ret;

    }
    else
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is SUCCESSSFULL\n");

    }

    mclk = of_clk_get_by_name(np, "ti,codec-clock");
    if (PTR_ERR(mclk) == -EPROBE_DEFER)
        return -EPROBE_DEFER;
    else if (IS_ERR(mclk)) {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC MCLKKK ti,codec-clock is SUCCESSSFULL\n");
        dev_dbg(&pdev->dev, "Codec clock not found.\n");
        mclk = NULL;
    }

    drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
    if (!drvdata)
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA FAILUREE\n");
        return -ENOMEM;
    }    
    else
    {
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA SUCCESSFULL\n");
    }

    drvdata->mclk = mclk;

    ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk);

    if (ret < 0) {
        if (!drvdata->mclk) {
            dev_err(&pdev->dev,
                "No clock or clock rate defined.\n");
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC,codec-clock-rate NNNNNOT FOUNDDDD\n");
            return -EINVAL;
        }
        drvdata->sysclk = clk_get_rate(drvdata->mclk);
    } else if (drvdata->mclk) {
        unsigned int requestd_rate = drvdata->sysclk;
        clk_set_rate(drvdata->mclk, drvdata->sysclk);
        drvdata->sysclk = clk_get_rate(drvdata->mclk);
        if (drvdata->sysclk != requestd_rate)
            dev_warn(&pdev->dev,
                 "Could not get requested rate %u using %u.\n",
                 requestd_rate, drvdata->sysclk);
        printk("DAVINCI EVM PROBE FOR UDA1345 CODEC,codec-clock-rate FOUNDDD\n");
    }



        //platform_set_drvdata(pdev, &evm_soc_card);
    snd_soc_card_set_drvdata(&evm_soc_card, &am335x_uda134x);

    //snd_soc_card_set_drvdata(&evm_soc_card, drvdata);
    ret = snd_soc_register_card(&evm_soc_card);

    if (ret)
        dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);

    return ret;
}



sound/soc/codecs/uda134x.c
===================================

#if defined(CONFIG_OF)
static const struct of_device_id uda134x_dt_ids[] = {
    { .compatible = "ti,uda134x" },
    { }
};
MODULE_DEVICE_TABLE(of, uda134x_dt_ids);
#endif


static struct platform_driver uda134x_codec_driver = {
    .driver = {
        .name = "uda134x-codec",
        .owner = THIS_MODULE,
        .of_match_table = of_match_ptr(uda134x_dt_ids),
    },
    .probe = uda134x_codec_probe,
    .remove = uda134x_codec_remove,
};


logs:
=====


[    1.290144] DAVINCI_UDA1345_PROBE_DT NODE L3_DATATAAA
[    1.295445] DAVINCI_UDA1345_PROBE_DT NODE L3_clkkkkkk
[    1.300755] DAVINCI_UDA1345_PROBE_DT NODE L3_modeeeee
[    1.306050] AM335X_UDA134X SoC Audio DAVINCIIIIIIIIII able to find platform data
[    1.313814] AM335X_UDA134X SoC Audio: l3 data pin is used for the first time
[    1.321212] AM335X_UDA134X SoC Audio: l3 clk pin is used for the first time
[    1.328540] AM335X_UDA134X SoC Audio: l3 mode pin is used for the first time
[    1.335989] DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS SUCCESSFULL ti,audio-codec
[    1.345394] DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS SUCCESSFULL ti,mcasp-controller
[    1.355064] DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is SUCCESSSFULL
[    1.364641] DAVINCI EVM PROBE FOR UDA1345 CODEC MCLKKK ti,codec-clock is SUCCESSSFULL
[    1.372896] DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA SUCCESSFULL
[    1.379553] mmc0: new high speed SDHC card at address aaaa
[    1.385452] SRINIII CLIENT DRIVER UDA134X SoC Audio Codec probe....
[    1.392039] UDA134X SoC codec: unsupported model 0
[    1.397063] uda134x-codec uda134x.3: ASoC: failed to probe CODEC -22
[    1.404244] mmcblk0: mmc0:aaaa SS04G 3.69 GiB
[    1.409615] davinci_evm sound.4: ASoC: failed to instantiate card -22
[    1.416525]  mmcblk0: p1 p2
[    1.419738] davinci_evm sound.4: snd_soc_register_card failed (-22)
[    1.426323] davinci_evm: probe of sound.4 failed with error -22




Could you please help me in porting l3 driver from the above board file to DTS in ti sdk 7, & could you please correct me my mistakes w.r.t this DTS porting, because of which I am stuck with this from past two weeks badly & unable to register sound card & get the PCM nodes created for the same & I tried googling & I was able to succeed to some extent till as shown above


Kindly do the needful in resolving this issues as early as possible so that it will be very grateful & would be appreciated a lot, as I didn't get any replies for my earlier post also.


Awaiting for your replies,
Many Many Thanks in advance

  • Kindly requesting, Could anybody please address the above thread as early as possible
  • Hi Srini,

    I don't think it is straight away possible.

    You need to understand certain key things like how and where the board file contents are used and similarly where the dtb file is parsed and used. Then you could easily sort out. Get down one step deeper on traces.
  • Thanks a lot for quick your replies,

    Now am able to parse my dts contents from dts & able to print in davinci-evm.c file but after reaching the probe function of my codec driver it is getting displayed as,

    [    0.485773] UDA134X SoC codec: unsupported model -1984084113

    I have embedded the uda134x_platform_data in drvdata structure of davinci-evm.c file as shown below,

    could you please now kindly let me know why am  unable to parse this data in uda134x.c file ie., in uda134x.c

    static int uda134x_soc_probe(struct snd_soc_codec *codec) function

     hope below line of code needs to be changed I feel

    struct uda134x_platform_data *pd = codec->card->dev->platform_data;

    because of which am not getting the uda134x_platform_data which is being passed from davinci-evm.c file, could you please help me out how the above line can be modified so that data can be parsed in static int uda134x_soc_probe(struct snd_soc_codec *codec) function of uda134x.c from davinci-evm.c

    Davinci-evm.c

    ============

    #include <sound/l3.h>

    struct uda134x_platform_data {
        struct l3_pins l3;
        void (*power) (int);
        int model;
        /*
          ALSA SOC usually puts the device in standby mode when it's not used
          for sometime. If you unset is_powered_on_standby the driver will
          turn off the ADC/DAC when this callback is invoked and turn it back
          on when needed. Unfortunately this will result in a very light bump
          (it can be audible only with good earphones). If this bothers you
          set is_powered_on_standby, you will have slightly higher power
          consumption. Please note that sending the L3 command for ADC is
          enough to make the bump, so it doesn't make difference if you
          completely take off power from the codec.
        */
        int is_powered_on_standby;
    #define UDA134X_UDA1340 1
    #define UDA134X_UDA1341 2
    #define UDA134X_UDA1344 3
    #define UDA134X_UDA1345 4
    };

    struct snd_soc_card_drvdata_davinci {
        struct clk *mclk;
        unsigned sysclk;
        unsigned clk_gpio;
        //struct am335x_uda134x_platform_data *am335x_uda134x_l3_pins;
        struct uda134x_platform_data am335x_uda134x ;
        struct snd_pcm_hw_constraint_list *rate_constraint;
    };

    #if 1
    static void setdat(int v)
    {
        gpio_set_value(am335x_uda134x_l3_pins->l3_data, v > 0);
        
        printk("static void setdat %d\n", am335x_uda134x_l3_pins->l3_data);
        
    }

    static void setclk(int v)
    {
        gpio_set_value(am335x_uda134x_l3_pins->l3_clk, v > 0);
        printk("static void setclk %d\n",am335x_uda134x_l3_pins->l3_clk);
    }

    static void setmode(int v)
    {
        gpio_set_value(am335x_uda134x_l3_pins->l3_mode, v > 0);
        printk("static void setmode %d\n", am335x_uda134x_l3_pins->l3_mode);
    }
    #endif
    /* FIXME - This must be codec platform data but in which board file ?? */
    static struct uda134x_platform_data am335x_uda134x = {
        .l3 = {
            .setdat = setdat,
            .setclk = setclk,
            .setmode = setmode,
            .data_hold = 1,
            .data_setup = 1,
            .clock_high = 1,
            .mode_hold = 1,
            .mode = 1,
            .mode_setup = 1,
        },
    };

    static int am335x_uda134x_setup_pin(int pin, char *fun)
    {
        if (gpio_request(pin, "am335x_uda134x") < 0) {
            printk(KERN_ERR "AM335X_UDA134X SoC Audio: "
                   "l3 %s pin already in use", fun);
            return -EBUSY;
        }
        else
        {
            printk(KERN_ERR "AM335X_UDA134X SoC Audio: "
                   "l3 %s pin is used for the first time\n", fun);
            
        }
        //gpio_direction_output(pin, 0);
        gpio_direction_output(pin, 1); // IN am335x arg 1 is direction out
        return 0;
    }

    #ifdef CONFIG_OF
    static int davinci_uda1345_probe_dt(/*struct am335x_uda134x_platform_data *data,*/
                 struct platform_device *pdev)
    {
        
        struct device_node *node = pdev->dev.of_node;
        struct am335x_uda134x_platform_data *pdata;
        enum of_gpio_flags flags;
        int gpio;

        int ret=0;

            if (!node)
            {
                printk("DAVINCI_UDA1345_PROBE_DT device lacks DT UDA1345TS data\n");
                //return ERR_PTR(-ENODEV);
                return 0;
            }

            pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
            if (!pdata) {
                printk("DAVINCI_UDA1345_PROBE_DT could not allocate memory for platform data for UDA1345TS\n");
                return -ENOMEM;
            }

            if (node) {

                    printk("DAVINCI_UDA1345_PROBE_DT NODE L3_DATATAAA\n");


                    gpio = of_get_named_gpio_flags(node, "l3_data", 0, &flags);


                    printk("GPIO VALUEEEEE l3_dataaaaaaaaaa %d\n", gpio);
    #if 1
                    if (gpio_is_valid(gpio)) {
                        printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_DATATAA PINNNNN\n");
                        ret = devm_gpio_request_one(&pdev->dev, gpio,
                                 flags & OF_GPIO_ACTIVE_LOW ?
                                GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                                 "uda1345 l3_data");
                        if (ret < 0)
                        {
                            printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_DATATAAA\n");
                            return ret;
                        }    
                    }
    #endif
                    pdata->l3_data = gpio;

                    printk("GPIO VALUEEEEE l3_dataaaaaaaaaa pdata->l3_data %d\n", pdata->l3_data);

            }

            
            if (node) {

                    printk("DAVINCI_UDA1345_PROBE_DT NODE L3_clkkkkkk\n");

                    gpio = of_get_named_gpio_flags(node, "l3_clk", 0, &flags);
    #if 1
                    if (gpio_is_valid(gpio)) {
                        printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_clkkkkkk PINNNNNNNNN\n");
                        ret = devm_gpio_request_one(&pdev->dev, gpio,
                                 flags & OF_GPIO_ACTIVE_LOW ?
                                GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                                 "uda1345 l3_clk");
                        if (ret < 0)
                        {
                            printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_clkkkkkk\n");
                            return ret;
                        }    
                    }
    #endif            
                    pdata->l3_clk = gpio;    
                    printk("GPIO VALUEEEEE l3_clkkkkkkkkkkkkkkkkk pdata->l3_clk %d\n", pdata->l3_clk);
                    
              }


            if (node) {

                    printk("DAVINCI_UDA1345_PROBE_DT NODE L3_modeeeee\n");

                    gpio = of_get_named_gpio_flags(node, "l3_mode", 0, &flags);
    #if 1                
                    if (gpio_is_valid(gpio)) {
                        printk("DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_modeeeee PINNNNNNNNN\n");
                        ret = devm_gpio_request_one(&pdev->dev, gpio,
                                 flags & OF_GPIO_ACTIVE_LOW ?
                                GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
                                 "uda1345 l3_mode");
                        if (ret < 0)
                        {
                            printk("DAVINCI_UDA1345_PROBE_DT devm_gpio_request_one errrrrrrrr L3_modeeeee\n");
                            return ret;
                        }    
                    }
    #endif
                    pdata->l3_mode = gpio;    
                    printk("GPIO VALUEEEEE l3_modeeeeeeeeeeeee  pdata->l3_mode %d\n", pdata->l3_mode);
            }

    #if 1

            ret = of_property_read_u32(node, "model",
                          (u32*)&pdata->model);
            if (ret) {
                printk("Not found L3 PLATFORM DATA MODEL NOT FOUND!!!!!!!!!!!!!!!\n");

            }
            else
            {
                printk("FOUNDDDD L3 PLATFORM DATA MODEL  FOUND!!!!!!!!!!!!!!! === %d\n", pdata->model);
            }
            


            ret = of_property_read_u32(node, "power",
                          (u32*) &pdata->power);
            if (ret) {
                printk("Not found L3 PLATFORM DATA POWER NOT FOUND!!!!!!!!!!!!!!!\n");

            }
            else
            {
                printk("FOUNDDDD L3 PLATFORM DATA POWER  FOUND!!!!!!!!!!!!!!!=== %d\n", pdata->power);
            }
    #endif        
            pdev->dev.platform_data = pdata;

        
        return 0;
    }
    #endif

    static int davinci_evm_probe(struct platform_device *pdev)
    {
        struct device_node *np = pdev->dev.of_node;
        const struct of_device_id *match =
            of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
        struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data;
        struct snd_soc_card_drvdata_davinci *drvdata = NULL;
        struct clk *mclk;
        int ret = 0;

        struct snd_soc_card *evm_snd_dev_data;
        evm_snd_dev_data = &am335x_snd_soc_card;

        evm_soc_card.dai_link = dai;

        printk(KERN_INFO "DAVINCI EVM PROBE FOR UDA1345TSSSSSSSSS CODEC SoC Audio driver\n");



        dai->codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
        if (!dai->codec_of_node)
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS FAILUREEE ti,audio-codec \n");
            return -EINVAL;

        }
        else
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS SUCCESSFULL ti,audio-codec\n");
        }        

        dai->cpu_of_node = of_parse_phandle(np, "ti,mcasp-controller", 0);
        if (!dai->cpu_of_node)
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS FAILURE ti,mcasp-controller\n");
            return -EINVAL;
        }
        else
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS SUCCESSFULL ti,mcasp-controller\n");
        }

        /* Only set the platform_of_node if the platform_name is not set */
        if (!dai->platform_name)
            dai->platform_of_node = dai->cpu_of_node;

        evm_soc_card.dev = &pdev->dev;
        ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model");
        if (ret)
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is failuree\n");
            return ret;

        }
        else
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is SUCCESSSFULL\n");

        }

        mclk = of_clk_get_by_name(np, "ti,codec-clock");
        if (PTR_ERR(mclk) == -EPROBE_DEFER)
            return -EPROBE_DEFER;
        else if (IS_ERR(mclk)) {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC MCLKKK ti,codec-clock is SUCCESSSFULL\n");
            dev_dbg(&pdev->dev, "Codec clock not found.\n");
            mclk = NULL;
        }

        drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata)
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA FAILUREE\n");
            return -ENOMEM;
        }    
        else
        {
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA SUCCESSFULL\n");
        }

        drvdata->mclk = mclk;

        ret = of_property_read_u32(np, "ti,codec-clock-rate", &drvdata->sysclk);

        if (ret < 0) {
            if (!drvdata->mclk) {
                dev_err(&pdev->dev,
                    "No clock or clock rate defined.\n");
                printk("DAVINCI EVM PROBE FOR UDA1345 CODEC,codec-clock-rate NNNNNOT FOUNDDDD\n");
                return -EINVAL;
            }
            drvdata->sysclk = clk_get_rate(drvdata->mclk);
        } else if (drvdata->mclk) {
            unsigned int requestd_rate = drvdata->sysclk;
            clk_set_rate(drvdata->mclk, drvdata->sysclk);
            drvdata->sysclk = clk_get_rate(drvdata->mclk);
            if (drvdata->sysclk != requestd_rate)
                dev_warn(&pdev->dev,
                     "Could not get requested rate %u using %u.\n",
                     requestd_rate, drvdata->sysclk);
            printk("DAVINCI EVM PROBE FOR UDA1345 CODEC,codec-clock-rate FOUNDDD\n");
        }



            ret = davinci_uda1345_probe_dt(pdev);
            if (ret)
            {
                printk(KERN_ERR "AM335X_UDA134X SoC Audio unable to find platform data\n");
                return ret;
            }
            else
            {
                printk(KERN_ERR "AM335X_UDA134X SoC Audio DAVINCIIIIIIIIII able to find platform data\n");
            }


            am335x_uda134x_l3_pins = pdev->dev.platform_data;
            //drvdata->am335x_uda134x_l3_pins = pdev->dev.platform_data;
            if (am335x_uda134x_l3_pins == NULL) {
                printk(KERN_ERR "AM335X_UDA134X SoC Audio: "
                       "unable to find platform data\n");
                return -ENODEV;
            }

            printk("am335x_uda134x_l3_pins->model %d\n",am335x_uda134x_l3_pins->model);
            printk("am335x_uda134x_l3_pins->power %d\n",am335x_uda134x_l3_pins->power);

         am335x_uda134x.power = am335x_uda134x_l3_pins->power;
            am335x_uda134x.model = am335x_uda134x_l3_pins->model;

            printk("am335x_uda134x.power  %d\n",am335x_uda134x.power);
            printk("am335x_uda134x.model %d\n",am335x_uda134x.model );
            
            printk("am335x_uda134x_l3_pins->l3_clk %d\n",am335x_uda134x_l3_pins->l3_clk);
            printk("am335x_uda134x_l3_pins->l3_data %d\n", am335x_uda134x_l3_pins->l3_data);
            printk("am335x_uda134x_l3_pins->l3_mode %d\n", am335x_uda134x_l3_pins->l3_mode);

    #if 0
        if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_data,
                          "data") < 0)
            return -EBUSY;
        if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_clk,
                          "clk") < 0) {
            gpio_free(am335x_uda134x_l3_pins->l3_data);
            return -EBUSY;
        }
        if (am335x_uda134x_setup_pin(am335x_uda134x_l3_pins->l3_mode,
                          "mode") < 0) {
            gpio_free(am335x_uda134x_l3_pins->l3_data);
            gpio_free(am335x_uda134x_l3_pins->l3_clk);
            return -EBUSY;
        }
        
    #endif

    #if 1    //////////////////////////////////////////////////// orginial code
        platform_set_drvdata(pdev, &evm_soc_card);

        snd_soc_card_set_drvdata(&evm_soc_card, drvdata);
        ret = snd_soc_register_card(&evm_soc_card);

        if (ret)
            dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
    #endif

        return ret;
    }

    sound/soc/codecs/uda134x.c

    ==========================

    static int uda134x_soc_probe(struct snd_soc_codec *codec)
    {
        struct uda134x_priv *uda134x;

        struct uda134x_platform_data *pd = codec->card->dev->platform_data;

        //struct platform_device *pdev;
        //struct snd_soc_card *card = platform_get_drvdata(pdev);
        //struct snd_soc_card_drvdata_davinci *drvdata = (struct snd_soc_card_drvdata_davinci *)snd_soc_card_get_drvdata(card);
        //struct uda134x_platform_data *pd = &(drvdata->am335x_uda134x);

        const struct snd_soc_dapm_widget *widgets;
        unsigned num_widgets;
        
        int ret;

        printk(KERN_INFO "SRINIII CLIENT DRIVER UDA134X SoC Audio Codec probe....!!!!!!!!!!!!!!!!!!!!\n");

        //uda1345_device_init(uda134x);

        if (!pd) {
            printk(KERN_ERR "UDA134X SoC codec: "
                   "missing L3 bitbang function\n");
            return -ENODEV;
        }


        switch (pd->model) {
        //switch(uda134x->pdata.model){
        case UDA134X_UDA1340:
        case UDA134X_UDA1341:
        case UDA134X_UDA1344:
        case UDA134X_UDA1345:
            break;
        default:
            printk(KERN_ERR "UDA134X SoC codec: "
                   "unsupported model %d\n",
                pd->model);
            return -EINVAL;
        }

        uda134x = kzalloc(sizeof(struct uda134x_priv), GFP_KERNEL);
        if (uda134x == NULL)
            return -ENOMEM;
        snd_soc_codec_set_drvdata(codec, uda134x);

        codec->control_data = pd;

        if (pd->power)
            pd->power(1);

        uda134x_reset(codec);

        if (pd->is_powered_on_standby)
            uda134x_set_bias_level(codec, SND_SOC_BIAS_ON);
        else
            uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

        if (pd->model == UDA134X_UDA1341) {
            widgets = uda1341_dapm_widgets;
            num_widgets = ARRAY_SIZE(uda1341_dapm_widgets);
        } else {
            widgets = uda1340_dapm_widgets;
            num_widgets = ARRAY_SIZE(uda1340_dapm_widgets);
        }

        ret = snd_soc_dapm_new_controls(&codec->dapm, widgets, num_widgets);
        if (ret) {
            printk(KERN_ERR "%s failed to register dapm controls: %d",
                __func__, ret);
            kfree(uda134x);
            return ret;
        }


        switch (pd->model) {
        case UDA134X_UDA1340:
        case UDA134X_UDA1344:
            ret = snd_soc_add_codec_controls(codec, uda1340_snd_controls,
                        ARRAY_SIZE(uda1340_snd_controls));
        break;
        case UDA134X_UDA1341:
            ret = snd_soc_add_codec_controls(codec, uda1341_snd_controls,
                        ARRAY_SIZE(uda1341_snd_controls));
        break;
        case UDA134X_UDA1345:
            printk("SWITCHING TO UDA134X_UDA1345 SNDDDDDDDDDDD CONTROLSSSSSSSSSS\n");
            ret = snd_soc_add_codec_controls(codec, uda1345_snd_controls,
                        ARRAY_SIZE(uda1345_snd_controls));
        break;
        default:
            printk(KERN_ERR "%s unknown codec type: %d",
                __func__, pd->model);
            kfree(uda134x);
            return -EINVAL;
        }

        if (ret < 0) {
            printk(KERN_ERR "UDA134X: failed to register controls\n");
            kfree(uda134x);
            return ret;
        }

        return 0;
    }

    [    0.477460] DAVINCI EVM PROBE FOR UDA1345TSSSSSSSSS CODEC SoC Audio driver

    [    0.477521] DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CODEC OF NODE IS SUCCESSFULL ti,audio-codec

    [    0.477532] DAVINCI EVM PROBE FOR UDA1345 CODEC DAI -> CPU OF NODE IS SUCCESSFULL ti,mcasp-controller

    [    0.477539] DAVINCI EVM PROBE FOR UDA1345 CODEC snd_soc_of_parse_card_name  ti,model is SUCCESSSFULL

    [    0.477548] DAVINCI EVM PROBE FOR UDA1345 CODEC MCLKKK ti,codec-clock is SUCCESSSFULL

    [    0.477554] DAVINCI EVM PROBE FOR UDA1345 CODEC DRVDATA SUCCESSFULL

    [    0.477561] DAVINCI_UDA1345_PROBE_DT NODE L3_DATATAAA

    [    0.477574] of_get_named_gpio_flags exited with status 8

    [    0.477579] GPIO VALUEEEEE l3_dataaaaaaaaaa 8

    [    0.477584] DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_DATATAA PINNNNN

    [    0.477603] GPIO VALUEEEEE l3_dataaaaaaaaaa pdata->l3_data 8

    [    0.477608] DAVINCI_UDA1345_PROBE_DT NODE L3_clkkkkkk

    [    0.477616] of_get_named_gpio_flags exited with status 10

    [    0.477620] DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_clkkkkkk PINNNNNNNNN

    [    0.477630] GPIO VALUEEEEE l3_clkkkkkkkkkkkkkkkkk pdata->l3_clk 10

    [    0.477634] DAVINCI_UDA1345_PROBE_DT NODE L3_modeeeee

    [    0.477643] of_get_named_gpio_flags exited with status 81

    [    0.477647] DAVINCI_UDA1345_PROBE_DT GPIO_IS_VALIDD L3_modeeeee PINNNNNNNNN

    [    0.477693] GPIO VALUEEEEE l3_modeeeeeeeeeeeee  pdata->l3_mode 81

    [    0.477700] FOUNDDDD L3 PLATFORM DATA MODEL  FOUND!!!!!!!!!!!!!!! === 4

    [    0.477707] FOUNDDDD L3 PLATFORM DATA POWER  FOUND!!!!!!!!!!!!!!!=== 1

    [    0.477712] AM335X_UDA134X SoC Audio DAVINCIIIIIIIIII able to find platform data

    [    0.485521] am335x_uda134x_l3_pins->model 4

    [    0.485527] am335x_uda134x_l3_pins->power 1

    [    0.485532] am335x_uda134x.power  1

    [    0.485536] am335x_uda134x.model 4

    [    0.485541] am335x_uda134x_l3_pins->l3_clk 10

    [    0.485546] am335x_uda134x_l3_pins->l3_data 8

    [    0.485551] am335x_uda134x_l3_pins->l3_mode 81

    [    0.485760] SRINIII CLIENT DRIVER UDA134X SoC Audio Codec probe....!!!!!!!!!!!!!!!!!!!!

    [    0.485773] UDA134X SoC codec: unsupported model -1984084113

    [    0.491738] uda134x-codec uda134x.3: ASoC: failed to probe CODEC -22

    [    0.498457] davinci_evm sound.4: ASoC: failed to instantiate card -22

    [    0.505294] davinci_evm sound.4: snd_soc_register_card failed (-22)

    [    0.511986] davinci_evm: probe of sound.4 failed with error -22

  • Hi Srini,

    Well thats good move. I am not sure about the perfect solution but if that particular structure is hard coded as a global variable and exported then possibly you override the issue.

    To chase the exact issue,

    Try printing the other contents of the codec / card / dev  to find out which pointer and associated information is not filled out properly.

  • Dear lyf sci,

    Many Many Thanks a lot for your prompt responses & would appreciate a lot

    I hope the codec/card/dev pointer associated information is filled in the codec driver is fetched from Davinci-evm.c file(which is in TI SDK 7) (please correct me if my understanding is wrong)

    TI SDK 7

    static int davinci_evm_probe(struct platform_device *pdev)

    {

    ......

       snd_soc_card_set_drvdata(&evm_soc_card, drvdata);

       ret = snd_soc_register_card(&evm_soc_card);

       if (ret)

           dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);

       return ret;

    }

    I tried adding ret = platform_device_add_data(evm_snd_device, &am335x_uda134x, sizeof(am335x_uda134x)); similar to s3c24xx_uda134x.c probe function as reference 

    Could you please let me know how this api ret = platform_device_add_data(evm_snd_device, &am335x_uda134x, sizeof(am335x_uda134x)); can be migrated to TI SDK 7 in Davinci-evm.c probe function, with the below exisiting apis ie., am unable to pass the arguments , could you please let me know how to pass the arguments &am335x_uda134x, sizeof(am335x_uda134x)

       snd_soc_card_set_drvdata(&evm_soc_card, drvdata);

       ret = snd_soc_register_card(&evm_soc_card);

       if (ret)

           dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);

       return ret;

    I hope if we migrate this api in Davinci-evm.c of TI SDK 7 we might get the correct platform data parsed in UDA134x.c file of TI SDK 7 &

    could you please help  me out if there is any dependencies also inorder to be done in uda134x_soc_probe function of uda134x.c of TI SDK 7

    Kindly do the needful in migrating to TI SDK 7, as  am already stuck with this from more than 3 weeks

    Kindly do the needful as early as possible,

    Many Many Thanks once again for your quick responses & henceforth