@@ -2269,6 +2269,39 @@ static const struct spmi_regulator_data pm8916_regulators[] = {
2269
2269
{ }
2270
2270
};
2271
2271
2272
+ static const struct spmi_regulator_data pm8937_regulators [] = {
2273
+ { "s1" , 0x1400 , "vdd_s1" , },
2274
+ { "s2" , 0x1700 , "vdd_s2" , },
2275
+ { "s3" , 0x1a00 , "vdd_s3" , },
2276
+ { "s4" , 0x1d00 , "vdd_s4" , },
2277
+ { "s5" , 0x2000 , "vdd_s5" , },
2278
+ { "s6" , 0x2300 , "vdd_s6" , },
2279
+ { "l1" , 0x4000 , "vdd_l1_l19" , },
2280
+ { "l2" , 0x4100 , "vdd_l2_l23" , },
2281
+ { "l3" , 0x4200 , "vdd_l3" , },
2282
+ { "l4" , 0x4300 , "vdd_l4_l5_l6_l7_l16" , },
2283
+ { "l5" , 0x4400 , "vdd_l4_l5_l6_l7_l16" , },
2284
+ { "l6" , 0x4500 , "vdd_l4_l5_l6_l7_l16" , },
2285
+ { "l7" , 0x4600 , "vdd_l4_l5_l6_l7_l16" , },
2286
+ { "l8" , 0x4700 , "vdd_l8_l11_l12_l17_l22" , },
2287
+ { "l9" , 0x4800 , "vdd_l9_l10_l13_l14_l15_l18" , },
2288
+ { "l10" , 0x4900 , "vdd_l9_l10_l13_l14_l15_l18" , },
2289
+ { "l11" , 0x4a00 , "vdd_l8_l11_l12_l17_l22" , },
2290
+ { "l12" , 0x4b00 , "vdd_l8_l11_l12_l17_l22" , },
2291
+ { "l13" , 0x4c00 , "vdd_l9_l10_l13_l14_l15_l18" , },
2292
+ { "l14" , 0x4d00 , "vdd_l9_l10_l13_l14_l15_l18" , },
2293
+ { "l15" , 0x4e00 , "vdd_l9_l10_l13_l14_l15_l18" , },
2294
+ { "l16" , 0x4f00 , "vdd_l4_l5_l6_l7_l16" , },
2295
+ { "l17" , 0x5000 , "vdd_l8_l11_l12_l17_l22" , },
2296
+ { "l18" , 0x5100 , "vdd_l9_l10_l13_l14_l15_l18" , },
2297
+ { "l19" , 0x5200 , "vdd_l1_l19" , },
2298
+ { "l20" , 0x5300 , "vdd_l20_l21" , },
2299
+ { "l21" , 0x5400 , "vdd_l21_l21" , },
2300
+ { "l22" , 0x5500 , "vdd_l8_l11_l12_l17_l22" , },
2301
+ { "l23" , 0x5600 , "vdd_l2_l23" , },
2302
+ { }
2303
+ };
2304
+
2272
2305
static const struct spmi_regulator_data pm8941_regulators [] = {
2273
2306
{ "s1" , 0x1400 , "vdd_s1" , },
2274
2307
{ "s2" , 0x1700 , "vdd_s2" , },
@@ -2586,6 +2619,7 @@ static const struct spmi_regulator_match qcom_spmi_regulator_match[] = {
2586
2619
{ .subtype = PM8226_SUBTYPE , .sid = 1 , .data = pm8226_regulators },
2587
2620
{ .subtype = PM8841_SUBTYPE , .sid = 5 , .data = pm8841_regulators },
2588
2621
{ .subtype = PM8916_SUBTYPE , .sid = 1 , .data = pm8916_regulators },
2622
+ { .subtype = PM8937_SUBTYPE , .sid = 1 , .data = pm8937_regulators },
2589
2623
{ .subtype = PM8941_SUBTYPE , .sid = 1 , .data = pm8941_regulators },
2590
2624
{ .subtype = PM8950_SUBTYPE , .sid = 1 , .data = pm8950_regulators },
2591
2625
{ .subtype = PM8994_SUBTYPE , .sid = 1 , .data = pm8994_regulators },
@@ -2619,15 +2653,19 @@ struct regulator_dev *spmi_regulator_probe(uint8_t subtype)
2619
2653
unsigned int i ;
2620
2654
int ret ;
2621
2655
2622
- if (!match )
2656
+ if (!match ) {
2657
+ dprintf (CRITICAL , "Failed to find SPMI regulator match for subtype 0x%02X\n" , subtype );
2623
2658
return NULL ;
2659
+ }
2624
2660
2625
2661
for (data = match -> data ; data -> name ; ++ data )
2626
2662
++ num ;
2627
2663
2628
2664
vreg = calloc (num , sizeof (* vreg ));
2629
- if (!vreg )
2665
+ if (!vreg ) {
2666
+ dprintf (CRITICAL , "Failed to allocate memory for SPMI regulator\n" );
2630
2667
return NULL ;
2668
+ }
2631
2669
2632
2670
for (i = 0 ; i < num ; ++ i ) {
2633
2671
const struct spmi_regulator_data * reg = & match -> data [i ];
@@ -2637,9 +2675,11 @@ struct regulator_dev *spmi_regulator_probe(uint8_t subtype)
2637
2675
vreg [i ].base = (match -> sid << 16 ) | reg -> base ;
2638
2676
2639
2677
ret = spmi_regulator_match (& vreg [i ], reg -> force_type );
2640
- if (ret )
2641
- dprintf (CRITICAL , "Failed to match SPMI regulator %s\n" ,
2642
- reg -> name );
2678
+ if (ret ) {
2679
+ dprintf (CRITICAL , "Failed to match SPMI regulator %s\n" , reg -> name );
2680
+ dprintf (CRITICAL , "subtype=%u, force_type=0x%02X, logical_type=%u\n" ,
2681
+ subtype , reg -> force_type , vreg [i ].logical_type );
2682
+ }
2643
2683
2644
2684
if (vreg [i ].set_points )
2645
2685
vreg [i ].desc .driver_type = vreg [i ].set_points -> type ;
0 commit comments