@@ -541,8 +541,9 @@ static const struct irq_domain_ops regmap_domain_ops = {
541
541
};
542
542
543
543
/**
544
- * regmap_add_irq_chip () - Use standard regmap IRQ controller handling
544
+ * regmap_add_irq_chip_np () - Use standard regmap IRQ controller handling
545
545
*
546
+ * @np: The device_node where the IRQ domain should be added to.
546
547
* @map: The regmap for the device.
547
548
* @irq: The IRQ the device uses to signal interrupts.
548
549
* @irq_flags: The IRQF_ flags to use for the primary interrupt.
@@ -556,9 +557,10 @@ static const struct irq_domain_ops regmap_domain_ops = {
556
557
* register cache. The chip driver is responsible for restoring the
557
558
* register values used by the IRQ controller over suspend and resume.
558
559
*/
559
- int regmap_add_irq_chip (struct regmap * map , int irq , int irq_flags ,
560
- int irq_base , const struct regmap_irq_chip * chip ,
561
- struct regmap_irq_chip_data * * data )
560
+ int regmap_add_irq_chip_np (struct device_node * np , struct regmap * map , int irq ,
561
+ int irq_flags , int irq_base ,
562
+ const struct regmap_irq_chip * chip ,
563
+ struct regmap_irq_chip_data * * data )
562
564
{
563
565
struct regmap_irq_chip_data * d ;
564
566
int i ;
@@ -769,12 +771,10 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
769
771
}
770
772
771
773
if (irq_base )
772
- d -> domain = irq_domain_add_legacy (map -> dev -> of_node ,
773
- chip -> num_irqs , irq_base , 0 ,
774
- & regmap_domain_ops , d );
774
+ d -> domain = irq_domain_add_legacy (np , chip -> num_irqs , irq_base ,
775
+ 0 , & regmap_domain_ops , d );
775
776
else
776
- d -> domain = irq_domain_add_linear (map -> dev -> of_node ,
777
- chip -> num_irqs ,
777
+ d -> domain = irq_domain_add_linear (np , chip -> num_irqs ,
778
778
& regmap_domain_ops , d );
779
779
if (!d -> domain ) {
780
780
dev_err (map -> dev , "Failed to create IRQ domain\n" );
@@ -808,6 +808,30 @@ int regmap_add_irq_chip(struct regmap *map, int irq, int irq_flags,
808
808
kfree (d );
809
809
return ret ;
810
810
}
811
+ EXPORT_SYMBOL_GPL (regmap_add_irq_chip_np );
812
+
813
+ /**
814
+ * regmap_add_irq_chip() - Use standard regmap IRQ controller handling
815
+ *
816
+ * @map: The regmap for the device.
817
+ * @irq: The IRQ the device uses to signal interrupts.
818
+ * @irq_flags: The IRQF_ flags to use for the primary interrupt.
819
+ * @irq_base: Allocate at specific IRQ number if irq_base > 0.
820
+ * @chip: Configuration for the interrupt controller.
821
+ * @data: Runtime data structure for the controller, allocated on success.
822
+ *
823
+ * Returns 0 on success or an errno on failure.
824
+ *
825
+ * This is the same as regmap_add_irq_chip_np, except that the device
826
+ * node of the regmap is used.
827
+ */
828
+ int regmap_add_irq_chip (struct regmap * map , int irq , int irq_flags ,
829
+ int irq_base , const struct regmap_irq_chip * chip ,
830
+ struct regmap_irq_chip_data * * data )
831
+ {
832
+ return regmap_add_irq_chip_np (map -> dev -> of_node , map , irq , irq_flags ,
833
+ irq_base , chip , data );
834
+ }
811
835
EXPORT_SYMBOL_GPL (regmap_add_irq_chip );
812
836
813
837
/**
@@ -875,9 +899,10 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data)
875
899
}
876
900
877
901
/**
878
- * devm_regmap_add_irq_chip () - Resource manager regmap_add_irq_chip ()
902
+ * devm_regmap_add_irq_chip_np () - Resource manager regmap_add_irq_chip_np ()
879
903
*
880
904
* @dev: The device pointer on which irq_chip belongs to.
905
+ * @np: The device_node where the IRQ domain should be added to.
881
906
* @map: The regmap for the device.
882
907
* @irq: The IRQ the device uses to signal interrupts
883
908
* @irq_flags: The IRQF_ flags to use for the primary interrupt.
@@ -890,10 +915,11 @@ static int devm_regmap_irq_chip_match(struct device *dev, void *res, void *data)
890
915
* The ®map_irq_chip_data will be automatically released when the device is
891
916
* unbound.
892
917
*/
893
- int devm_regmap_add_irq_chip (struct device * dev , struct regmap * map , int irq ,
894
- int irq_flags , int irq_base ,
895
- const struct regmap_irq_chip * chip ,
896
- struct regmap_irq_chip_data * * data )
918
+ int devm_regmap_add_irq_chip_np (struct device * dev , struct device_node * np ,
919
+ struct regmap * map , int irq , int irq_flags ,
920
+ int irq_base ,
921
+ const struct regmap_irq_chip * chip ,
922
+ struct regmap_irq_chip_data * * data )
897
923
{
898
924
struct regmap_irq_chip_data * * ptr , * d ;
899
925
int ret ;
@@ -903,8 +929,8 @@ int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
903
929
if (!ptr )
904
930
return - ENOMEM ;
905
931
906
- ret = regmap_add_irq_chip ( map , irq , irq_flags , irq_base ,
907
- chip , & d );
932
+ ret = regmap_add_irq_chip_np ( np , map , irq , irq_flags , irq_base ,
933
+ chip , & d );
908
934
if (ret < 0 ) {
909
935
devres_free (ptr );
910
936
return ret ;
@@ -915,6 +941,32 @@ int devm_regmap_add_irq_chip(struct device *dev, struct regmap *map, int irq,
915
941
* data = d ;
916
942
return 0 ;
917
943
}
944
+ EXPORT_SYMBOL_GPL (devm_regmap_add_irq_chip_np );
945
+
946
+ /**
947
+ * devm_regmap_add_irq_chip() - Resource manager regmap_add_irq_chip()
948
+ *
949
+ * @dev: The device pointer on which irq_chip belongs to.
950
+ * @map: The regmap for the device.
951
+ * @irq: The IRQ the device uses to signal interrupts
952
+ * @irq_flags: The IRQF_ flags to use for the primary interrupt.
953
+ * @irq_base: Allocate at specific IRQ number if irq_base > 0.
954
+ * @chip: Configuration for the interrupt controller.
955
+ * @data: Runtime data structure for the controller, allocated on success
956
+ *
957
+ * Returns 0 on success or an errno on failure.
958
+ *
959
+ * The ®map_irq_chip_data will be automatically released when the device is
960
+ * unbound.
961
+ */
962
+ int devm_regmap_add_irq_chip (struct device * dev , struct regmap * map , int irq ,
963
+ int irq_flags , int irq_base ,
964
+ const struct regmap_irq_chip * chip ,
965
+ struct regmap_irq_chip_data * * data )
966
+ {
967
+ return devm_regmap_add_irq_chip_np (dev , map -> dev -> of_node , map , irq ,
968
+ irq_flags , irq_base , chip , data );
969
+ }
918
970
EXPORT_SYMBOL_GPL (devm_regmap_add_irq_chip );
919
971
920
972
/**
0 commit comments