@@ -459,6 +459,47 @@ int __must_check devm_clk_bulk_get_all(struct device *dev,
459459 */
460460struct clk * devm_clk_get (struct device * dev , const char * id );
461461
462+ /**
463+ * devm_clk_get_prepared - devm_clk_get() + clk_prepare()
464+ * @dev: device for clock "consumer"
465+ * @id: clock consumer ID
466+ *
467+ * Context: May sleep.
468+ *
469+ * Return: a struct clk corresponding to the clock producer, or
470+ * valid IS_ERR() condition containing errno. The implementation
471+ * uses @dev and @id to determine the clock consumer, and thereby
472+ * the clock producer. (IOW, @id may be identical strings, but
473+ * clk_get may return different clock producers depending on @dev.)
474+ *
475+ * The returned clk (if valid) is prepared. Drivers must however assume
476+ * that the clock is not enabled.
477+ *
478+ * The clock will automatically be unprepared and freed when the device
479+ * is unbound from the bus.
480+ */
481+ struct clk * devm_clk_get_prepared (struct device * dev , const char * id );
482+
483+ /**
484+ * devm_clk_get_enabled - devm_clk_get() + clk_prepare_enable()
485+ * @dev: device for clock "consumer"
486+ * @id: clock consumer ID
487+ *
488+ * Context: May sleep.
489+ *
490+ * Return: a struct clk corresponding to the clock producer, or
491+ * valid IS_ERR() condition containing errno. The implementation
492+ * uses @dev and @id to determine the clock consumer, and thereby
493+ * the clock producer. (IOW, @id may be identical strings, but
494+ * clk_get may return different clock producers depending on @dev.)
495+ *
496+ * The returned clk (if valid) is prepared and enabled.
497+ *
498+ * The clock will automatically be disabled, unprepared and freed
499+ * when the device is unbound from the bus.
500+ */
501+ struct clk * devm_clk_get_enabled (struct device * dev , const char * id );
502+
462503/**
463504 * devm_clk_get_optional - lookup and obtain a managed reference to an optional
464505 * clock producer.
@@ -482,6 +523,50 @@ struct clk *devm_clk_get(struct device *dev, const char *id);
482523 */
483524struct clk * devm_clk_get_optional (struct device * dev , const char * id );
484525
526+ /**
527+ * devm_clk_get_optional_prepared - devm_clk_get_optional() + clk_prepare()
528+ * @dev: device for clock "consumer"
529+ * @id: clock consumer ID
530+ *
531+ * Context: May sleep.
532+ *
533+ * Return: a struct clk corresponding to the clock producer, or
534+ * valid IS_ERR() condition containing errno. The implementation
535+ * uses @dev and @id to determine the clock consumer, and thereby
536+ * the clock producer. If no such clk is found, it returns NULL
537+ * which serves as a dummy clk. That's the only difference compared
538+ * to devm_clk_get_prepared().
539+ *
540+ * The returned clk (if valid) is prepared. Drivers must however
541+ * assume that the clock is not enabled.
542+ *
543+ * The clock will automatically be unprepared and freed when the
544+ * device is unbound from the bus.
545+ */
546+ struct clk * devm_clk_get_optional_prepared (struct device * dev , const char * id );
547+
548+ /**
549+ * devm_clk_get_optional_enabled - devm_clk_get_optional() +
550+ * clk_prepare_enable()
551+ * @dev: device for clock "consumer"
552+ * @id: clock consumer ID
553+ *
554+ * Context: May sleep.
555+ *
556+ * Return: a struct clk corresponding to the clock producer, or
557+ * valid IS_ERR() condition containing errno. The implementation
558+ * uses @dev and @id to determine the clock consumer, and thereby
559+ * the clock producer. If no such clk is found, it returns NULL
560+ * which serves as a dummy clk. That's the only difference compared
561+ * to devm_clk_get_enabled().
562+ *
563+ * The returned clk (if valid) is prepared and enabled.
564+ *
565+ * The clock will automatically be disabled, unprepared and freed
566+ * when the device is unbound from the bus.
567+ */
568+ struct clk * devm_clk_get_optional_enabled (struct device * dev , const char * id );
569+
485570/**
486571 * devm_get_clk_from_child - lookup and obtain a managed reference to a
487572 * clock producer from child node.
@@ -826,12 +911,36 @@ static inline struct clk *devm_clk_get(struct device *dev, const char *id)
826911 return NULL ;
827912}
828913
914+ static inline struct clk * devm_clk_get_prepared (struct device * dev ,
915+ const char * id )
916+ {
917+ return NULL ;
918+ }
919+
920+ static inline struct clk * devm_clk_get_enabled (struct device * dev ,
921+ const char * id )
922+ {
923+ return NULL ;
924+ }
925+
829926static inline struct clk * devm_clk_get_optional (struct device * dev ,
830927 const char * id )
831928{
832929 return NULL ;
833930}
834931
932+ static inline struct clk * devm_clk_get_optional_prepared (struct device * dev ,
933+ const char * id )
934+ {
935+ return NULL ;
936+ }
937+
938+ static inline struct clk * devm_clk_get_optional_enabled (struct device * dev ,
939+ const char * id )
940+ {
941+ return NULL ;
942+ }
943+
835944static inline int __must_check devm_clk_bulk_get (struct device * dev , int num_clks ,
836945 struct clk_bulk_data * clks )
837946{
0 commit comments