forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extcon: Split out extcon header file for consumer and provider device
The extcon has two type of extcon devices as following. - 'extcon provider deivce' adds new extcon device and detect the state/properties of external connector. Also, it notifies the state/properties to the extcon consumer device. - 'extcon consumer device' gets the change state/properties from extcon provider device. Prior to that, include/linux/extcon.h contains all exported API for both provider and consumer device driver. To clarify the meaning of header file and to remove the wrong use-case on consumer device, this patch separates into extcon.h and extcon-provider.h. [Description for include/linux/{extcon.h|extcon-provider.h}] - extcon.h includes the extcon API and data structure for extcon consumer device driver. This header file contains the following APIs: : Register/unregister the notifier to catch the change of extcon device : Get the extcon device instance : Get the extcon device name : Get the state of each external connector : Get the property value of each external connector : Get the property capability of each external connector - extcon-provider.h includes the extcon API and data structure for extcon provider device driver. This header file contains the following APIs: : Include 'include/linux/extcon.h' : Allocate the memory for extcon device instance : Register/unregister extcon device : Set the state of each external connector : Set the property value of each external connector : Set the property capability of each external connector Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> Acked-by: Charles Keepax <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Felipe Balbi <[email protected]> Acked-by: Yoshihiro Shimoda <[email protected]> Acked-by: Kishon Vijay Abraham I <[email protected]>
- Loading branch information
1 parent
2bd6bf0
commit 176aa36
Showing
27 changed files
with
172 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/* | ||
* External Connector (extcon) framework | ||
* - linux/include/linux/extcon-provider.h for extcon provider device driver. | ||
* | ||
* Copyright (C) 2017 Samsung Electronics | ||
* Author: Chanwoo Choi <[email protected]> | ||
* | ||
* This software is licensed under the terms of the GNU General Public | ||
* License version 2, as published by the Free Software Foundation, and | ||
* may be copied, distributed, and modified under those terms. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
#ifndef __LINUX_EXTCON_PROVIDER_H__ | ||
#define __LINUX_EXTCON_PROVIDER_H__ | ||
|
||
#include <linux/extcon.h> | ||
|
||
struct extcon_dev; | ||
|
||
#if IS_ENABLED(CONFIG_EXTCON) | ||
|
||
/* Following APIs register/unregister the extcon device. */ | ||
extern int extcon_dev_register(struct extcon_dev *edev); | ||
extern void extcon_dev_unregister(struct extcon_dev *edev); | ||
extern int devm_extcon_dev_register(struct device *dev, | ||
struct extcon_dev *edev); | ||
extern void devm_extcon_dev_unregister(struct device *dev, | ||
struct extcon_dev *edev); | ||
|
||
/* Following APIs allocate/free the memory of the extcon device. */ | ||
extern struct extcon_dev *extcon_dev_allocate(const unsigned int *cable); | ||
extern void extcon_dev_free(struct extcon_dev *edev); | ||
extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, | ||
const unsigned int *cable); | ||
extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); | ||
|
||
/* Synchronize the state and property value for each external connector. */ | ||
extern int extcon_sync(struct extcon_dev *edev, unsigned int id); | ||
|
||
/* | ||
* Following APIs set the connected state of each external connector. | ||
* The 'id' argument indicates the defined external connector. | ||
*/ | ||
extern int extcon_set_state(struct extcon_dev *edev, unsigned int id, | ||
bool state); | ||
extern int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, | ||
bool state); | ||
|
||
/* | ||
* Following APIs set the property of each external connector. | ||
* The 'id' argument indicates the defined external connector | ||
* and the 'prop' indicates the extcon property. | ||
* | ||
* And extcon_set_property_capability() set the capability of the property | ||
* for each external connector. They are used to set the capability of the | ||
* property of each external connector based on the id and property. | ||
*/ | ||
extern int extcon_set_property(struct extcon_dev *edev, unsigned int id, | ||
unsigned int prop, | ||
union extcon_property_value prop_val); | ||
extern int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id, | ||
unsigned int prop, | ||
union extcon_property_value prop_val); | ||
extern int extcon_set_property_capability(struct extcon_dev *edev, | ||
unsigned int id, unsigned int prop); | ||
|
||
#else /* CONFIG_EXTCON */ | ||
static inline int extcon_dev_register(struct extcon_dev *edev) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void extcon_dev_unregister(struct extcon_dev *edev) { } | ||
|
||
static inline int devm_extcon_dev_register(struct device *dev, | ||
struct extcon_dev *edev) | ||
{ | ||
return -EINVAL; | ||
} | ||
|
||
static inline void devm_extcon_dev_unregister(struct device *dev, | ||
struct extcon_dev *edev) { } | ||
|
||
static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable) | ||
{ | ||
return ERR_PTR(-ENOSYS); | ||
} | ||
|
||
static inline void extcon_dev_free(struct extcon_dev *edev) { } | ||
|
||
static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, | ||
const unsigned int *cable) | ||
{ | ||
return ERR_PTR(-ENOSYS); | ||
} | ||
|
||
static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } | ||
|
||
|
||
static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id, | ||
bool state) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id, | ||
bool state) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int extcon_sync(struct extcon_dev *edev, unsigned int id) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id, | ||
unsigned int prop, | ||
union extcon_property_value prop_val) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int extcon_set_property_sync(struct extcon_dev *edev, | ||
unsigned int id, unsigned int prop, | ||
union extcon_property_value prop_val) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline int extcon_set_property_capability(struct extcon_dev *edev, | ||
unsigned int id, unsigned int prop) | ||
{ | ||
return 0; | ||
} | ||
#endif /* CONFIG_EXTCON */ | ||
#endif /* __LINUX_EXTCON_PROVIDER_H__ */ |
Oops, something went wrong.