linux-newbie.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* No probing in module while using devicetree
@ 2015-06-06 22:24 alex
  0 siblings, 0 replies; only message in thread
From: alex @ 2015-06-06 22:24 UTC (permalink / raw)
  To: linux-newbie

Hi,
I want to write my first driver. The target is the beaglebone black. For 
my platform_driver need access to one simple gpio pin and one pwm pin so 
i used the device tree model to access the drivers for pwm and gpio 
chip. Now i have the issue that my probe function will never get called 
and i cant identify the problem. I tried the driver as built-in and as 
module, but in both cases i didn't find the probe-string in dmesg. The 
entry in the dts looks like:

/ {
     model = "TI AM335x BegleBone Black";
     compatible = "ti,am335x-boneblack","ti,am335x-bone","ti,am33xx";

                 motor_left:motor@1 {
                     compatible ="alex,motor";
                     gpio=&gpio0;
                     pincrtl-names="default";
                     pincrtl-0=<&pwm_pins>;
                     gpio_out_pins=<&gpio0 1>;
                     pwms = <&ehrpwm0 0 500000>;
                     status = "okay";
                 };
};

  and the module code:
...

static int motor_probe(struct platform_device *pdev)
{
     pr_alert("motor_probe called!\n");
     return 0;
}

static int motor_remove(struct platform_device *pdev)
{
       pr_alert("motor_remove called!\n");
       return 0;
}

...

static struct of_device_id motor_of_match[] =
{
     {.compatible = "alex,motor"},
     {}
};

MODULE_DEVICE_TABLE(of, motor_of_match);

static struct platform_driver motor_pdriver =
{
   .probe = motor_probe,
   .remove = motor_remove,
   .driver = {
         .name = "motor",
         .of_match_table = of_match_ptr(motor_of_match),
         .owner = THIS_MODULE,
       },
};

static int __init motor_driver_init(void)
{
   int ret;

   pr_info("motor_dirver_init\n");
   ret = platform_driver_register(&motor_pdriver);
   if(ret < 0)
       goto motor_driver_init_error;

   return 0;

motor_driver_init_error:
   return ret;
}

thx for your help.
static void __exit motor_driver_exit(void)
{
   pr_alert("motor_dirver_exit\n");
   platform_driver_unregister(&motor_pdriver);
}

module_init(motor_driver_init);
module_exit(motor_driver_exit);



--
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-06 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06 22:24 No probing in module while using devicetree alex

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).