Add a drm_aux-dev module.
Subsystems (3)
v2 cover Add a drm_aux-dev module.
Second attempt at implementing a module that allows reading/writing arbitrary dpcd registers. Changes to this version:
- lseek is used to select the register to read/write;
- read/write are used instead of ioctl;
- no blocking_notifier is used, just a direct callback.
One thing to notice is that I am not updating the file offset during read or write, which is kind of breaking the filesystem abstraction. But i2c-dev doesn't do it either, so I assumed it's fine.
Rafael Antognolli (3):
drm/dp: Keep a list of drm_dp_aux helper.
drm/dp: Store the drm_connector device pointer on the helper. drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.
drivers/gpu/drm/Kconfig | 4 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_aux-dev.c | 326 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_dp_helper.c | 73 +++++++++ drivers/gpu/drm/i915/intel_dp.c | 1 + include/drm/drm_dp_helper.h | 6 + 6 files changed, 411 insertions(+) create mode 100644 drivers/gpu/drm/drm_aux-dev.c
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
v3 cover Add drm_dp_aux chardev support.
This series implement support to a drm_dp_aux chardev that allows reading and writing an arbitrary amount of bytes to arbitrary dpcd register addresses using regular read, write and lseek operations.
v2:
- lseek is used to select the register to read/write
- read/write are used instead of ioctl
- no blocking_notifier is used, just a direct callback
v3:
- use drm_dp_aux_dev prefix for public functions
- chardev is named drm_dp_auxN
- read/write don't allocate a buffer anymore, and transfer up to 16 bytes a time
- remove notifier list from the implementation
- option on menuconfig is now a boolean
- add inline stub functions to avoid breakage when this option is disabled
Rafael Antognolli (2):
drm/dp: Store the drm_connector device pointer on the helper. drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.
drivers/gpu/drm/Kconfig | 8 + drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/drm_dp_aux_dev.c | 357 +++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_dp_helper.c | 5 + drivers/gpu/drm/i915/intel_dp.c | 1 + include/drm/drm_dp_aux_dev.h | 50 ++++++ include/drm/drm_dp_helper.h | 1 + 7 files changed, 424 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c create mode 100644 include/drm/drm_dp_aux_dev.h
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/2 drm/dp: Store the drm_connector device pointer on the helper.
In reply to Rafael AntognolliThis is useful to determine which connector owns this AUX channel.
--- drivers/gpu/drm/i915/intel_dp.c | 1 + include/drm/drm_dp_helper.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -1079,6 +1079,7 @@ intel_dp_aux_init(struct intel_dp *intel_dp, struct intel_connector *connector) intel_dp->aux.name = name; intel_dp->aux.dev = dev->dev; + intel_dp->aux.connector = connector->base.kdev; intel_dp->aux.transfer = intel_dp_aux_transfer; DRM_DEBUG_KMS("registering %s bus for %s\n", name,
include/drm/drm_dp_helper.h +1 -0
@@ -702,6 +702,7 @@ struct drm_dp_aux {const char *name;struct i2c_adapter ddc;struct device *dev; +struct device *connector;struct mutex hw_mutex;ssize_t (*transfer)(struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg);
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/2 drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.
In reply to Rafael AntognolliThis module is heavily based on i2c-dev. Once loaded, it provides one dev node per DP AUX channel, named drm_dp_auxN, where N is an integer.
It's possible to know which connector owns this aux channel by looking at the respective sysfs /sys/class/drm_aux_dev/drm_dp_auxN/connector, if the connector device pointer was correctly set in the aux helper struct.
Two main operations are provided on the registers read and write. The address of the register to be read or written is given using lseek. The seek position is updated upon read or write.
--- drivers/gpu/drm/Kconfig | 8 + drivers/gpu/drm/Makefile | 3 +- drivers/gpu/drm/drm_dp_aux_dev.c | 357 +++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_dp_helper.c | 5 + include/drm/drm_dp_aux_dev.h | 50 ++++++ 5 files changed, 422 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_dp_aux_dev.c create mode 100644 include/drm/drm_dp_aux_dev.h
drivers/gpu/drm/Kconfig +8 -0
@@ -25,6 +25,14 @@ config DRM_MIPI_DSI bool depends on DRM +config DRM_DP_AUX_CHARDEV + bool "DRM DP AUX Interface" + depends on DRM + help + Choose this option to enable a /dev/drm_dp_auxN node that allows to + read and write values to arbitrary DPCD registers on the DP aux + channel. + config DRM_KMS_HELPER tristate depends on DRM
drivers/gpu/drm/Makefile +2 -1
@@ -21,7 +21,8 @@ drm-$(CONFIG_DRM_PANEL) += drm_panel.o drm-$(CONFIG_OF) += drm_of.o drm_kms_helper-y := drm_crtc_helper.o drm_dp_helper.o drm_probe_helper.o \ - drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o + drm_plane_helper.o drm_dp_mst_topology.o drm_atomic_helper.o \ + drm_dp_aux_dev.o drm_kms_helper-$(CONFIG_DRM_LOAD_EDID_FIRMWARE) += drm_edid_load.o drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
drivers/gpu/drm/drm_dp_aux_dev.c new file +357 -0
357 lines not on this page · raw message
drivers/gpu/drm/drm_dp_helper.c +5 -0
@@ -28,6 +28,7 @@#include <linux/sched.h> #include <linux/i2c.h> #include <drm/drm_dp_helper.h> +#include <drm/drm_dp_aux_dev.h> #include <drm/drmP.h> /**
@@ -768,6 +769,9 @@ int drm_dp_aux_register(struct drm_dp_aux *aux)strlcpy (aux->ddc.name, aux->name ? aux->name :dev_name (aux->dev),sizeof (aux->ddc.name)); + +drm_dp_aux_register_devnode (aux); +return i2c_add_adapter (&aux->ddc); }EXPORT_SYMBOL (drm_dp_aux_register);
@@ -778,6 +782,7 @@ EXPORT_SYMBOL(drm_dp_aux_register);*/ void drm_dp_aux_unregister (struct drm_dp_aux *aux) { +drm_dp_aux_unregister_devnode (aux);i2c_del_adapter (&aux->ddc); }EXPORT_SYMBOL (drm_dp_aux_unregister);
include/drm/drm_dp_aux_dev.h new file +50 -0
50 lines not on this page · raw message
Signature · 6 lines
2.4.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Oops, sorry, this email shouldn't be in the patch set, please disconsider it.
--
Rafael
Quoted 15 lines · Rafael Antognolli
Second attempt at implementing a module that allows reading/writing arbitrary dpcd registers. Changes to this version:
- lseek is used to select the register to read/write;
- read/write are used instead of ioctl;
- noblocking_notifieris used, just a direct callback.One thing to notice is that I am not updating the file offset during read or write, which is kind of breaking the filesystem abstraction. But i2c-dev doesn't do it either, so I assumed it's fine.
Rafael Antognolli (3):
drm/dp: Keep a list ofdrm_dp_auxhelper.
drm/dp: Store thedrm_connectordevice pointer on the helper. drm/dp: Add a drm_aux-dev module for reading/writing dpcd registers.
Quoted 12 lines
drivers/gpu/drm/Kconfig | 4 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/drm_aux-dev.c | 326 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_dp_helper.c | 73 +++++++++ drivers/gpu/drm/i915/intel_dp.c | 1 + include/drm/drm_dp_helper.h | 6 + 6 files changed, 411 insertions(+) create mode 100644 drivers/gpu/drm/drm_aux-dev.cSignature · 1 line
2.4.3
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel