Skip to content

Commit 9d6d8a5

Browse files
remove clients from sddf pinctrl
Signed-off-by: Bill Nguyen <[email protected]>
1 parent 9cb5dba commit 9d6d8a5

File tree

5 files changed

+4
-83
lines changed

5 files changed

+4
-83
lines changed

src/c/c.zig

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -713,20 +713,6 @@ export fn sdfgen_sddf_pinctrl_destroy(system: *align(8) anyopaque) void {
713713
allocator.destroy(pinctrl);
714714
}
715715

716-
export fn sdfgen_sddf_pinctrl_add_client(system: *align(8) anyopaque, client: *align(8) anyopaque) bindings.sdfgen_sddf_status_t {
717-
const pinctrl: *sddf.Pinctrl = @ptrCast(system);
718-
pinctrl.addClient(@ptrCast(client)) catch |e| {
719-
switch (e) {
720-
sddf.Pinctrl.Error.DuplicateClient => return 1,
721-
sddf.Pinctrl.Error.InvalidClient => return 2,
722-
// Should never happen when adding a client
723-
sddf.Pinctrl.Error.NotConnected => @panic("internal error"),
724-
}
725-
};
726-
727-
return 0;
728-
}
729-
730716
export fn sdfgen_sddf_pinctrl_connect(system: *align(8) anyopaque) bool {
731717
const pinctrl: *sddf.Pinctrl = @ptrCast(system);
732718
pinctrl.connect() catch return false;

src/c/sdfgen.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ bool sdfgen_sddf_gpu_serialise_config(void *system, char *output_dir);
132132

133133
void *sdfgen_sddf_pinctrl(void *sdf, void *device, void *driver);
134134
void sdfgen_sddf_pinctrl_destroy(void *system);
135-
sdfgen_sddf_status_t sdfgen_sddf_pinctrl_add_client(void *system, void *client);
136135
bool sdfgen_sddf_pinctrl_connect(void *system);
137136
bool sdfgen_sddf_pinctrl_serialise_config(void *system, char *output_dir);
138137

src/data.zig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,15 +338,6 @@ pub const Resources = struct {
338338
};
339339
};
340340

