mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-23 07:03:08 +00:00
56d8de66db
Move the regmap from experiments/ to a handier place. Also add the codec to trace_codecs.py and codecshell.py. Signed-off-by: Martin Povišer <povik@protonmail.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
# SPDX-License-Identifier: MIT
|
|
|
|
from m1n1.utils import RegMap
|
|
from m1n1.trace.i2c import I2CTracer, I2CRegMapTracer
|
|
from m1n1.hw.codecs import *
|
|
|
|
class SN012776Tracer(I2CRegMapTracer):
|
|
REGMAP = SN012776Regs
|
|
ADDRESSING = (1, 1)
|
|
|
|
class TAS5770Tracer(I2CRegMapTracer):
|
|
REGMAP = TAS5770Regs
|
|
ADDRESSING = (1, 1)
|
|
|
|
class CS42L84Tracer(I2CRegMapTracer):
|
|
REGMAP = CS42L84Regs
|
|
ADDRESSING = (0, 2)
|
|
|
|
i2c_tracers = {}
|
|
|
|
for node in hv.adt["/arm-io"]:
|
|
if not node.name.startswith("i2c"):
|
|
continue
|
|
|
|
n = int(node.name[3:])
|
|
i2c_tracers[n] = bus = I2CTracer(hv, f"/arm-io/{node.name}")
|
|
|
|
for devnode in node:
|
|
if "compatible" not in devnode._properties: # thanks Apple
|
|
continue
|
|
|
|
dcls = {
|
|
"audio-control,tas5770": TAS5770Tracer,
|
|
"audio-control,sn012776": SN012776Tracer,
|
|
"audio-control,cs42l84": CS42L84Tracer,
|
|
}.get(devnode.compatible[0], None)
|
|
if dcls:
|
|
bus.add_device(
|
|
devnode.reg[0] & 0xff,
|
|
dcls(name=devnode.name)
|
|
)
|
|
|
|
bus.start()
|