LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-27-2020, 07:29 AM   #1
DeanAnderson
LQ Newbie
 
Registered: Nov 2019
Posts: 19

Rep: Reputation: Disabled
driver is not probed


Hi
I have problem that my driver "adm1075-reset" is not probed.

Code:
&i2c4 {
	status = "okay";
	clock-frequency = <100000>;
	refclk-frequency = <25000000>;
	i2c-sda-hold-time-ns = <600>;
	
	adm1075: adm1075@18 {
		compatible = "adi,adm1075";
		reg = <0x18>;

		por: reset-controller {
			compatible = "adi,adm1075-reset";
			#reset-cells = <0>;
		};
	};
};

Code:
#include <linux/hwmon/adm1275.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset-controller.h>
#include <linux/i2c.h>

#define ADM1075_POWER_CYCLE_COMMAND     0xD9

struct adm1275_reset_data {
	struct i2c_client *client;
	struct reset_controller_dev rcdev;
};

static int adm1275_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
{
	int ret;
	struct adm1275_reset_data *data = container_of(rcdev, struct adm1275_reset_data, rcdev);
	struct i2c_client* client = data->client;

	(void)id;

    ret = i2c_smbus_write_byte(client, ADM1075_POWER_CYCLE_COMMAND);

	if(ret)
		dev_err(&client->dev, "Reset not performed!!!\n");

	return ret;
}

static int adm1275_reset_deassert(struct reset_controller_dev *rcdev,
		unsigned long id)
{
	struct adm1275_reset_data *data = container_of(rcdev, struct adm1275_reset_data, rcdev);
	struct i2c_client* client = data->client;

	(void)id;
	
	dev_err(&client->dev, "Unsupported operation\n");

	return 0;
}

static const struct reset_control_ops adm1275_reset_ops = {
	.assert		= adm1275_reset_assert,
	.deassert	= adm1275_reset_deassert,
};

static int adm1275_reset_probe(struct platform_device *pdev)
{
	int ret = 0;
	struct device *dev = &pdev->dev;
	struct device_node *node = dev->of_node;
	struct adm1275_reset_data *data;
	struct i2c_client *client;

	printk(KERN_ALERT "adm1275_reset_probe start");

	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	client = adm1275_node_to_i2c_client(node->parent);
	if (client == NULL)
	{
		dev_err(dev, "Cannot get pointer to i2c client from parent adm1275 node data\n");
		return -ENOENT;
	}

	if (of_find_property(node, "#reset-cells", NULL)) {
		data->rcdev.owner     = THIS_MODULE;
		data->rcdev.nr_resets = 1;
		data->rcdev.ops       = &adm1275_reset_ops;
		data->rcdev.of_node   = node;
		data->client          = client;

		ret = devm_reset_controller_register(&client->dev, &data->rcdev);
		if(ret)
		{
			dev_err(dev, "Failed to register reset controller, err %d\n", ret);
			return ret;
		}

		platform_set_drvdata(pdev, data);
	}
	else
	{
		dev_err(dev, "%s missing #reset-cells property\n", client->dev.of_node->full_name);
	}

	printk(KERN_ALERT "adm1275_reset_probe end");

	return ret;
}

static const struct of_device_id adm1275_reset_of_match[] = {
	{ .compatible = "adi,adm1075-reset" },
	{ .compatible = "adi,adm1275-reset" },
	{ .compatible = "adi,adm1276-reset" },
	{ .compatible = "adi,adm1278-reset" },
	{ .compatible = "adi,adm1293-reset" },
	{ .compatible = "adi,adm1294-reset" },
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, adm1275_reset_of_match);

static struct platform_driver adm1275_reset_driver = {
	.probe = adm1275_reset_probe,
	.driver = {
		.name = "adm1275-reset",
		.of_match_table = adm1275_reset_of_match,
	},
};
module_platform_driver(adm1275_reset_driver);

MODULE_AUTHOR("");
MODULE_DESCRIPTION("ADM 1275 reset controller driver part which executes in assert POWER_CYCLE command");
MODULE_LICENSE("GPL v2");
Any idea what might be wrong? It isn't probed neither as buildin module nor as external one. String "adm1275_reset_probe start" isn't visible in dmesg. Probing of parent driver "adi,adm1075" finishes succesfully. However parent driver doesn't know anything about its child. My understanding is that it doesn't have to. However I am not so experienced in kernel programming (about 4 months).

Last edited by DeanAnderson; 01-27-2020 at 07:31 AM.
 
Old 01-29-2020, 05:07 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,292

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
My simplistic understanding was that hardware was probed, but drivers were run.

If it's not being probed as you think it should be, the code is steering away; stopping or idling the task before the probe, or making "logical" decisions that avoid that code. That's when yu need to get working with higher debug levels, gdb or strace.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse not probed on install srfpala Linux - Hardware 1 12-14-2006 09:16 PM
5900XT, ViewSonic not probed MrJoshua Fedora - Installation 0 06-05-2004 11:29 AM
Emu10k1 can't be probed. Why? zaltar Linux - Newbie 3 11-09-2003 04:31 AM
Probed and Attacked - Battle Damage Assessment halifax Linux - Security 2 08-17-2003 08:06 PM
RedHat 7.3 installation problem : monitor not probed bsambit Linux - Newbie 0 12-08-2002 10:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration