Skip to contentSkip to conversation

dvb-core: add template code for i2c binding model

PATCH Superseded [email protected] 1 participant 1 message Jan 7, 2015 Media (V4L/DVB)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dvb-core: add template code for i2c binding model

From: Akihiro Tsukada <[email protected]>

Changes in v2:
- rename some varibles for consistency and readability
- (registering of tuner subdev media_entity is NOT implemented yet).

Define a standard interface for demod/tuner i2c driver modules. A module client calls dvb_i2c_attach_{fe,tuner}(), and a module driver defines struct dvb_i2c_module_param and calls DEFINE_DVB_I2C_MODULE() macro.

This template provides implicit module requests and ref-counting, alloc/free's private data structures,
fixes the usage of clientdata of i2c devices,
and defines the platformdata structures for passing around device specific config/output parameters between drivers and clients. These kinds of code are common to (almost) all dvb i2c drivers/client, but they were scattered over adapter modules and demod/tuner modules.

---
 drivers/media/dvb-core/Makefile       |   4 +
 drivers/media/dvb-core/dvb_frontend.h |   1 +
 drivers/media/dvb-core/dvb_i2c.c      | 219 ++++++++++++++++++++++++++++++++++
 drivers/media/dvb-core/dvb_i2c.h      | 110 +++++++++++++++++
 4 files changed, 334 insertions(+)
 create mode 100644 drivers/media/dvb-core/dvb_i2c.c
 create mode 100644 drivers/media/dvb-core/dvb_i2c.h
drivers/media/dvb-core/Makefile +4 -0
index 8f22bcd..271648d 100644
@@ -8,4 +8,8 @@ dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o dvb_filter.o 	\
 		 dvb_ca_en50221.o dvb_frontend.o 		\
 		 $(dvb-net-y) dvb_ringbuffer.o dvb_math.o
 
+ifneq ($(CONFIG_I2C)$(CONFIG_I2C_MODULE),)
+dvb-core-objs += dvb_i2c.o
+endif
+
 obj-$(CONFIG_DVB_CORE) += dvb-core.o
drivers/media/dvb-core/dvb_frontend.h +1 -0
index 816269e..903719a 100644
@@ -415,6 +415,7 @@ struct dtv_frontend_properties {
 struct dvb_frontend {
 	struct dvb_frontend_ops ops;
 	struct dvb_adapter *dvb;
+	struct i2c_client *fe_i2c_client;
 	void *demodulator_priv;
 	void *tuner_priv;
 	void *frontend_priv;
drivers/media/dvb-core/dvb_i2c.c new file +219 -0

219 lines not on this page · raw message

drivers/media/dvb-core/dvb_i2c.h new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.2.1