341-
pub const Pinctrl = struct {
342-
const MAGIC: [5]u8 = MAGIC_START ++ .{0x8};
343-
344-
pub const Client = extern struct {
345-
magic: [5]u8 = MAGIC,
346-
driver_id: u8,
347-
};
348-
};
349-
350341
pub const Fs = extern struct {
351342
const MAGIC: [8]u8 = LIONS_MAGIC_START ++ .{0x1};
352343

src/python/module.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ class SddfStatus(IntEnum):
146146
libsdfgen.sdfgen_sddf_pinctrl_destroy.restype = None
147147
libsdfgen.sdfgen_sddf_pinctrl_destroy.argtypes = [c_void_p]
148148

149-
libsdfgen.sdfgen_sddf_pinctrl_add_client.restype = c_uint32
150-
libsdfgen.sdfgen_sddf_pinctrl_add_client.argtypes = [c_void_p, c_void_p]
151-
152149
libsdfgen.sdfgen_sddf_pinctrl_connect.restype = c_bool
153150
libsdfgen.sdfgen_sddf_pinctrl_connect.argtypes = [c_void_p]
154151
libsdfgen.sdfgen_sddf_pinctrl_serialise_config.restype = c_bool
@@ -1025,17 +1022,6 @@ def __init__(
10251022

10261023
self._obj: c_void_p = libsdfgen.sdfgen_sddf_pinctrl(sdf._obj, device_obj, driver._obj)
10271024

1028-
def add_client(self, client: SystemDescription.ProtectionDomain):
1029-
ret = libsdfgen.sdfgen_sddf_pinctrl_add_client(self._obj, client._obj)
1030-
if ret == SddfStatus.OK:
1031-
return
1032-
elif ret == SddfStatus.DUPLICATE_CLIENT:
1033-
raise Exception(f"duplicate client given '{client}'")
1034-
elif ret == SddfStatus.INVALID_CLIENT:
1035-
raise Exception(f"invalid client given '{client}'")
1036-
else:
1037-
raise Exception(f"internal error: {ret}")
1038-
10391025
def connect(self) -> bool:
10401026
return libsdfgen.sdfgen_sddf_pinctrl_connect(self._obj)
10411027

src/sddf.zig

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,11 +1645,8 @@ pub const Pinctrl = struct {
16451645
/// Device Tree node for the pinctrl device
16461646
device: *dtb.Node,
16471647
device_res: ConfigResources.Device,
1648-
/// Client PDs serviced by the pinctrl driver
1649-
clients: std.ArrayList(*Pd),
1650-
client_configs: std.ArrayList(ConfigResources.Pinctrl.Client),
1651-
connected: bool = false,
16521648
serialised: bool = false,
1649+
connected: bool = false,
16531650

16541651
pub const Error = SystemError;
16551652

@@ -1664,53 +1661,20 @@ pub const Pinctrl = struct {
16641661
.driver = driver,
16651662
.device = device,
16661663
.device_res = std.mem.zeroInit(ConfigResources.Device, .{}),
1667-
.clients = std.ArrayList(*Pd).init(allocator),
1668-
.client_configs = std.ArrayList(ConfigResources.Pinctrl.Client).init(allocator),
16691664
};
16701665
}
16711666

16721667
pub fn deinit(system: *Pinctrl) void {
1673-
system.clients.deinit();
1674-
system.client_configs.deinit();
1675-
}
1676-
1677-
pub fn addClient(system: *Pinctrl, client: *Pd) Error!void {
1678-
// Check that the client does not already exist
1679-
for (system.clients.items) |existing_client| {
1680-
if (std.mem.eql(u8, existing_client.name, client.name)) {
1681-
return Error.DuplicateClient;
1682-
}
1683-
}
1684-
if (std.mem.eql(u8, client.name, system.driver.name)) {
1685-
log.err("invalid pinctrl client, same name as driver '{s}", .{client.name});
1686-
return Error.InvalidClient;
1687-
}
1688-
const client_priority = if (client.priority) |priority| priority else Pd.DEFAULT_PRIORITY;
1689-
const driver_priority = if (system.driver.priority) |priority| priority else Pd.DEFAULT_PRIORITY;
1690-
if (client_priority >= driver_priority) {
1691-
log.err("invalid pinctrl client '{s}', driver '{s}' must have greater priority than client", .{ client.name, system.driver.name });
1692-
return Error.InvalidClient;
1693-
}
1694-
system.clients.append(client) catch @panic("Could not add client to Pinctrl");
1695-
system.client_configs.append(std.mem.zeroInit(ConfigResources.Pinctrl.Client, .{})) catch @panic("Could not add client to Timer");
1668+
// In the future when we add clients we would need to free associated resources here
1669+
_ = system;
1670+
return;
16961671
}
16971672

16981673
pub fn connect(system: *Pinctrl) !void {
16991674
// The driver must be passive
17001675
assert(system.driver.passive.?);
17011676

17021677
try createDriver(system.sdf, system.driver, system.device, .pinctrl, &system.device_res);
1703-
for (system.clients.items, 0..) |client, i| {
1704-
const ch = Channel.create(system.driver, client, .{
1705-
// Client needs to be able to PPC into driver
1706-
.pp = .b,
1707-
// Client does not need to notify driver
1708-
.pd_b_notify = false,
1709-
}) catch unreachable;
1710-
system.sdf.addChannel(ch);
1711-
system.client_configs.items[i].driver_id = ch.pd_b_id;
1712-
}
1713-
17141678
system.connected = true;
17151679
}
17161680

@@ -1722,11 +1686,6 @@ pub const Pinctrl = struct {
17221686
const device_res_data_name = fmt(allocator, "{s}_device_resources", .{system.driver.name});
17231687
try data.serialize(allocator, system.device_res, prefix, device_res_data_name);
17241688

1725-
for (system.clients.items, 0..) |client, i| {
1726-
const data_name = fmt(allocator, "pinctrl_client_{s}", .{client.name});
1727-
try data.serialize(allocator, system.client_configs.items[i], prefix, data_name);
1728-
}
1729-
17301689
system.serialised = true;
17311690
}
17321691
};

0 commit comments

Comments
 (0)