Files
linux-stable-mirror/include/linux/ulpi/driver.h
T
Uwe Kleine-König (The Capable Hub) ecca1d63c1 Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (headers)
<linux/mod_devicetable.h> is included in a many files:

	$ git grep '<linux/mod_devicetable.h>' ef0c9f75a1 | wc -l
	1598

; some of them are widely used headers. To stop mixing up different and
unrelated driver( type)s let the subsystem headers only use the subset
of the recently split <linux/mod_devicetable.h> that are relevant for
them.

The fallout (I hope) is addressed in the previous commits that handle
sources relying on e.g. <linux/i2c.h> pulling in the full legacy header
and thus providing pci_device_id.

Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://patch.msgid.link/199fe46b624ba07fb9bd3e0cd6ff13757932cb5f.1782808461.git.u.kleine-koenig@baylibre.com
Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-07-03 07:38:16 +02:00

66 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_ULPI_DRIVER_H
#define __LINUX_ULPI_DRIVER_H
#include <linux/device-id/ulpi.h>
#include <linux/device.h>
struct ulpi_ops;
/**
* struct ulpi - describes ULPI PHY device
* @id: vendor and product ids for ULPI device
* @ops: I/O access
* @dev: device interface
*/
struct ulpi {
struct device dev;
struct ulpi_device_id id;
const struct ulpi_ops *ops;
};
#define to_ulpi_dev(d) container_of(d, struct ulpi, dev)
static inline void ulpi_set_drvdata(struct ulpi *ulpi, void *data)
{
dev_set_drvdata(&ulpi->dev, data);
}
static inline void *ulpi_get_drvdata(struct ulpi *ulpi)
{
return dev_get_drvdata(&ulpi->dev);
}
/**
* struct ulpi_driver - describes a ULPI PHY driver
* @id_table: array of device identifiers supported by this driver
* @probe: binds this driver to ULPI device
* @remove: unbinds this driver from ULPI device
* @driver: the name and owner members must be initialized by the drivers
*/
struct ulpi_driver {
const struct ulpi_device_id *id_table;
int (*probe)(struct ulpi *ulpi);
void (*remove)(struct ulpi *ulpi);
struct device_driver driver;
};
#define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
/*
* use a macro to avoid include chaining to get THIS_MODULE
*/
#define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
void ulpi_unregister_driver(struct ulpi_driver *drv);
#define module_ulpi_driver(__ulpi_driver) \
module_driver(__ulpi_driver, ulpi_register_driver, \
ulpi_unregister_driver)
int ulpi_read(struct ulpi *ulpi, u8 addr);
int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val);
#endif /* __LINUX_ULPI_DRIVER_H */