diff options
Diffstat (limited to 'include/media/dvbdev.h')
-rw-r--r-- | include/media/dvbdev.h | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h index 554db879527f..ee91516ad074 100644 --- a/include/media/dvbdev.h +++ b/include/media/dvbdev.h | |||
@@ -358,7 +358,61 @@ long dvb_generic_ioctl(struct file *file, | |||
358 | int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | 358 | int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg, |
359 | int (*func)(struct file *file, unsigned int cmd, void *arg)); | 359 | int (*func)(struct file *file, unsigned int cmd, void *arg)); |
360 | 360 | ||
361 | /** generic DVB attach function. */ | 361 | #if IS_ENABLED(CONFIG_I2C) |
362 | |||
363 | struct i2c_adapter; | ||
364 | struct i2c_client; | ||
365 | /** | ||
366 | * dvb_module_probe - helper routine to probe an I2C module | ||
367 | * | ||
368 | * @module_name: | ||
369 | * Name of the I2C module to be probed | ||
370 | * @name: | ||
371 | * Optional name for the I2C module. Used for debug purposes. | ||
372 | * If %NULL, defaults to @module_name. | ||
373 | * @adap: | ||
374 | * pointer to &struct i2c_adapter that describes the I2C adapter where | ||
375 | * the module will be bound. | ||
376 | * @addr: | ||
377 | * I2C address of the adapter, in 7-bit notation. | ||
378 | * @platform_data: | ||
379 | * Platform data to be passed to the I2C module probed. | ||
380 | * | ||
381 | * This function binds an I2C device into the DVB core. Should be used by | ||
382 | * all drivers that use I2C bus to control the hardware. A module bound | ||
383 | * with dvb_module_probe() should use dvb_module_release() to unbind. | ||
384 | * | ||
385 | * Return: | ||
386 | * On success, return an &struct i2c_client, pointing the the bound | ||
387 | * I2C device. %NULL otherwise. | ||
388 | * | ||
389 | * .. note:: | ||
390 | * | ||
391 | * In the past, DVB modules (mainly, frontends) were bound via dvb_attach() | ||
392 | * macro, with does an ugly hack, using I2C low level functions. Such | ||
393 | * usage is deprecated and will be removed soon. Instead, use this routine. | ||
394 | */ | ||
395 | struct i2c_client *dvb_module_probe(const char *module_name, | ||
396 | const char *name, | ||
397 | struct i2c_adapter *adap, | ||
398 | unsigned char addr, | ||
399 | void *platform_data); | ||
400 | |||
401 | /** | ||
402 | * dvb_module_release - releases an I2C device allocated with | ||
403 | * dvb_module_probe(). | ||
404 | * | ||
405 | * @client: pointer to &struct i2c_client with the I2C client to be released. | ||
406 | * can be %NULL. | ||
407 | * | ||
408 | * This function should be used to free all resources reserved by | ||
409 | * dvb_module_probe() and unbinding the I2C hardware. | ||
410 | */ | ||
411 | void dvb_module_release(struct i2c_client *client); | ||
412 | |||
413 | #endif /* CONFIG_I2C */ | ||
414 | |||
415 | /* Legacy generic DVB attach function. */ | ||
362 | #ifdef CONFIG_MEDIA_ATTACH | 416 | #ifdef CONFIG_MEDIA_ATTACH |
363 | 417 | ||
364 | /** | 418 | /** |
@@ -371,6 +425,13 @@ int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | |||
371 | * the @FUNCTION function there, with @ARGS. | 425 | * the @FUNCTION function there, with @ARGS. |
372 | * As it increments symbol usage cont, at unregister, dvb_detach() | 426 | * As it increments symbol usage cont, at unregister, dvb_detach() |
373 | * should be called. | 427 | * should be called. |
428 | * | ||
429 | * .. note:: | ||
430 | * | ||
431 | * In the past, DVB modules (mainly, frontends) were bound via dvb_attach() | ||
432 | * macro, with does an ugly hack, using I2C low level functions. Such | ||
433 | * usage is deprecated and will be removed soon. Instead, you should use | ||
434 | * dvb_module_probe(). | ||
374 | */ | 435 | */ |
375 | #define dvb_attach(FUNCTION, ARGS...) ({ \ | 436 | #define dvb_attach(FUNCTION, ARGS...) ({ \ |
376 | void *__r = NULL; \ | 437 | void *__r = NULL; \ |
@@ -402,6 +463,6 @@ int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg, | |||
402 | 463 | ||
403 | #define dvb_detach(FUNC) {} | 464 | #define dvb_detach(FUNC) {} |
404 | 465 | ||
405 | #endif | 466 | #endif /* CONFIG_MEDIA_ATTACH */ |
406 | 467 | ||
407 | #endif /* #ifndef _DVBDEV_H_ */ | 468 | #endif /* #ifndef _DVBDEV_H_ */ |