Skip to content

Commit ee6177c

Browse files
committed
Merge branch 'bits/500-backports' into asahi-wip
2 parents 6ab40fd + 5f8563f commit ee6177c

6 files changed

Lines changed: 70 additions & 15 deletions

File tree

drivers/bus/simple-pm-bus.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ static const struct of_device_id simple_pm_bus_of_match[] = {
142142
{ .compatible = "simple-mfd", .data = ONLY_BUS },
143143
{ .compatible = "isa", .data = ONLY_BUS },
144144
{ .compatible = "arm,amba-bus", .data = ONLY_BUS },
145+
{ .compatible = "apple,s5l8960x-pmgr", .data = ONLY_BUS },
146+
{ .compatible = "apple,t7000-pmgr", .data = ONLY_BUS },
147+
{ .compatible = "apple,s8000-pmgr", .data = ONLY_BUS },
148+
{ .compatible = "apple,t8010-pmgr", .data = ONLY_BUS },
149+
{ .compatible = "apple,t8015-pmgr", .data = ONLY_BUS },
150+
{ .compatible = "apple,t8103-pmgr", .data = ONLY_BUS },
151+
{ .compatible = "apple,t8112-pmgr", .data = ONLY_BUS },
152+
{ .compatible = "apple,t6000-pmgr", .data = ONLY_BUS },
153+
{ .compatible = "apple,t6020-pmgr", .data = ONLY_BUS },\
145154
{ .compatible = "fsl,ls1021a-scfg", },
146155
{ .compatible = "fsl,ls1043a-scfg", },
147156
{ .compatible = "fsl,ls1046a-scfg", },

drivers/nvmem/core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,12 +1615,14 @@ static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void
16151615
*p = *b++ >> bit_offset;
16161616

16171617
/* setup rest of the bytes if any */
1618-
for (i = 1; i < cell->bytes; i++) {
1618+
for (i = 1; i < (cell->bytes - bytes_offset); i++) {
16191619
/* Get bits from next byte and shift them towards msb */
16201620
*p++ |= *b << (BITS_PER_BYTE - bit_offset);
16211621

16221622
*p = *b++ >> bit_offset;
16231623
}
1624+
/* point to end of the buffer unused bits will be cleared */
1625+
p = buf + cell->bytes - 1;
16241626
} else if (p != b) {
16251627
memmove(p, b, cell->bytes - bytes_offset);
16261628
p += cell->bytes - 1;

drivers/phy/apple/atc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,14 +2202,16 @@ static int atcphy_map_resources(struct platform_device *pdev, struct apple_atcph
22022202
{ "pipehandler", &atcphy->regs.pipehandler, NULL },
22032203
};
22042204
struct resource *res;
2205+
void __iomem *addr;
22052206

22062207
for (int i = 0; i < ARRAY_SIZE(resources); i++) {
22072208
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, resources[i].name);
2208-
*resources[i].addr = devm_ioremap_resource(&pdev->dev, res);
2209-
if (IS_ERR(resources[i].addr))
2210-
return dev_err_probe(atcphy->dev, PTR_ERR(resources[i].addr),
2209+
addr = devm_ioremap_resource(&pdev->dev, res);
2210+
if (IS_ERR(addr))
2211+
return dev_err_probe(atcphy->dev, PTR_ERR(addr),
22112212
"Unable to map %s regs", resources[i].name);
22122213

2214+
*resources[i].addr = addr;
22132215
if (resources[i].res)
22142216
*resources[i].res = res;
22152217
}

drivers/watchdog/apple_wdt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ static int apple_wdt_suspend(struct device *dev)
218218
static DEFINE_SIMPLE_DEV_PM_OPS(apple_wdt_pm_ops, apple_wdt_suspend, apple_wdt_resume);
219219

220220
static const struct of_device_id apple_wdt_of_match[] = {
221+
{ .compatible = "apple,t8103-wdt" },
221222
{ .compatible = "apple,wdt" },
222223
{},
223224
};

sound/soc/codecs/tas2764.c

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -626,18 +626,33 @@ static int tas2764_read_die_temp(struct tas2764_priv *tas2764, long *result)
626626
* As per datasheet, subtract 93 from raw value to get degrees
627627
* Celsius. hwmon wants millidegrees.
628628
*
629-
* NOTE: The chip will initialise the TAS2764_TEMP register to
630-
* 2.6 *C to avoid triggering temperature protection. Since the
631-
* ADC is powered down during software shutdown, this value will
632-
* persist until the chip is fully powered up (e.g. the PCM it's
633-
* attached to is opened). The ADC will power down again when
634-
* the chip is put back into software shutdown, with the last
635-
* value sampled persisting in the ADC's register.
629+
* NOTE: The TAS2764 datasheet mentions initialising TAS2764_TEMP
630+
* such that the temperature is 2.6 *C, however the register
631+
* is actually initialised to 0. The ADC is also powered down during
632+
* software shutdown. The last sampled temperature will persist
633+
* in the register while the amp is in this power state.
636634
*/
635+
if (reg == 0)
636+
return -ENODATA;
637+
637638
*result = (reg - 93) * 1000;
638639
return 0;
639640
}
640641

642+
static int tas2764_hwmon_is_fault(struct tas2764_priv *tas2764, long *result)
643+
{
644+
int ret;
645+
long temp;
646+
647+
ret = tas2764_read_die_temp(tas2764, &temp);
648+
if (ret == -ENODATA) {
649+
*result = true;
650+
return 0;
651+
}
652+
653+
return ret;
654+
}
655+
641656
static umode_t tas2764_hwmon_is_visible(const void *data,
642657
enum hwmon_sensor_types type, u32 attr,
643658
int channel)
@@ -647,6 +662,7 @@ static umode_t tas2764_hwmon_is_visible(const void *data,
647662

648663
switch (attr) {
649664
case hwmon_temp_input:
665+
case hwmon_temp_fault:
650666
return 0444;
651667
default:
652668
break;
@@ -666,6 +682,9 @@ static int tas2764_hwmon_read(struct device *dev,
666682
case hwmon_temp_input:
667683
ret = tas2764_read_die_temp(tas2764, val);
668684
break;
685+
case hwmon_temp_fault:
686+
ret = tas2764_hwmon_is_fault(tas2764, val);
687+
break;
669688
default:
670689
ret = -EOPNOTSUPP;
671690
break;
@@ -675,7 +694,7 @@ static int tas2764_hwmon_read(struct device *dev,
675694
}
676695

677696
static const struct hwmon_channel_info *const tas2764_hwmon_info[] = {
678-
HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
697+
HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_FAULT),
679698
NULL
680699
};
681700

@@ -876,6 +895,7 @@ static bool tas2764_volatile_register(struct device *dev, unsigned int reg)
876895
{
877896
switch (reg) {
878897
case TAS2764_SW_RST:
898+
case TAS2764_TEMP:
879899
case TAS2764_INT_LTCH0 ... TAS2764_INT_LTCH4:
880900
case TAS2764_INT_CLK_CFG:
881901
return true;

sound/soc/codecs/tas2770.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static int tas2770_read_die_temp(struct tas2770_priv *tas2770, long *result)
555555
/*
556556
* As per datasheet: divide register by 16 and subtract 93 to get
557557
* degrees Celsius. hwmon requires millidegrees. Let's avoid rounding
558-
* errors by subtracting 93 * 16 then multiplying by 1000 / 16.
558+
* errors by subtracting 93 * 16 and scaling before dividing.
559559
*
560560
* NOTE: The ADC registers are initialised to 0 on reset. This means
561561
* that the temperature will read -93 *C until the chip is brought out
@@ -564,10 +564,27 @@ static int tas2770_read_die_temp(struct tas2770_priv *tas2770, long *result)
564564
* value read back from its registers will be the last value sampled
565565
* before entering software shutdown.
566566
*/
567-
*result = (reading - (93 * 16)) * (1000 / 16);
567+
if (reading == 0)
568+
return -ENODATA;
569+
570+
*result = (reading - (93 * 16)) * 1000 / 16;
568571
return 0;
569572
}
570573

574+
static int tas2770_hwmon_is_fault(struct tas2770_priv *tas2770, long *result)
575+
{
576+
int ret;
577+
long temp;
578+
579+
ret = tas2770_read_die_temp(tas2770, &temp);
580+
if (ret == -ENODATA) {
581+
*result = true;
582+
return 0;
583+
}
584+
585+
return ret;
586+
}
587+
571588
static umode_t tas2770_hwmon_is_visible(const void *data,
572589
enum hwmon_sensor_types type, u32 attr,
573590
int channel)
@@ -577,6 +594,7 @@ static umode_t tas2770_hwmon_is_visible(const void *data,
577594

578595
switch (attr) {
579596
case hwmon_temp_input:
597+
case hwmon_temp_fault:
580598
return 0444;
581599
default:
582600
break;
@@ -596,6 +614,9 @@ static int tas2770_hwmon_read(struct device *dev,
596614
case hwmon_temp_input:
597615
ret = tas2770_read_die_temp(tas2770, val);
598616
break;
617+
case hwmon_temp_fault:
618+
ret = tas2770_hwmon_is_fault(tas2770, val);
619+
break;
599620
default:
600621
ret = -EOPNOTSUPP;
601622
break;
@@ -605,7 +626,7 @@ static int tas2770_hwmon_read(struct device *dev,
605626
}
606627

607628
static const struct hwmon_channel_info *const tas2770_hwmon_info[] = {
608-
HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT),
629+
HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_FAULT),
609630
NULL
610631
};
611632

0 commit comments

Comments
 (0)